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 (myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
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);
348 return getParametersStr();
350 return "";
351 default:
352 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
353 }
354}
355
356
357double
359 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
360}
361
362
367
368
369void
370GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
371 switch (key) {
372 case SUMO_ATTR_ID:
373 case SUMO_ATTR_EDGE:
374 case SUMO_ATTR_LANE:
376 case SUMO_ATTR_PERIOD:
378 case SUMO_ATTR_NAME:
379 case SUMO_ATTR_OUTPUT:
382 case SUMO_ATTR_VTYPES:
386 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
387 break;
388 default:
389 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
390 }
391
392}
393
394
395bool
396GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
397 switch (key) {
398 case SUMO_ATTR_ID:
400 case SUMO_ATTR_EDGE:
401 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
402 return true;
403 } else {
404 return false;
405 }
406 case SUMO_ATTR_LANE:
407 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
408 return true;
409 } else {
410 return false;
411 }
413 if (canParse<double>(value)) {
414 // obtain position and check if is valid
415 const double newPosition = parse<double>(value);
416 if (isTemplate()) {
417 return (newPosition >= 0);
418 }
419 // get shape
420 PositionVector shape = (getParentLanes().size() > 0) ? getParentLanes().front()->getLaneShape() : getParentEdges().front()->getLanes().at(0)->getLaneShape();
421 if ((newPosition < 0) || (newPosition > shape.length())) {
422 return false;
423 } else {
424 return true;
425 }
426 } else {
427 return false;
428 }
429 case SUMO_ATTR_PERIOD:
431 return canParse<SUMOTime>(value);
432 case SUMO_ATTR_NAME:
434 case SUMO_ATTR_OUTPUT:
437 if (value.empty()) {
438 return true;
439 } else {
440 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
441 }
443 return canParse<double>(value) ? (parse<double>(value) >= 0) : false;
444 case SUMO_ATTR_VTYPES:
445 if (value.empty()) {
446 return true;
447 } else {
449 }
451 return canParse<bool>(value);
453 return areParametersValid(value);
454 default:
455 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
456 }
457}
458
459
460std::string
462 return getTagStr() + ": " + getID();
463}
464
465
466std::string
468 return getTagStr();
469}
470
471// ===========================================================================
472// private
473// ===========================================================================
474
475void
477 const Position& pos, const double rot, const int symbolIndex) const {
478 // draw geometry only if we'rent in drawForObjectUnderCursor mode
480 // push layer matrix
482 // translate to front
484 // translate to position
485 glTranslated(pos.x(), pos.y(), 0);
486 // rotate over lane
488 // scale
489 glScaled(exaggeration, exaggeration, 1);
490 // set drawing mode
491 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
492 // set color
494 // base
495 glBegin(GL_TRIANGLES);
496 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
499 glVertex2d(0 + s.additionalSettings.calibratorWidth, 0);
500 glVertex2d(0 - s.additionalSettings.calibratorWidth, 0);
502 glEnd();
503 // draw text if isn't being drawn for selecting
505 // set color depending of selection status
507 // draw "C"
508 GLHelper::drawText("C", Position(0, 1.5), 0.1, 3, textColor, 180);
509 // draw "edge" or "lane "
510 if (getParentLanes().size() > 0) {
511 GLHelper::drawText("lane", Position(0, 3), .1, 1, textColor, 180);
512 } else if (getParentEdges().size() > 0) {
513 GLHelper::drawText("edge", Position(0, 3), .1, 1, textColor, 180);
514 } else {
515 throw ProcessError(TL("Both myEdge and myLane aren't defined"));
516 }
517 }
518 // pop layer matrix
520 // draw dotted contours
521 if (symbolIndex == -1) {
523 } else if (symbolIndex < (int)myCalibratorContours->size()) {
524 myCalibratorContours->at(symbolIndex)->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
525 }
526 }
527 // calculate dotted contour
528 if (symbolIndex == -1) {
530 s.additionalSettings.calibratorHeight * 0.5, getType(), 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
531 } else if (symbolIndex < (int)myCalibratorContours->size()) {
532 myCalibratorContours->at(symbolIndex)->calculateContourRectangleShape(s, d, this, pos, s.additionalSettings.calibratorWidth,
533 s.additionalSettings.calibratorHeight * 0.5, getType(), 0, s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration);
534 }
535}
536
537void
538GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
539 switch (key) {
540 case SUMO_ATTR_ID:
541 // update microsimID
542 setAdditionalID(value);
543 break;
544 case SUMO_ATTR_EDGE:
546 break;
547 case SUMO_ATTR_LANE:
549 break;
551 myPositionOverLane = parse<double>(value);
552 break;
553 case SUMO_ATTR_PERIOD:
555 myFrequency = parse<SUMOTime>(value);
556 break;
557 case SUMO_ATTR_NAME:
558 myAdditionalName = value;
559 break;
560 case SUMO_ATTR_OUTPUT:
561 myOutput = value;
562 break;
565 break;
567 myJamThreshold = parse<double>(value);
568 break;
569 case SUMO_ATTR_VTYPES:
570 myVTypes = parse<std::vector<std::string> >(value);
571 break;
573 if (parse<bool>(value)) {
575 } else {
577 }
578 break;
580 setParametersStr(value);
581 break;
584 break;
585 default:
586 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
587 }
588}
589
590
591void
593 // nothing to do
594}
595
596
597void
598GNECalibrator::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
599 // nothing to do
600}
601
602
603/****************************************************************************/
@ 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:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2155
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 GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
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
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
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