Eclipse SUMO - Simulation of Urban MObility
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/GNEViewNet.h>
24 #include <netedit/GNEViewParent.h>
28 #include <utils/gui/div/GLHelper.h>
30 
31 #include "GNEDetector.h"
32 
33 
34 // ===========================================================================
35 // member method definitions
36 // ===========================================================================
37 
38 GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, const double pos,
39  const SUMOTime period, const std::vector<GNELane*>& parentLanes, const std::string& filename,
40  const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
41  const std::string& detectPersons, const std::string& name, const bool friendlyPos,
42  const Parameterised::Map& parameters) :
43  GNEAdditional(id, net, type, tag, icon, name, {}, {}, parentLanes, {}, {}, {}),
44  Parameterised(parameters),
45  myPositionOverLane(pos),
46  myPeriod(period),
47  myFilename(filename),
48  myVehicleTypes(vehicleTypes),
49  myNextEdges(nextEdges),
50  myDetectPersons(detectPersons),
51 myFriendlyPosition(friendlyPos) {
52 }
53 
54 
55 GNEDetector::GNEDetector(GNEAdditional* additionalParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon,
56  const double pos, const SUMOTime period, const std::vector<GNELane*>& parentLanes, const std::string& filename,
57  const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters) :
58  GNEAdditional(net, type, tag, icon, name, {}, {}, parentLanes, {additionalParent}, {}, {}),
59 Parameterised(parameters),
60 myPositionOverLane(pos),
61 myPeriod(period),
62 myFilename(filename),
63 myFriendlyPosition(friendlyPos) {
64 }
65 
66 
68 
69 
72  // check modes and detector type
74  return nullptr;
79  } else {
80  // return move operation for detectors with single position placed over shape (E1, EntryExits..)
81  return new GNEMoveOperation(this, getParentLanes().front(), myPositionOverLane,
83  }
84 }
85 
86 
87 double
89  return myPositionOverLane;
90 }
91 
92 
93 bool
95  // get edit modes
96  const auto& editModes = myNet->getViewNet()->getEditModes();
97  // check if we're in move mode
98  if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
100  (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
101  // only move the first element
103  } else {
104  return false;
105  }
106 }
107 
108 
109 GNELane*
111  return getParentLanes().front();
112 }
113 
114 
115 Position
118 }
119 
120 
121 void
122 GNEDetector::updateCenteringBoundary(const bool /*updateGrid*/) {
123  // nothing to update
124 }
125 
126 void
127 GNEDetector::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement,
128  const GNENetworkElement* newElement, GNEUndoList* undoList) {
129  // only split geometry of E2 multilane detectors
131  // obtain new list of E2 lanes
132  std::string newE2Lanes = getNewListOfParents(originalElement, newElement);
133  // update E2 Lanes
134  if (newE2Lanes.size() > 0) {
135  setAttribute(SUMO_ATTR_LANES, newE2Lanes, undoList);
136  }
137  } else if (splitPosition < myPositionOverLane) {
138  // change lane
139  setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
140  // now adjust start position
141  setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
142  }
143 }
144 
145 
146 double
148  double fixedPos = myPositionOverLane;
149  const double len = getLane()->getParentEdge()->getNBEdge()->getFinalLength();
150  double length = 0;
151  GNEAdditionalHandler::fixLanePosition(fixedPos, length, len);
152  return (fixedPos * getLane()->getLengthGeometryFactor());
153 }
154 
155 
156 
157 std::string
159  return getLane()->getID();
160 }
161 
162 
163 const Parameterised::Map&
165  return getParametersMap();
166 }
167 
168 
169 std::string
171  return getTagStr() + ": " + getID();
172 }
173 
174 
175 std::string
177  return getTagStr();
178 }
179 
180 
181 std::string
183  switch (key) {
184  case SUMO_ATTR_ID:
185  return getMicrosimID();
186  case SUMO_ATTR_LANE:
187  return getParentLanes().front()->getID();
188  case SUMO_ATTR_POSITION:
190  case SUMO_ATTR_PERIOD:
191  if (myPeriod == SUMOTime_MAX_PERIOD) {
192  return "";
193  } else {
194  return time2string(myPeriod);
195  }
196  case SUMO_ATTR_NAME:
197  return myAdditionalName;
198  case SUMO_ATTR_FILE:
199  return myFilename;
200  case SUMO_ATTR_VTYPES:
201  return toString(myVehicleTypes);
203  return toString(myNextEdges);
205  return toString(myDetectPersons);
208  case GNE_ATTR_SELECTED:
210  case GNE_ATTR_PARAMETERS:
211  return getParametersStr();
213  return "";
214  default:
215  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
216  }
217 }
218 
219 
220 double
222  switch (key) {
223  case SUMO_ATTR_POSITION:
224  return myPositionOverLane;
225  default:
226  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
227  }
228 }
229 
230 
231 void
232 GNEDetector::setDetectorAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
233  switch (key) {
234  case SUMO_ATTR_ID:
235  case SUMO_ATTR_LANE:
236  case SUMO_ATTR_POSITION:
237  case SUMO_ATTR_PERIOD:
238  case SUMO_ATTR_NAME:
239  case SUMO_ATTR_FILE:
240  case SUMO_ATTR_VTYPES:
244  case GNE_ATTR_SELECTED:
245  case GNE_ATTR_PARAMETERS:
247  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
248  break;
249  default:
250  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
251  }
252 }
253 
254 
255 
256 bool
257 GNEDetector::isDetectorValid(SumoXMLAttr key, const std::string& value) {
258  switch (key) {
259  case SUMO_ATTR_ID:
260  return isValidDetectorID(value);
261  case SUMO_ATTR_LANE:
262  if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
263  return true;
264  } else {
265  return false;
266  }
267  case SUMO_ATTR_POSITION:
268  return canParse<double>(value) && fabs(parse<double>(value)) < getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
269  case SUMO_ATTR_PERIOD:
270  if (value.empty()) {
271  return true;
272  } else {
273  return (canParse<double>(value) && (parse<double>(value) >= 0));
274  }
275  case SUMO_ATTR_NAME:
277  case SUMO_ATTR_FILE:
279  case SUMO_ATTR_VTYPES:
280  if (value.empty()) {
281  return true;
282  } else {
284  }
286  if (value.empty()) {
287  return true;
288  } else {
290  }
292  if (value.empty()) {
293  return true;
294  } else {
296  }
298  return canParse<bool>(value);
299  case GNE_ATTR_SELECTED:
300  return canParse<bool>(value);
301  case GNE_ATTR_PARAMETERS:
302  return areParametersValid(value);
303  default:
304  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
305  }
306 }
307 
308 
309 void
311  if (myPeriod > 0) {
313  }
314  if (myAdditionalName.size() > 0) {
316  }
317  if (myFilename.size() > 0) {
319  }
320  if (myVehicleTypes.size() > 0) {
322  }
323  if (myNextEdges.size() > 0) {
325  }
328  }
329  if (myFriendlyPosition) {
330  device.writeAttr(SUMO_ATTR_FRIENDLY_POS, true);
331  }
332 }
333 
334 
335 void
336 GNEDetector::setDetectorAttribute(SumoXMLAttr key, const std::string& value) {
337  switch (key) {
338  case SUMO_ATTR_ID:
339  // update microsimID
340  setAdditionalID(value);
341  break;
342  case SUMO_ATTR_LANE:
344  break;
345  case SUMO_ATTR_POSITION:
346  myPositionOverLane = parse<double>(value);
347  break;
348  case SUMO_ATTR_PERIOD:
349  if (value.empty()) {
351  } else {
352  myPeriod = string2time(value);
353  }
354  break;
355  case SUMO_ATTR_FILE:
356  myFilename = value;
357  break;
358  case SUMO_ATTR_NAME:
359  myAdditionalName = value;
360  break;
361  case SUMO_ATTR_VTYPES:
362  myVehicleTypes = parse<std::vector<std::string> >(value);
363  break;
365  myNextEdges = parse<std::vector<std::string> >(value);
366  break;
368  myDetectPersons = value;
369  break;
371  myFriendlyPosition = parse<bool>(value);
372  break;
373  case GNE_ATTR_SELECTED:
374  if (parse<bool>(value)) {
376  } else {
378  }
379  break;
380  case GNE_ATTR_PARAMETERS:
381  setParametersStr(value);
382  break;
384  shiftLaneIndex();
385  break;
386  default:
387  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
388  }
389 }
390 
391 
392 void
394  const RGBColor& mainColor, const RGBColor& secondColor) const {
395  // push matrix
397  // set line width
398  glLineWidth(1.0);
399  // translate to center geometry
400  glTranslated(myAdditionalGeometry.getShape().front().x(), myAdditionalGeometry.getShape().front().y(), 0);
401  // rotate over lane
403  // scale
404  glScaled(exaggeration, exaggeration, 1);
405  // set main color
406  GLHelper::setColor(mainColor);
407  // begin draw square
408  glBegin(GL_QUADS);
409  // draw square
410  glVertex2d(-1.0, 2);
411  glVertex2d(-1.0, -2);
412  glVertex2d(1.0, -2);
413  glVertex2d(1.0, 2);
414  // end draw square
415  glEnd();
416  // move top
417  glTranslated(0, 0, .01);
418  // begin draw line
419  glBegin(GL_LINES);
420  // draw lines
421  glVertex2d(0, 2 - .1);
422  glVertex2d(0, -2 + .1);
423  // end draw line
424  glEnd();
425  // draw center only in draw in level 2
427  // set main color
428  GLHelper::setColor(secondColor);
429  // set polygon mode
430  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
431  // begin draw square
432  glBegin(GL_QUADS);
433  // draw square
434  glVertex2f(-1.0, 2);
435  glVertex2f(-1.0, -2);
436  glVertex2f(1.0, -2);
437  glVertex2f(1.0, 2);
438  // end draw square
439  glEnd();
440  // rotate 90 degrees
441  glRotated(90, 0, 0, -1);
442  //set polygon mode
443  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
444  // begin draw line
445  glBegin(GL_LINES);
446  // draw line
447  glVertex2d(0, 1.7);
448  glVertex2d(0, -1.7);
449  // end draw line
450  glEnd();
451  //arrow
452  glTranslated(2, 0, 0);
453  GLHelper::setColor(mainColor);
454  GLHelper::drawTriangleAtEnd(Position(0, 0), Position(0.5, 0), (double) 0.5, (double) 1);
455  }
456  // pop matrix
458 }
459 
460 
461 void
463  const double exaggeration, const std::string& logo, const RGBColor& textColor) const {
464  // only draw in level 2
466  // calculate position
467  const Position pos = myAdditionalGeometry.getShape().front();
468  // calculate rotation
469  const double rot = s.getTextAngle(myAdditionalGeometry.getShapeRotations().front() + 90);
470  // Start pushing matrix
472  // Traslate to position
473  glTranslated(pos.x(), pos.y(), 0.1);
474  // scale text
475  glScaled(exaggeration, exaggeration, 1);
476  // draw E1 logo
477  GLHelper::drawText(logo + " ", Position(), .1, 1.5, textColor, rot);
478  // pop matrix
480  }
481 }
482 
483 
484 void
486  const double exaggeration, const std::string& logo, const RGBColor& textColor) const {
487  // only draw in level 2
489  // calculate middle point
490  const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
491  // calculate position
492  const Position pos = myAdditionalGeometry.getShape().positionAtOffset2D(middlePoint);
493  // calculate rotation
494  const double rot = s.getTextAngle(myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint) + 90);
495  // Start pushing matrix
497  // Traslate to position
498  glTranslated(pos.x(), pos.y(), 0.1);
499  // scale text
500  glScaled(exaggeration, exaggeration, 1);
501  // draw E1 logo
502  GLHelper::drawText(logo, Position(), .1, 1.5, textColor, rot);
503  // pop matrix
505  }
506 }
507 
508 /****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
long long int SUMOTime
Definition: GUI.h:35
GUIGlObjectType
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.
Definition: GNEAdditional.h:49
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.
Definition: GNEDetector.h:194
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.
Definition: GNEDetector.h:197
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:191
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.
Definition: GNEDetector.cpp:38
~GNEDetector()
Destructor.
Definition: GNEDetector.cpp:67
bool isDetectorValid(SumoXMLAttr key, const std::string &value)
double getPositionOverLane() const
get position over lane
Definition: GNEDetector.cpp:88
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
Definition: GNEDetector.h:203
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEDetector.cpp:71
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)
Definition: GNEDetector.cpp:94
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.
Definition: GNEDetector.h:209
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
Definition: GNEDetector.h:200
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
Definition: GNEDetector.h:206
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:753
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:123
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:723
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
Definition: GNEViewNet.cpp:759
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
Definition: GNEViewNet.cpp:477
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.
Definition: GUIGlObject.h:143
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:4704
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
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
Definition: Parameterised.h:45
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)
bool hasString(const std::string &str) const
const std::string & getString(const T key) 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