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>
27 
28 #include "GNECalibrator.h"
29 
30 
31 // ===========================================================================
32 // member method definitions
33 // ===========================================================================
34 
36  GNEAdditional("", net, GLO_CALIBRATOR, tag, "",
37 {}, {}, {}, {}, {}, {}, {}, {},
38 std::map<std::string, std::string>()),
39  myPositionOverLane(0),
40  myFrequency(0),
41 myJamThreshold(0) {
42  // reset default values
43  resetDefaultValues();
44 }
45 
46 
47 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
48  const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const std::map<std::string, std::string>& parameters) :
50 {}, {edge}, {}, {}, {}, {}, {}, {},
51 parameters),
52 myPositionOverLane(pos),
53 myFrequency(frequency),
54 myOutput(output),
55 myJamThreshold(jamThreshold),
56 myVTypes(vTypes) {
57  // update centering boundary without updating grid
58  updateCenteringBoundary(false);
59 }
60 
61 
62 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
63  const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
64  const std::map<std::string, std::string>& parameters) :
66 {}, {edge}, {}, {routeProbe}, {}, {}, {}, {},
67 parameters),
68 myPositionOverLane(pos),
69 myFrequency(frequency),
70 myOutput(output),
71 myJamThreshold(jamThreshold),
72 myVTypes(vTypes) {
73  // update centering boundary without updating grid
74  updateCenteringBoundary(false);
75 }
76 
77 
78 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
79  const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const std::map<std::string, std::string>& parameters) :
81 {}, {}, {lane}, {}, {}, {}, {}, {},
82 parameters),
83 myPositionOverLane(pos),
84 myFrequency(frequency),
85 myOutput(output),
86 myJamThreshold(jamThreshold),
87 myVTypes(vTypes) {
88  // update centering boundary without updating grid
89  updateCenteringBoundary(false);
90 }
91 
92 
93 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
94  const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
95  const std::map<std::string, std::string>& parameters) :
97 {}, {}, {lane}, {routeProbe}, {}, {}, {}, {},
98 parameters),
99 myPositionOverLane(pos),
100 myFrequency(frequency),
101 myOutput(output),
102 myJamThreshold(jamThreshold),
103 myVTypes(vTypes) {
104  // update centering boundary without updating grid
105  updateCenteringBoundary(false);
106 }
107 
108 
110 
111 
112 void
114  // open tag
116  // write parameters
117  device.writeAttr(SUMO_ATTR_ID, getID());
118  if (getParentEdges().size() > 0) {
119  device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
120  }
121  if (getParentLanes().size() > 0) {
122  device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
123  }
125  if (time2string(myFrequency) != "1.00") {
127  }
128  if (!myAdditionalName.empty()) {
130  }
131  if (!myOutput.empty()) {
133  }
134  if (getParentAdditionals().size() > 0) {
136  }
137  if (myJamThreshold != 0.5) {
139  }
140  if (myVTypes.size() > 0) {
142  }
143  // write calibrator flows
144  for (const auto& calibratorFlow : getChildAdditionals()) {
145  if (calibratorFlow->getTagProperty().getTag() == GNE_TAG_FLOW_CALIBRATOR) {
146  calibratorFlow->writeAdditional(device);
147  }
148  }
149  // write parameters (Always after children to avoid problems with additionals.xsd)
150  writeParams(device);
151  device.closeTag();
152 }
153 
154 
157  // calibrators cannot be moved
158  return nullptr;
159 }
160 
161 
162 void
164  // get shape depending of we have a edge or a lane
165  if (getParentLanes().size() > 0) {
166  // update geometry
168  } else if (getParentEdges().size() > 0) {
169  // update geometry of first edge
170  myAdditionalGeometry.updateGeometry(getParentEdges().front()->getLanes().front()->getLaneShape(), myPositionOverLane, 0);
171  // clear extra geometries
173  // iterate over every lane and get point
174  for (int i = 1; i < (int)getParentEdges().front()->getLanes().size(); i++) {
175  // add new calibrator geometry
176  GUIGeometry calibratorGeometry;
177  calibratorGeometry.updateGeometry(getParentEdges().front()->getLanes().at(i)->getLaneShape(), myPositionOverLane, 0);
178  myEdgeCalibratorGeometries.push_back(calibratorGeometry);
179  }
180  } else {
181  throw ProcessError("Both edges and lanes aren't defined");
182  }
183 }
184 
185 
186 Position
189 }
190 
191 
192 void
193 GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
195  // add center
197  // grow
199 }
200 
201 
202 void
203 GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
204  if (splitPosition < myPositionOverLane) {
205  // change lane or edge
206  if (newElement->getTagProperty().getTag() == SUMO_TAG_LANE) {
207  setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
208  } else {
209  setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
210  }
211  // now adjust start position
212  setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
213  }
214 }
215 
216 
217 std::string
219  // get parent name depending of we have a edge or a lane
220  if (getParentLanes().size() > 0) {
221  return getParentLanes().front()->getID();
222  } else if (getParentEdges().size() > 0) {
223  return getParentEdges().front()->getLanes().at(0)->getID();
224  } else {
225  throw ProcessError("Both myEdge and myLane aren't defined");
226  }
227 }
228 
229 
230 void
232  // get values
233  const double exaggeration = getExaggeration(s);
234  // first check if additional has to be drawn
236  if (s.drawAdditionals(exaggeration)) {
237  // begin push name
239  // draw first symbol
241  // continue with the other symbols
242  for (const auto& edgeCalibratorGeometry : myEdgeCalibratorGeometries) {
243  drawCalibratorSymbol(s, exaggeration, edgeCalibratorGeometry.getShape().front(), edgeCalibratorGeometry.getShapeRotations().front());
244  }
245  // pop name
247  // draw additional ID
248  drawAdditionalID(s);
249  // iterate over additionals and check if drawn
250  for (const auto& calibratorFlow : getChildAdditionals()) {
251  // if rerouter or their intevals are selected, then draw
254  calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
255  (myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
256  calibratorFlow->drawGL(s);
257  }
258  }
259  }
260  }
261 }
262 
263 
264 void
266  // Open calibrator dialog
267  GNECalibratorDialog calibratorDialog(this);
268 }
269 
270 
271 std::string
273  switch (key) {
274  case SUMO_ATTR_ID:
275  return getID();
276  case SUMO_ATTR_EDGE:
277  return getParentEdges().front()->getID();
278  case SUMO_ATTR_LANE:
279  return getParentLanes().front()->getID();
280  case SUMO_ATTR_POSITION:
282  case SUMO_ATTR_FREQUENCY:
283  return time2string(myFrequency);
284  case SUMO_ATTR_NAME:
285  return myAdditionalName;
286  case SUMO_ATTR_OUTPUT:
287  return myOutput;
289  if (getParentAdditionals().size() > 0) {
290  return getParentAdditionals().front()->getID();
291  } else {
292  return "";
293  }
295  return toString(myJamThreshold);
296  case SUMO_ATTR_VTYPES:
297  return toString(myVTypes);
298  case GNE_ATTR_SELECTED:
300  case GNE_ATTR_PARAMETERS:
301  return getParametersStr();
303  return "";
304  default:
305  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
306  }
307 }
308 
309 
310 double
312  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
313 }
314 
315 
316 void
317 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
318  switch (key) {
319  case SUMO_ATTR_ID:
320  case SUMO_ATTR_EDGE:
321  case SUMO_ATTR_LANE:
322  case SUMO_ATTR_POSITION:
323  case SUMO_ATTR_FREQUENCY:
324  case SUMO_ATTR_NAME:
325  case SUMO_ATTR_OUTPUT:
328  case SUMO_ATTR_VTYPES:
329  case GNE_ATTR_SELECTED:
330  case GNE_ATTR_PARAMETERS:
332  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
333  break;
334  default:
335  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
336  }
337 
338 }
339 
340 
341 bool
342 GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
343  switch (key) {
344  case SUMO_ATTR_ID:
345  return isValidAdditionalID(value);
346  case SUMO_ATTR_EDGE:
347  if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
348  return true;
349  } else {
350  return false;
351  }
352  case SUMO_ATTR_LANE:
353  if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
354  return true;
355  } else {
356  return false;
357  }
358  case SUMO_ATTR_POSITION:
359  if (canParse<double>(value)) {
360  // obtain position and check if is valid
361  double newPosition = parse<double>(value);
362  PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
363  if ((newPosition < 0) || (newPosition > shape.length())) {
364  return false;
365  } else {
366  return true;
367  }
368  } else {
369  return false;
370  }
371  case SUMO_ATTR_FREQUENCY:
372  return canParse<SUMOTime>(value);
373  case SUMO_ATTR_NAME:
375  case SUMO_ATTR_OUTPUT:
378  if (value.empty()) {
379  return true;
380  } else {
381  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
382  }
384  return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
385  case SUMO_ATTR_VTYPES:
386  if (value.empty()) {
387  return true;
388  } else {
390  }
391  case GNE_ATTR_SELECTED:
392  return canParse<bool>(value);
393  case GNE_ATTR_PARAMETERS:
394  return Parameterised::areParametersValid(value);
395  default:
396  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
397  }
398 }
399 
400 
401 bool
403  return true;
404 }
405 
406 
407 std::string
409  return getTagStr() + ": " + getID();
410 }
411 
412 
413 std::string
415  return getTagStr();
416 }
417 
418 // ===========================================================================
419 // private
420 // ===========================================================================
421 
422 void GNECalibrator::drawCalibratorSymbol(const GUIVisualizationSettings& s, const double exaggeration, const Position& pos, const double rot) const {
423  // push layer matrix
425  // translate to front
427  // translate to position
428  glTranslated(pos.x(), pos.y(), 0);
429  // rotate over lane
430  GUIGeometry::rotateOverLane(rot - 90);
431  // scale
432  glScaled(exaggeration, exaggeration, 1);
433  // set drawing mode
434  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
435  // set color
436  if (drawUsingSelectColor()) {
438  } else {
440  }
441  // base
442  glBegin(GL_TRIANGLES);
443  glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
446  glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
447  glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
449  glEnd();
450  // draw text if isn't being drawn for selecting
452  // set color depending of selection status
454  // draw "C"
455  GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
456  // draw "edge" or "lane "
457  if (getParentLanes().size() > 0) {
458  GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
459  } else if (getParentEdges().size() > 0) {
460  GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
461  } else {
462  throw ProcessError("Both myEdge and myLane aren't defined");
463  }
464  }
465  // pop layer matrix
467  // check if dotted contours has to be drawn
472  rot + 90, exaggeration);
473  }
474  if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
478  rot + 90, exaggeration);
479  }
480 }
481 
482 void
483 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
484  switch (key) {
485  case SUMO_ATTR_ID:
486  // update microsimID
487  setMicrosimID(value);
488  break;
489  case SUMO_ATTR_EDGE:
491  break;
492  case SUMO_ATTR_LANE:
494  break;
495  case SUMO_ATTR_POSITION:
496  myPositionOverLane = parse<double>(value);
497  break;
498  case SUMO_ATTR_FREQUENCY:
499  myFrequency = parse<SUMOTime>(value);
500  break;
501  case SUMO_ATTR_NAME:
502  myAdditionalName = value;
503  break;
504  case SUMO_ATTR_OUTPUT:
505  myOutput = value;
506  break;
509  break;
511  myJamThreshold = parse<double>(value);
512  break;
513  case SUMO_ATTR_VTYPES:
514  myVTypes = parse<std::vector<std::string> >(value);
515  break;
516  case GNE_ATTR_SELECTED:
517  if (parse<bool>(value)) {
519  } else {
521  }
522  break;
523  case GNE_ATTR_PARAMETERS:
524  setParametersStr(value);
525  break;
527  shiftLaneIndex();
528  break;
529  default:
530  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
531  }
532 }
533 
534 
535 void
537  // nothing to do
538 }
539 
540 
541 void
542 GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
543  // nothing to do
544 }
545 
546 
547 /****************************************************************************/
@ GLO_CALIBRATOR
a Calibrator
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
long long int SUMOTime
Definition: SUMOTime.h:32
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ GNE_TAG_FLOW_CALIBRATOR
a flow definition within in Calibrator
@ SUMO_TAG_LANECALIBRATOR
A calibrator placed over lane (used in netedit)
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ 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_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:77
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
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:609
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
const std::string & getID() const
get ID
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 asociated 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
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
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.
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
bool isAttributeEnabled(SumoXMLAttr key) const
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 conrrespond 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
writte 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:125
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
const std::string & getID() const
get ID
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:537
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
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 DottedContourType type, const GUIVisualizationSettings &s, 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.
GUIGlID getGlID() const
Returns the numerical id of the object.
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:248
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
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|....
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"
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