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-2023 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>
28
29#include "GNECalibrator.h"
30
31
32// ===========================================================================
33// member method definitions
34// ===========================================================================
35
37 GNEAdditional("", net, GLO_CALIBRATOR, tag, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "", {}, {}, {}, {}, {}, {}),
38 myPositionOverLane(0),
39 myFrequency(0),
40myJamThreshold(0) {
41 // reset default values
42 resetDefaultValues();
43}
44
45
46GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
47 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
48 GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {}, {}, {}),
49Parameterised(parameters),
50myPositionOverLane(pos),
51myFrequency(frequency),
52myOutput(output),
53myJamThreshold(jamThreshold),
54myVTypes(vTypes) {
55 // update centering boundary without updating grid
56 updateCenteringBoundary(false);
57}
58
59
60GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
61 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
62 const Parameterised::Map& parameters) :
63 GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {edge}, {}, {routeProbe}, {}, {}),
64Parameterised(parameters),
65myPositionOverLane(pos),
66myFrequency(frequency),
67myOutput(output),
68myJamThreshold(jamThreshold),
69myVTypes(vTypes) {
70 // update centering boundary without updating grid
71 updateCenteringBoundary(false);
72}
73
74
75GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
76 const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
77 GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {}, {}, {}),
78Parameterised(parameters),
79myPositionOverLane(pos),
80myFrequency(frequency),
81myOutput(output),
82myJamThreshold(jamThreshold),
83myVTypes(vTypes) {
84 // update centering boundary without updating grid
85 updateCenteringBoundary(false);
86}
87
88
89GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
90 const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
91 const Parameterised::Map& parameters) :
92 GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name, {}, {}, {lane}, {routeProbe}, {}, {}),
93Parameterised(parameters),
94myPositionOverLane(pos),
95myFrequency(frequency),
96myOutput(output),
97myJamThreshold(jamThreshold),
98myVTypes(vTypes) {
99 // update centering boundary without updating grid
100 updateCenteringBoundary(false);
101}
102
103
105
106
107void
109 // open tag
111 // write parameters
112 device.writeAttr(SUMO_ATTR_ID, getID());
113 if (getParentEdges().size() > 0) {
114 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
115 }
116 if (getParentLanes().size() > 0) {
117 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
118 }
120 if (time2string(myFrequency) != "1.00") {
122 }
123 if (!myAdditionalName.empty()) {
125 }
126 if (!myOutput.empty()) {
128 }
129 if (getParentAdditionals().size() > 0) {
131 }
132 if (myJamThreshold != 0.5) {
134 }
135 if (myVTypes.size() > 0) {
137 }
138 // write calibrator flows
139 for (const auto& calibratorFlow : getChildAdditionals()) {
140 if (calibratorFlow->getTagProperty().getTag() == GNE_TAG_CALIBRATOR_FLOW) {
141 calibratorFlow->writeAdditional(device);
142 }
143 }
144 // write parameters (Always after children to avoid problems with additionals.xsd)
145 writeParams(device);
146 device.closeTag();
147}
148
149
150bool
152 return true;
153}
154
155
156std::string
158 return "";
159}
160
161
162void
164 // nothing to fix
165}
166
167
170 // calibrators cannot be moved
171 return nullptr;
172}
173
174
175void
177 // get shape depending of we have a edge or a lane
178 if (getParentLanes().size() > 0) {
179 // update geometry
181 } else if (getParentEdges().size() > 0) {
182 // update geometry of first edge
183 myAdditionalGeometry.updateGeometry(getParentEdges().front()->getLanes().front()->getLaneShape(), myPositionOverLane, 0);
184 // clear extra geometries
186 // iterate over every lane and get point
187 for (int i = 1; i < (int)getParentEdges().front()->getLanes().size(); i++) {
188 // add new calibrator geometry
189 GUIGeometry calibratorGeometry;
190 calibratorGeometry.updateGeometry(getParentEdges().front()->getLanes().at(i)->getLaneShape(), myPositionOverLane, 0);
191 myEdgeCalibratorGeometries.push_back(calibratorGeometry);
192 }
193 } else {
194 throw ProcessError(TL("Both edges and lanes aren't defined"));
195 }
196}
197
198
203
204
205void
206GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
208 // add center
210 // grow
212}
213
214
215void
216GNECalibrator::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* newElement, GNEUndoList* undoList) {
217 if (splitPosition < myPositionOverLane) {
218 // change lane or edge
219 if (newElement->getTagProperty().getTag() == SUMO_TAG_LANE) {
220 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
221 } else {
222 setAttribute(SUMO_ATTR_EDGE, newElement->getID(), undoList);
223 }
224 // now adjust start position
225 setAttribute(SUMO_ATTR_POSITION, toString(myPositionOverLane - splitPosition), undoList);
226 }
227}
228
229
230std::string
232 // get parent name depending of we have a edge or a lane
233 if (getParentLanes().size() > 0) {
234 return getParentLanes().front()->getID();
235 } else if (getParentEdges().size() > 0) {
236 return getParentEdges().front()->getLanes().at(0)->getID();
237 } else {
238 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
239 }
240}
241
242
243void
245 // get values
246 const double exaggeration = getExaggeration(s);
247 // first check if additional has to be drawn
249 if (s.drawAdditionals(exaggeration)) {
250 // draw first symbol
252 // continue with the other symbols
253 for (const auto& edgeCalibratorGeometry : myEdgeCalibratorGeometries) {
254 drawCalibratorSymbol(s, exaggeration, edgeCalibratorGeometry.getShape().front(), edgeCalibratorGeometry.getShapeRotations().front() + 90);
255 }
256 // draw additional ID
258 // iterate over additionals and check if drawn
259 for (const auto& calibratorFlow : getChildAdditionals()) {
260 // if calibrator is being inspected or selected, then draw
263 calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
264 (myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
265 calibratorFlow->drawGL(s);
266 }
267 }
268 }
269 }
270}
271
272
273void
275 // Open calibrator dialog
276 GNECalibratorDialog calibratorDialog(this);
277}
278
279
280std::string
282 switch (key) {
283 case SUMO_ATTR_ID:
284 return getMicrosimID();
285 case SUMO_ATTR_EDGE:
286 return getParentEdges().front()->getID();
287 case SUMO_ATTR_LANE:
288 return getParentLanes().front()->getID();
291 case SUMO_ATTR_PERIOD:
293 return time2string(myFrequency);
294 case SUMO_ATTR_NAME:
295 return myAdditionalName;
296 case SUMO_ATTR_OUTPUT:
297 return myOutput;
299 if (getParentAdditionals().size() > 0) {
300 return getParentAdditionals().front()->getID();
301 } else {
302 return "";
303 }
305 return toString(myJamThreshold);
306 case SUMO_ATTR_VTYPES:
307 return toString(myVTypes);
311 return getParametersStr();
313 return "";
314 default:
315 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
316 }
317}
318
319
320double
322 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
323}
324
325
330
331
332void
333GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
334 switch (key) {
335 case SUMO_ATTR_ID:
336 case SUMO_ATTR_EDGE:
337 case SUMO_ATTR_LANE:
339 case SUMO_ATTR_PERIOD:
341 case SUMO_ATTR_NAME:
342 case SUMO_ATTR_OUTPUT:
345 case SUMO_ATTR_VTYPES:
349 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
350 break;
351 default:
352 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
353 }
354
355}
356
357
358bool
359GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
360 switch (key) {
361 case SUMO_ATTR_ID:
362 return isValidAdditionalID(value);
363 case SUMO_ATTR_EDGE:
364 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
365 return true;
366 } else {
367 return false;
368 }
369 case SUMO_ATTR_LANE:
370 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
371 return true;
372 } else {
373 return false;
374 }
376 if (canParse<double>(value)) {
377 // obtain position and check if is valid
378 const double newPosition = parse<double>(value);
379 if (isTemplate()) {
380 return (newPosition >= 0);
381 }
382 // get shape
383 PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
384 if ((newPosition < 0) || (newPosition > shape.length())) {
385 return false;
386 } else {
387 return true;
388 }
389 } else {
390 return false;
391 }
392 case SUMO_ATTR_PERIOD:
394 return canParse<SUMOTime>(value);
395 case SUMO_ATTR_NAME:
397 case SUMO_ATTR_OUTPUT:
400 if (value.empty()) {
401 return true;
402 } else {
403 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
404 }
406 return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
407 case SUMO_ATTR_VTYPES:
408 if (value.empty()) {
409 return true;
410 } else {
412 }
414 return canParse<bool>(value);
416 return areParametersValid(value);
417 default:
418 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
419 }
420}
421
422
423std::string
425 return getTagStr() + ": " + getID();
426}
427
428
429std::string
431 return getTagStr();
432}
433
434// ===========================================================================
435// private
436// ===========================================================================
437
438void
439GNECalibrator::drawCalibratorSymbol(const GUIVisualizationSettings& s, const double exaggeration, const Position& pos, const double rot) const {
440 // begin push name
442 // push layer matrix
444 // translate to front
446 // translate to position
447 glTranslated(pos.x(), pos.y(), 0);
448 // rotate over lane
450 // scale
451 glScaled(exaggeration, exaggeration, 1);
452 // set drawing mode
453 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
454 // set color
456 // avoid draw invisible elements
457 if (color.alpha() != 0) {
458 GLHelper::setColor(color);
459 // base
460 glBegin(GL_TRIANGLES);
461 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
464 glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
465 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
467 glEnd();
468 // draw text if isn't being drawn for selecting
470 // set color depending of selection status
472 // draw "C"
473 GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
474 // draw "edge" or "lane "
475 if (getParentLanes().size() > 0) {
476 GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
477 } else if (getParentEdges().size() > 0) {
478 GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
479 } else {
480 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
481 }
482 }
483 // pop layer matrix
485 // pop name
487 }
488 // check if mouse is over element
491 // inspect element
495 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
496 }
497 // front element
498 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
501 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
502 }
503 // delete contour
504 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
507 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
508 }
509 // select contour
510 if (myNet->getViewNet()->drawSelectContour(this, this)) {
513 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
514 }
515}
516
517void
518GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
519 switch (key) {
520 case SUMO_ATTR_ID:
521 // update microsimID
522 setMicrosimID(value);
523 break;
524 case SUMO_ATTR_EDGE:
526 break;
527 case SUMO_ATTR_LANE:
529 break;
531 myPositionOverLane = parse<double>(value);
532 break;
533 case SUMO_ATTR_PERIOD:
535 myFrequency = parse<SUMOTime>(value);
536 break;
537 case SUMO_ATTR_NAME:
538 myAdditionalName = value;
539 break;
540 case SUMO_ATTR_OUTPUT:
541 myOutput = value;
542 break;
545 break;
547 myJamThreshold = parse<double>(value);
548 break;
549 case SUMO_ATTR_VTYPES:
550 myVTypes = parse<std::vector<std::string> >(value);
551 break;
553 if (parse<bool>(value)) {
555 } else {
557 }
558 break;
560 setParametersStr(value);
561 break;
564 break;
565 default:
566 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
567 }
568}
569
570
571void
573 // nothing to do
574}
575
576
577void
578GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
579 // nothing to do
580}
581
582
583/****************************************************************************/
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:287
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
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:78
void reset()
Resets the boundary.
Definition Boundary.cpp:66
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:583
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void popName()
pop Name
Definition GLHelper.cpp:148
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:685
An Element which don't belong to GNENet but has influence in the simulation.
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string myAdditionalName
name of additional
Boundary myAdditionalBoundary
Additional Boundary.
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
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 drawCalibratorSymbol(const GUIVisualizationSettings &s, const double exaggeration, const Position &pos, const double rot) const
draw calibrator symbol
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 writed into XML (must be reimplemented in all detector chi...
~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
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
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:120
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static void drawDottedSquaredShape(const GUIVisualizationSettings &s, const DottedContourType type, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
GUIGlID getGlID() const
Returns the numerical id of the object.
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
GUIVisualizationColorSettings colorSettings
color settings
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
Static storage of an output device and its base (abstract) implementation.
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.
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition RGBColor.cpp:92
static const RGBColor BLACK
Definition RGBColor.h:193
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name)
static bool isValidListOfTypeID(const std::string &value)
whether the given string is a valid list of ids for an edge or vehicle type (empty aren't allowed)
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
bool showAdditionals() const
check if additionals has to be drawn
bool showSubAdditionals() const
check if show sub-additionals
static const RGBColor calibratorColor
color for Calibrators
static const double calibratorWidth
Calibrator width.
static const double calibratorHeight
Calibrator height.
RGBColor selectionColor
basic selection color
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double calibratorText
details for calibrator text