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-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>
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),
42myCalibratorContours(new std::vector<GNEContour*>()) {
43 // reset default values
44 resetDefaultValues();
45}
46
47
48GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
49 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
50 GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {}, {}, {}),
51Parameterised(parameters),
52myPositionOverLane(pos),
53myFrequency(frequency),
54myOutput(output),
55myJamThreshold(jamThreshold),
56myVTypes(vTypes),
57myCalibratorContours(new std::vector<GNEContour*>()) {
58 // update centering boundary without updating grid
59 updateCenteringBoundary(false);
60}
61
62
63GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
64 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
65 const Parameterised::Map& parameters) :
66 GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {routeProbe}, {}, {}),
67Parameterised(parameters),
68myPositionOverLane(pos),
69myFrequency(frequency),
70myOutput(output),
71myJamThreshold(jamThreshold),
72myVTypes(vTypes),
73myCalibratorContours(new std::vector<GNEContour*>()) {
74 // update centering boundary without updating grid
75 updateCenteringBoundary(false);
76}
77
78
79GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
80 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
81 GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {}, {}, {}),
82Parameterised(parameters),
83myPositionOverLane(pos),
84myFrequency(frequency),
85myOutput(output),
86myJamThreshold(jamThreshold),
87myVTypes(vTypes),
88myCalibratorContours(new std::vector<GNEContour*>()) {
89 // update centering boundary without updating grid
90 updateCenteringBoundary(false);
91}
92
93
94GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, 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, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {routeProbe}, {}, {}),
98Parameterised(parameters),
99myPositionOverLane(pos),
100myFrequency(frequency),
101myOutput(output),
102myJamThreshold(jamThreshold),
103myVTypes(vTypes),
104myCalibratorContours(new std::vector<GNEContour*>()) {
105 // update centering boundary without updating grid
106 updateCenteringBoundary(false);
107}
108
109
111 for (auto it = myCalibratorContours->begin(); it != myCalibratorContours->end(); it++) {
112 delete *it;
113 }
115}
116
117
118void
120 // open tag
122 // write parameters
123 device.writeAttr(SUMO_ATTR_ID, getID());
124 if (getParentEdges().size() > 0) {
125 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
126 }
127 if (getParentLanes().size() > 0) {
128 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
129 }
131 if (time2string(myFrequency) != "1.00") {
133 }
134 if (!myAdditionalName.empty()) {
136 }
137 if (!myOutput.empty()) {
139 }
140 if (getParentAdditionals().size() > 0) {
142 }
143 if (myJamThreshold != 0.5) {
145 }
146 if (myVTypes.size() > 0) {
148 }
149 // write calibrator flows
150 for (const auto& calibratorFlow : getChildAdditionals()) {
151 if (calibratorFlow->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_FLOW) {
152 calibratorFlow->writeAdditional(device);
153 }
154 }
155 // write parameters (Always after children to avoid problems with additionals.xsd)
156 writeParams(device);
157 device.closeTag();
158}
159
160
161bool
163 return true;
164}
165
166
167std::string
169 return "";
170}
171
172
173void
175 // nothing to fix
176}
177
178
181 // calibrators cannot be moved
182 return nullptr;
183}
184
185
186void
188 // get shape depending of we have a edge or a lane
189 if (getParentLanes().size() > 0) {
190 // update geometry
192 } else if (getParentEdges().size() > 0) {
193 // clear extra geometries and contours
194 if (getParentEdges().size() != myCalibratorContours->size()) {
195 for (auto it = myCalibratorContours->begin(); it != myCalibratorContours->end(); it++) {
196 delete *it;
197 }
198 myCalibratorContours->clear();
199 for (int i = 1; i < (int)getParentEdges().front()->getLanes().size(); i++) {
200 myCalibratorContours->push_back(new GNEContour());
201 }
202 }
204 // iterate over every lane and upadte geometries
205 for (const auto& lane : getParentEdges().front()->getLanes()) {
206 if (lane == getParentEdges().front()->getLanes().front()) {
208 } else {
209 // add new calibrator geometry
210 GUIGeometry calibratorGeometry;
211 calibratorGeometry.updateGeometry(lane->getLaneShape(), myPositionOverLane, 0);
212 myEdgeCalibratorGeometries.push_back(calibratorGeometry);
213 }
214 }
215 } else {
216 throw ProcessError(TL("Both edges and lanes aren't defined"));
217 }
218}
219
220
225
226
227void
228GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
229 // nothing to update
230}
231
232
233void
234GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
235 if (splitPosition < myPositionOverLane) {
236 // change lane or edge
237 if (newElement->getTagProperty().getTag() == SUMO_TAG_LANE) {
238 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
239 } else {
240 setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
241 }
242 // now adjust start position
243 setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
244 }
245}
246
247
248std::string
250 // get parent name depending of we have a edge or a lane
251 if (getParentLanes().size() > 0) {
252 return getParentLanes().front()->getID();
253 } else if (getParentEdges().size() > 0) {
254 return getParentEdges().front()->getLanes().at(0)->getID();
255 } else {
256 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
257 }
258}
259
260
261void
263 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
264 // first check if additional has to be drawn
266 // get values
267 const double exaggeration = getExaggeration(s);
268 // get detail level
269 const auto d = s.getDetailLevel(exaggeration);
270 // draw first calibrator symbols
271 drawCalibratorSymbol(s, d, exaggeration, myAdditionalGeometry.getShape().front(),
272 myAdditionalGeometry.getShapeRotations().front() + 90, -1);
273 // draw rest of calibrator symbols
274 for (int i = 0; i < (int)myEdgeCalibratorGeometries.size(); i++) {
275 drawCalibratorSymbol(s, d, exaggeration, myEdgeCalibratorGeometries.at(i).getShape().front(),
276 myEdgeCalibratorGeometries.at(i).getShapeRotations().front() + 90, i);
277 }
278 // draw additional ID
280 // iterate over additionals and check if drawn
281 for (const auto& calibratorFlow : getChildAdditionals()) {
282 // if calibrator is being inspected or selected, then draw
284 isAttributeCarrierSelected() || inspectedElements.isACInspected(this) ||
285 calibratorFlow->isAttributeCarrierSelected() || inspectedElements.isACInspected(calibratorFlow) ||
286 calibratorFlow->isMarkedForDrawingFront()) {
287 calibratorFlow->drawGL(s);
288 }
289 }
290 }
291}
292
293
294bool
296 // get edit modes
297 const auto& editModes = myNet->getViewNet()->getEditModes();
298 // check if we're in move mode
299 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
301 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
302 // only move the first element
304 } else {
305 return false;
306 }
307}
308
309
310void
312 // Open calibrator dialog
313 GNECalibratorDialog calibratorDialog(this);
314}
315
316
317std::string
319 switch (key) {
320 case SUMO_ATTR_ID:
321 return getMicrosimID();
322 case SUMO_ATTR_EDGE:
323 return getParentEdges().front()->getID();
324 case SUMO_ATTR_LANE:
325 return getParentLanes().front()->getID();
328 case SUMO_ATTR_PERIOD:
330 return time2string(myFrequency);
331 case SUMO_ATTR_NAME:
332 return myAdditionalName;
333 case SUMO_ATTR_OUTPUT:
334 return myOutput;
336 if (getParentAdditionals().size() > 0) {
337 return getParentAdditionals().front()->getID();
338 } else {
339 return "";
340 }
342 return toString(myJamThreshold);
343 case SUMO_ATTR_VTYPES:
344 return toString(myVTypes);
346 return getParametersStr();
348 return "";
349 default:
350 return getCommonAttribute(key);
351 }
352}
353
354
355double
357 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
358}
359
360
365
366
367void
368GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
369 switch (key) {
370 case SUMO_ATTR_ID:
371 case SUMO_ATTR_EDGE:
372 case SUMO_ATTR_LANE:
374 case SUMO_ATTR_PERIOD:
376 case SUMO_ATTR_NAME:
377 case SUMO_ATTR_OUTPUT:
380 case SUMO_ATTR_VTYPES:
383 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
384 break;
385 default:
386 setCommonAttribute(key, value, undoList);
387 break;
388 }
389
390}
391
392
393bool
394GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
395 switch (key) {
396 case SUMO_ATTR_ID:
398 case SUMO_ATTR_EDGE:
399 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
400 return true;
401 } else {
402 return false;
403 }
404 case SUMO_ATTR_LANE:
405 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
406 return true;
407 } else {
408 return false;
409 }
411 if (canParse<double>(value)) {
412 // obtain position and check if is valid
413 const double newPosition = parse<double>(value);
414 if (isTemplate()) {
415 return (newPosition >= 0);
416 }
417 // get shape
418 PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
419 if ((newPosition < 0) || (newPosition > shape.length())) {
420 return false;
421 } else {
422 return true;
423 }
424 } else {
425 return false;
426 }
427 case SUMO_ATTR_PERIOD:
429 return canParse<SUMOTime>(value);
430 case SUMO_ATTR_NAME:
432 case SUMO_ATTR_OUTPUT:
435 if (value.empty()) {
436 return true;
437 } else {
438 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
439 }
441 return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
442 case SUMO_ATTR_VTYPES:
443 if (value.empty()) {
444 return true;
445 } else {
447 }
449 return areParametersValid(value);
450 default:
451 return isCommonValid(key, value);
452 }
453}
454
455
456std::string
458 return getTagStr() + ": " + getID();
459}
460
461
462std::string
464 return getTagStr();
465}
466
467// ===========================================================================
468// private
469// ===========================================================================
470
471void
473 const Position& pos, const double rot, const int symbolIndex) const {
474 // draw geometry only if we'rent in drawForObjectUnderCursor mode
476 // push layer matrix
478 // translate to front
480 // translate to position
481 glTranslated(pos.x(), pos.y(), 0);
482 // rotate over lane
484 // scale
485 glScaled(exaggeration, exaggeration, 1);
486 // set drawing mode
487 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
488 // set color
490 // base
491 glBegin(GL_TRIANGLES);
492 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
495 glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
496 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
498 glEnd();
499 // draw text if isn't being drawn for selecting
501 // set color depending of selection status
503 // draw "C"
504 GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
505 // draw "edge" or "lane "
506 if (getParentLanes().size() > 0) {
507 GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
508 } else if (getParentEdges().size() > 0) {
509 GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
510 } else {
511 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
512 }
513 }
514 // pop layer matrix
516 // draw dotted contours
517 if (symbolIndex == -1) {
519 } else if (symbolIndex < (int)myCalibratorContours->size()) {
520 myCalibratorContours->at(symbolIndex)->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
521 }
522 }
523 GUIGlObject* parentBoundary = nullptr;
524 if (getParentEdges().size() > 0) {
525 parentBoundary = getParentEdges().front();
526 } else if (getParentLanes().size() > 0) {
527 parentBoundary = getParentLanes().front();
528 }
529 // calculate dotted contour
530 if (symbolIndex == -1) {
533 exaggeration, parentBoundary);
534 } else if (symbolIndex < (int)myCalibratorContours->size()) {
535 myCalibratorContours->at(symbolIndex)->calculateContourRectangleShape(s, d, this, pos, s.additionalSettings.calibratorWidth,
537 exaggeration, parentBoundary);
538 }
539}
540
541void
542GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
543 switch (key) {
544 case SUMO_ATTR_ID:
545 // update microsimID
546 setAdditionalID(value);
547 break;
548 case SUMO_ATTR_EDGE:
550 break;
551 case SUMO_ATTR_LANE:
553 break;
555 myPositionOverLane = parse<double>(value);
556 break;
557 case SUMO_ATTR_PERIOD:
559 myFrequency = parse<SUMOTime>(value);
560 break;
561 case SUMO_ATTR_NAME:
562 myAdditionalName = value;
563 break;
564 case SUMO_ATTR_OUTPUT:
565 myOutput = value;
566 break;
569 break;
571 myJamThreshold = parse<double>(value);
572 break;
573 case SUMO_ATTR_VTYPES:
574 myVTypes = parse<std::vector<std::string> >(value);
575 break;
577 setParametersStr(value);
578 break;
581 break;
582 default:
583 setCommonAttribute(key, value);
584 break;
585 }
586}
587
588
589void
591 // nothing to do
592}
593
594
595void
596GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
597 // nothing to do
598}
599
600
601/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
long long int SUMOTime
Definition GUI.h:36
@ 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
@ 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: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:751
An Element which don't belong to GNENet but has influence in the simulation.
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 (more quickly as checking GUIGlObjectStorage)
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
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
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool isCommonValid(SumoXMLAttr key, const std::string &value)
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
GNENet * myNet
pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
Dialog for edit calibrators.
std::string getAttribute(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)
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)
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.
std::vector< GNEContour * > * myCalibratorContours
calibrator contours
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
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)
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:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2163
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.
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
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
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