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
22#include <netedit/GNENet.h>
23#include <netedit/GNESegment.h>
27
28#include "GNELaneAreaDetector.h"
29
30// ===========================================================================
31// member method definitions
32// ===========================================================================
33
34#ifdef _MSC_VER
35#pragma warning(push)
36#pragma warning(disable: 4355) // mask warning about "this" in initializers
37#endif
39 GNEDetector(net, tag),
40 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane,
41 SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
42}
43
44
45GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, const double pos, const double length, const SUMOTime freq,
46 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
47 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos,
48 const bool show, const Parameterised::Map& parameters) :
49 GNEDetector(id, net, fileBucket, SUMO_TAG_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges, detectPersons, name, parameters),
50 myStartPosOverLane(pos),
51 myEndPosPosOverLane(pos + length),
52 myFriendlyPosition(friendlyPos),
53 myTimeThreshold(timeThreshold),
54 mySpeedThreshold(speedThreshold),
55 myJamThreshold(jamThreshold),
56 myTrafficLight(trafficLight),
57 myShow(show),
58 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
59 // set parents
60 setParent<GNELane*>(lane);
61}
62#ifdef _MSC_VER
63#pragma warning(pop)
64#endif
65
66
67GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, std::vector<GNELane*> lanes, const double pos, const double endPos, const SUMOTime freq,
68 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
69 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show,
70 const Parameterised::Map& parameters) :
71 GNEDetector(id, net, fileBucket, GNE_TAG_MULTI_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges,
72 detectPersons, name, parameters),
73 myStartPosOverLane(pos),
74 myEndPosPosOverLane(endPos),
75 myFriendlyPosition(friendlyPos),
76 myTimeThreshold(timeThreshold),
77 mySpeedThreshold(speedThreshold),
78 myJamThreshold(jamThreshold),
79 myTrafficLight(trafficLight),
80 myShow(show),
81 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
82 // set parents
83 setParents<GNELane*>(lanes);
84}
85
86
90
91
96
97
100 return this;
101}
102
103
104void
107 // write common additional attributes
109 // write move atributes
111 // write common detector parameters
112 writeDetectorValues(device);
113 // write specific attributes
114 if (myTrafficLight.size() > 0) {
116 }
119 }
122 }
125 }
128 }
129 // write parameters (Always after children to avoid problems with additionals.xsd)
130 writeParams(device);
131 device.closeTag();
132}
133
134
135bool
137 // only movement problems
139}
140
141
142std::string
144 // only movement problems
146}
147
148
149void
151 // only movement problems
153}
154
155
156void
158 // check E2 detector
160 // compute path
162 } else {
163 // Cut shape using as delimitators fixed start position and fixed end position
164 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
168 }
169}
170
171
172void
174 // check drawing conditions
178 // Obtain exaggeration of the draw
179 const double E2Exaggeration = getExaggeration(s);
180 // get detail level
181 const auto d = s.getDetailLevel(E2Exaggeration);
182 // check if draw geometry points
183 const bool movingGeometryPoints = drawMovingGeometryPoints();
184 // draw geometry only if we'rent in drawForObjectUnderCursor mode
186 // draw E2
187 drawE2(s, d, E2Exaggeration, movingGeometryPoints);
188 // draw lock icon
190 // Draw additional ID
192 // draw additional name
194 // check if draw geometry points
195 if (movingGeometryPoints) {
198 } else {
200 }
201 }
202 // check if we're calculating the contour or the moving geometry points
203 if (movingGeometryPoints) {
207 }
208 if (movingGeometryPoints && (myEndPosPosOverLane != INVALID_DOUBLE)) {
211 }
212 } else {
213 // don't exaggerate contour
215 E2Exaggeration, true, true, 0, nullptr, getParentLanes().front()->getParentEdge());
216 }
217 }
218}
219
220
221void
226
227
228void
229GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
230 // check if E2 can be drawn
233 const bool movingGeometryPoints = drawMovingGeometryPoints();
234 // Obtain exaggeration of the draw
235 const double E2Exaggeration = getExaggeration(s);
236 // get detail level
237 const auto d = s.getDetailLevel(E2Exaggeration);
238 // calculate startPos
239 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_POSITION);
240 // get endPos
241 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
242 // declare path geometry
243 GUIGeometry E2Geometry;
244 // update pathGeometry depending of first and last segment
245 if (segment->isFirstSegment() && segment->isLastSegment()) {
246 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
247 geometryDepartPos,
249 geometryEndPos,
251 } else if (segment->isFirstSegment()) {
252 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
253 geometryDepartPos,
255 -1,
257 } else if (segment->isLastSegment()) {
258 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
259 -1,
261 geometryEndPos,
263 } else {
264 E2Geometry = segment->getLane()->getLaneGeometry();
265 }
266 // draw geometry only if we'rent in drawForObjectUnderCursor mode
268 // draw E2 partial
269 drawE2PartialLane(s, d, segment, offsetFront, E2Geometry, E2Exaggeration, movingGeometryPoints);
270 // draw additional ID
272 // draw dotted contour
273 if (movingGeometryPoints) {
274 // get mouse position
275 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
276 // get snap radius
278 if (segment->getFromContour() && E2Geometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
280 } else if (segment->getToContour() && E2Geometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
282 }
283 } else {
284 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
285 }
286 }
287 // calculate contour and draw dotted geometry
288 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width,
289 E2Exaggeration, segment->isFirstSegment(), segment->isLastSegment(), 0, segment, segment->getLane()->getParentEdge());
290 // check if create from-to contours
291 if (segment->getFromContour()) {
292 segment->getFromContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().front(),
294 } else if (segment->getToContour()) {
295 segment->getToContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().back(),
297 }
298 // check if add this path element to redraw buffer
301 }
302 }
303}
304
305
306void
307GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
308 // check if E2 can be drawn
309 if ((myTagProperty->getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && segment->getPreviousLane() && segment->getNextLane() &&
311 // Obtain exaggeration of the draw
312 const double E2Exaggeration = getExaggeration(s);
313 // get detail level
314 const auto d = s.getDetailLevel(E2Exaggeration);
315 // get flag for show only contour
317 // check if connection to next lane exist
318 const bool connectionExist = segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane());
319 // get geometry
320 const GUIGeometry& E2Geometry = connectionExist ? segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()) :
321 GUIGeometry({segment->getPreviousLane()->getLaneShape().back(), segment->getNextLane()->getLaneShape().front()});
322 // draw geometry only if we'rent in drawForObjectUnderCursor mode
324 // draw E2 partial
325 drawE2PartialJunction(s, d, onlyContour, offsetFront, E2Geometry, E2Exaggeration);
326 // draw dotted contour
328 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
329 }
330 }
331 // calculate contour
332 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width, E2Exaggeration,
333 false, false, 0, segment, segment->getJunction());
334 // check if add this path element to redraw buffer
337 }
338 }
339}
340
341
342std::string
365
366
367double
369 switch (key) {
371 return myStartPosOverLane;
372 case SUMO_ATTR_ENDPOS:
373 return myEndPosPosOverLane;
374 case SUMO_ATTR_LENGTH:
376 default:
377 return getDetectorAttributeDouble(key);
378 }
379}
380
381
386
387
392
393
394void
395GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
396 switch (key) {
398 case SUMO_ATTR_ENDPOS:
399 case SUMO_ATTR_TLID:
400 case SUMO_ATTR_LENGTH:
405 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
406 break;
407 default:
408 setDetectorAttribute(key, value, undoList);
409 break;
410 }
411}
412
413
414bool
415GNELaneAreaDetector::isValid(SumoXMLAttr key, const std::string& value) {
416 switch (key) {
418 case SUMO_ATTR_ENDPOS:
419 return canParse<double>(value);
420 case SUMO_ATTR_TLID:
421 // temporal
423 case SUMO_ATTR_LENGTH:
424 return (canParse<double>(value) && (parse<double>(value) >= 0));
426 return canParse<SUMOTime>(value) && (parse<SUMOTime>(value) >= 0);
428 return (canParse<double>(value) && (parse<double>(value) >= 0));
430 return (canParse<double>(value) && (parse<double>(value) >= 0));
432 return canParse<bool>(value);
433 default:
434 return isDetectorValid(key, value);
435 }
436}
437
438// ===========================================================================
439// private
440// ===========================================================================
441
442void
444 const double exaggeration, const bool movingGeometryPoints) const {
445 // declare color
446 RGBColor E2Color, textColor;
447 // set color
448 if (drawUsingSelectColor()) {
450 textColor = E2Color.changedBrightness(-32);
451 } else if (areLaneConsecutives(getParentLanes())) {
452 E2Color = s.detectorSettings.E2Color;
453 textColor = RGBColor::BLACK;
454 }
455 // draw parent and child lines
457 // push layer matrix
459 // translate to front
461 // set color
462 GLHelper::setColor(E2Color);
463 // draw geometry
465 // draw arrow
466 if (myAdditionalGeometry.getShape().size() > 1) {
467 glTranslated(0, 0, 0.1);
469 }
470 // draw E2 Logo
471 drawE2DetectorLogo(s, d, exaggeration, "E2", textColor);
472 // check if draw geometry points
473 if (movingGeometryPoints) {
476 }
477 // pop layer matrix
479}
480
481
482void
484 const GNESegment* segment, const double offsetFront,
485 const GUIGeometry& geometry, const double exaggeration, const bool movingGeometryPoints) const {
486 // obtain color
488 // push layer matrix
490 // Start with the drawing of the area traslating matrix to origin
491 glTranslated(0, 0, getType() + offsetFront);
492 // Set color
493 GLHelper::setColor(E2Color);
494 // draw geometry
495 GUIGeometry::drawGeometry(d, geometry, s.detectorSettings.E2Width * exaggeration);
496 // check if draw moving geometry points
497 if (movingGeometryPoints) {
498 if (segment->isFirstSegment()) {
499 // calculate and draw left geometry point
502 drawLeftGeometryPoint(s, d, geometry.getShape().front(), geometry.getShapeRotations().front(), E2Color, true);
503 }
504 if (segment->isLastSegment()) {
505 // calculate and draw right geometry point
508 drawRightGeometryPoint(s, d, geometry.getShape().back(), geometry.getShapeRotations().back(), E2Color, true);
509 // draw arrow
510 if (geometry.getShape().size() > 1) {
511 glTranslated(0, 0, 0.1);
512 GLHelper::drawTriangleAtEnd(geometry.getShape()[-2], geometry.getShape()[-1], (double) 0.5, (double) 1, 0.5);
513 }
514 }
515 }
516 // Pop layer matrix
518 // check if this is the label segment
519 if (segment->isLabelSegment()) {
520 // calculate middle point
521 const double middlePoint = (geometry.getShape().length2D() * 0.5);
522 // calculate position
523 const Position pos = geometry.getShape().positionAtOffset2D(middlePoint);
524 // calculate rotation
525 const double rot = s.getTextAngle((geometry.getShape().rotationDegreeAtOffset(middlePoint) * -1) + 90);
526 // Start pushing matrix
528 // Traslate to position
529 glTranslated(pos.x(), pos.y(), getType() + offsetFront + 0.1);
530 // rotate
531 glRotated(rot, 0, 0, 1);
532 // move
533 glTranslated(-1, 0, 0);
534 // scale text
535 glScaled(exaggeration, exaggeration, 1);
536 // draw E1 logo
537 GLHelper::drawText("E2 Multilane", Position(), .1, 1.5, RGBColor::BLACK);
538 // pop matrix
540 }
541
542}
543
544
545void
547 const bool onlyContour, const double offsetFront, const GUIGeometry& geometry,
548 const double exaggeration) const {
549 const bool invalid = geometry.getShape().length() == 2;
550 const double width = s.detectorSettings.E2Width * exaggeration * (invalid ? 0.5 : 1);
551 // Add a draw matrix
553 // Start with the drawing of the area traslating matrix to origin
554 glTranslated(0, 0, getType() + offsetFront);
555 // Set color of the base
556 if (drawUsingSelectColor()) {
558 } else if (invalid) {
560 } else {
562 }
563 // check if draw only contour
564 if (onlyContour) {
565 GUIGeometry::drawContourGeometry(geometry, width);
566 } else {
567 GUIGeometry::drawGeometry(d, geometry, width);
568 }
569 // Pop last matrix
571}
572
573
574void
575GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value) {
576 switch (key) {
577 case SUMO_ATTR_LANE:
578 case SUMO_ATTR_LANES:
580 break;
582 myStartPosOverLane = parse<double>(value);
583 // update geometry (except for template)
584 if (getParentLanes().size() > 0) {
586 }
587 break;
588 case SUMO_ATTR_ENDPOS:
589 myEndPosPosOverLane = parse<double>(value);
590 // update geometry (except for template)
591 if (getParentLanes().size() > 0) {
593 }
594 break;
595 case SUMO_ATTR_TLID:
596 myTrafficLight = value;
597 break;
598 case SUMO_ATTR_LENGTH:
599 myEndPosPosOverLane = (myStartPosOverLane + parse<double>(value));
600 // update geometry (except for template)
601 if (getParentLanes().size() > 0) {
603 }
604 break;
606 myTimeThreshold = TIME2STEPS(parse<double>(value));
607 break;
609 mySpeedThreshold = parse<double>(value);
610 break;
612 myJamThreshold = parse<double>(value);
613 break;
615 myShow = parse<bool>(value);
616 break;
617 default:
618 setDetectorAttribute(key, value);
619 break;
620 }
621}
622
623/****************************************************************************/
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:91
#define TIME2STEPS(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:49
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:232
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:666
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition GNELane.cpp:226
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:214
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)
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
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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:200
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
static const RGBColor RED
named colors
Definition RGBColor.h:192
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
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
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