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
23#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
27
28#include "GNECalibrator.h"
29
30// ===========================================================================
31// member method definitions
32// ===========================================================================
33
35 GNEAdditional("", net, "", tag, ""),
36 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
37}
38
39
40GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
41 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
42 GNEAdditional(id, net, filename, SUMO_TAG_CALIBRATOR, name),
43 Parameterised(parameters),
44 myPositionOverLane(pos),
45 myFrequency(frequency),
46 myOutput(output),
47 myJamThreshold(jamThreshold),
48 myVTypes(vTypes),
49 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
50 // set parents
51 setParent<GNEEdge*>(edge);
52 // update centering boundary without updating grid
54}
55
56
57GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
58 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
59 const Parameterised::Map& parameters) :
60 GNEAdditional(id, net, filename, SUMO_TAG_CALIBRATOR, name),
61 Parameterised(parameters),
62 myPositionOverLane(pos),
63 myFrequency(frequency),
64 myOutput(output),
65 myJamThreshold(jamThreshold),
66 myVTypes(vTypes),
67 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
68 // set parents
69 setParent<GNEEdge*>(edge);
70 setParent<GNEAdditional*>(routeProbe);
71 // update centering boundary without updating grid
73}
74
75
76GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, 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, filename, GNE_TAG_CALIBRATOR_LANE, name),
79 Parameterised(parameters),
80 myPositionOverLane(pos),
81 myFrequency(frequency),
82 myOutput(output),
83 myJamThreshold(jamThreshold),
84 myVTypes(vTypes),
85 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
86 // set parents
87 setParent<GNELane*>(lane);
88 // update centering boundary without updating grid
90}
91
92
93GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, const std::string& filename, 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 Parameterised::Map& parameters) :
96 GNEAdditional(id, net, filename, GNE_TAG_CALIBRATOR_LANE, name),
97 Parameterised(parameters),
98 myPositionOverLane(pos),
99 myFrequency(frequency),
100 myOutput(output),
101 myJamThreshold(jamThreshold),
102 myVTypes(vTypes),
103 myEdgeCalibratorContours(new std::vector<GNEContour*>()) {
104 // set parents
105 setParent<GNELane*>(lane);
106 setParent<GNEAdditional*>(routeProbe);
107 // update centering boundary without updating grid
109}
110
111
113 for (auto it = myEdgeCalibratorContours->begin(); it != myEdgeCalibratorContours->end(); it++) {
114 delete *it;
115 }
117}
118
119
122 return nullptr;
123}
124
125
128 return this;
129}
130
131
132const Parameterised*
134 return this;
135}
136
137
138void
140 // open tag
142 // write common additional attributes
144 // write specific attributes
145 if (getParentEdges().size() > 0) {
146 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
147 }
148 if (getParentLanes().size() > 0) {
149 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
150 }
152 if (time2string(myFrequency) != "1.00") {
154 }
155 if (!myOutput.empty()) {
157 }
158 if (getParentAdditionals().size() > 0) {
160 }
161 if (myJamThreshold != 0.5) {
163 }
164 if (myVTypes.size() > 0) {
166 }
167 // write calibrator flows
168 for (const auto& calibratorFlow : getChildAdditionals()) {
169 if (calibratorFlow->getTagProperty()->getTag() == GNE_TAG_CALIBRATOR_FLOW) {
170 calibratorFlow->writeAdditional(device);
171 }
172 }
173 // write parameters (Always after children to avoid problems with additionals.xsd)
174 writeParams(device);
175 device.closeTag();
176}
177
178
179bool
181 return true;
182}
183
184
185std::string
187 return "";
188}
189
190
191void
193 // nothing to fix
194}
195
196
197void
199 // get shape depending of we have a edge or a lane
200 if (getParentLanes().size() > 0) {
201 // simply update geometry
203 } else if (getParentEdges().size() > 0) {
204 // clear all contours
205 for (auto it = myEdgeCalibratorContours->begin(); it != myEdgeCalibratorContours->end(); it++) {
206 delete *it;
207 }
208 // clear all edge geometries
211 // iterate over every lane and upadte geometries
212 for (const auto& lane : getParentEdges().front()->getChildLanes()) {
213 // this is needed for centering calibratorFlows as additional listed
214 if (lane == getParentEdges().front()->getChildLanes().front()) {
216 }
217 // add new calibrator geometry
218 GUIGeometry calibratorGeometry;
219 calibratorGeometry.updateGeometry(lane->getLaneShape(), myPositionOverLane, 0);
220 myEdgeCalibratorGeometries.push_back(calibratorGeometry);
221 // also add a new contour
222 myEdgeCalibratorContours->push_back(new GNEContour());
223 }
224 }
225 // update geometries of all children
226 for (const auto& rerouterElement : getChildAdditionals()) {
227 rerouterElement->updateGeometry();
228 }
229}
230
231
236
237
238void
239GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
240 // nothing to update
241}
242
243
244void
245GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
246 if (splitPosition < myPositionOverLane) {
247 // change lane or edge
248 if (newElement->getTagProperty()->getTag() == SUMO_TAG_LANE) {
249 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
250 } else {
251 setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
252 }
253 // now adjust start position
254 setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
255 }
256}
257
258
259std::string
261 // get parent name depending of we have a edge or a lane
262 if (getParentLanes().size() > 0) {
263 return getParentLanes().front()->getID();
264 } else if (getParentEdges().size() > 0) {
265 return getParentEdges().front()->getChildLanes().at(0)->getID();
266 } else {
267 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
268 }
269}
270
271
272void
274 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
275 // first check if additional has to be drawn
277 // get values
278 const double exaggeration = getExaggeration(s);
279 // get detail level
280 const auto d = s.getDetailLevel(exaggeration);
281 if (myEdgeCalibratorGeometries.size() > 0) {
282 // draw all calibrator symbols
283 for (int i = 0; i < (int)myEdgeCalibratorGeometries.size(); i++) {
284 drawCalibratorSymbol(s, d, exaggeration, myEdgeCalibratorGeometries.at(i).getShape().front(),
285 myEdgeCalibratorGeometries.at(i).getShapeRotations().front(), i);
286 }
287 } else {
288 // draw single calibrator symbol
289 drawCalibratorSymbol(s, d, exaggeration, myAdditionalGeometry.getShape().front(),
291 }
292 // draw additional ID
294 // iterate over additionals and check if drawn
295 for (const auto& calibratorFlow : getChildAdditionals()) {
296 // if calibrator is being inspected or selected, then draw
298 isAttributeCarrierSelected() || inspectedElements.isACInspected(this) ||
299 calibratorFlow->isAttributeCarrierSelected() || inspectedElements.isACInspected(calibratorFlow) ||
300 calibratorFlow->isMarkedForDrawingFront()) {
301 calibratorFlow->drawGL(s);
302 }
303 }
304 }
305}
306
307
308bool
310 // get edit modes
311 const auto& editModes = myNet->getViewNet()->getEditModes();
312 // check if we're in move mode
313 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
315 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
316 // only move the first element
318 } else {
319 return false;
320 }
321}
322
323
324void
326 // Open calibrator dialog
327 GNECalibratorDialog calibratorDialog(this);
328}
329
330
331std::string
333 switch (key) {
334 case SUMO_ATTR_ID:
335 return getMicrosimID();
336 case SUMO_ATTR_EDGE:
337 return getParentEdges().front()->getID();
338 case SUMO_ATTR_LANE:
339 return getParentLanes().front()->getID();
342 case SUMO_ATTR_PERIOD:
344 return time2string(myFrequency);
345 case SUMO_ATTR_NAME:
346 return myAdditionalName;
347 case SUMO_ATTR_OUTPUT:
348 return myOutput;
350 if (getParentAdditionals().size() > 0) {
351 return getParentAdditionals().front()->getID();
352 } else {
353 return "";
354 }
356 return toString(myJamThreshold);
357 case SUMO_ATTR_VTYPES:
358 return toString(myVTypes);
360 return "";
361 default:
362 return getCommonAttribute(key);
363 }
364}
365
366
367double
371
372
377
378
383
384
385void
386GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
387 switch (key) {
388 case SUMO_ATTR_ID:
389 case SUMO_ATTR_EDGE:
390 case SUMO_ATTR_LANE:
392 case SUMO_ATTR_PERIOD:
394 case SUMO_ATTR_NAME:
395 case SUMO_ATTR_OUTPUT:
398 case SUMO_ATTR_VTYPES:
400 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
401 break;
402 default:
403 setCommonAttribute(key, value, undoList);
404 break;
405 }
406
407}
408
409
410bool
411GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
412 switch (key) {
413 case SUMO_ATTR_ID:
415 case SUMO_ATTR_EDGE:
416 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
417 return true;
418 } else {
419 return false;
420 }
421 case SUMO_ATTR_LANE:
422 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
423 return true;
424 } else {
425 return false;
426 }
428 if (canParse<double>(value)) {
429 // obtain position and check if is valid
430 const double newPosition = parse<double>(value);
431 if (isTemplate()) {
432 return (newPosition >= 0);
433 }
434 // get shape
435 PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getChildLanes().at(0)->getLaneShape();
436 if ((newPosition < 0) || (newPosition > shape.length())) {
437 return false;
438 } else {
439 return true;
440 }
441 } else {
442 return false;
443 }
444 case SUMO_ATTR_PERIOD:
446 return canParse<SUMOTime>(value) ? (parse<SUMOTime>(value) >= 0) : false;
447 case SUMO_ATTR_NAME:
449 case SUMO_ATTR_OUTPUT:
452 if (value.empty()) {
453 return true;
454 } else {
455 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
456 }
458 return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
459 case SUMO_ATTR_VTYPES:
460 if (value.empty()) {
461 return true;
462 } else {
464 }
465 default:
466 return isCommonAttributeValid(key, value);
467 }
468}
469
470
471std::string
473 return getTagStr() + ": " + getID();
474}
475
476
477std::string
479 return getTagStr();
480}
481
482// ===========================================================================
483// private
484// ===========================================================================
485
486void
488 const Position& pos, const double rot, const int symbolIndex) const {
489 // draw geometry only if we'rent in drawForObjectUnderCursor mode
491 // push layer matrix
493 // translate to front
495 // translate to position
496 glTranslated(pos.x(), pos.y(), 0);
497 // rotate over lane
499 // scale
500 glScaled(exaggeration, exaggeration, 1);
501 // set drawing mode
502 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
503 // set color
505 // base
506 glBegin(GL_TRIANGLES);
507 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
510 glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
511 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
513 glEnd();
514 // draw text if isn't being drawn for selecting
516 // set color depending of selection status
518 // draw "C"
519 GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
520 // draw "edge" or "lane "
521 if (getParentLanes().size() > 0) {
522 GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
523 } else if (getParentEdges().size() > 0) {
524 GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
525 } else {
526 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
527 }
528 }
529 // pop layer matrix
531 // draw dotted contours
532 if (symbolIndex == -1) {
534 } else {
535 myEdgeCalibratorContours->at(symbolIndex)->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
536 }
537 }
538 GUIGlObject* parentBoundary = nullptr;
539 if (getParentEdges().size() > 0) {
540 parentBoundary = getParentEdges().front();
541 } else if (getParentLanes().size() > 0) {
542 parentBoundary = getParentLanes().front();
543 }
544 // calculate dotted contour
545 if (symbolIndex == -1) {
548 exaggeration, parentBoundary);
549 } else {
550 if (symbolIndex == 0) {
553 exaggeration, parentBoundary);
554 }
555 myEdgeCalibratorContours->at(symbolIndex)->calculateContourRectangleShape(s, d, this, pos, s.additionalSettings.calibratorWidth,
557 exaggeration, parentBoundary);
558 }
559}
560
561void
562GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
563 switch (key) {
564 case SUMO_ATTR_ID:
565 // update microsimID
566 setAdditionalID(value);
567 break;
568 case SUMO_ATTR_EDGE:
570 break;
571 case SUMO_ATTR_LANE:
573 break;
575 myPositionOverLane = parse<double>(value);
576 break;
577 case SUMO_ATTR_PERIOD:
579 myFrequency = parse<SUMOTime>(value);
580 break;
581 case SUMO_ATTR_NAME:
582 myAdditionalName = value;
583 break;
584 case SUMO_ATTR_OUTPUT:
585 myOutput = value;
586 break;
589 break;
591 myJamThreshold = parse<double>(value);
592 break;
593 case SUMO_ATTR_VTYPES:
594 myVTypes = parse<std::vector<std::string> >(value);
595 break;
598 break;
599 default:
600 setCommonAttribute(key, value);
601 break;
602 }
603}
604
605/****************************************************************************/
@ 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
const std::string getID() const
get ID (all Attribute Carriers have one)
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)
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
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
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 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.
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
double myJamThreshold
jamThreshold
std::string myOutput
output of calibrator
std::vector< GNEContour * > * myEdgeCalibratorContours
edge calibrator contours
std::string getParentName() const
Returns the name of the parent object.
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this calibrator
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
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 setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool checkDrawMoveContour() const override
check if draw move contour (red)
GNECalibrator(SumoXMLTag tag, GNENet *net)
Default constructor.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position getAttributePosition(SumoXMLAttr key) const override
void updateGeometry() override
update pre-computed geometry information
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Parameterised * getParameters() override
get parameters associated with this calibrator
void openAdditionalDialog()
open Calibrator Dialog
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