56 #ifdef CHECK_MEMORY_LEAKS 58 #endif // CHECK_MEMORY_LEAKS 101 myChosenValue(0), myChosenTarget(myChosenValue, NULL, MID_OPTION),
102 myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
104 myChosenTarget.setTarget(
this);
105 FXVerticalFrame* f1 =
106 new FXVerticalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
108 FXGroupBox* gp =
new FXGroupBox(f1,
"Change Probability",
109 GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
110 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
113 FXHorizontalFrame* gf1 =
114 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
115 new FXRadioButton(gf1,
"Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
116 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
117 0, 0, 0, 0, 2, 2, 0, 0);
121 FXHorizontalFrame* gf12 =
122 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
123 new FXRadioButton(gf12,
"User Given: ", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
124 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
125 0, 0, 0, 0, 2, 2, 0, 0);
126 myUsageProbabilityDial =
128 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
129 myUsageProbabilityDial->setFormatString(
"%.2f");
130 myUsageProbabilityDial->setIncrements(.1, .1, .1);
131 myUsageProbabilityDial->setRange(0, 1);
132 myUsageProbabilityDial->setValue(myObject->getUserProbability());
136 FXHorizontalFrame* gf13 =
137 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
138 new FXRadioButton(gf13,
"Off", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
139 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
140 0, 0, 0, 0, 2, 2, 0, 0);
142 myChosenValue = myObject->inUserMode()
143 ? myObject->getUserProbability() > 0
146 new FXButton(f1,
"Close", NULL,
this,
MID_CLOSE,
147 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
174 myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
229 const std::string&
id,
231 SUMOReal prob,
const std::string& aXMLFilename,
bool off,
236 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
258 for (MSEdgeVector::const_iterator it = ri.
closed.begin(); it != ri.
closed.end(); ++it) {
321 myAmClosedEdge(closed) {
322 const std::vector<MSLane*>& lanes = edge->
getLanes();
325 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
328 myFGPositions.push_back((*i)->geometryPositionAtOffset(pos));
355 if (s.
scale * exaggeration >= 3) {
362 if (ri != 0 && prob > 0) {
366 for (
int j = 0; j < noLanes; ++j) {
370 glTranslated(pos.
x(), pos.
y(), 0);
371 glRotated(rot, 0, 0, 1);
372 glTranslated(0, -1.5, 0);
375 noPoints = (int)(9.0 + s.
scale / 10.0);
382 glColor3d(0.7, 0, 0);
384 glTranslated(0, 0, .1);
387 glTranslated(0, 0, .1);
389 glRotated(-90, 0, 0, 1);
390 glBegin(GL_TRIANGLES);
391 glVertex2d(0 - .3, -1.);
392 glVertex2d(0 - .3, 1.);
393 glVertex2d(0 + .3, 1.);
394 glVertex2d(0 + .3, -1.);
395 glVertex2d(0 - .3, -1.);
396 glVertex2d(0 + .3, 1.);
409 glTranslated(pos.
x(), pos.
y(), 0);
410 glRotated(rot, 0, 0, 1);
412 glScaled(exaggeration, exaggeration, 1);
413 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
415 glBegin(GL_TRIANGLES);
416 glColor3d(1, .8f, 0);
418 glVertex2d(0 - 1.4, 0);
419 glVertex2d(0 - 1.4, 6);
420 glVertex2d(0 + 1.4, 6);
421 glVertex2d(0 + 1.4, 0);
422 glVertex2d(0 - 1.4, 0);
423 glVertex2d(0 + 1.4, 6);
426 glTranslated(0, 0, .1);
431 glRotated(180, 0, 1, 0);
432 glTranslated(-w / 2., 2, 0);
435 glTranslated(w / 2., -2, 0);
436 std::string str =
toString((
int)(prob * 100)) +
"%";
440 glTranslated(-w / 2., 4, 0);
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
int pfDrawString(const char *c)
long onCmdClose(FXObject *, FXSelector, void *)
MSEdgeVector closed
The list of closed edges.
GUITriggeredRerouterEdge(GUIEdge *edge, GUITriggeredRerouter *parent, bool closed)
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
std::vector< GUITriggeredRerouterEdge * > myEdgeVisualizations
FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[]
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
GUIManipulator * openManipulator(GUIMainWindow &app, GUISUMOAbstractView &parent)
const std::string & getFullName() const
Stores the information about how to visualize structures.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void pfSetPosition(SUMOReal x, SUMOReal y)
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
GUITriggeredRerouter * myParent
The parent rerouter to which this edge instance belongs.
void setUserUsageProbability(SUMOReal prob)
Sets the probability with which a vehicle is rerouted given by the user.
void setUserMode(bool val)
Sets whether the process is currently steered by the user.
GUITriggeredRerouterPopupMenuMap[]
MSEdge * myEdge
The edge for which this visualization applies.
A RT-tree for efficient storing of SUMO's GL-objects.
SUMOReal x() const
Returns the x-position.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
A road/street connecting two junctions (gui-version)
const std::string & getID() const
Returns the id.
virtual void myEndElement(int element)
Called when a closing tag occurs.
GUIVisualizationSizeSettings addSize
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
FXdouble getValue() const
Return current value.
A point in 2D or 3D with translation and scaling methods.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
SUMOReal myUsageProbability
virtual ~GUIManip_TriggeredRerouter()
Destructor.
const bool myAmClosedEdge
whether this edge instance visualizes a closed edge
virtual ~GUITriggeredRerouterEdge()
Open the object's manipulator.
SUMOReal getProbability() const
Returns the rerouting probability.
GUITriggeredRerouter * myObject
long onCmdUserDef(FXObject *, FXSelector, void *)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
const RerouteInterval * getCurrentReroute(SUMOTime time, SUMOVehicle &veh) const
Returns the rerouting definition valid for the given time and vehicle, 0 if none. ...
Boundary myBoundary
The boundary of this rerouter.
long onUpdUserDef(FXObject *, FXSelector, void *)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
long onCmdChangeOption(FXObject *, FXSelector, void *)
RotCont myFGRotations
The rotations in full-geometry mode.
FXRealSpinDial * myUsageProbabilityDial
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the manipulator window.
Reroutes vehicles passing an edge.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
A MSNet extended by some values for usage within the gui.
void pfSetScale(SUMOReal s)
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
SUMOReal y() const
Returns the y-position.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
SUMOReal pfdkGetStringWidth(const char *c)
std::vector< MSEdge * > MSEdgeVector
~GUITriggeredRerouter()
Destructor.
void myEndElement(int element)
Called when a closing tag occurs.
Boundary myBoundary
The boundary of this rerouter.
A window containing a gl-object's parameter.
GUITriggeredRerouter(const std::string &id, const MSEdgeVector &edges, SUMOReal prob, const std::string &aXMLFilename, bool off, SUMORTree &rtree)
Constructor.
PosCont myFGPositions
The positions in full-geometry mode.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.