111 myAdditionalFrameParent(additionalFrameParent),
119 for (
auto i : listOfTags) {
120 myAdditionalMatchBox->appendItem(
toString(i).c_str());
124 myAdditionalMatchBox->setNumVisible((
int)myAdditionalMatchBox->getNumItems());
127 myAdditionalMatchBox->setCurrentItem(10);
152 if (tagValue.canBlockMovement()) {
160 for (
auto i : tagValue) {
162 if (!i.second.isUnique()) {
170 if (tagValue.hasParent()) {
202 for (
auto i : listOfTags) {
215 WRITE_DEBUG(
"Selected invalid additional in AdditionalSelector");
225 myAdditionalAttributesParent(additionalAttributesParent),
249 if (attributeProperties.isInt()) {
253 }
else if (attributeProperties.isFloat()) {
257 }
else if (attributeProperties.isBool()) {
258 if (GNEAttributeCarrier::parse<bool>(value)) {
298 if (attrValue.isBool()) {
300 }
else if (attrValue.isInt()) {
302 }
else if (attrValue.isFloat() || attrValue.isTime()) {
323 if (attrValues.isInt()) {
324 if (GNEAttributeCarrier::canParse<int>(
myTextFieldInt->getText().text())) {
326 int intValue = GNEAttributeCarrier::parse<int>(
myTextFieldInt->getText().text());
328 if (attrValues.isPositive() && (intValue < 0)) {
334 }
else if (attrValues.isTime()) {
336 if (GNEAttributeCarrier::canParse<double>(
myTextFieldReal->getText().text())) {
338 double doubleValue = GNEAttributeCarrier::parse<double>(
myTextFieldReal->getText().text());
340 if (doubleValue < 0) {
346 }
else if (attrValues.isFloat()) {
347 if (GNEAttributeCarrier::canParse<double>(
myTextFieldReal->getText().text())) {
349 double doubleValue = GNEAttributeCarrier::parse<double>(
myTextFieldReal->getText().text());
351 if (attrValues.isPositive() && (doubleValue < 0)) {
354 }
else if (attrValues.isProbability() && ((doubleValue < 0) || doubleValue > 1)) {
360 }
else if (attrValues.isFilename()) {
363 myInvalidValue =
"input contains invalid characters for a filename";
365 }
else if (attrValues.isVClass() && attrValues.isList()) {
383 myInvalidValue =
"Ids contains invalid characters for vehicle type ids";
422 myAdditionalFrameParent(additionalFrameParent) {
465 std::map<SumoXMLAttr, std::string>
467 std::map<SumoXMLAttr, std::string> values;
480 std::string errorMessage;
483 if (errorMessage.empty()) {
486 if (attributeValue.size() != 0) {
487 errorMessage = attributeValue;
492 if (extra.size() == 0) {
537 myActualAdditionalReferencePoint(GNE_ADDITIONALREFERENCEPOINT_LEFT),
538 myCurrentLengthValid(true) {
568 if (includeLengthAndReferencePoint) {
613 if (GNEAttributeCarrier::canParse<double>(
myLengthTextField->getText().text()) &&
667 FXDialogBox* additionalNeteditAttributesHelpDialog =
new FXDialogBox(
this,
"Netedit Parameters Help",
GUIDesignDialogBox);
670 std::ostringstream help;
672 <<
"- Referece point: Mark the initial position of the additional element.\n" 673 <<
" Example: If you want to create a busStop with a length of 30 in the point 100 of the lane:\n" 674 <<
" - Reference Left will create it with startPos = 70 and endPos = 100.\n" 675 <<
" - Reference Right will create it with startPos = 100 and endPos = 130.\n" 676 <<
" - Reference Center will create it with startPos = 85 and endPos = 115.\n" 678 <<
"- Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with\n" 679 <<
" the mouse. This option can be modified inspecting element.";
691 WRITE_DEBUG(
"Opening NeteditAttributes help dialog");
693 additionalNeteditAttributesHelpDialog->create();
695 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
699 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
701 WRITE_DEBUG(
"Closing NeteditAttributes help dialog");
709 std::string vectorOfIds;
710 for (
int i = 0; i < list->getNumItems(); i++) {
711 if (list->isItemSelected(i)) {
712 if (vectorOfIds.size() > 0) {
715 vectorOfIds += (list->getItem(i)->getText()).text();
763 myAdditionalFrameParent(additionalFrameParent),
879 for (
auto i : vectorOfEdges) {
881 if (i->getID().find(search) != std::string::npos) {
882 myList->appendItem(i->getID().c_str());
960 for (
int i = 0; i <
myList->getNumItems(); i++) {
961 if (
myList->getItem(i)->isSelected()) {
971 for (
int i = 0; i <
myList->getNumItems(); i++) {
972 if (
myList->getItem(i)->isSelected()) {
1024 for (
auto i : vectorOfLanes) {
1025 if (i->getID().find(search) != std::string::npos) {
1026 myList->appendItem(i->getID().c_str());
1100 for (
int i = 0; i <
myList->getNumItems(); i++) {
1101 if (
myList->getItem(i)->isSelected()) {
1111 for (
int i = 0; i <
myList->getNumItems(); i++) {
1112 if (
myList->getItem(i)->isSelected()) {
1126 GNEFrame(horizontalFrameParent, viewNet,
"Additionals") {
1173 GNEEdge* pointed_edge =
nullptr;
1174 GNELane* pointed_lane =
nullptr;
1178 if (tagValue.hasParent()) {
1180 if (additionalElement && (additionalElement->
getTag() == tagValue.getParentTag())) {
1195 pointed_junction =
dynamic_cast<GNEJunction*
>(netElement);
1196 if (pointed_junction !=
nullptr) {
1214 if (dynamic_cast<GNELane*>(netElement) !=
nullptr) {
1215 pointed_edge = &(
dynamic_cast<GNELane*
>(netElement)->getParentEdge());
1217 if (pointed_edge !=
nullptr) {
1233 pointed_lane =
dynamic_cast<GNELane*
>(netElement);
1234 if (pointed_lane !=
nullptr) {
1250 pointed_crossing =
dynamic_cast<GNECrossing*
>(netElement);
1251 if (pointed_crossing !=
nullptr) {
1279 double positionOfTheMouseOverEdge = pointed_edge->
getLanes().at(0)->getShape().nearest_offset_to_point2D(currentPosition);
1299 }
else if (pointed_lane) {
1330 double end = GNEAttributeCarrier::parse<double>(valuesOfElement[
SUMO_ATTR_END]);
1346 if (tagValue.canBlockMovement()) {
1354 std::vector<std::string> vectorOfIds;
1358 for (
auto i : selectedEdges) {
1359 vectorOfIds.push_back(i->getID());
1377 std::vector<std::string> vectorOfIds;
1381 for (
auto i : selectedLanes) {
1382 vectorOfIds.push_back(i->getID());
1443 return currentAdditionalTypeStr +
"_" + netElement->
getID() +
"_" +
toString(additionalIndex);
1449 return currentAdditionalTypeStr +
"_" +
toString(additionalIndex);
1458 return positionOfTheMouseOverLane;
1460 return positionOfTheMouseOverLane - lengthOfAdditional;
1462 return positionOfTheMouseOverLane - lengthOfAdditional / 2;
1473 return positionOfTheMouseOverLane + lengthOfAdditional;
1475 return positionOfTheMouseOverLane;
1477 return positionOfTheMouseOverLane + lengthOfAdditional / 2;
double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional)
obtain the Start position values of StoppingPlaces and E2 detector over the lane
GNEAdditionalFrame::AdditionalSelector * myAdditionalSelector
additional selector
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
SumoXMLTag
Numbers representing SUMO-XML - element names.
long onCmdSelectReferencePoint(FXObject *, FXSelector, void *)
Called when user enters another reference point.
SumoXMLAttr myAdditionalAttr
current XML attribute
additionalReferencePoint myActualAdditionalReferencePoint
actual additional reference point selected in the match Box
#define GUIDesignComboBoxNCol
number of column of every combo box
clear selection of elements
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
additionalReferencePoint getActualReferencePoint() const
get actual reference point
FXCheckButton * myUseSelectedLanesCheckButton
CheckBox for selected lanes.
static std::vector< SumoXMLTag > allowedAdditionalTags(bool onlyDrawables)
get all editable for tag additional elements
SelectorParentAdditional * getAdditionalParentSelector() const
get additional parent selector
invert selection of eleents
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name) ...
static bool isValidListOfTypeID(const std::string &value)
whether the given string is a valid list of ids for an edge or vehicle type (empty aren't allowed) ...
void showListOfAdditionalParents(SumoXMLTag additionalTypeParent)
Show list of SelectorParentAdditional.
SumoXMLTag getCurrentAdditionalType() const
get current additional type
long onCmdSelectLane(FXObject *, FXSelector, void *)
called when user select a lane of the list
begin/end of the description of a single lane
bool isUseSelectedLanesEnable() const
get status of checkBox UseSelectedLanes
A calibrator placed over edge.
void setCurrentAdditional(SumoXMLTag actualAdditionalType)
set parameters depending of the given additionalType
AddAdditionalResult addAdditional(GNENetElement *netElement, GNEAdditional *additional)
add additional element
FXLabel * myFirstAdditionalParentsLabel
Label with the name of additional.
#define GUIDesignListSingleElement
design for FXLists that only allow a single selected elements
void hideAdditionalParameters()
hide group box
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
FXTextField * myTextFieldStrings
textField to modify the default value of string parameters
FXComboBox * myReferencePointMatchBox
match box with the list of reference points
additionalReferencePoint
FOX-declaration.
double setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional)
obtain the End position values of StoppingPlaces and E2 detector over the lane
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
FXList * myFirstAdditionalParentsList
List of additional sets.
FXCheckButton * myBoolCheckButton
check button to enable/disable the value of boolean parameters
long onCmdHelp(FXObject *, FXSelector, void *)
FXButton * myClearEdgesSelection
button for clear selection
~AdditionalSelector()
destructor
std::string myInvalidValue
string which indicates the reason due current value is invalid
void hideList()
hide SelectorParentLanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GNEAdditionalFrame::SelectorParentEdges * myEdgeParentsSelector
list of SelectorParentEdges
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
FXTextField * myLengthTextField
textField for length
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool areValuesValid() const
check if parameters of attributes are valid
void openHelpAttributesDialog(SumoXMLTag tag) const
Open help attributes dialog.
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
GNEViewNet * getViewNet() const
get view net
bool myCurrentLengthValid
Flag to check if current length is valid.
FXTextField * myEdgesSearch
text field for search edge IDs
void showList(std::string search="")
Show list of SelectorParentEdges.
AdditionalAttributes * myAdditionalAttributesParent
additional attribute parent
FXButton * myInvertEdgesSelection
button for invert selection
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additional frame parent
void showNeteditAttributes(bool includeLengthAndReferencePoint)
show length field and reference point
std::string getIdSelected() const
get currently additional parent selected
#define GUIDesignComboBox
GNEViewNet * myViewNet
View Net for changes.
FXCheckButton * myUseSelectedEdgesCheckButton
CheckBox for selected edges.
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
long onCmdselectAttributeCarrier(FXObject *, FXSelector, void *)
GNEUndoList * getUndoList() const
get the undoList object
FXButton * clearLanesSelection
button for clear selection
SelectorParentLanes * getLaneParentsSelector() const
get lane parents selector
FXDEFMAP(GNEAdditionalFrame::AdditionalSelector) SelectorAdditionalMap[]
#define GUIDesignList
design for FXLists
GNEAdditionalFrame::NeteditAttributes * myNeteditParameters
Netedit parameter.
FXLabel * myLengthLabel
Label for length.
#define GUIDesignHorizontalSeparator
SelectorParentAdditional(GNEAdditionalFrame *additionalFrameParent)
constructor
long onCmdSetAttribute(FXObject *, FXSelector, void *)
#define GUIDesignTextField
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SelectorParentEdges * getEdgeParentsSelector() const
get edge parents selector
std::map< SumoXMLAttr, std::string > getAttributesAndValues() const
get attributes and their values
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
bool isCurrentLengthValid() const
check if current length is valid
GNEAdditionalFrame * myAdditionalFrameParent
pointer to Additional Frame Parent
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
A point in 2D or 3D with translation and scaling methods.
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
FXList * myList
List of SelectorParentLanes.
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
GNEAdditionalFrame::SelectorParentAdditional * myFirstAdditionalParentSelector
list of additional Set
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
FXComboBox * myAdditionalMatchBox
combo box with the list of additional elements
GNEAdditionalFrame::AdditionalAttributes * myAdditionalParameters
additional internal attributes
SelectorParentLanes()
FOX needs this.
~AdditionalAttributes()
destructor
void removeAdditional(GNEAdditional *additional)
remove an additional element previously added
block movement of a graphic element
void showWarningMessage(std::string extra="") const
show warning message with information about non-valid attributes
SelectorParentEdges()
FOX needs this.
GNEAdditionalFrame::SelectorParentLanes * myLaneParentsSelector
list of SelectorParentLanes
GNEAdditionalFrame * getAdditionalFrameParent() const
get additional frame parent
~GNEAdditionalFrame()
Destructor.
double getLengthGeometryFactor() const
get lenght geometry factor
~NeteditAttributes()
destructor
SumoXMLAttr getAttr() const
return Attr
FXLabel * myBlockLabel
Label for block movement.
~SelectorParentLanes()
destructor
FXTextField * myLanesSearch
text field for search lane IDs
AdditionalAttributes()
FOX needs this.
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additionalFrameParent
void clearAttributes()
clear attributes
SumoXMLTag myCurrentAdditionalType
actual additional type selected in the match Box
const std::string getID() const
function to support debugging
SumoXMLTag myAdditionalTypeParent
current additional type parent
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
GNEAdditionalFrame * myAdditionalFrameParent
pointer to additional frame parent
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#define GUIDesignButtonRectangular
little button rectangular (46x23) used in frames (For example, in "help" buttons) ...
double getLaneShapeLength() const
returns the length of the lane's shape
double getLength() const
get value of length
friend class AdditionalAttributeSingle
FOX-declaration.
begin/end of the description of an edge
void addAttribute(SumoXMLAttr AdditionalAttributeSingle)
add attribute
void hideListOfAdditionalParents()
hide SelectorParentAdditional
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
void showList(std::string search="")
Show list of SelectorParentLanes.
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
void hideParameter()
hide all parameters
FXList * myList
List of SelectorParentEdges.
A road/street connecting two junctions (netedit-version)
#define GUIDesignTextFieldNCol
Num of column of text field.
~AdditionalAttributeSingle()
destructor
FXLabel * myLabel
lael with the name of the parameter
~SelectorParentAdditional()
destructor
AddAdditionalResult
enum with all possible values after try to create an additional using frame
long onCmdSetBlocking(FXObject *, FXSelector, void *)
Called when user changes the checkbox "set blocking".
const PositionVector & getShape() const
returns the shape of the lane
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
virtual void show()
show Frame
long onCmdUseSelectedLanes(FXObject *, FXSelector, void *)
#define GUIDesignDialogBox
void show()
show additional frame and update use selected edges/lanes
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
void showAdditionalParameters()
show group box
An Element which don't belongs to GNENet but has influency in the simulation.
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
static GNEAdditional * buildAdditional(GNEViewNet *viewNet, bool allowUndoRedo, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Build additionals.
std::string getValue() const
return value
~SelectorParentEdges()
destructor
long onCmdSetBooleanAttribute(FXObject *, FXSelector, void *)
called when user change the value of myBoolCheckButton
void updateUseSelectedEdges()
Update use selectedEdges.
bool isBlockEnabled() const
check if block is enabled
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
virtual void hide()
hide Frame
std::string generateID(GNENetElement *netElement) const
generate a ID for an additiona element
long onCmdHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
GNEAdditionalFrame * myAdditionalFrameParent
pointer to Additional Frame Parent
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
AdditionalSelector * getAdditionalSelector() const
get additional selector
void hideList()
hide SelectorParentEdges
const std::map< std::string, GNEAdditional * > & getAdditionalByType(SumoXMLTag type) const
get map with IDs and pointers to additionals
#define GUIDesignButtonOK
const std::string & isAttributeValid() const
returns a empty string if current value is valid, a string with information about invalid value in ot...
void setStatusBarText(const std::string &text)
set staturBar text
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
void setIDSelected(const std::string &id)
select manually a element of the list
bool isUseSelectedEdgesEnable() const
get status of checkBox UseSelectedEdges
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
FXButton * invertLanesSelection
button for invert selection
parent of an additional element
used to select a type of element in a combo box
static const TagValues & getTagProperties(SumoXMLTag tag)
get Tag Properties
std::string getIdsSelected() const
get list of selecte id's in string format
AdditionalAttributeSingle()
FOX needs this.
FXTextField * myTextFieldInt
textField to modify the default value of int/float/string parameters
static std::string getIdsSelected(const FXList *list)
get list of selecte id's in string format
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame and height of 23
std::string getIdsSelected() const
get list of selecte id's in string format
GNEAdditionalFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
long onCmdSetLength(FXObject *, FXSelector, void *)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name) ...
long onCmdTypeInSearchBox(FXObject *, FXSelector, void *)
called when user type in search box
AdditionalAttributes * getAdditionalParameters() const
get additional attributes
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
std::vector< AdditionalAttributeSingle * > myVectorOfsingleAdditionalParameter
vector with the additional parameters
void showParameter(SumoXMLAttr additionalAttr, std::string value)
show name and value of attribute of type string
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left and height of 23 ...
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
void hideNeteditAttributes()
show length field and reference point
void refreshListOfAdditionalParents()
Refresh list of Additional Parents.
void updateUseSelectedLanes()
long onCmdSelectEdge(FXObject *, FXSelector, void *)
called when user select a edge of the list
NeteditAttributes * getNeteditAttributes() const
get netedit attributes
FXCheckButton * myBlockMovementCheckButton
checkBox for block movement
FXTextField * myTextFieldReal
textField to modify the default value of real/times parameters
FXButton * helpReferencePoint
Button for help about the reference point.
SumoXMLTag getTag() const
get XML Tag assigned to this object
NeteditAttributes()
FOX needs this.