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-2025 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
21#include <netedit/GNENet.h>
22#include <netedit/GNESegment.h>
26
27#include "GNELaneAreaDetector.h"
28
29// ===========================================================================
30// member method definitions
31// ===========================================================================
32
34 GNEDetector(net, tag),
35 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane,
36 SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
37}
38
39
40GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double pos, const double length, const SUMOTime freq,
41 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
42 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos,
43 const bool show, const Parameterised::Map& parameters) :
44 GNEDetector(id, net, filename, SUMO_TAG_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges, detectPersons, name, parameters),
45 myStartPosOverLane(pos),
46 myEndPosPosOverLane(pos + length),
47 myFriendlyPosition(friendlyPos),
48 myTimeThreshold(timeThreshold),
49 mySpeedThreshold(speedThreshold),
50 myJamThreshold(jamThreshold),
51 myTrafficLight(trafficLight),
52 myShow(show),
53 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
54 // set parents
55 setParent<GNELane*>(lane);
56}
57
58
59GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, const std::string& filename, std::vector<GNELane*> lanes, const double pos, const double endPos, const SUMOTime freq,
60 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
61 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show,
62 const Parameterised::Map& parameters) :
63 GNEDetector(id, net, filename, GNE_TAG_MULTI_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges,
64 detectPersons, name, parameters),
65 myStartPosOverLane(pos),
66 myEndPosPosOverLane(endPos),
67 myFriendlyPosition(friendlyPos),
68 myTimeThreshold(timeThreshold),
69 mySpeedThreshold(speedThreshold),
70 myJamThreshold(jamThreshold),
71 myTrafficLight(trafficLight),
72 myShow(show),
73 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
74 // set parents
75 setParents<GNELane*>(lanes);
76}
77
78
82
83
88
89
92 return this;
93}
94
95
96void
99 // write common additional attributes
101 // write move atributes
103 // write common detector parameters
104 writeDetectorValues(device);
105 // write specific attributes
106 if (myTrafficLight.size() > 0) {
108 }
111 }
114 }
117 }
120 }
121 // write parameters (Always after children to avoid problems with additionals.xsd)
122 writeParams(device);
123 device.closeTag();
124}
125
126
127bool
129 // only movement problems
131}
132
133
134std::string
136 // only movement problems
138}
139
140
141void
143 // only movement problems
145}
146
147
148void
150 // check E2 detector
152 // compute path
154 } else {
155 // Cut shape using as delimitators fixed start position and fixed end position
156 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
160 }
161}
162
163
164void
166 // check drawing conditions
170 // Obtain exaggeration of the draw
171 const double E2Exaggeration = getExaggeration(s);
172 // get detail level
173 const auto d = s.getDetailLevel(E2Exaggeration);
174 // check if draw geometry points
175 const bool movingGeometryPoints = drawMovingGeometryPoints();
176 // draw geometry only if we'rent in drawForObjectUnderCursor mode
178 // draw E2
179 drawE2(s, d, E2Exaggeration, movingGeometryPoints);
180 // draw lock icon
182 // Draw additional ID
184 // draw additional name
186 // check if draw geometry points
187 if (movingGeometryPoints) {
190 } else {
192 }
193 }
194 // check if we're calculating the contour or the moving geometry points
195 if (movingGeometryPoints) {
199 }
200 if (movingGeometryPoints && (myEndPosPosOverLane != INVALID_DOUBLE)) {
203 }
204 } else {
205 // don't exaggerate contour
207 E2Exaggeration, true, true, 0, nullptr, getParentLanes().front()->getParentEdge());
208 }
209 }
210}
211
212
213void
218
219
220void
221GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
222 // check if E2 can be drawn
225 const bool movingGeometryPoints = drawMovingGeometryPoints();
226 // Obtain exaggeration of the draw
227 const double E2Exaggeration = getExaggeration(s);
228 // get detail level
229 const auto d = s.getDetailLevel(E2Exaggeration);
230 // calculate startPos
231 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_POSITION);
232 // get endPos
233 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
234 // declare path geometry
235 GUIGeometry E2Geometry;
236 // update pathGeometry depending of first and last segment
237 if (segment->isFirstSegment() && segment->isLastSegment()) {
238 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
239 geometryDepartPos,
241 geometryEndPos,
243 } else if (segment->isFirstSegment()) {
244 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
245 geometryDepartPos,
247 -1,
249 } else if (segment->isLastSegment()) {
250 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
251 -1,
253 geometryEndPos,
255 } else {
256 E2Geometry = segment->getLane()->getLaneGeometry();
257 }
258 // draw geometry only if we'rent in drawForObjectUnderCursor mode
260 // draw E2 partial
261 drawE2PartialLane(s, d, segment, offsetFront, E2Geometry, E2Exaggeration, movingGeometryPoints);
262 // draw additional ID
264 // draw dotted contour
265 if (movingGeometryPoints) {
266 // get mouse position
267 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
268 // get snap radius
270 if (segment->getFromContour() && E2Geometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
272 } else if (segment->getToContour() && E2Geometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
274 }
275 } else {
276 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
277 }
278 }
279 // calculate contour and draw dotted geometry
280 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width,
281 E2Exaggeration, segment->isFirstSegment(), segment->isLastSegment(), 0, segment, segment->getLane()->getParentEdge());
282 // check if create from-to contours
283 if (segment->getFromContour()) {
284 segment->getFromContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().front(),
286 } else if (segment->getToContour()) {
287 segment->getToContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().back(),
289 }
290 // check if add this path element to redraw buffer
293 }
294 }
295}
296
297
298void
299GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
300 // check if E2 can be drawn
301 if ((myTagProperty->getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && segment->getPreviousLane() && segment->getNextLane() &&
303 // Obtain exaggeration of the draw
304 const double E2Exaggeration = getExaggeration(s);
305 // get detail level
306 const auto d = s.getDetailLevel(E2Exaggeration);
307 // get flag for show only contour
309 // check if connection to next lane exist
310 const bool connectionExist = segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane());
311 // get geometry
312 const GUIGeometry& E2Geometry = connectionExist ? segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()) :
313 GUIGeometry({segment->getPreviousLane()->getLaneShape().back(), segment->getNextLane()->getLaneShape().front()});
314 // draw geometry only if we'rent in drawForObjectUnderCursor mode
316 // draw E2 partial
317 drawE2PartialJunction(s, d, onlyContour, offsetFront, E2Geometry, E2Exaggeration);
318 // draw dotted contour
320 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
321 }
322 }
323 // calculate contour
324 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width, E2Exaggeration,
325 false, false, 0, segment, segment->getJunction());
326 // check if add this path element to redraw buffer
329 }
330 }
331}
332
333
334std::string
357
358
359double
361 switch (key) {
363 return myStartPosOverLane;
364 case SUMO_ATTR_ENDPOS:
365 return myEndPosPosOverLane;
366 case SUMO_ATTR_LENGTH:
368 default:
369 return getDetectorAttributeDouble(key);
370 }
371}
372
373
378
379
384
385
386void
387GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
388 switch (key) {
390 case SUMO_ATTR_ENDPOS:
391 case SUMO_ATTR_TLID:
392 case SUMO_ATTR_LENGTH:
397 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
398 break;
399 default:
400 setDetectorAttribute(key, value, undoList);
401 break;
402 }
403}
404
405
406bool
407GNELaneAreaDetector::isValid(SumoXMLAttr key, const std::string& value) {
408 switch (key) {
410 case SUMO_ATTR_ENDPOS:
411 return canParse<double>(value);
412 case SUMO_ATTR_TLID:
413 // temporal
415 case SUMO_ATTR_LENGTH:
416 return (canParse<double>(value) && (parse<double>(value) >= 0));
418 return canParse<SUMOTime>(value) && (parse<SUMOTime>(value) >= 0);
420 return (canParse<double>(value) && (parse<double>(value) >= 0));
422 return (canParse<double>(value) && (parse<double>(value) >= 0));
424 return canParse<bool>(value);
425 default:
426 return isDetectorValid(key, value);
427 }
428}
429
430// ===========================================================================
431// private
432// ===========================================================================
433
434void
436 const double exaggeration, const bool movingGeometryPoints) const {
437 // declare color
438 RGBColor E2Color, textColor;
439 // set color
440 if (drawUsingSelectColor()) {
442 textColor = E2Color.changedBrightness(-32);
443 } else if (areLaneConsecutives(getParentLanes())) {
444 E2Color = s.detectorSettings.E2Color;
445 textColor = RGBColor::BLACK;
446 }
447 // draw parent and child lines
449 // push layer matrix
451 // translate to front
453 // set color
454 GLHelper::setColor(E2Color);
455 // draw geometry
457 // draw arrow
458 if (myAdditionalGeometry.getShape().size() > 1) {
459 glTranslated(0, 0, 0.1);
461 }
462 // draw E2 Logo
463 drawE2DetectorLogo(s, d, exaggeration, "E2", textColor);
464 // check if draw geometry points
465 if (movingGeometryPoints) {
468 }
469 // pop layer matrix
471}
472
473
474void
476 const GNESegment* segment, const double offsetFront,
477 const GUIGeometry& geometry, const double exaggeration, const bool movingGeometryPoints) const {
478 // obtain color
480 // push layer matrix
482 // Start with the drawing of the area traslating matrix to origin
483 glTranslated(0, 0, getType() + offsetFront);
484 // Set color
485 GLHelper::setColor(E2Color);
486 // draw geometry
487 GUIGeometry::drawGeometry(d, geometry, s.detectorSettings.E2Width * exaggeration);
488 // check if draw moving geometry points
489 if (movingGeometryPoints) {
490 if (segment->isFirstSegment()) {
491 // calculate and draw left geometry point
494 drawLeftGeometryPoint(s, d, geometry.getShape().front(), geometry.getShapeRotations().front(), E2Color, true);
495 }
496 if (segment->isLastSegment()) {
497 // calculate and draw right geometry point
500 drawRightGeometryPoint(s, d, geometry.getShape().back(), geometry.getShapeRotations().back(), E2Color, true);
501 // draw arrow
502 if (geometry.getShape().size() > 1) {
503 glTranslated(0, 0, 0.1);
504 GLHelper::drawTriangleAtEnd(geometry.getShape()[-2], geometry.getShape()[-1], (double) 0.5, (double) 1, 0.5);
505 }
506 }
507 }
508 // Pop layer matrix
510 // check if this is the label segment
511 if (segment->isLabelSegment()) {
512 // calculate middle point
513 const double middlePoint = (geometry.getShape().length2D() * 0.5);
514 // calculate position
515 const Position pos = geometry.getShape().positionAtOffset2D(middlePoint);
516 // calculate rotation
517 const double rot = s.getTextAngle((geometry.getShape().rotationDegreeAtOffset(middlePoint) * -1) + 90);
518 // Start pushing matrix
520 // Traslate to position
521 glTranslated(pos.x(), pos.y(), getType() + offsetFront + 0.1);
522 // rotate
523 glRotated(rot, 0, 0, 1);
524 // move
525 glTranslated(-1, 0, 0);
526 // scale text
527 glScaled(exaggeration, exaggeration, 1);
528 // draw E1 logo
529 GLHelper::drawText("E2 Multilane", Position(), .1, 1.5, RGBColor::BLACK);
530 // pop matrix
532 }
533
534}
535
536
537void
539 const bool onlyContour, const double offsetFront, const GUIGeometry& geometry,
540 const double exaggeration) const {
541 const bool invalid = geometry.getShape().length() == 2;
542 const double width = s.detectorSettings.E2Width * exaggeration * (invalid ? 0.5 : 1);
543 // Add a draw matrix
545 // Start with the drawing of the area traslating matrix to origin
546 glTranslated(0, 0, getType() + offsetFront);
547 // Set color of the base
548 if (drawUsingSelectColor()) {
550 } else if (invalid) {
552 } else {
554 }
555 // check if draw only contour
556 if (onlyContour) {
557 GUIGeometry::drawContourGeometry(geometry, width);
558 } else {
559 GUIGeometry::drawGeometry(d, geometry, width);
560 }
561 // Pop last matrix
563}
564
565
566void
567GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value) {
568 switch (key) {
569 case SUMO_ATTR_LANE:
570 case SUMO_ATTR_LANES:
572 break;
574 myStartPosOverLane = parse<double>(value);
575 // update geometry (except for template)
576 if (getParentLanes().size() > 0) {
578 }
579 break;
580 case SUMO_ATTR_ENDPOS:
581 myEndPosPosOverLane = parse<double>(value);
582 // update geometry (except for template)
583 if (getParentLanes().size() > 0) {
585 }
586 break;
587 case SUMO_ATTR_TLID:
588 myTrafficLight = value;
589 break;
590 case SUMO_ATTR_LENGTH:
591 myEndPosPosOverLane = (myStartPosOverLane + parse<double>(value));
592 // update geometry (except for template)
593 if (getParentLanes().size() > 0) {
595 }
596 break;
598 myTimeThreshold = TIME2STEPS(parse<double>(value));
599 break;
601 mySpeedThreshold = parse<double>(value);
602 break;
604 myJamThreshold = parse<double>(value);
605 break;
607 myShow = parse<bool>(value);
608 break;
609 default:
610 setDetectorAttribute(key, value);
611 break;
612 }
613}
614
615/****************************************************************************/
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:57
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:46
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
double myEndPosPosOverLane
The end position over lane.
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Position getAttributePosition(SumoXMLAttr key) const override
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
void fixAdditionalProblem()
fix additional problem
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 drawGL(const GUIVisualizationSettings &s) const
Draws the object.
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
bool isAdditionalValid() const
check if current additional is valid to be written into XML
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.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object 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.
std::string getAdditionalProblem() const
return a string with the current additional problem
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
void computePathElement()
compute pathElement
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
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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPathManager * getNetworkPathManager()
get network path manager
Definition GNENet.cpp:168
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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 & 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.
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:196
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:188
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