Eclipse SUMO - Simulation of Urban MObility
GNENeteditAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Modul for edit netedit attributes
19 /****************************************************************************/
20 #include <config.h>
21 
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEViewNet.h>
26 #include <utils/gui/div/GLHelper.h>
29 
30 #include "GNENeteditAttributes.h"
31 
32 
33 // ===========================================================================
34 // FOX callback mapping
35 // ===========================================================================
36 
37 FXDEFMAP(GNENeteditAttributes) NeteditAttributesMap[] = {
39  FXMAPFUNC(SEL_COMMAND, MID_HELP, GNENeteditAttributes::onCmdHelp)
40 };
41 
42 // Object implementation
43 FXIMPLEMENT(GNENeteditAttributes, MFXGroupBoxModule, NeteditAttributesMap, ARRAYNUMBER(NeteditAttributesMap))
44 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
49 
51  MFXGroupBoxModule(frameParent, TL("Netedit attributes")),
52  myFrameParent(frameParent),
53  myReferencePoint(ReferencePoint::LEFT) {
54  // fill reference points
55  myReferencePoints.push_back(std::make_pair(TL("Reference Left"), ReferencePoint::LEFT));
56  myReferencePoints.push_back(std::make_pair(TL("Reference Right"), ReferencePoint::RIGHT));
57  myReferencePoints.push_back(std::make_pair(TL("Center"), ReferencePoint::CENTER));
58  myReferencePoints.push_back(std::make_pair(TL("Extended Left"), ReferencePoint::EXTENDEDLEFT));
59  myReferencePoints.push_back(std::make_pair(TL("Extended Right"), ReferencePoint::EXTENDEDRIGHT));
60  myReferencePoints.push_back(std::make_pair(TL("Extended"), ReferencePoint::EXTENDED));
61  // Create FXListBox for the reference points and fill it
62  myReferencePointComboBox = new MFXComboBoxIcon(getCollapsableFrame(), GUIDesignComboBoxNCol, false, GUIDesignComboBoxVisibleItemsMedium,
64  for (const auto& referencePoint : myReferencePoints) {
65  myReferencePointComboBox->appendIconItem(referencePoint.first.c_str());
66  }
67  myReferencePointComboBox->setCurrentItem(0);
68  // Create Frame for Length Label and textField
69  myLengthFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
70  new FXLabel(myLengthFrame, toString(SUMO_ATTR_LENGTH).c_str(), 0, GUIDesignLabelThickedFixed(100));
71  myLengthTextField = new FXTextField(myLengthFrame, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldRestricted(TEXTFIELD_REAL));
72  myLengthTextField->setText("10");
73  // Create Frame for force length
74  myForceLengthFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
75  new FXLabel(myForceLengthFrame, TL("Force leng."), 0, GUIDesignLabelThickedFixed(100));
76  myForceLengthCheckButton = new FXCheckButton(myForceLengthFrame, "false", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
77  // Create Frame for block close polygon and checkBox (By default disabled)
78  myCloseShapeFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
79  new FXLabel(myCloseShapeFrame, TL("Close shape"), 0, GUIDesignLabelThickedFixed(100));
80  myCloseShapeCheckButton = new FXCheckButton(myCloseShapeFrame, "false", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
81  // Create Frame for center element after creation (By default enabled)
82  myCenterViewAfterCreationFrame = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
83  new FXLabel(myCenterViewAfterCreationFrame, TL("Center view"), 0, GUIDesignLabelThickedFixed(100));
84  myCenterViewAfterCreationButton = new FXCheckButton(myCenterViewAfterCreationFrame, "false", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
85  myCenterViewAfterCreationButton->setCheck(true);
86  // Create help button
87  GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Help"), "", "", 0, this, MID_HELP, GUIDesignButtonRectangular);
88 }
89 
90 
92 
93 
94 void
96  // we assume that frame will not be show
97  bool showFrame = false;
98  // check if length text field has to be showed
99  if (templateAC->getTagProperty().canMaskStartEndPos()) {
100  myLengthFrame->show();
101  myForceLengthFrame->show();
102  myReferencePointComboBox->show();
103  showFrame = true;
104  } else {
105  myForceLengthFrame->hide();
106  myLengthFrame->hide();
107  myReferencePointComboBox->hide();
108  }
109  // check if close shape check button has to be show
110  if (templateAC->getTagProperty().canCloseShape()) {
111  myCloseShapeFrame->show();
112  showFrame = true;
113  } else {
114  myCloseShapeFrame->hide();
115  }
116  // check if center camera after creation check button has to be show
117  if (templateAC->getTagProperty().canCenterCameraAfterCreation()) {
119  showFrame = true;
120  } else {
122  }
123  // if at least one element is show, show modul
124  if (showFrame) {
125  recalc();
126  show();
127  } else {
128  hide();
129  }
130 }
131 
132 
133 void
135  hide();
136 }
137 
138 
139 bool
141  // check if we need to obtain a start and end position over an edge
142  if (myReferencePointComboBox->shown()) {
143  // declare error message
144  std::string errorMessage;
145  // get element length
146  const double elementLength = getElementLength();
147  // we need a valid lane to calculate position over lane
148  if (lane == nullptr) {
149  // stop creating element, but without showing error message
150  return false;
152  // write warning and stop
153  errorMessage = TL("Current selected reference point isn't valid");
154  myFrameParent->getViewNet()->setStatusBarText(errorMessage);
155  WRITE_WARNING(errorMessage);
156  return false;
157  } else if (elementLength == INVALID_DOUBLE) {
158  // write warning and stop
159  errorMessage = TL("Invalid length");
160  myFrameParent->getViewNet()->setStatusBarText(errorMessage);
161  WRITE_WARNING(errorMessage);
162  return false;
163  } else {
164  // Obtain position of the mouse over lane (limited over grid)
166  // get start and end positions
167  const double startPos = setStartPosition(mousePosOverLane, elementLength);
168  const double endPos = setEndPosition(mousePosOverLane, elementLength, lane->getLaneShape().length2D());
169  // check if force length
170  if (myForceLengthFrame->shown() && (myForceLengthCheckButton->getCheck() == TRUE) && (endPos - startPos) != elementLength) {
171  // write warning and stop
172  errorMessage = TL("Invalid position. Uncheck 'Force length' to create element with flexible length");
173  myFrameParent->getViewNet()->setStatusBarText(errorMessage);
174  WRITE_WARNING(errorMessage);
175  return false;
176  }
177  // set start and end position
178  baseObject->addDoubleAttribute(SUMO_ATTR_STARTPOS, startPos);
179  baseObject->addDoubleAttribute(SUMO_ATTR_ENDPOS, endPos);
180  }
181  }
182  // add close shape value if shape's element can be closed
183  if (myCloseShapeFrame->shown()) {
184  baseObject->addBoolAttribute(GNE_ATTR_CLOSE_SHAPE, myCloseShapeCheckButton->getCheck() == TRUE);
185  }
186  // add center element after creation
187  if (myCenterViewAfterCreationFrame->shown()) {
189  }
190  // all ok, then return true to continue creating element
191  return true;
192 }
193 
194 
195 void
197  // get element length
198  const double elementLength = getElementLength();
199  // check lane
200  if (lane && shown() && myReferencePointComboBox->shown() && (myReferencePoint != ReferencePoint::INVALID) &&
201  (elementLength != INVALID_DOUBLE)) {
202  // Obtain position of the mouse over lane (limited over grid)
204  // continue depending of mouse pos over lane
205  if (mousePosOverLane >= 0) {
206  // set start and end position
207  const double startPos = setStartPosition(mousePosOverLane, elementLength);
208  const double endPos = setEndPosition(mousePosOverLane, elementLength, lane->getLaneShape().length2D());
209  // get lane geometry
210  const auto laneShape = lane->getLaneGeometry().getShape();
211  // difference between start-end position and elementLength
212  const auto lengthDifference = (endPos - startPos) - elementLength;
213  // set color
214  RGBColor segmentColor;
215  // check if force length
216  if (myForceLengthFrame->shown() && (myForceLengthCheckButton->getCheck() == TRUE) && abs(lengthDifference) >= 0.1) {
217  segmentColor = RGBColor::RED;
218  } else {
219  segmentColor = RGBColor::ORANGE;
220  }
221  // declare geometries
222  GUIGeometry geometry;
223  // trim geomtry
224  geometry.updateGeometry(laneShape,
225  (startPos == INVALID_DOUBLE) ? -1 : startPos,
227  (endPos == INVALID_DOUBLE) ? -1 : endPos,
229  // push layer matrix
231  // translate to temporal shape layer
232  glTranslated(0, 0, GLO_TEMPORALSHAPE);
233  // set color
234  GLHelper::setColor(segmentColor);
235  // draw temporal edge
236  GUIGeometry::drawGeometry(lane->getDrawingConstants()->getDetail(), geometry, 0.45);
237  // check if draw starPos
238  if (startPos != INVALID_DOUBLE) {
239  // cut start pos
240  geometry.updateGeometry(laneShape, startPos, Position::INVALID, startPos + 0.5, Position::INVALID);
241  // draw startPos
243  } else {
244  // push circle matrix
246  // translate to test layer, but under magenta square
247  glTranslated(laneShape.front().x(), laneShape.front().y(), 0);
248  // draw circle
250  // pop circle matrix
252  }
253  // check if draw endPos
254  if (endPos != INVALID_DOUBLE) {
255  // cut endPos
256  geometry.updateGeometry(laneShape, endPos - 0.5, Position::INVALID, endPos, Position::INVALID);
257  // draw endPos
259  } else {
260  // push circle matrix
262  // translate to test layer, but under magenta square
263  glTranslated(laneShape.back().x(), laneShape.back().y(), 0);
264  // draw circle
266  // pop circle matrix
268  }
269  // set color
270  GLHelper::setColor(segmentColor.changedBrightness(-32));
271  // translate to front
272  glTranslated(0, 0, 2);
273  // check if draw at end, or over circle
274  if (endPos == INVALID_DOUBLE) {
275  // cut endPos
276  geometry.updateGeometry(laneShape, laneShape.length() - 0.5, Position::INVALID, laneShape.length(), Position::INVALID);
277  // draw triangle at end
278  GLHelper::drawTriangleAtEnd(geometry.getShape().front(), geometry.getShape().back(), (double) 0.45, (double) 0.3, 0.3);
279  } else {
280  // draw triangle at end
281  GLHelper::drawTriangleAtEnd(geometry.getShape().front(), geometry.getShape().back(), (double) 0.45, (double) 0.3, -0.1);
282  }
283  // pop layer matrix
285  }
286  }
287 }
288 
289 
290 long
291 GNENeteditAttributes::onCmdSetNeteditAttribute(FXObject* obj, FXSelector, void*) {
292  if (obj == myForceLengthCheckButton) {
293  if (myForceLengthCheckButton->getCheck()) {
294  myForceLengthCheckButton->setText(TL("true"));
295  } else {
296  myForceLengthCheckButton->setText(TL("false"));
297  }
298  } else if (obj == myCloseShapeCheckButton) {
299  if (myCloseShapeCheckButton->getCheck()) {
300  myCloseShapeCheckButton->setText(TL("true"));
301  } else {
302  myCloseShapeCheckButton->setText(TL("false"));
303  }
304  } else if (obj == myCenterViewAfterCreationButton) {
305  if (myCenterViewAfterCreationButton->getCheck()) {
306  myCenterViewAfterCreationButton->setText(TL("true"));
307  } else {
308  myCenterViewAfterCreationButton->setText(TL("false"));
309  }
310  } else if (obj == myLengthTextField) {
311  // change color of text field depending of the input length
312  if (getElementLength() != INVALID_DOUBLE) {
313  myLengthTextField->setTextColor(FXRGB(0, 0, 0));
314  myLengthTextField->killFocus();
315  } else {
316  myLengthTextField->setTextColor(FXRGB(255, 0, 0));
317  }
318  // set background color
319  if (myLengthTextField->getText().empty()) {
320  myLengthTextField->setBackColor(FXRGBA(255, 213, 213, 255));
321  } else {
322  myLengthTextField->setBackColor(FXRGBA(255, 255, 255, 255));
323  }
324  // Update additional frame
325  update();
326  } else if (obj == myReferencePointComboBox) {
327  // iterate over all reference points
328  for (const auto& referencePoint : myReferencePoints) {
329  if (myReferencePointComboBox->getText().text() == referencePoint.first) {
330  // update reference point
331  myReferencePoint = referencePoint.second;
332  // update comboBox
333  myReferencePointComboBox->setTextColor(FXRGB(0, 0, 0));
334  myReferencePointComboBox->killFocus();
335  myReferencePointComboBox->setBackColor(FXRGBA(255, 255, 255, 255));
336  // enable text fierld
337  myLengthTextField->enable();
338  // check if show force length
342  myForceLengthFrame->show();
343  } else {
344  myForceLengthFrame->hide();
345  }
346  // recalf modul
347  recalc();
348  return 1;
349  }
350  }
351  // set invalid reference point
353  // update comboBox
354  myReferencePointComboBox->setTextColor(FXRGB(255, 0, 0));
355  // disable text field for length
356  myLengthTextField->disable();
357  // hide force length frame
358  myForceLengthFrame->hide();
359  // recalc modul
360  recalc();
361  // set background color
362  if (myReferencePointComboBox->getText().empty()) {
363  myReferencePointComboBox->setBackColor(FXRGBA(255, 213, 213, 255));
364  } else {
365  myReferencePointComboBox->setBackColor(FXRGBA(255, 255, 255, 255));
366  }
367  }
368  return 1;
369 }
370 
371 
372 long
373 GNENeteditAttributes::onCmdHelp(FXObject*, FXSelector, void*) {
374  // Create dialog box
375  FXDialogBox* additionalNeteditAttributesHelpDialog = new FXDialogBox(getCollapsableFrame(), TL("Netedit Parameters Help"), GUIDesignDialogBox);
376  additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
377  // set help text
378  std::ostringstream help;
379  help
380  << TL("- Reference point: Mark the initial position of the additional element.") << "\n"
381  << TL(" Example: If you want to create a busStop with a length of 30 in the point 100 of the lane:") << "\n"
382  // references
383  << TL(" - Reference Left: will have startPos = 70 and endPos = 100.") << "\n"
384  << TL(" - Reference Right: will have startPos = 100 and endPos = 130.") << "\n"
385  << TL(" - Center: will have startPos = 85 and endPos = 115.") << "\n"
386  // extended
387  << TL(" - Extended Left: will have startPos = 85 and endPos until lane's length.") << "\n"
388  << TL(" - Extended Right: will have startPos from start and endPos = 115.") << "\n"
389  << TL(" - Extended: will have startPos from start and endPos until lane's length.") << "\n"
390  // other options
391  << TL("- Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with") << "\n"
392  << TL(" the mouse. This option can be modified inspecting element.") << "\n"
393  << TL("- Center view: if is enabled, view will be center over created element.");
394  // Create label with the help text
395  new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), 0, GUIDesignLabelFrameInformation);
396  // Create horizontal separator
397  new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
398  // Create frame for OK Button
399  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
400  // Create Button Close (And two more horizontal frames to center it)
401  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
402  GUIDesigns::buildFXButton(myHorizontalFrameOKButton, TL("OK"), "", TL("close"), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
403  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
404  // Write Warning in console if we're in testing mode
405  WRITE_DEBUG("Opening GNENeteditAttributes help dialog");
406  // create Dialog
407  additionalNeteditAttributesHelpDialog->create();
408  // show in the given position
409  additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
410  // refresh APP
411  getApp()->refresh();
412  // open as modal dialog (will block all windows until stop() or stopModal() is called)
413  getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
414  // Write Warning in console if we're in testing mode
415  WRITE_DEBUG("Closing GNENeteditAttributes help dialog");
416  return 1;
417 }
418 
419 
420 double
422  if (GNEAttributeCarrier::canParse<double>(myLengthTextField->getText().text())) {
423  const double elementLength = GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text());
424  if (elementLength > 0) {
425  return elementLength;
426  } else {
427  return INVALID_DOUBLE;
428  }
429  } else {
430  return INVALID_DOUBLE;
431  }
432 }
433 
434 
435 double
436 GNENeteditAttributes::setStartPosition(const double mouseOverLanePos, double elementLength) const {
437  switch (myReferencePoint) {
439  return mouseOverLanePos;
441  if ((mouseOverLanePos - elementLength) <= 0) {
442  return INVALID_DOUBLE;
443  } else {
444  return mouseOverLanePos - elementLength;
445  }
447  if ((mouseOverLanePos - (elementLength * 0.5)) <= 0) {
448  return INVALID_DOUBLE;
449  } else {
450  return mouseOverLanePos - (elementLength * 0.5);
451  }
453  return INVALID_DOUBLE;
455  return mouseOverLanePos;
457  return INVALID_DOUBLE;
458  default:
459  throw InvalidArgument("Reference Point invalid");
460  }
461 }
462 
463 
464 double
465 GNENeteditAttributes::setEndPosition(const double mouseOverLanePos, double elementLength, const double laneLength) const {
466  switch (myReferencePoint) {
468  if ((mouseOverLanePos + elementLength) >= laneLength) {
469  return INVALID_DOUBLE;
470  } else {
471  return mouseOverLanePos + elementLength;
472  }
474  return mouseOverLanePos;
476  if ((mouseOverLanePos + (elementLength * 0.5)) >= laneLength) {
477  return INVALID_DOUBLE;
478  } else {
479  return mouseOverLanePos + (elementLength * 0.5);
480  }
482  return mouseOverLanePos;
484  return INVALID_DOUBLE;
486  return INVALID_DOUBLE;
487  default:
488  throw InvalidArgument("Reference Point invalid");
489  }
490 }
491 
492 /****************************************************************************/
FXDEFMAP(GNENeteditAttributes) NeteditAttributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:930
@ MID_HELP
help button
Definition: GUIAppEnum.h:648
#define GUIDesignComboBox
Definition: GUIDesigns.h:301
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:319
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:407
#define GUIDesignDialogBox
Definition: GUIDesigns.h:604
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:102
#define GUIDesignComboBoxVisibleItemsMedium
combo box medium small
Definition: GUIDesigns.h:55
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:82
#define GUIDesignButtonOK
Definition: GUIDesigns.h:161
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:200
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
Definition: GUIDesigns.h:70
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:468
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition: GUIDesigns.h:260
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:287
@ GLO_TEMPORALSHAPE
temporal shape (used in netedit)
@ MODEADDITIONAL
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:306
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
@ SUMO_ATTR_STARTPOS
@ GNE_ATTR_CENTER_AFTER_CREATION
flag to center camera after element creation
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
@ SUMO_ATTR_LENGTH
const double INVALID_DOUBLE
invalid double
Definition: StdDefs.h:64
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:655
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:630
static void drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:570
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
GUIVisualizationSettings::Detail getDetail() const
get detail
Definition: GNELane.cpp:142
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:214
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1964
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition: GNELane.cpp:236
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition: GNELane.cpp:208
FXHorizontalFrame * myLengthFrame
horizontal frame for length
FXHorizontalFrame * myCenterViewAfterCreationFrame
horizontal frame for center view after creation frame
void drawLaneReference(const GNELane *lane) const
draw lane reference
double getElementLength() const
get element length
double setEndPosition(const double mouseOverLanePos, double elementLength, const double laneLength) const
return the end position
long onCmdSetNeteditAttribute(FXObject *, FXSelector, void *)
Called when user changes some element of GNENeteditAttributes.
double setStartPosition(const double mouseOverLanePos, double elementLength) const
return the start position
ReferencePoint myReferencePoint
current reference point
MFXComboBoxIcon * myReferencePointComboBox
match box with the list of reference points
FXHorizontalFrame * myForceLengthFrame
horizontal frame for force length
long onCmdHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
std::vector< std::pair< std::string, ReferencePoint > > myReferencePoints
map with all references
FXTextField * myLengthTextField
textField for length
FXCheckButton * myCenterViewAfterCreationButton
checkbox to enable/disable center element after creation
void showNeteditAttributesModule(GNEAttributeCarrier *templateAC)
show Netedit attributes modul
FXCheckButton * myForceLengthCheckButton
checkbox to enable/disable force length
FXHorizontalFrame * myCloseShapeFrame
horizontal frame for close polygon
void hideNeteditAttributesModule()
hide Netedit attributes modul
FXCheckButton * myCloseShapeCheckButton
checkbox to enable/disable close polygon
ReferencePoint
FOX needs this.
bool getNeteditAttributesAndValues(CommonXMLStructure::SumoBaseObject *baseObject, const GNELane *lane) const
fill valuesMap with netedit attributes
GNEFrame * myFrameParent
pointer to frame parent
bool canMaskStartEndPos() const
return true if tag correspond to an element that can mask the attributes "start" and "end" position a...
bool canCenterCameraAfterCreation() const
return true if tag correspond to an element that center camera after creation
bool canCloseShape() const
return true if tag correspond to an element that can close their shape
void setStatusBarText(const std::string &text)
set statusBar text
Definition: GNEViewNet.cpp:841
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Definition: GUIDesigns.cpp:128
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:59
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
ComboBox with icon.
void setBackColor(FXColor clr)
Set window background color.
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:317
double length2D() const
Returns the length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static const RGBColor ORANGE
Definition: RGBColor.h:191
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
static const RGBColor RED
named colors
Definition: RGBColor.h:185