57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
104 myParent(&app), myChosenValue(0), myChosenTarget(myChosenValue, NULL, MID_OPTION),
105 mySpeed(o.getDefaultSpeed()), mySpeedTarget(mySpeed),
107 myChosenTarget.setTarget(
this);
108 FXVerticalFrame* f1 =
109 new FXVerticalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
111 FXGroupBox* gp =
new FXGroupBox(f1,
"Change Speed",
112 GROUPBOX_TITLE_LEFT | FRAME_RIDGE,
113 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
118 new FXRadioButton(gf1,
"Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
119 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
120 0, 0, 0, 0, 2, 2, 0, 0);
126 new FXRadioButton(gf0,
"Loaded", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
127 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
128 0, 0, 0, 0, 2, 2, 0, 0);
134 new FXRadioButton(gf2,
"Predefined: ", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
135 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
136 0, 0, 0, 0, 2, 2, 0, 0);
138 new FXComboBox(gf2, 10,
this, MID_PRE_DEF,
139 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y | COMBOBOX_STATIC);
140 myPredefinedValues->appendItem(
"20 km/h");
141 myPredefinedValues->appendItem(
"40 km/h");
142 myPredefinedValues->appendItem(
"60 km/h");
143 myPredefinedValues->appendItem(
"80 km/h");
144 myPredefinedValues->appendItem(
"100 km/h");
145 myPredefinedValues->appendItem(
"120 km/h");
146 myPredefinedValues->appendItem(
"140 km/h");
147 myPredefinedValues->appendItem(
"160 km/h");
148 myPredefinedValues->appendItem(
"180 km/h");
149 myPredefinedValues->appendItem(
"200 km/h");
150 myPredefinedValues->setNumVisible(5);
156 new FXRadioButton(gf12,
"Free Entry: ", &myChosenTarget, FXDataTarget::ID_OPTION + 3,
157 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
158 0, 0, 0, 0, 2, 2, 0, 0);
161 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
162 myUserDefinedSpeed->setFormatString(
"%.0f km/h");
163 myUserDefinedSpeed->setIncrements(1, 10, 10);
164 myUserDefinedSpeed->setRange(0, 300);
165 myUserDefinedSpeed->setValue(
166 static_cast<GUILaneSpeedTrigger*>(myObject)->getDefaultSpeed() * 3.6);
169 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
186 mySpeed = (
SUMOReal)(myUserDefinedSpeed->getValue() / 3.6);
188 myParent->updateChildren();
196 myChosenValue != 3 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
198 myParent->updateChildren();
205 mySpeed = (
SUMOReal)(
SUMOReal)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6);
207 myParent->updateChildren();
215 myChosenValue != 2 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
217 myParent->updateChildren();
225 switch (myChosenValue) {
227 mySpeed = (
SUMOReal) static_cast<GUILaneSpeedTrigger*>(myObject)->getDefaultSpeed();
230 mySpeed = (
SUMOReal) static_cast<GUILaneSpeedTrigger*>(myObject)->getLoadedSpeed();
233 mySpeed = (
SUMOReal)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6);
236 mySpeed = (
SUMOReal)(myUserDefinedSpeed->getValue() / 3.6);
243 myParent->updateChildren();
244 if (myChosenValue == 1) {
270 *myApplication, *myParent);
279 const std::string&
id,
const std::vector<MSLane*>& destLanes,
280 const std::string& aXMLFilename) :
286 std::vector<MSLane*>::const_iterator i;
287 for (i = destLanes.begin(); i != destLanes.end(); ++i) {
320 ret->
mkItem(
"speed [m/s]",
true,
338 glTranslated(pos.
x(), pos.
y(), 0);
339 glRotated(rot, 0, 0, 1);
340 glTranslated(0, -1.5, 0);
344 noPoints = (
int)(9.0 + s.
scale / 10.0);
352 glTranslated(0, 0, .1);
361 if (((
int) value + 1) % 10 == 0) {
362 value = (
SUMOReal)(((
int) value + 1) / 10 * 10);
369 if (idx != std::string::npos) {
378 glTranslated(0, 0, .1);
379 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
383 glRotated(180, 0, 1, 0);
384 glTranslated(-w / 2., 0.3, 0);
void setOverridingValue(SUMOReal val)
int pfDrawString(const char *c)
long onCmdClose(FXObject *, FXSelector, void *)
long onCmdUserDef(FXObject *, FXSelector, void *)
GUIVisualizationTextSettings addName
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
PosCont myFGPositions
The positions in full-geometry mode.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Stores the information about how to visualize structures.
long onCmdChangeOption(FXObject *, FXSelector, void *)
void pfSetPosition(SUMOReal x, SUMOReal y)
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
long onUpdPreDef(FXObject *, FXSelector, void *)
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.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
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.
A class that stores a 2D geometrical boundary.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
Changes the speed allowed on a set of lanes.
long onUpdUserDef(FXObject *, FXSelector, void *)
SUMOReal getCurrentSpeed() const
Returns the current speed.
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Boundary myBoundary
The boundary of this rerouter.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
float addExaggeration
The additional structures exaggeration (upscale)
A point in 2D or 3D with translation and scaling methods.
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
GUILaneSpeedTriggerPopupMenuMap[]
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
void setOverriding(bool val)
long onCmdPreDef(FXObject *, FXSelector, void *)
std::string myLastValueString
Storage for speed string to avoid recomputation.
GUILaneSpeedTrigger(const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Constructor.
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.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void pfSetScale(SUMOReal s)
RotCont myFGRotations
The rotations in full-geometry mode.
SUMOReal y() const
Returns the y-position.
bool myShowAsKMH
The information whether the speed shall be shown in m/s or km/h.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
SUMOReal pfdkGetStringWidth(const char *c)
GUIManipulator * openManipulator(GUIMainWindow &app, GUISUMOAbstractView &parent)
FXDEFMAP(GUILaneSpeedTrigger::GUIManip_LaneSpeedTrigger) GUIManip_LaneSpeedTriggerMap[]
Changes the speed allowed on a set of lanes (gui version)
virtual ~GUIManip_LaneSpeedTrigger()
Destructor.
const std::string & getFullName() const
Returns the full name appearing in the tool tip.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
void closeBuilding()
Closes the building of the table.
A window containing a gl-object's parameter.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Open the object's manipulator.
SUMOReal myLastValue
Storage for last value to avoid string recomputation.