Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDetector.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//
19/****************************************************************************/
20#include <config.h>
21
22#include <netedit/GNENet.h>
23#include <netedit/GNESegment.h>
24#include <netedit/GNEViewNet.h>
31
32#include "GNEDetector.h"
33
34
35// ===========================================================================
36// member method definitions
37// ===========================================================================
38
39GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, const double pos,
40 const SUMOTime period, const std::vector<GNELane*>& parentLanes, const std::string& filename,
41 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
42 const std::string& detectPersons, const std::string& name, const bool friendlyPos,
43 const Parameterised::Map& parameters) :
44 GNEAdditional(id, net, type, tag, icon, name, {}, {}, parentLanes, {}, {}, {}),
45 Parameterised(parameters),
46 myPositionOverLane(pos),
47 myPeriod(period),
48 myFilename(filename),
49 myVehicleTypes(vehicleTypes),
50 myNextEdges(nextEdges),
51 myDetectPersons(detectPersons),
52myFriendlyPosition(friendlyPos) {
53}
54
55
56GNEDetector::GNEDetector(GNEAdditional* additionalParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon,
57 const double pos, const SUMOTime period, const std::vector<GNELane*>& parentLanes, const std::string& filename,
58 const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters) :
59 GNEAdditional(net, type, tag, icon, name, {}, {}, parentLanes, {additionalParent}, {}, {}),
60Parameterised(parameters),
61myPositionOverLane(pos),
62myPeriod(period),
63myFilename(filename),
64myFriendlyPosition(friendlyPos) {
65}
66
67
69
70
73 // check modes and detector type
75 return nullptr;
80 } else {
81 // return move operation for detectors with single position placed over shape (E1, EntryExits..)
82 return new GNEMoveOperation(this, getParentLanes().front(), myPositionOverLane,
84 }
85}
86
87
88double
92
93
94bool
96 // get edit modes
97 const auto& editModes = myNet->getViewNet()->getEditModes();
98 // check if we're in move mode
99 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
101 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
102 // only move the first element
104 // special case for multiple lane area detectors
106 auto segment = gViewObjectsHandler.getSelectedSegment(this);
107 if (segment && segment->getJunction()) {
108 return false;
109 } else if (segment && segment->getLane()) {
110 // ensure that is the first or the last lane
111 if (segment->getLaneIndex() == 0) {
112 return true;
113 } else if (segment->getLaneIndex() == ((int)getParentLanes().size() - 1)) {
114 return true;
115 }
116 } else {
117 // this is the start or end point
118 return true;
119 }
120 } else {
121 return true;
122 }
123 }
124 }
125 return false;
126}
127
128
129GNELane*
131 return getParentLanes().front();
132}
133
134
139
140
141void
142GNEDetector::updateCenteringBoundary(const bool /*updateGrid*/) {
143 // nothing to update
144}
145
146void
147GNEDetector::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement,
148 const GNENetworkElement* newElement, GNEUndoList* undoList) {
149 // only split geometry of E2 multilane detectors
151 // obtain new list of E2 lanes
152 std::string newE2Lanes = getNewListOfParents(originalElement, newElement);
153 // update E2 Lanes
154 if (newE2Lanes.size() > 0) {
155 setAttribute(SUMO_ATTR_LANES, newE2Lanes, undoList);
156 }
157 } else if (splitPosition < myPositionOverLane) {
158 // change lane
159 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
160 // now adjust start position
161 setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
162 }
163}
164
165
166double
168 double fixedPos = myPositionOverLane;
169 const double len = getLane()->getParentEdge()->getNBEdge()->getFinalLength();
170 double length = 0;
171 GNEAdditionalHandler::fixLanePosition(fixedPos, length, len);
172 return (fixedPos * getLane()->getLengthGeometryFactor());
173}
174
175
176
177std::string
179 return getLane()->getID();
180}
181
182
187
188
189std::string
191 return getTagStr() + ": " + getID();
192}
193
194
195std::string
197 return getTagStr();
198}
199
200
201std::string
203 switch (key) {
204 case SUMO_ATTR_ID:
205 return getMicrosimID();
206 case SUMO_ATTR_LANE:
207 return getParentLanes().front()->getID();
210 case SUMO_ATTR_PERIOD:
212 return "";
213 } else {
214 return time2string(myPeriod);
215 }
216 case SUMO_ATTR_NAME:
217 return myAdditionalName;
218 case SUMO_ATTR_FILE:
219 return myFilename;
220 case SUMO_ATTR_VTYPES:
221 return toString(myVehicleTypes);
223 return toString(myNextEdges);
231 return getParametersStr();
233 return "";
234 default:
235 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
236 }
237}
238
239
240double
242 switch (key) {
244 return myPositionOverLane;
245 default:
246 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
247 }
248}
249
250
251void
252GNEDetector::setDetectorAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
253 switch (key) {
254 case SUMO_ATTR_ID:
255 case SUMO_ATTR_LANE:
257 case SUMO_ATTR_PERIOD:
258 case SUMO_ATTR_NAME:
259 case SUMO_ATTR_FILE:
260 case SUMO_ATTR_VTYPES:
267 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
268 break;
269 default:
270 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
271 }
272}
273
274
275
276bool
277GNEDetector::isDetectorValid(SumoXMLAttr key, const std::string& value) {
278 switch (key) {
279 case SUMO_ATTR_ID:
280 return isValidDetectorID(value);
281 case SUMO_ATTR_LANE:
282 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
283 return true;
284 } else {
285 return false;
286 }
288 return canParse<double>(value) && fabs(parse<double>(value)) < getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
289 case SUMO_ATTR_PERIOD:
290 if (value.empty()) {
291 return true;
292 } else {
293 return (canParse<double>(value) && (parse<double>(value) >= 0));
294 }
295 case SUMO_ATTR_NAME:
297 case SUMO_ATTR_FILE:
299 case SUMO_ATTR_VTYPES:
300 if (value.empty()) {
301 return true;
302 } else {
304 }
306 if (value.empty()) {
307 return true;
308 } else {
310 }
312 if (value.empty()) {
313 return true;
314 } else {
316 }
318 return canParse<bool>(value);
320 return canParse<bool>(value);
322 return areParametersValid(value);
323 default:
324 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
325 }
326}
327
328
329void
331 if (myPeriod > 0) {
333 }
334 if (myAdditionalName.size() > 0) {
336 }
337 if (myFilename.size() > 0) {
339 }
340 if (myVehicleTypes.size() > 0) {
342 }
343 if (myNextEdges.size() > 0) {
345 }
348 }
349 if (myFriendlyPosition) {
350 device.writeAttr(SUMO_ATTR_FRIENDLY_POS, true);
351 }
352}
353
354
355void
356GNEDetector::setDetectorAttribute(SumoXMLAttr key, const std::string& value) {
357 switch (key) {
358 case SUMO_ATTR_ID:
359 // update microsimID
360 setAdditionalID(value);
361 break;
362 case SUMO_ATTR_LANE:
364 break;
366 myPositionOverLane = parse<double>(value);
367 break;
368 case SUMO_ATTR_PERIOD:
369 if (value.empty()) {
371 } else {
372 myPeriod = string2time(value);
373 }
374 break;
375 case SUMO_ATTR_FILE:
376 myFilename = value;
377 break;
378 case SUMO_ATTR_NAME:
379 myAdditionalName = value;
380 break;
381 case SUMO_ATTR_VTYPES:
382 myVehicleTypes = parse<std::vector<std::string> >(value);
383 break;
385 myNextEdges = parse<std::vector<std::string> >(value);
386 break;
388 myDetectPersons = value;
389 break;
391 myFriendlyPosition = parse<bool>(value);
392 break;
394 if (parse<bool>(value)) {
396 } else {
398 }
399 break;
401 setParametersStr(value);
402 break;
405 break;
406 default:
407 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
408 }
409}
410
411
412void
414 const RGBColor& mainColor, const RGBColor& secondColor) const {
415 // push matrix
417 // set line width
418 glLineWidth(1.0);
419 // translate to center geometry
420 glTranslated(myAdditionalGeometry.getShape().front().x(), myAdditionalGeometry.getShape().front().y(), 0);
421 // rotate over lane
423 // scale
424 glScaled(exaggeration, exaggeration, 1);
425 // set main color
426 GLHelper::setColor(mainColor);
427 // begin draw square
428 glBegin(GL_QUADS);
429 // draw square
430 glVertex2d(-1.0, 2);
431 glVertex2d(-1.0, -2);
432 glVertex2d(1.0, -2);
433 glVertex2d(1.0, 2);
434 // end draw square
435 glEnd();
436 // move top
437 glTranslated(0, 0, .01);
438 // begin draw line
439 glBegin(GL_LINES);
440 // draw lines
441 glVertex2d(0, 2 - .1);
442 glVertex2d(0, -2 + .1);
443 // end draw line
444 glEnd();
445 // draw center only in draw in level 2
447 // set main color
448 GLHelper::setColor(secondColor);
449 // set polygon mode
450 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
451 // begin draw square
452 glBegin(GL_QUADS);
453 // draw square
454 glVertex2f(-1.0, 2);
455 glVertex2f(-1.0, -2);
456 glVertex2f(1.0, -2);
457 glVertex2f(1.0, 2);
458 // end draw square
459 glEnd();
460 // rotate 90 degrees
461 glRotated(90, 0, 0, -1);
462 //set polygon mode
463 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
464 // begin draw line
465 glBegin(GL_LINES);
466 // draw line
467 glVertex2d(0, 1.7);
468 glVertex2d(0, -1.7);
469 // end draw line
470 glEnd();
471 //arrow
472 glTranslated(2, 0, 0);
473 GLHelper::setColor(mainColor);
474 GLHelper::drawTriangleAtEnd(Position(0, 0), Position(0.5, 0), (double) 0.5, (double) 1);
475 }
476 // pop matrix
478}
479
480
481void
483 const double exaggeration, const std::string& logo, const RGBColor& textColor) const {
484 // only draw in level 2
486 // calculate position
487 const Position pos = myAdditionalGeometry.getShape().front();
488 // calculate rotation
489 const double rot = s.getTextAngle(myAdditionalGeometry.getShapeRotations().front() + 90);
490 // Start pushing matrix
492 // Traslate to position
493 glTranslated(pos.x(), pos.y(), 0.1);
494 // scale text
495 glScaled(exaggeration, exaggeration, 1);
496 // draw E1 logo
497 GLHelper::drawText(logo + " ", Position(), .1, 1.5, textColor, rot);
498 // pop matrix
500 }
501}
502
503
504void
506 const double exaggeration, const std::string& logo, const RGBColor& textColor) const {
507 // only draw in level 2
509 // calculate middle point
510 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
511 // calculate position
512 const Position pos = myAdditionalGeometry.getShape().positionAtOffset2D(middlePoint);
513 // calculate rotation
514 const double rot = s.getTextAngle(myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint) + 90);
515 // Start pushing matrix
517 // Traslate to position
518 glTranslated(pos.x(), pos.y(), 0.1);
519 // scale text
520 glScaled(exaggeration, exaggeration, 1);
521 // draw E1 logo
522 GLHelper::drawText(logo, Position(), .1, 1.5, textColor, rot);
523 // pop matrix
525 }
526}
527
528/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
long long int SUMOTime
Definition GUI.h:36
GUIGlObjectType
GUIViewObjectsHandler gViewObjectsHandler
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define SUMOTime_MAX_PERIOD
Definition SUMOTime.h:36
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_NEXT_EDGES
@ SUMO_ATTR_FILE
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_LANES
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_NAME
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_ID
@ SUMO_ATTR_POSITION
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
@ SUMO_ATTR_DETECT_PERSONS
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:654
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:629
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition GLHelper.cpp:756
static void fixLanePosition(double &pos, double &length, const double laneLength)
fix given position over lane
An Element which don't belong to GNENet but has influence in the simulation.
void setAdditionalID(const std::string &newID)
set additional ID
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
bool isValidDetectorID(const std::string &value) const
check if a new detector ID is valid
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
GNEMoveOperation * getMoveOperationMultiLane(const double startPos, const double endPos)
get moveOperation for an element over multi lane
std::string myAdditionalName
name of additional
GNEMoveOperation * getMoveOperationSingleLane(const double startPos, const double endPos)
get moveOperation for an element over single lane
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
SUMOTime myPeriod
The aggregation period the values the detector collects shall be summed up.
void drawE2DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E2 detector Logo
std::string myFilename
The path to the output file.
double myPositionOverLane
position of detector over Lane
Position getPositionInView() const
Returns position of additional in view.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
GNEDetector(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const double pos, const SUMOTime period, const std::vector< GNELane * > &parentLanes, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const bool friendlyPos, const Parameterised::Map &parameters)
Constructor.
~GNEDetector()
Destructor.
bool isDetectorValid(SumoXMLAttr key, const std::string &value)
double getPositionOverLane() const
get position over lane
double getGeometryPositionOverLane() const
get position over lane that is applicable to the shape
GNELane * getLane() const
get lane
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void setDetectorAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::vector< std::string > myNextEdges
next edges
GNEMoveOperation * getMoveOperation()
get move operation
void drawE1Shape(const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor &mainColor, const RGBColor &secondColor) const
draw E1 shape
const Parameterised::Map & getACParametersMap() const
get parameters map
double getDetectorAttributeDouble(SumoXMLAttr key) const
bool checkDrawMoveContour() const
check if draw move contour (red)
void writeDetectorValues(OutputDevice &device) const
write additional element into a xml file
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
bool myFriendlyPosition
Flag for friendly position.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getDetectorAttribute(SumoXMLAttr key) const
std::vector< std::string > myVehicleTypes
attribute vehicle types
void drawE1DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E1 detector Logo
std::string myDetectPersons
detect persons
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
std::string getParentName() const
Returns the name of the parent object.
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:781
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:196
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2155
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const GNESegment * getSelectedSegment(const GUIGlObject *GLObject) const
get segment associated with the given GLObject (if exist)
Stores the information about how to visualize structures.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition NBEdge.cpp:4714
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
An upper class for objects with additional parameters.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
double length2D() const
Returns the length.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static StringBijection< PersonMode > PersonModeValues
person modes
static bool isValidListOfNetIDs(const std::string &value)
whether the given string is a valid list of id for a network (empty aren't allowed)
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (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)
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
const std::string & getString(const T key) const
bool hasString(const std::string &str) const
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element