Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2025 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// Calibrator over edge or lane
19/****************************************************************************/
20#include <config.h>
21
24#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
28
29#include "GNECalibrator.h"
30
31// ===========================================================================
32// member method definitions
33// ===========================================================================
34
36 GNEAdditional("", net, "", tag, ""),
37 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
38}
39
40
41GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
42 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
43 GNEAdditional(id, net, filename, SUMO_TAG_CALIBRATOR, name),
44 Parameterised(parameters),
45 myPositionOverLane(pos),
46 myFrequency(frequency),
47 myOutput(output),
48 myJamThreshold(jamThreshold),
49 myVTypes(vTypes),
50 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
51 // set parents
52 setParent<GNEEdge*>(edge);
53 // update centering boundary without updating grid
55}
56
57
58GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
59 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
60 const Parameterised::Map& parameters) :
61 GNEAdditional(id, net, filename, SUMO_TAG_CALIBRATOR, name),
62 Parameterised(parameters),
63 myPositionOverLane(pos),
64 myFrequency(frequency),
65 myOutput(output),
66 myJamThreshold(jamThreshold),
67 myVTypes(vTypes),
68 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
69 // set parents
70 setParent<GNEEdge*>(edge);
71 setParent<GNEAdditional*>(routeProbe);
72 // update centering boundary without updating grid
74}
75
76
77GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
78 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
79 GNEAdditional(id, net, filename, GNE_TAG_CALIBRATOR_LANE, name),
80 Parameterised(parameters),
81 myPositionOverLane(pos),
82 myFrequency(frequency),
83 myOutput(output),
84 myJamThreshold(jamThreshold),
85 myVTypes(vTypes),
86 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
87 // set parents
88 setParent<GNELane*>(lane);
89 // update centering boundary without updating grid
91}
92
93
94GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
95 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
96 const Parameterised::Map& parameters) :
97 GNEAdditional(id, net, filename, GNE_TAG_CALIBRATOR_LANE, name),
98 Parameterised(parameters),
99 myPositionOverLane(pos),
100 myFrequency(frequency),
101 myOutput(output),
102 myJamThreshold(jamThreshold),
103 myVTypes(vTypes),
104 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
105 // set parents
106 setParent<GNELane*>(lane);
107 setParent<GNEAdditional*>(routeProbe);
108 // update centering boundary without updating grid
110}
111
112
114 for (auto it = myEdgeCalibratorContours->begin(); it != myEdgeCalibratorContours->end(); it++) {
115 delete *it;
116 }
118}
119
120
123 return nullptr;
124}
125
126
129 return this;
130}
131
132
133const Parameterised*
135 return this;
136}
137
138
139void
141 // open tag
143 // write common additional attributes
145 // write specific attributes
146 if (getParentEdges().size() > 0) {
147 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
148 }
149 if (getParentLanes().size() > 0) {
150 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
151 }
153 if (time2string(myFrequency) != "1.00") {
155 }
156 if (!myOutput.empty()) {
158 }
159 if (getParentAdditionals().size() > 0) {
161 }
162 if (myJamThreshold != 0.5) {
164 }
165 if (myVTypes.size() > 0) {
167 }
168 // write calibrator flows
169 for (const auto& calibratorFlow : getChildAdditionals()) {
170 if (calibratorFlow->getTagProperty()->getTag() == GNE_TAG_CALIBRATOR_FLOW) {
171 calibratorFlow->writeAdditional(device);
172 }
173 }
174 // write parameters (Always after children to avoid problems with additionals.xsd)
175 writeParams(device);
176 device.closeTag();
177}
178
179
180bool
182 return true;
183}
184
185
186std::string
188 return "";
189}
190
191
192void
194 // nothing to fix
195}
196
197
198void
200 // get shape depending of we have a edge or a lane
201 if (getParentLanes().size() > 0) {
202 // simply update geometry
204 } else if (getParentEdges().size() > 0) {
205 // clear all contours
206 for (auto it = myEdgeCalibratorContours->begin(); it != myEdgeCalibratorContours->end(); it++) {
207 delete *it;
208 }
209 // clear all edge geometries
212 // iterate over every lane and upadte geometries
213 for (const auto& lane : getParentEdges().front()->getChildLanes()) {
214 // this is needed for centering calibratorFlows as additional listed
215 if (lane == getParentEdges().front()->getChildLanes().front()) {
217 }
218 // add new calibrator geometry
219 GUIGeometry calibratorGeometry;
220 calibratorGeometry.updateGeometry(lane->getLaneShape(), myPositionOverLane, 0);
221 myEdgeCalibratorGeometries.push_back(calibratorGeometry);
222 // also add a new contour
223 myEdgeCalibratorContours->push_back(new GNEContour());
224 }
225 }
226 // update geometries of all children
227 for (const auto& rerouterElement : getChildAdditionals()) {
228 rerouterElement->updateGeometry();
229 }
230}
231
232
237
238
239void
240GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
241 // nothing to update
242}
243
244
245void
246GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
247 if (splitPosition < myPositionOverLane) {
248 // change lane or edge
249 if (newElement->getTagProperty()->getTag() == SUMO_TAG_LANE) {
250 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
251 } else {
252 setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
253 }
254 // now adjust start position
255 setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
256 }
257}
258
259
260std::string
262 // get parent name depending of we have a edge or a lane
263 if (getParentLanes().size() > 0) {
264 return getParentLanes().front()->getID();
265 } else if (getParentEdges().size() > 0) {
266 return getParentEdges().front()->getChildLanes().at(0)->getID();
267 } else {
268 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
269 }
270}
271
272
273void
275 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
276 // first check if additional has to be drawn
278 // get values
279 const double exaggeration = getExaggeration(s);
280 // get detail level
281 const auto d = s.getDetailLevel(exaggeration);
282 if (myEdgeCalibratorGeometries.size() > 0) {
283 // draw all calibrator symbols
284 for (int i = 0; i < (int)myEdgeCalibratorGeometries.size(); i++) {
285 drawCalibratorSymbol(s, d, exaggeration, myEdgeCalibratorGeometries.at(i).getShape().front(),
286 myEdgeCalibratorGeometries.at(i).getShapeRotations().front(), i);
287 }
288 } else {
289 // draw single calibrator symbol
290 drawCalibratorSymbol(s, d, exaggeration, myAdditionalGeometry.getShape().front(),
292 }
293 // draw additional ID
295 // iterate over additionals and check if drawn
296 for (const auto& calibratorFlow : getChildAdditionals()) {
297 // if calibrator is being inspected or selected, then draw
299 isAttributeCarrierSelected() || inspectedElements.isACInspected(this) ||
300 calibratorFlow->isAttributeCarrierSelected() || inspectedElements.isACInspected(calibratorFlow) ||
301 calibratorFlow->isMarkedForDrawingFront()) {
302 calibratorFlow->drawGL(s);
303 }
304 }
305 }
306}
307
308
309bool
311 // get edit modes
312 const auto& editModes = myNet->getViewNet()->getEditModes();
313 // check if we're in move mode
314 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
316 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
317 // only move the first element
319 } else {
320 return false;
321 }
322}
323
324
325void
327 // Open calibrator dialog
328 GNECalibratorDialog calibratorDialog(this);
329}
330
331
332std::string
334 switch (key) {
335 case SUMO_ATTR_ID:
336 return getMicrosimID();
337 case SUMO_ATTR_EDGE:
338 return getParentEdges().front()->getID();
339 case SUMO_ATTR_LANE:
340 return getParentLanes().front()->getID();
343 case SUMO_ATTR_PERIOD:
345 return time2string(myFrequency);
346 case SUMO_ATTR_NAME:
347 return myAdditionalName;
348 case SUMO_ATTR_OUTPUT:
349 return myOutput;
351 if (getParentAdditionals().size() > 0) {
352 return getParentAdditionals().front()->getID();
353 } else {
354 return "";
355 }
357 return toString(myJamThreshold);
358 case SUMO_ATTR_VTYPES:
359 return toString(myVTypes);
361 return "";
362 default:
363 return getCommonAttribute(key);
364 }
365}
366
367
368double
372
373
378
379
384
385
386void
387GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
388 switch (key) {
389 case SUMO_ATTR_ID:
390 case SUMO_ATTR_EDGE:
391 case SUMO_ATTR_LANE:
393 case SUMO_ATTR_PERIOD:
395 case SUMO_ATTR_NAME:
396 case SUMO_ATTR_OUTPUT:
399 case SUMO_ATTR_VTYPES:
401 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
402 break;
403 default:
404 setCommonAttribute(key, value, undoList);
405 break;
406 }
407
408}
409
410
411bool
412GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
413 switch (key) {
414 case SUMO_ATTR_ID:
416 case SUMO_ATTR_EDGE:
417 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
418 return true;
419 } else {
420 return false;
421 }
422 case SUMO_ATTR_LANE:
423 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
424 return true;
425 } else {
426 return false;
427 }
429 if (canParse<double>(value)) {
430 // obtain position and check if is valid
431 const double newPosition = parse<double>(value);
432 if (isTemplate()) {
433 return (newPosition >= 0);
434 }
435 // get shape
436 PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getChildLanes().at(0)->getLaneShape();
437 if ((newPosition < 0) || (newPosition > shape.length())) {
438 return false;
439 } else {
440 return true;
441 }
442 } else {
443 return false;
444 }
445 case SUMO_ATTR_PERIOD:
447 return canParse<SUMOTime>(value) ? (parse<SUMOTime>(value) >= 0) : false;
448 case SUMO_ATTR_NAME:
450 case SUMO_ATTR_OUTPUT:
453 if (value.empty()) {
454 return true;
455 } else {
456 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
457 }
459 return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
460 case SUMO_ATTR_VTYPES:
461 if (value.empty()) {
462 return true;
463 } else {
465 }
466 default:
467 return isCommonAttributeValid(key, value);
468 }
469}
470
471
472std::string
474 return getTagStr() + ": " + getID();
475}
476
477
478std::string
480 return getTagStr();
481}
482
483// ===========================================================================
484// private
485// ===========================================================================
486
487void
489 const Position& pos, const double rot, const int symbolIndex) const {
490 // draw geometry only if we'rent in drawForObjectUnderCursor mode
492 // push layer matrix
494 // translate to front
496 // translate to position
497 glTranslated(pos.x(), pos.y(), 0);
498 // rotate over lane
500 // scale
501 glScaled(exaggeration, exaggeration, 1);
502 // set drawing mode
503 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
504 // set color
506 // base
507 glBegin(GL_TRIANGLES);
508 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
511 glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
512 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
514 glEnd();
515 // draw text if isn't being drawn for selecting
517 // set color depending of selection status
519 // draw "C"
520 GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
521 // draw "edge" or "lane "
522 if (getParentLanes().size() > 0) {
523 GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
524 } else if (getParentEdges().size() > 0) {
525 GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
526 } else {
527 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
528 }
529 }
530 // pop layer matrix
532 // draw dotted contours
533 if (symbolIndex == -1) {
535 } else {
536 myEdgeCalibratorContours->at(symbolIndex)->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
537 }
538 }
539 GUIGlObject* parentBoundary = nullptr;
540 if (getParentEdges().size() > 0) {
541 parentBoundary = getParentEdges().front();
542 } else if (getParentLanes().size() > 0) {
543 parentBoundary = getParentLanes().front();
544 }
545 // calculate dotted contour
546 if (symbolIndex == -1) {
549 exaggeration, parentBoundary);
550 } else {
551 if (symbolIndex == 0) {
554 exaggeration, parentBoundary);
555 }
556 myEdgeCalibratorContours->at(symbolIndex)->calculateContourRectangleShape(s, d, this, pos, s.additionalSettings.calibratorWidth,
558 exaggeration, parentBoundary);
559 }
560}
561
562void
563GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
564 switch (key) {
565 case SUMO_ATTR_ID:
566 // update microsimID
567 setAdditionalID(value);
568 break;
569 case SUMO_ATTR_EDGE:
571 break;
572 case SUMO_ATTR_LANE:
574 break;
576 myPositionOverLane = parse<double>(value);
577 break;
578 case SUMO_ATTR_PERIOD:
580 myFrequency = parse<SUMOTime>(value);
581 break;
582 case SUMO_ATTR_NAME:
583 myAdditionalName = value;
584 break;
585 case SUMO_ATTR_OUTPUT:
586 myOutput = value;
587 break;
590 break;
592 myJamThreshold = parse<double>(value);
593 break;
594 case SUMO_ATTR_VTYPES:
595 myVTypes = parse<std::vector<std::string> >(value);
596 break;
599 break;
600 default:
601 setCommonAttribute(key, value);
602 break;
603 }
604}
605
606/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
long long int SUMOTime
Definition GUI.h:36
@ GLO_CALIBRATOR
a calibrator
#define TL(string)
Definition MsgHandler.h:304
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
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
@ SUMO_ATTR_ROUTEPROBE
@ 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:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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:742
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
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
std::string myAdditionalName
name of additional
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getCommonAttributeDouble(SumoXMLAttr key) const
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
const std::string getID() const override
get ID (all Attribute Carriers have one)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
Position getCommonAttributePosition(SumoXMLAttr key) const
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
std::string getCommonAttribute(SumoXMLAttr key) const
void drawCalibratorSymbol(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const Position &pos, const double rot, const int symbolIndex) const
draw calibrator symbol
bool isAdditionalValid() const override
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
std::string getParentName() const override
Returns the name of the parent object.
double myJamThreshold
jamThreshold
std::string myOutput
output of calibrator
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
std::vector< GNEContour * > * myEdgeCalibratorContours
edge calibrator contours
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this calibrator
double getAttributeDouble(SumoXMLAttr key) const override
~GNECalibrator()
Destructor.
SUMOTime myFrequency
Frequency of calibrator.
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
bool isValid(SumoXMLAttr key, const std::string &value) override
std::string getAttribute(SumoXMLAttr key) const override
double myPositionOverLane
position over Lane
std::vector< std::string > myVTypes
vTypes
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
bool checkDrawMoveContour() const override
check if draw move contour (red)
Position getPositionInView() const override
Returns position of additional in view.
void openAdditionalDialog() override
open Calibrator Dialog
GNECalibrator(SumoXMLTag tag, GNENet *net)
Default constructor.
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Position getAttributePosition(SumoXMLAttr key) const override
void updateGeometry() override
update pre-computed geometry information
Parameterised * getParameters() override
get parameters associated with this calibrator
std::vector< GUIGeometry > myEdgeCalibratorGeometries
edge calibrator geometries
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double layer, const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (for rectangled elements)
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
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:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
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
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
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Stores the information about how to visualize structures.
bool checkDrawAdditional(Detail d, const bool selected) const
check if draw additionals
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static const std::vector< SumoXMLTag > calibrators
calibrators namespace
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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.
std::map< std::string, std::string > Map
parameters map
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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:52
double y() const
Returns the y-position.
Definition Position.h:57
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:196
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)
Definition json.hpp:4471
bool showAdditionals() const
check if additionals has to be drawn
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
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