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 // first check if additional has to be drawn
265 // get values
266 const double exaggeration = getExaggeration(s);
267 // get detail level
268 const auto d = s.getDetailLevel(exaggeration);
269 // draw first calibrator symbols
270 drawCalibratorSymbol(s, d, exaggeration, myAdditionalGeometry.getShape().front(),
271 myAdditionalGeometry.getShapeRotations().front() + 90, -1);
272 // draw rest of calibrator symbols
273 for (int i = 0; i < (int)myEdgeCalibratorGeometries.size(); i++) {
274 drawCalibratorSymbol(s, d, exaggeration, myEdgeCalibratorGeometries.at(i).getShape().front(),
275 myEdgeCalibratorGeometries.at(i).getShapeRotations().front() + 90, i);
276 }
277 // draw additional ID
279 // iterate over additionals and check if drawn
280 for (const auto& calibratorFlow : getChildAdditionals()) {
281 // if calibrator is being inspected or selected, then draw
284 calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
285 (myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
286 calibratorFlow->drawGL(s);
287 }
288 }
289 }
290}
291
292
293bool
295 // get edit modes
296 const auto& editModes = myNet->getViewNet()->getEditModes();
297 // check if we're in move mode
298 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
300 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
301 // only move the first element
303 } else {
304 return false;
305 }
306}
307
308
309void
311 // Open calibrator dialog
312 GNECalibratorDialog calibratorDialog(this);
313}
314
315
316std::string
318 switch (key) {
319 case SUMO_ATTR_ID:
320 return getMicrosimID();
321 case SUMO_ATTR_EDGE:
322 return getParentEdges().front()->getID();
323 case SUMO_ATTR_LANE:
324 return getParentLanes().front()->getID();
327 case SUMO_ATTR_PERIOD:
329 return time2string(myFrequency);
330 case SUMO_ATTR_NAME:
331 return myAdditionalName;
332 case SUMO_ATTR_OUTPUT:
333 return myOutput;
335 if (getParentAdditionals().size() > 0) {
336 return getParentAdditionals().front()->getID();
337 } else {
338 return "";
339 }
341 return toString(myJamThreshold);
342 case SUMO_ATTR_VTYPES:
343 return toString(myVTypes);
347 return getParametersStr();
349 return "";
350 default:
351 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
352 }
353}
354
355
356double
358 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
359}
360
361
366
367
368void
369GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
370 switch (key) {
371 case SUMO_ATTR_ID:
372 case SUMO_ATTR_EDGE:
373 case SUMO_ATTR_LANE:
375 case SUMO_ATTR_PERIOD:
377 case SUMO_ATTR_NAME:
378 case SUMO_ATTR_OUTPUT:
381 case SUMO_ATTR_VTYPES:
385 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
386 break;
387 default:
388 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
389 }
390
391}
392
393
394bool
395GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
396 switch (key) {
397 case SUMO_ATTR_ID:
399 case SUMO_ATTR_EDGE:
400 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
401 return true;
402 } else {
403 return false;
404 }
405 case SUMO_ATTR_LANE:
406 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
407 return true;
408 } else {
409 return false;
410 }
412 if (canParse<double>(value)) {
413 // obtain position and check if is valid
414 const double newPosition = parse<double>(value);
415 if (isTemplate()) {
416 return (newPosition >= 0);
417 }
418 // get shape
419 PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
420 if ((newPosition < 0) || (newPosition > shape.length())) {
421 return false;
422 } else {
423 return true;
424 }
425 } else {
426 return false;
427 }
428 case SUMO_ATTR_PERIOD:
430 return canParse<SUMOTime>(value);
431 case SUMO_ATTR_NAME:
433 case SUMO_ATTR_OUTPUT:
436 if (value.empty()) {
437 return true;
438 } else {
439 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
440 }
442 return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
443 case SUMO_ATTR_VTYPES:
444 if (value.empty()) {
445 return true;
446 } else {
448 }
450 return canParse<bool>(value);
452 return areParametersValid(value);
453 default:
454 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
455 }
456}
457
458
459std::string
461 return getTagStr() + ": " + getID();
462}
463
464
465std::string
467 return getTagStr();
468}
469
470// ===========================================================================
471// private
472// ===========================================================================
473
474void
476 const Position& pos, const double rot, const int symbolIndex) const {
477 // draw geometry only if we'rent in drawForObjectUnderCursor mode
479 // push layer matrix
481 // translate to front
483 // translate to position
484 glTranslated(pos.x(), pos.y(), 0);
485 // rotate over lane
487 // scale
488 glScaled(exaggeration, exaggeration, 1);
489 // set drawing mode
490 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
491 // set color
493 // base
494 glBegin(GL_TRIANGLES);
495 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
498 glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
499 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
501 glEnd();
502 // draw text if isn't being drawn for selecting
504 // set color depending of selection status
506 // draw "C"
507 GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
508 // draw "edge" or "lane "
509 if (getParentLanes().size() > 0) {
510 GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
511 } else if (getParentEdges().size() > 0) {
512 GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
513 } else {
514 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
515 }
516 }
517 // pop layer matrix
519 // draw dotted contours
520 if (symbolIndex == -1) {
522 } else if (symbolIndex < (int)myCalibratorContours->size()) {
523 myCalibratorContours->at(symbolIndex)->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
524 }
525 }
526 // calculate dotted contour
527 if (symbolIndex == -1) {
529 s.additionalSettings.calibratorHeight * 0.5, getType(), 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
530 } else if (symbolIndex < (int)myCalibratorContours->size()) {
531 myCalibratorContours->at(symbolIndex)->calculateContourRectangleShape(s, d, this, pos, s.additionalSettings.calibratorWidth,
532 s.additionalSettings.calibratorHeight * 0.5, getType(), 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
533 }
534}
535
536void
537GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
538 switch (key) {
539 case SUMO_ATTR_ID:
540 // update microsimID
541 setAdditionalID(value);
542 break;
543 case SUMO_ATTR_EDGE:
545 break;
546 case SUMO_ATTR_LANE:
548 break;
550 myPositionOverLane = parse<double>(value);
551 break;
552 case SUMO_ATTR_PERIOD:
554 myFrequency = parse<SUMOTime>(value);
555 break;
556 case SUMO_ATTR_NAME:
557 myAdditionalName = value;
558 break;
559 case SUMO_ATTR_OUTPUT:
560 myOutput = value;
561 break;
564 break;
566 myJamThreshold = parse<double>(value);
567 break;
568 case SUMO_ATTR_VTYPES:
569 myVTypes = parse<std::vector<std::string> >(value);
570 break;
572 if (parse<bool>(value)) {
574 } else {
576 }
577 break;
579 setParametersStr(value);
580 break;
583 break;
584 default:
585 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
586 }
587}
588
589
590void
592 // nothing to do
593}
594
595
596void
597GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
598 // nothing to do
599}
600
601
602/****************************************************************************/
@ 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
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_ROUTEPROBE
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_NAME
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_FREQUENCY
@ SUMO_ATTR_OUTPUT
@ SUMO_ATTR_ID
@ SUMO_ATTR_POSITION
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:654
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition GLHelper.cpp:756
An Element which don't belong to GNENet but has influence in the simulation.
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string myAdditionalName
name of additional
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
Dialog for edit calibrators.
std::string getAttribute(SumoXMLAttr key) const
void 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
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
calculate contour (for rectangled elements)
void 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...)
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:125
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2147
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier 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 GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
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