52 myFrameParent(frameParent),
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));
64 for (
const auto& referencePoint : myReferencePoints) {
65 myReferencePointComboBox->appendIconItem(referencePoint.first.c_str());
67 myReferencePointComboBox->setCurrentItem(0);
72 myLengthTextField->setText(
"10");
85 myCenterViewAfterCreationButton->setCheck(
true);
97 bool showFrame =
false;
144 std::string errorMessage;
148 if (lane ==
nullptr) {
153 errorMessage =
TL(
"Current selected reference point isn't valid");
159 errorMessage =
TL(
"Invalid length");
172 errorMessage =
TL(
"Invalid position. Uncheck 'Force length' to create element with flexible length");
205 if (mousePosOverLane >= 0) {
212 const auto lengthDifference = (endPos - startPos) - elementLength;
247 glTranslated(laneShape.front().x(), laneShape.front().y(), 0);
263 glTranslated(laneShape.back().x(), laneShape.back().y(), 0);
272 glTranslated(0, 0, 2);
378 std::ostringstream 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"
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"
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"
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.");
405 WRITE_DEBUG(
"Opening GNENeteditAttributes help dialog");
407 additionalNeteditAttributesHelpDialog->create();
409 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
413 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
415 WRITE_DEBUG(
"Closing GNENeteditAttributes help dialog");
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;
439 return mouseOverLanePos;
441 if ((mouseOverLanePos - elementLength) <= 0) {
444 return mouseOverLanePos - elementLength;
447 if ((mouseOverLanePos - (elementLength * 0.5)) <= 0) {
450 return mouseOverLanePos - (elementLength * 0.5);
455 return mouseOverLanePos;
468 if ((mouseOverLanePos + elementLength) >= laneLength) {
471 return mouseOverLanePos + elementLength;
474 return mouseOverLanePos;
476 if ((mouseOverLanePos + (elementLength * 0.5)) >= laneLength) {
479 return mouseOverLanePos + (elementLength * 0.5);
482 return mouseOverLanePos;
FXDEFMAP(GNENeteditAttributes) NeteditAttributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
#define GUIDesignComboBox
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignDialogBox
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignButtonOK
#define GUIDesignComboBoxVisibleItems
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
#define GUIDesignHorizontalSeparator
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
@ GLO_TEMPORALSHAPE
temporal shape (used in netedit)
#define WRITE_WARNING(msg)
@ LEFT
At the leftmost side of the lane.
@ GNE_ATTR_CENTER_AFTER_CREATION
flag to center camera after element creation
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
const double INVALID_DOUBLE
invalid double
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
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.
static void drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0)
static void popMatrix()
pop matrix
static void pushMatrix()
push matrix
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNEViewNet * getViewNet() const
get view net
GUIVisualizationSettings::Detail getDetail() const
get detail
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
get elements shape
double getLengthGeometryFactor() const
get length geometry factor
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
const GUIGeometry & getLaneGeometry() const
get lane geometry
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
~GNENeteditAttributes()
destructor
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
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
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
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.
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)
double length() const
Computes the length of the given vector.
static const Position INVALID
used to indicate that a position is valid
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
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
static const RGBColor RED
named colors