Eclipse SUMO - Simulation of Urban MObility
GNECalibrator.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 <netedit/GNENet.h>
21 #include <netedit/GNEUndoList.h>
22 #include <netedit/GNEViewNet.h>
25 #include <utils/gui/div/GLHelper.h>
28 
29 #include "GNECalibrator.h"
30 
31 
32 // ===========================================================================
33 // member method definitions
34 // ===========================================================================
35 
37  GNEAdditional("", net, GLO_CALIBRATOR, tag, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "", {}, {}, {}, {}, {}, {}),
38  myPositionOverLane(0),
39  myFrequency(0),
40 myJamThreshold(0) {
41  // reset default values
42  resetDefaultValues();
43 }
44 
45 
46 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
47  const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
48  GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {}, {}, {}),
49 Parameterised(parameters),
50 myPositionOverLane(pos),
51 myFrequency(frequency),
52 myOutput(output),
53 myJamThreshold(jamThreshold),
54 myVTypes(vTypes) {
55  // update centering boundary without updating grid
56  updateCenteringBoundary(false);
57 }
58 
59 
60 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
61  const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
62  const Parameterised::Map& parameters) :
63  GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {routeProbe}, {}, {}),
64 Parameterised(parameters),
65 myPositionOverLane(pos),
66 myFrequency(frequency),
67 myOutput(output),
68 myJamThreshold(jamThreshold),
69 myVTypes(vTypes) {
70  // update centering boundary without updating grid
71  updateCenteringBoundary(false);
72 }
73 
74 
75 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
76  const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
77  GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {}, {}, {}),
78 Parameterised(parameters),
79 myPositionOverLane(pos),
80 myFrequency(frequency),
81 myOutput(output),
82 myJamThreshold(jamThreshold),
83 myVTypes(vTypes) {
84  // update centering boundary without updating grid
85  updateCenteringBoundary(false);
86 }
87 
88 
89 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
90  const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
91  const Parameterised::Map& parameters) :
92  GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {routeProbe}, {}, {}),
93 Parameterised(parameters),
94 myPositionOverLane(pos),
95 myFrequency(frequency),
96 myOutput(output),
97 myJamThreshold(jamThreshold),
98 myVTypes(vTypes) {
99  // update centering boundary without updating grid
100  updateCenteringBoundary(false);
101 }
102 
103 
105 
106 
107 void
109  // open tag
111  // write parameters
112  device.writeAttr(SUMO_ATTR_ID, getID());
113  if (getParentEdges().size() > 0) {
114  device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
115  }
116  if (getParentLanes().size() > 0) {
117  device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
118  }
120  if (time2string(myFrequency) != "1.00") {
122  }
123  if (!myAdditionalName.empty()) {
125  }
126  if (!myOutput.empty()) {
128  }
129  if (getParentAdditionals().size() > 0) {
131  }
132  if (myJamThreshold != 0.5) {
134  }
135  if (myVTypes.size() > 0) {
137  }
138  // write calibrator flows
139  for (const auto& calibratorFlow : getChildAdditionals()) {
140  if (calibratorFlow->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_FLOW) {
141  calibratorFlow->writeAdditional(device);
142  }
143  }
144  // write parameters (Always after children to avoid problems with additionals.xsd)
145  writeParams(device);
146  device.closeTag();
147 }
148 
149 
152  // calibrators cannot be moved
153  return nullptr;
154 }
155 
156 
157 void
159  // get shape depending of we have a edge or a lane
160  if (getParentLanes().size() > 0) {
161  // update geometry
163  } else if (getParentEdges().size() > 0) {
164  // update geometry of first edge
165  myAdditionalGeometry.updateGeometry(getParentEdges().front()->getLanes().front()->getLaneShape(), myPositionOverLane, 0);
166  // clear extra geometries
168  // iterate over every lane and get point
169  for (int i = 1; i < (int)getParentEdges().front()->getLanes().size(); i++) {
170  // add new calibrator geometry
171  GUIGeometry calibratorGeometry;
172  calibratorGeometry.updateGeometry(getParentEdges().front()->getLanes().at(i)->getLaneShape(), myPositionOverLane, 0);
173  myEdgeCalibratorGeometries.push_back(calibratorGeometry);
174  }
175  } else {
176  throw ProcessError("Both edges and lanes aren't defined");
177  }
178 }
179 
180 
181 Position
184 }
185 
186 
187 void
188 GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
190  // add center
192  // grow
194 }
195 
196 
197 void
198 GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
199  if (splitPosition < myPositionOverLane) {
200  // change lane or edge
201  if (newElement->getTagProperty().getTag() == SUMO_TAG_LANE) {
202  setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
203  } else {
204  setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
205  }
206  // now adjust start position
207  setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
208  }
209 }
210 
211 
212 std::string
214  // get parent name depending of we have a edge or a lane
215  if (getParentLanes().size() > 0) {
216  return getParentLanes().front()->getID();
217  } else if (getParentEdges().size() > 0) {
218  return getParentEdges().front()->getLanes().at(0)->getID();
219  } else {
220  throw ProcessError("Both myEdge and myLane aren't defined");
221  }
222 }
223 
224 
225 void
227  // get values
228  const double exaggeration = getExaggeration(s);
229  // first check if additional has to be drawn
231  if (s.drawAdditionals(exaggeration)) {
232  // draw first symbol
234  // continue with the other symbols
235  for (const auto& edgeCalibratorGeometry : myEdgeCalibratorGeometries) {
236  drawCalibratorSymbol(s, exaggeration, edgeCalibratorGeometry.getShape().front(), edgeCalibratorGeometry.getShapeRotations().front() + 90);
237  }
238  // draw additional ID
239  drawAdditionalID(s);
240  // iterate over additionals and check if drawn
241  for (const auto& calibratorFlow : getChildAdditionals()) {
242  // if calibrator is being inspected or selected, then draw
245  calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
246  (myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
247  calibratorFlow->drawGL(s);
248  }
249  }
250  }
251  }
252 }
253 
254 
255 void
257  // Open calibrator dialog
258  GNECalibratorDialog calibratorDialog(this);
259 }
260 
261 
262 std::string
264  switch (key) {
265  case SUMO_ATTR_ID:
266  return getMicrosimID();
267  case SUMO_ATTR_EDGE:
268  return getParentEdges().front()->getID();
269  case SUMO_ATTR_LANE:
270  return getParentLanes().front()->getID();
271  case SUMO_ATTR_POSITION:
273  case SUMO_ATTR_PERIOD:
274  case SUMO_ATTR_FREQUENCY:
275  return time2string(myFrequency);
276  case SUMO_ATTR_NAME:
277  return myAdditionalName;
278  case SUMO_ATTR_OUTPUT:
279  return myOutput;
281  if (getParentAdditionals().size() > 0) {
282  return getParentAdditionals().front()->getID();
283  } else {
284  return "";
285  }
287  return toString(myJamThreshold);
288  case SUMO_ATTR_VTYPES:
289  return toString(myVTypes);
290  case GNE_ATTR_SELECTED:
292  case GNE_ATTR_PARAMETERS:
293  return getParametersStr();
295  return "";
296  default:
297  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
298  }
299 }
300 
301 
302 double
304  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
305 }
306 
307 
308 const Parameterised::Map&
310  return getParametersMap();
311 }
312 
313 
314 void
315 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
316  switch (key) {
317  case SUMO_ATTR_ID:
318  case SUMO_ATTR_EDGE:
319  case SUMO_ATTR_LANE:
320  case SUMO_ATTR_POSITION:
321  case SUMO_ATTR_PERIOD:
322  case SUMO_ATTR_FREQUENCY:
323  case SUMO_ATTR_NAME:
324  case SUMO_ATTR_OUTPUT:
327  case SUMO_ATTR_VTYPES:
328  case GNE_ATTR_SELECTED:
329  case GNE_ATTR_PARAMETERS:
331  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
332  break;
333  default:
334  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
335  }
336 
337 }
338 
339 
340 bool
341 GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
342  switch (key) {
343  case SUMO_ATTR_ID:
344  return isValidAdditionalID(value);
345  case SUMO_ATTR_EDGE:
346  if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
347  return true;
348  } else {
349  return false;
350  }
351  case SUMO_ATTR_LANE:
352  if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
353  return true;
354  } else {
355  return false;
356  }
357  case SUMO_ATTR_POSITION:
358  if (canParse<double>(value)) {
359  // obtain position and check if is valid
360  const double newPosition = parse<double>(value);
361  if (isTemplate()) {
362  return (newPosition >= 0);
363  }
364  // get shape
365  PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
366  if ((newPosition < 0) || (newPosition > shape.length())) {
367  return false;
368  } else {
369  return true;
370  }
371  } else {
372  return false;
373  }
374  case SUMO_ATTR_PERIOD:
375  case SUMO_ATTR_FREQUENCY:
376  return canParse<SUMOTime>(value);
377  case SUMO_ATTR_NAME:
379  case SUMO_ATTR_OUTPUT:
382  if (value.empty()) {
383  return true;
384  } else {
385  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
386  }
388  return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
389  case SUMO_ATTR_VTYPES:
390  if (value.empty()) {
391  return true;
392  } else {
394  }
395  case GNE_ATTR_SELECTED:
396  return canParse<bool>(value);
397  case GNE_ATTR_PARAMETERS:
398  return areParametersValid(value);
399  default:
400  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
401  }
402 }
403 
404 
405 std::string
407  return getTagStr() + ": " + getID();
408 }
409 
410 
411 std::string
413  return getTagStr();
414 }
415 
416 // ===========================================================================
417 // private
418 // ===========================================================================
419 
420 void
421 GNECalibrator::drawCalibratorSymbol(const GUIVisualizationSettings& s, const double exaggeration, const Position& pos, const double rot) const {
422  // begin push name
424  // push layer matrix
426  // translate to front
428  // translate to position
429  glTranslated(pos.x(), pos.y(), 0);
430  // rotate over lane
432  // scale
433  glScaled(exaggeration, exaggeration, 1);
434  // set drawing mode
435  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
436  // set color
437  if (drawUsingSelectColor()) {
439  } else {
441  }
442  // base
443  glBegin(GL_TRIANGLES);
444  glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
447  glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
448  glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
450  glEnd();
451  // draw text if isn't being drawn for selecting
453  // set color depending of selection status
455  // draw "C"
456  GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
457  // draw "edge" or "lane "
458  if (getParentLanes().size() > 0) {
459  GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
460  } else if (getParentEdges().size() > 0) {
461  GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
462  } else {
463  throw ProcessError("Both myEdge and myLane aren't defined");
464  }
465  }
466  // pop layer matrix
468  // pop name
470  // check if mouse is over element
473  // inspect element
477  0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
478  }
479  // front element
480  if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
483  0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
484  }
485  // delete contour
486  if (myNet->getViewNet()->drawDeleteContour(this, this)) {
489  0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
490  }
491  // select contour
492  if (myNet->getViewNet()->drawSelectContour(this, this)) {
495  0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
496  }
497 }
498 
499 void
500 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
501  switch (key) {
502  case SUMO_ATTR_ID:
503  // update microsimID
504  setMicrosimID(value);
505  break;
506  case SUMO_ATTR_EDGE:
508  break;
509  case SUMO_ATTR_LANE:
511  break;
512  case SUMO_ATTR_POSITION:
513  myPositionOverLane = parse<double>(value);
514  break;
515  case SUMO_ATTR_PERIOD:
516  case SUMO_ATTR_FREQUENCY:
517  myFrequency = parse<SUMOTime>(value);
518  break;
519  case SUMO_ATTR_NAME:
520  myAdditionalName = value;
521  break;
522  case SUMO_ATTR_OUTPUT:
523  myOutput = value;
524  break;
527  break;
529  myJamThreshold = parse<double>(value);
530  break;
531  case SUMO_ATTR_VTYPES:
532  myVTypes = parse<std::vector<std::string> >(value);
533  break;
534  case GNE_ATTR_SELECTED:
535  if (parse<bool>(value)) {
537  } else {
539  }
540  break;
541  case GNE_ATTR_PARAMETERS:
542  setParametersStr(value);
543  break;
545  shiftLaneIndex();
546  break;
547  default:
548  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
549  }
550 }
551 
552 
553 void
555  // nothing to do
556 }
557 
558 
559 void
560 GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
561  // nothing to do
562 }
563 
564 
565 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
@ GLO_CALIBRATOR
a Calibrator
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_CALIBRATOR_FLOW
a flow definition within in Calibrator
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_ROUTEPROBE
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_NAME
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_FREQUENCY
@ SUMO_ATTR_OUTPUT
@ SUMO_ATTR_ID
@ SUMO_ATTR_POSITION
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:583
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void popName()
pop Name
Definition: GLHelper.cpp:148
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:685
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string myAdditionalName
name of additional
Boundary myAdditionalBoundary
Additional Boundary.
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
Dialog for edit calibrators.
std::string getAttribute(SumoXMLAttr key) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void drawCalibratorSymbol(const GUIVisualizationSettings &s, const double exaggeration, const Position &pos, const double rot) const
draw calibrator symbol
void updateGeometry()
update pre-computed geometry information
Position getPositionInView() const
Returns position of additional in view.
const Parameterised::Map & getACParametersMap() const
get parameters map
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
double myJamThreshold
jamThreshold
std::string myOutput
output of calibrator
std::string getParentName() const
Returns the name of the parent object.
~GNECalibrator()
Destructor.
SUMOTime myFrequency
Frequency of calibrator.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double myPositionOverLane
position over Lane
std::vector< std::string > myVTypes
vTypes
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
double getAttributeDouble(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
GNECalibrator(SumoXMLTag tag, GNENet *net)
Default constructor.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
GNEMoveOperation * getMoveOperation()
get move operation
void openAdditionalDialog()
open Calibrator Dialog
std::vector< GUIGeometry > myEdgeCalibratorGeometries
extra calibrator geometries
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
move operation
move result
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge 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:132
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:656
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:644
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static void drawDottedSquaredShape(const GUIVisualizationSettings &s, const DottedContourType type, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand 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.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:141
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:102
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
GUIVisualizationColorSettings colorSettings
color settings
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
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.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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
A list of positions.
double length() const
Returns the length.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
static const RGBColor BLACK
Definition: RGBColor.h:193
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 showAdditionals() const
check if additionals has to be drawn
bool showSubAdditionals() const
check if show sub-additionals
static const RGBColor calibratorColor
color for Calibrators
static const double calibratorWidth
Calibrator width.
static const double calibratorHeight
Calibrator height.
RGBColor selectionColor
basic selection color
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double calibratorText
details for calibrator text