Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNELaneAreaDetector.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-2026 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 <config.h>
21
23
24#include <netedit/GNENet.h>
25#include <netedit/GNESegment.h>
29
30#include "GNELaneAreaDetector.h"
31
32// ===========================================================================
33// member method definitions
34// ===========================================================================
35
36#ifdef _MSC_VER
37#pragma warning(push)
38#pragma warning(disable: 4355) // mask warning about "this" in initializers
39#endif
41 GNEDetector(net, tag),
42 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane,
43 SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
44}
45
46
47GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, const double pos, const double length, const SUMOTime freq,
48 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
49 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos,
50 const bool show, const Parameterised::Map& parameters) :
51 GNEDetector(id, net, fileBucket, SUMO_TAG_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges, detectPersons, name, parameters),
52 myStartPosOverLane(pos),
53 myEndPosPosOverLane(pos + length),
54 myFriendlyPosition(friendlyPos),
55 myTimeThreshold(timeThreshold),
56 mySpeedThreshold(speedThreshold),
57 myJamThreshold(jamThreshold),
58 myTrafficLight(trafficLight),
59 myShow(show),
60 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
61 // set parents
62 setParent<GNELane*>(lane);
63}
64
65
66GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, std::vector<GNELane*> lanes, const double pos, const double endPos, const SUMOTime freq,
67 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
68 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show,
69 const Parameterised::Map& parameters) :
70 GNEDetector(id, net, fileBucket, GNE_TAG_MULTI_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges,
71 detectPersons, name, parameters),
72 myStartPosOverLane(pos),
73 myEndPosPosOverLane(endPos),
74 myFriendlyPosition(friendlyPos),
75 myTimeThreshold(timeThreshold),
76 mySpeedThreshold(speedThreshold),
77 myJamThreshold(jamThreshold),
78 myTrafficLight(trafficLight),
79 myShow(show),
80 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
81 // set parents
82 setParents<GNELane*>(lanes);
83}
84#ifdef _MSC_VER
85#pragma warning(pop)
86#endif
87
88
92
93
98
99
102 return this;
103}
104
105
106void
109 // write common additional attributes
111 // write move atributes
113 // write common detector parameters
114 writeDetectorValues(device);
115 // write specific attributes
116 if (myTrafficLight.size() > 0) {
118 }
121 }
124 }
127 }
130 }
131 // write parameters (Always after children to avoid problems with additionals.xsd)
132 XMLHelpers::writeParams(device, *this);
133 device.closeTag();
134}
135
136
137bool
139 // only movement problems
141}
142
143
144std::string
146 // only movement problems
148}
149
150
151void
153 // only movement problems
155}
156
157
158void
160 // check E2 detector
162 // compute path
164 } else {
165 // Cut shape using as delimitators fixed start position and fixed end position
166 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
170 }
171}
172
173
174void
176 // check drawing conditions
180 // Obtain exaggeration of the draw
181 const double E2Exaggeration = getExaggeration(s);
182 // get detail level
183 const auto d = s.getDetailLevel(E2Exaggeration);
184 // check if draw geometry points
185 const bool movingGeometryPoints = drawMovingGeometryPoints();
186 // draw geometry only if we'rent in drawForObjectUnderCursor mode
188 // draw E2
189 drawE2(s, d, E2Exaggeration, movingGeometryPoints);
190 // draw lock icon
192 // Draw additional ID
194 // draw additional name
196 // check if draw geometry points
197 if (movingGeometryPoints) {
200 } else {
202 }
203 }
204 // check if we're calculating the contour or the moving geometry points
205 if (movingGeometryPoints) {
209 }
210 if (movingGeometryPoints && (myEndPosPosOverLane != INVALID_DOUBLE)) {
213 }
214 } else {
215 // don't exaggerate contour
217 E2Exaggeration, true, true, 0, nullptr, getParentLanes().front()->getParentEdge());
218 }
219 }
220}
221
222
223void
228
229
230void
231GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
232 // check if E2 can be drawn
235 const bool movingGeometryPoints = drawMovingGeometryPoints();
236 // Obtain exaggeration of the draw
237 const double E2Exaggeration = getExaggeration(s);
238 // get detail level
239 const auto d = s.getDetailLevel(E2Exaggeration);
240 // calculate startPos
241 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_POSITION);
242 // get endPos
243 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
244 // declare path geometry
245 GUIGeometry E2Geometry;
246 // update pathGeometry depending of first and last segment
247 if (segment->isFirstSegment() && segment->isLastSegment()) {
248 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
249 geometryDepartPos,
251 geometryEndPos,
253 } else if (segment->isFirstSegment()) {
254 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
255 geometryDepartPos,
257 -1,
259 } else if (segment->isLastSegment()) {
260 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
261 -1,
263 geometryEndPos,
265 } else {
266 E2Geometry = segment->getLane()->getLaneGeometry();
267 }
268 // draw geometry only if we'rent in drawForObjectUnderCursor mode
270 // draw E2 partial
271 drawE2PartialLane(s, d, segment, offsetFront, E2Geometry, E2Exaggeration, movingGeometryPoints);
272 // draw additional ID
274 // draw dotted contour
275 if (movingGeometryPoints) {
276 // get mouse position
277 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
278 // get snap radius
280 if (segment->getFromContour() && E2Geometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
282 } else if (segment->getToContour() && E2Geometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
284 }
285 } else {
286 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
287 }
288 }
289 // calculate contour and draw dotted geometry
290 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width,
291 E2Exaggeration, segment->isFirstSegment(), segment->isLastSegment(), 0, segment, segment->getLane()->getParentEdge());
292 // check if create from-to contours
293 if (segment->getFromContour()) {
294 segment->getFromContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().front(),
296 } else if (segment->getToContour()) {
297 segment->getToContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().back(),
299 }
300 // check if add this path element to redraw buffer
303 }
304 }
305}
306
307
308void
309GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
310 // check if E2 can be drawn
311 if ((myTagProperty->getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && segment->getPreviousLane() && segment->getNextLane() &&
313 // Obtain exaggeration of the draw
314 const double E2Exaggeration = getExaggeration(s);
315 // get detail level
316 const auto d = s.getDetailLevel(E2Exaggeration);
317 // get flag for show only contour
318 const bool onlyContour = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() ? myNet->getViewNet()->getNetworkViewOptions().showConnections(nullptr) : false;
319 // check if connection to next lane exist
320 const bool connectionExist = segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane());
321 // get geometry
322 const GUIGeometry& E2Geometry = connectionExist ? segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()) :
323 GUIGeometry({segment->getPreviousLane()->getLaneShape().back(), segment->getNextLane()->getLaneShape().front()});
324 // draw geometry only if we'rent in drawForObjectUnderCursor mode
326 // draw E2 partial
327 drawE2PartialJunction(s, d, onlyContour, offsetFront, E2Geometry, E2Exaggeration);
328 // draw dotted contour
330 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
331 }
332 }
333 // calculate contour
334 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width, E2Exaggeration,
335 false, false, 0, segment, segment->getJunction());
336 // check if add this path element to redraw buffer
339 }
340 }
341}
342
343
344std::string
367
368
369double
371 switch (key) {
373 return myStartPosOverLane;
374 case SUMO_ATTR_ENDPOS:
375 return myEndPosPosOverLane;
376 case SUMO_ATTR_LENGTH:
378 default:
379 return getDetectorAttributeDouble(key);
380 }
381}
382
383
388
389
394
395
396void
397GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
398 switch (key) {
400 case SUMO_ATTR_ENDPOS:
401 case SUMO_ATTR_TLID:
402 case SUMO_ATTR_LENGTH:
407 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
408 break;
409 default:
410 setDetectorAttribute(key, value, undoList);
411 break;
412 }
413}
414
415
416bool
417GNELaneAreaDetector::isValid(SumoXMLAttr key, const std::string& value) {
418 switch (key) {
420 case SUMO_ATTR_ENDPOS:
421 return canParse<double>(value);
422 case SUMO_ATTR_TLID:
423 // temporal
424 return StringUtils::isValidNetID(value);
425 case SUMO_ATTR_LENGTH:
426 return (canParse<double>(value) && (parse<double>(value) >= 0));
428 return canParse<SUMOTime>(value) && (parse<SUMOTime>(value) >= 0);
430 return (canParse<double>(value) && (parse<double>(value) >= 0));
432 return (canParse<double>(value) && (parse<double>(value) >= 0));
434 return canParse<bool>(value);
435 default:
436 return isDetectorValid(key, value);
437 }
438}
439
440// ===========================================================================
441// private
442// ===========================================================================
443
444void
446 const double exaggeration, const bool movingGeometryPoints) const {
447 // declare color
448 RGBColor E2Color, textColor;
449 // set color
450 if (drawUsingSelectColor()) {
452 textColor = E2Color.changedBrightness(-32);
453 } else if (areLaneConsecutives(getParentLanes())) {
454 E2Color = s.detectorSettings.E2Color;
455 textColor = RGBColor::BLACK;
456 }
457 // draw parent and child lines
459 // push layer matrix
461 // translate to front
463 // set color
464 GLHelper::setColor(E2Color);
465 // draw geometry
467 // draw arrow
468 if (myAdditionalGeometry.getShape().size() > 1) {
469 glTranslated(0, 0, 0.1);
471 }
472 // draw E2 Logo
473 drawE2DetectorLogo(s, d, exaggeration, "E2", textColor);
474 // check if draw geometry points
475 if (movingGeometryPoints) {
478 }
479 // pop layer matrix
481}
482
483
484void
486 const GNESegment* segment, const double offsetFront,
487 const GUIGeometry& geometry, const double exaggeration, const bool movingGeometryPoints) const {
488 // obtain color
490 // push layer matrix
492 // Start with the drawing of the area translating matrix to origin
493 glTranslated(0, 0, getType() + offsetFront);
494 // Set color
495 GLHelper::setColor(E2Color);
496 // draw geometry
497 GUIGeometry::drawGeometry(d, geometry, s.detectorSettings.E2Width * exaggeration);
498 // check if draw moving geometry points
499 if (movingGeometryPoints) {
500 if (segment->isFirstSegment()) {
501 // calculate and draw left geometry point
504 drawLeftGeometryPoint(s, d, geometry.getShape().front(), geometry.getShapeRotations().front(), E2Color, true);
505 }
506 if (segment->isLastSegment()) {
507 // calculate and draw right geometry point
510 drawRightGeometryPoint(s, d, geometry.getShape().back(), geometry.getShapeRotations().back(), E2Color, true);
511 // draw arrow
512 if (geometry.getShape().size() > 1) {
513 glTranslated(0, 0, 0.1);
514 GLHelper::drawTriangleAtEnd(geometry.getShape()[-2], geometry.getShape()[-1], (double) 0.5, (double) 1, 0.5);
515 }
516 }
517 }
518 // Pop layer matrix
520 // check if this is the label segment
521 if (segment->isLabelSegment()) {
522 // calculate middle point
523 const double middlePoint = (geometry.getShape().length2D() * 0.5);
524 // calculate position
525 const Position pos = geometry.getShape().positionAtOffset2D(middlePoint);
526 // calculate rotation
527 const double rot = s.getTextAngle((geometry.getShape().rotationDegreeAtOffset(middlePoint) * -1) + 90);
528 // Start pushing matrix
530 // Translate to position
531 glTranslated(pos.x(), pos.y(), getType() + offsetFront + 0.1);
532 // rotate
533 glRotated(rot, 0, 0, 1);
534 // move
535 glTranslated(-1, 0, 0);
536 // scale text
537 glScaled(exaggeration, exaggeration, 1);
538 // draw E1 logo
539 GLHelper::drawText("E2 Multilane", Position(), .1, 1.5, RGBColor::BLACK);
540 // pop matrix
542 }
543
544}
545
546
547void
549 const bool onlyContour, const double offsetFront, const GUIGeometry& geometry,
550 const double exaggeration) const {
551 const bool invalid = geometry.getShape().length() == 2;
552 const double width = s.detectorSettings.E2Width * exaggeration * (invalid ? 0.5 : 1);
553 // Add a draw matrix
555 // Start with the drawing of the area translating matrix to origin
556 glTranslated(0, 0, getType() + offsetFront);
557 // Set color of the base
558 if (drawUsingSelectColor()) {
560 } else if (invalid) {
562 } else {
564 }
565 // check if draw only contour
566 if (onlyContour) {
567 GUIGeometry::drawContourGeometry(geometry, width);
568 } else {
569 GUIGeometry::drawGeometry(d, geometry, width);
570 }
571 // Pop last matrix
573}
574
575
576void
577GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value) {
578 switch (key) {
579 case SUMO_ATTR_LANE:
580 case SUMO_ATTR_LANES:
582 break;
584 myStartPosOverLane = parse<double>(value);
585 // update geometry (except for template)
586 if (getParentLanes().size() > 0) {
588 }
589 break;
590 case SUMO_ATTR_ENDPOS:
591 myEndPosPosOverLane = parse<double>(value);
592 // update geometry (except for template)
593 if (getParentLanes().size() > 0) {
595 }
596 break;
597 case SUMO_ATTR_TLID:
598 myTrafficLight = value;
599 break;
600 case SUMO_ATTR_LENGTH:
601 myEndPosPosOverLane = (myStartPosOverLane + parse<double>(value));
602 // update geometry (except for template)
603 if (getParentLanes().size() > 0) {
605 }
606 break;
608 myTimeThreshold = TIME2STEPS(parse<double>(value));
609 break;
611 mySpeedThreshold = parse<double>(value);
612 break;
614 myJamThreshold = parse<double>(value);
615 break;
617 myShow = parse<bool>(value);
618 break;
619 default:
620 setDetectorAttribute(key, value);
621 break;
622 }
623}
624
625/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ GLO_E2DETECTOR
a E2 detector
GUIViewObjectsHandler gViewObjectsHandler
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
constexpr SUMOTime TIME2STEPS(double x)
Definition SUMOTime.h:60
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_LANES
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_SHOW_DETECTOR
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_POSITION
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
Definition GLHelper.cpp:624
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition GLHelper.cpp:742
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
GNEContour myAdditionalContour
variable used for draw additional contours
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
bool drawMovingGeometryPoints() const
check if draw moving geometry points
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
GNENet * myNet
pointer to net
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
void calculateContourLastGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool forceCalculation=false) const
calculate contour for last geometry point
void drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (circle elements)
void calculateContourFirstGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool forceCalculation=false) const
calculate contour for first geometry point
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...)
bool checkDrawPathContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC) const
drawing contour functions
void drawE2DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E2 detector Logo
Position getDetectorAttributePosition(SumoXMLAttr key) const
bool isDetectorValid(SumoXMLAttr key, const std::string &value)
void setDetectorAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
double getDetectorAttributeDouble(SumoXMLAttr key) const
void writeDetectorValues(OutputDevice &device) const
write additional element into a xml file
std::string getDetectorAttribute(SumoXMLAttr key) const
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given toLane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
void fixAdditionalProblem() override
fix additional problem
void computePathElement() override
compute pathElement
double myEndPosPosOverLane
The end position over lane.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Position getAttributePosition(SumoXMLAttr key) const override
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this GNEAdditional
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
GNEMoveElementLaneDouble * myMoveElementLaneDouble
move element lane double
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool myShow
show or hidde detector in sumo-gui
double getAttributeDouble(SumoXMLAttr key) const override
void drawE2PartialLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNESegment *segment, const double offsetFront, const GUIGeometry &geometry, const double exaggeration, const bool movingGeometryPoints) const
draw E2 partial lane
std::string getAttribute(SumoXMLAttr key) const override
double myStartPosOverLane
The start position over lane.
GNELaneAreaDetector(SumoXMLTag tag, GNENet *net)
default Constructor
void updateGeometry() override
update pre-computed geometry information
void drawE2(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool drawGeometryPoints) const
draw E2 detector
Parameterised * getParameters() override
get parameters associated with this GNEAdditional
bool isValid(SumoXMLAttr key, const std::string &value) override
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
bool isAdditionalValid() const override
check if current additional is valid to be written into XML
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
void drawE2PartialJunction(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool onlyContour, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw E2 partial junction
std::string getAdditionalProblem() const override
return a string with the current additional problem
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:234
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:683
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition GNELane.cpp:228
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:216
double myMovingLateralOffset
move element lateral offset
void fixMovingProblem()
fix moving problem
double getEndFixedPositionOverLane(const bool adjustGeometryFactor) const
get end offset position over lane
std::string getMovingProblem() const
return a string with the current moving problem
bool isMoveElementValid() const
check if current moving element is valid to be written into XML
double getStartFixedPositionOverLane(const bool adjustGeometryFactor) const
get start offset position over lane
void writeMoveAttributes(OutputDevice &device, const bool writeLength) const
write move attributes
GNEPathManager * getNetworkPathManager()
get network path manager
Definition GNENet.cpp:192
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
void calculateConsecutivePathLanes(GNEPathElement *pathElement, const std::vector< GNELane * > &lanes)
calculate consecutive path lanes
const GNELane * getLane() const
get lane associated with this segment
const GNEJunction * getJunction() const
get junction associated with this segment
const GNELane * getNextLane() const
get next lane
const GNELane * getPreviousLane() const
get previous lane
GNEContour * getFromContour() const
get from contour associated with segment (only if this is the first path segment)
bool isFirstSegment() const
check if segment is the first path's segment
GNEContour * getContour() const
bool isLastSegment() const
check if segment is the last path's segment
bool isLabelSegment() const
check if segment is label segment
GNEContour * getToContour() const
get to contour associated with segment (only if this is the last path segment)
bool getDefaultBoolValue(SumoXMLAttr attr) const
get default bool value
double getDefaultDoubleValue(SumoXMLAttr attr) const
get default double value
SUMOTime getDefaultTimeValue(SumoXMLAttr attr) const
get default time value
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
bool selectingDetectorsTLSMode() const
check if we're selecting detectors in TLS mode
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawContourGeometry(const GUIGeometry &geometry, const double width, const bool drawExtremes=false)
draw contour geometry
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
virtual Position getCenter() const
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
void addToRedrawPathElements(const GNEPathElement *pathElement)
add path element to redrawing set
bool isPathElementMarkForRedraw(const GNEPathElement *pathElement) const
check if the given path element has to be redraw again
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
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
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
GUIVisualizationDetectorSettings detectorSettings
Detector settings.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:323
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
A list of positions.
double length2D() const
Returns the length.
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
static const RGBColor BLACK
Definition RGBColor.h:212
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:228
static const RGBColor RED
named colors
Definition RGBColor.h:204
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
static OutputDevice & writeParams(OutputDevice &device, const Parameterised &params)
write the parameters of the given object as param tags
bool showAdditionals() const
check if additionals has to be drawn
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showConnections(const GNEConnection *connection) const
check if select show connections checkbox is enabled
static const RGBColor connectionColor
connection color
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const RGBColor E2Color
color for E2 detectors
static const double E2Width
E2 detector widths.
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double additionalGeometryPointRadius
moving additional geometry point radius