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.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 <netedit/GNENet.h>
21 #include <netedit/GNEUndoList.h>
22 #include <netedit/GNEViewNet.h>
25 #include <utils/gui/div/GLHelper.h>
28 #include <utils/xml/NamespaceIDs.h>
29 
30 #include "GNECalibrator.h"
31 
32 
33 // ===========================================================================
34 // member method definitions
35 // ===========================================================================
36 
38  GNEAdditional("", net, GLO_CALIBRATOR, tag, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "", {}, {}, {}, {}, {}, {}),
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 Parameterised::Map& parameters) :
49  GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {}, {}, {}),
50 Parameterised(parameters),
51 myPositionOverLane(pos),
52 myFrequency(frequency),
53 myOutput(output),
54 myJamThreshold(jamThreshold),
55 myVTypes(vTypes) {
56  // update centering boundary without updating grid
57  updateCenteringBoundary(false);
58 }
59 
60 
61 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
62  const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
63  const Parameterised::Map& parameters) :
64  GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {routeProbe}, {}, {}),
65 Parameterised(parameters),
66 myPositionOverLane(pos),
67 myFrequency(frequency),
68 myOutput(output),
69 myJamThreshold(jamThreshold),
70 myVTypes(vTypes) {
71  // update centering boundary without updating grid
72  updateCenteringBoundary(false);
73 }
74 
75 
76 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
77  const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
78  GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {}, {}, {}),
79 Parameterised(parameters),
80 myPositionOverLane(pos),
81 myFrequency(frequency),
82 myOutput(output),
83 myJamThreshold(jamThreshold),
84 myVTypes(vTypes) {
85  // update centering boundary without updating grid
86  updateCenteringBoundary(false);
87 }
88 
89 
90 GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
91  const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
92  const Parameterised::Map& parameters) :
93  GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {routeProbe}, {}, {}),
94 Parameterised(parameters),
95 myPositionOverLane(pos),
96 myFrequency(frequency),
97 myOutput(output),
98 myJamThreshold(jamThreshold),
99 myVTypes(vTypes) {
100  // update centering boundary without updating grid
101  updateCenteringBoundary(false);
102 }
103 
104 
106 
107 
108 void
110  // open tag
112  // write parameters
113  device.writeAttr(SUMO_ATTR_ID, getID());
114  if (getParentEdges().size() > 0) {
115  device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
116  }
117  if (getParentLanes().size() > 0) {
118  device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
119  }
121  if (time2string(myFrequency) != "1.00") {
123  }
124  if (!myAdditionalName.empty()) {
126  }
127  if (!myOutput.empty()) {
129  }
130  if (getParentAdditionals().size() > 0) {
132  }
133  if (myJamThreshold != 0.5) {
135  }
136  if (myVTypes.size() > 0) {
138  }
139  // write calibrator flows
140  for (const auto& calibratorFlow : getChildAdditionals()) {
141  if (calibratorFlow->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_FLOW) {
142  calibratorFlow->writeAdditional(device);
143  }
144  }
145  // write parameters (Always after children to avoid problems with additionals.xsd)
146  writeParams(device);
147  device.closeTag();
148 }
149 
150 
151 bool
153  return true;
154 }
155 
156 
157 std::string
159  return "";
160 }
161 
162 
163 void
165  // nothing to fix
166 }
167 
168 
171  // calibrators cannot be moved
172  return nullptr;
173 }
174 
175 
176 void
178  // get shape depending of we have a edge or a lane
179  if (getParentLanes().size() > 0) {
180  // update geometry
182  } else if (getParentEdges().size() > 0) {
183  // update geometry of first edge
184  myAdditionalGeometry.updateGeometry(getParentEdges().front()->getLanes().front()->getLaneShape(), myPositionOverLane, 0);
185  // clear extra geometries
187  // iterate over every lane and get point
188  for (int i = 1; i < (int)getParentEdges().front()->getLanes().size(); i++) {
189  // add new calibrator geometry
190  GUIGeometry calibratorGeometry;
191  calibratorGeometry.updateGeometry(getParentEdges().front()->getLanes().at(i)->getLaneShape(), myPositionOverLane, 0);
192  myEdgeCalibratorGeometries.push_back(calibratorGeometry);
193  }
194  } else {
195  throw ProcessError(TL("Both edges and lanes aren't defined"));
196  }
197 }
198 
199 
200 Position
203 }
204 
205 
206 void
207 GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
208  // nothing to update
209 }
210 
211 
212 void
213 GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
214  if (splitPosition < myPositionOverLane) {
215  // change lane or edge
216  if (newElement->getTagProperty().getTag() == SUMO_TAG_LANE) {
217  setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
218  } else {
219  setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
220  }
221  // now adjust start position
222  setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
223  }
224 }
225 
226 
227 std::string
229  // get parent name depending of we have a edge or a lane
230  if (getParentLanes().size() > 0) {
231  return getParentLanes().front()->getID();
232  } else if (getParentEdges().size() > 0) {
233  return getParentEdges().front()->getLanes().at(0)->getID();
234  } else {
235  throw ProcessError(TL("Both myEdge and myLane aren't defined"));
236  }
237 }
238 
239 
240 void
242  // get values
243  const double exaggeration = getExaggeration(s);
244  // first check if additional has to be drawn
246  // get detail level
247  const auto d = s.getDetailLevel(exaggeration);
248  // draw first symbol
249  drawCalibratorSymbol(s, d, exaggeration, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front() + 90);
250  // continue with the other symbols
251  for (const auto& edgeCalibratorGeometry : myEdgeCalibratorGeometries) {
252  drawCalibratorSymbol(s, d, exaggeration, edgeCalibratorGeometry.getShape().front(), edgeCalibratorGeometry.getShapeRotations().front() + 90);
253  }
254  // draw additional ID
255  drawAdditionalID(s);
256  // iterate over additionals and check if drawn
257  for (const auto& calibratorFlow : getChildAdditionals()) {
258  // if calibrator is being inspected or selected, then draw
261  calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
262  (myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
263  calibratorFlow->drawGL(s);
264  }
265  }
266  }
267 }
268 
269 
270 bool
272  // get edit modes
273  const auto& editModes = myNet->getViewNet()->getEditModes();
274  // check if we're in move mode
275  if (!myNet->getViewNet()->isMovingElement() && editModes.isCurrentSupermodeNetwork() &&
276  (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
277  // only move the first element
279  } else {
280  return false;
281  }
282 }
283 
284 
285 void
287  // Open calibrator dialog
288  GNECalibratorDialog calibratorDialog(this);
289 }
290 
291 
292 std::string
294  switch (key) {
295  case SUMO_ATTR_ID:
296  return getMicrosimID();
297  case SUMO_ATTR_EDGE:
298  return getParentEdges().front()->getID();
299  case SUMO_ATTR_LANE:
300  return getParentLanes().front()->getID();
301  case SUMO_ATTR_POSITION:
303  case SUMO_ATTR_PERIOD:
304  case SUMO_ATTR_FREQUENCY:
305  return time2string(myFrequency);
306  case SUMO_ATTR_NAME:
307  return myAdditionalName;
308  case SUMO_ATTR_OUTPUT:
309  return myOutput;
311  if (getParentAdditionals().size() > 0) {
312  return getParentAdditionals().front()->getID();
313  } else {
314  return "";
315  }
317  return toString(myJamThreshold);
318  case SUMO_ATTR_VTYPES:
319  return toString(myVTypes);
320  case GNE_ATTR_SELECTED:
322  case GNE_ATTR_PARAMETERS:
323  return getParametersStr();
325  return "";
326  default:
327  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
328  }
329 }
330 
331 
332 double
334  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
335 }
336 
337 
338 const Parameterised::Map&
340  return getParametersMap();
341 }
342 
343 
344 void
345 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
346  switch (key) {
347  case SUMO_ATTR_ID:
348  case SUMO_ATTR_EDGE:
349  case SUMO_ATTR_LANE:
350  case SUMO_ATTR_POSITION:
351  case SUMO_ATTR_PERIOD:
352  case SUMO_ATTR_FREQUENCY:
353  case SUMO_ATTR_NAME:
354  case SUMO_ATTR_OUTPUT:
357  case SUMO_ATTR_VTYPES:
358  case GNE_ATTR_SELECTED:
359  case GNE_ATTR_PARAMETERS:
361  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
362  break;
363  default:
364  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
365  }
366 
367 }
368 
369 
370 bool
371 GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
372  switch (key) {
373  case SUMO_ATTR_ID:
375  case SUMO_ATTR_EDGE:
376  if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
377  return true;
378  } else {
379  return false;
380  }
381  case SUMO_ATTR_LANE:
382  if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
383  return true;
384  } else {
385  return false;
386  }
387  case SUMO_ATTR_POSITION:
388  if (canParse<double>(value)) {
389  // obtain position and check if is valid
390  const double newPosition = parse<double>(value);
391  if (isTemplate()) {
392  return (newPosition >= 0);
393  }
394  // get shape
395  PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
396  if ((newPosition < 0) || (newPosition > shape.length())) {
397  return false;
398  } else {
399  return true;
400  }
401  } else {
402  return false;
403  }
404  case SUMO_ATTR_PERIOD:
405  case SUMO_ATTR_FREQUENCY:
406  return canParse<SUMOTime>(value);
407  case SUMO_ATTR_NAME:
409  case SUMO_ATTR_OUTPUT:
412  if (value.empty()) {
413  return true;
414  } else {
415  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
416  }
418  return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
419  case SUMO_ATTR_VTYPES:
420  if (value.empty()) {
421  return true;
422  } else {
424  }
425  case GNE_ATTR_SELECTED:
426  return canParse<bool>(value);
427  case GNE_ATTR_PARAMETERS:
428  return areParametersValid(value);
429  default:
430  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
431  }
432 }
433 
434 
435 std::string
437  return getTagStr() + ": " + getID();
438 }
439 
440 
441 std::string
443  return getTagStr();
444 }
445 
446 // ===========================================================================
447 // private
448 // ===========================================================================
449 
450 void
452  const Position& pos, const double rot) const {
453  // draw geometry only if we'rent in drawForObjectUnderCursor mode
454  if (!s.drawForViewObjectsHandler) {
455  // push layer matrix
457  // translate to front
459  // translate to position
460  glTranslated(pos.x(), pos.y(), 0);
461  // rotate over lane
463  // scale
464  glScaled(exaggeration, exaggeration, 1);
465  // set drawing mode
466  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
467  // set color
469  // base
470  glBegin(GL_TRIANGLES);
471  glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
474  glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
475  glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
477  glEnd();
478  // draw text if isn't being drawn for selecting
480  // set color depending of selection status
482  // draw "C"
483  GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
484  // draw "edge" or "lane "
485  if (getParentLanes().size() > 0) {
486  GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
487  } else if (getParentEdges().size() > 0) {
488  GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
489  } else {
490  throw ProcessError(TL("Both myEdge and myLane aren't defined"));
491  }
492  }
493  // pop layer matrix
495  // draw dotted contour
497  }
498  // draw dotted contour
500  s.additionalSettings.calibratorHeight * 0.5, 0, 0, rot, exaggeration);
501 }
502 
503 void
504 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
505  switch (key) {
506  case SUMO_ATTR_ID:
507  // update microsimID
508  setAdditionalID(value);
509  break;
510  case SUMO_ATTR_EDGE:
512  break;
513  case SUMO_ATTR_LANE:
515  break;
516  case SUMO_ATTR_POSITION:
517  myPositionOverLane = parse<double>(value);
518  break;
519  case SUMO_ATTR_PERIOD:
520  case SUMO_ATTR_FREQUENCY:
521  myFrequency = parse<SUMOTime>(value);
522  break;
523  case SUMO_ATTR_NAME:
524  myAdditionalName = value;
525  break;
526  case SUMO_ATTR_OUTPUT:
527  myOutput = value;
528  break;
531  break;
533  myJamThreshold = parse<double>(value);
534  break;
535  case SUMO_ATTR_VTYPES:
536  myVTypes = parse<std::vector<std::string> >(value);
537  break;
538  case GNE_ATTR_SELECTED:
539  if (parse<bool>(value)) {
541  } else {
543  }
544  break;
545  case GNE_ATTR_PARAMETERS:
546  setParametersStr(value);
547  break;
549  shiftLaneIndex();
550  break;
551  default:
552  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
553  }
554 }
555 
556 
557 void
559  // nothing to do
560 }
561 
562 
563 void
564 GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
565  // nothing to do
566 }
567 
568 
569 /****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
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
#define TL(string)
Definition: MsgHandler.h:315
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition: SUMOTime.cpp:69
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
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
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
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
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
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
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 updateGeometry()
update pre-computed geometry information
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
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)
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
void drawCalibratorSymbol(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const Position &pos, const double rot) const
draw calibrator symbol
double myJamThreshold
jamThreshold
std::string myOutput
output of calibrator
std::string getParentName() const
Returns the name of the parent object.
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
~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
bool checkDrawMoveContour() const
check if draw move contour (red)
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
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double scale) const
calculate contour (for rectangled elements)
Definition: GNEContour.cpp:103
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
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:122
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2055
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:727
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:703
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:715
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool isMovingElement() const
check if an element is being moved
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:468
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
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:59
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.
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static const std::vector< SumoXMLTag > calibrators
calibrators namespace
Definition: NamespaceIDs.h:44
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:254
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 segmentWidth
width of dotted contour segments