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#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
35 GNEDetector(net, tag),
36 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane,
37 SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
38}
39
40
41GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double pos, const double length, const SUMOTime freq,
42 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
43 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos,
44 const bool show, const Parameterised::Map& parameters) :
45 GNEDetector(id, net, filename, SUMO_TAG_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges, detectPersons, name, parameters),
46 myStartPosOverLane(pos),
47 myEndPosPosOverLane(pos + length),
48 myFriendlyPosition(friendlyPos),
49 myTimeThreshold(timeThreshold),
50 mySpeedThreshold(speedThreshold),
51 myJamThreshold(jamThreshold),
52 myTrafficLight(trafficLight),
53 myShow(show),
54 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
55 // set parents
56 setParent<GNELane*>(lane);
57}
58
59
60GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, GNENet* net, const std::string& filename, std::vector<GNELane*> lanes, const double pos, const double endPos, const SUMOTime freq,
61 const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
62 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show,
63 const Parameterised::Map& parameters) :
64 GNEDetector(id, net, filename, GNE_TAG_MULTI_LANE_AREA_DETECTOR, freq, outputFilename, vehicleTypes, nextEdges,
65 detectPersons, name, parameters),
66 myStartPosOverLane(pos),
67 myEndPosPosOverLane(endPos),
68 myFriendlyPosition(friendlyPos),
69 myTimeThreshold(timeThreshold),
70 mySpeedThreshold(speedThreshold),
71 myJamThreshold(jamThreshold),
72 myTrafficLight(trafficLight),
73 myShow(show),
74 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_POSITION, myStartPosOverLane, SUMO_ATTR_ENDPOS, myEndPosPosOverLane, myFriendlyPosition)) {
75 // set parents
76 setParents<GNELane*>(lanes);
77}
78
79
83
84
89
90
93 return this;
94}
95
96
97void
100 // write common additional attributes
102 // write move atributes
104 // write common detector parameters
105 writeDetectorValues(device);
106 // write specific attributes
107 if (myTrafficLight.size() > 0) {
109 }
112 }
115 }
118 }
121 }
122 // write parameters (Always after children to avoid problems with additionals.xsd)
123 writeParams(device);
124 device.closeTag();
125}
126
127
128bool
130 // only movement problems
132}
133
134
135std::string
137 // only movement problems
139}
140
141
142void
144 // only movement problems
146}
147
148
149void
151 // check E2 detector
153 // compute path
155 } else {
156 // Cut shape using as delimitators fixed start position and fixed end position
157 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
161 }
162}
163
164
165void
167 // check drawing conditions
171 // Obtain exaggeration of the draw
172 const double E2Exaggeration = getExaggeration(s);
173 // get detail level
174 const auto d = s.getDetailLevel(E2Exaggeration);
175 // check if draw geometry points
176 const bool movingGeometryPoints = drawMovingGeometryPoints();
177 // draw geometry only if we'rent in drawForObjectUnderCursor mode
179 // draw E2
180 drawE2(s, d, E2Exaggeration, movingGeometryPoints);
181 // draw lock icon
183 // Draw additional ID
185 // draw additional name
187 // check if draw geometry points
188 if (movingGeometryPoints) {
191 } else {
193 }
194 }
195 // check if we're calculating the contour or the moving geometry points
196 if (movingGeometryPoints) {
200 }
201 if (movingGeometryPoints && (myEndPosPosOverLane != INVALID_DOUBLE)) {
204 }
205 } else {
206 // don't exaggerate contour
208 E2Exaggeration, true, true, 0, nullptr, getParentLanes().front()->getParentEdge());
209 }
210 }
211}
212
213
214void
219
220
221void
222GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
223 // check if E2 can be drawn
226 const bool movingGeometryPoints = drawMovingGeometryPoints();
227 // Obtain exaggeration of the draw
228 const double E2Exaggeration = getExaggeration(s);
229 // get detail level
230 const auto d = s.getDetailLevel(E2Exaggeration);
231 // calculate startPos
232 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_POSITION);
233 // get endPos
234 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
235 // declare path geometry
236 GUIGeometry E2Geometry;
237 // update pathGeometry depending of first and last segment
238 if (segment->isFirstSegment() && segment->isLastSegment()) {
239 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
240 geometryDepartPos,
242 geometryEndPos,
244 } else if (segment->isFirstSegment()) {
245 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
246 geometryDepartPos,
248 -1,
250 } else if (segment->isLastSegment()) {
251 E2Geometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
252 -1,
254 geometryEndPos,
256 } else {
257 E2Geometry = segment->getLane()->getLaneGeometry();
258 }
259 // draw geometry only if we'rent in drawForObjectUnderCursor mode
261 // draw E2 partial
262 drawE2PartialLane(s, d, segment, offsetFront, E2Geometry, E2Exaggeration, movingGeometryPoints);
263 // draw additional ID
265 // draw dotted contour
266 if (movingGeometryPoints) {
267 // get mouse position
268 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
269 // get snap radius
271 if (segment->getFromContour() && E2Geometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
273 } else if (segment->getToContour() && E2Geometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
275 }
276 } else {
277 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
278 }
279 }
280 // calculate contour and draw dotted geometry
281 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width,
282 E2Exaggeration, segment->isFirstSegment(), segment->isLastSegment(), 0, segment, segment->getLane()->getParentEdge());
283 // check if create from-to contours
284 if (segment->getFromContour()) {
285 segment->getFromContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().front(),
287 } else if (segment->getToContour()) {
288 segment->getToContour()->calculateContourCircleShape(s, d, this, E2Geometry.getShape().back(),
290 }
291 // check if add this path element to redraw buffer
294 }
295 }
296}
297
298
299void
300GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
301 // check if E2 can be drawn
302 if ((myTagProperty->getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && segment->getPreviousLane() && segment->getNextLane() &&
304 // Obtain exaggeration of the draw
305 const double E2Exaggeration = getExaggeration(s);
306 // get detail level
307 const auto d = s.getDetailLevel(E2Exaggeration);
308 // get flag for show only contour
310 // check if connection to next lane exist
311 const bool connectionExist = segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane());
312 // get geometry
313 const GUIGeometry& E2Geometry = connectionExist ? segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()) :
314 GUIGeometry({segment->getPreviousLane()->getLaneShape().back(), segment->getNextLane()->getLaneShape().front()});
315 // draw geometry only if we'rent in drawForObjectUnderCursor mode
317 // draw E2 partial
318 drawE2PartialJunction(s, d, onlyContour, offsetFront, E2Geometry, E2Exaggeration);
319 // draw dotted contour
321 segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
322 }
323 }
324 // calculate contour
325 segment->getContour()->calculateContourExtrudedShape(s, d, this, E2Geometry.getShape(), getType(), s.detectorSettings.E2Width, E2Exaggeration,
326 false, false, 0, segment, segment->getJunction());
327 // check if add this path element to redraw buffer
330 }
331 }
332}
333
334
335std::string
358
359
360double
362 switch (key) {
364 return myStartPosOverLane;
365 case SUMO_ATTR_ENDPOS:
366 return myEndPosPosOverLane;
367 case SUMO_ATTR_LENGTH:
369 default:
370 return getDetectorAttributeDouble(key);
371 }
372}
373
374
379
380
385
386
387void
388GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
389 switch (key) {
391 case SUMO_ATTR_ENDPOS:
392 case SUMO_ATTR_TLID:
393 case SUMO_ATTR_LENGTH:
398 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
399 break;
400 default:
401 setDetectorAttribute(key, value, undoList);
402 break;
403 }
404}
405
406
407bool
408GNELaneAreaDetector::isValid(SumoXMLAttr key, const std::string& value) {
409 switch (key) {
411 case SUMO_ATTR_ENDPOS:
412 return canParse<double>(value);
413 case SUMO_ATTR_TLID:
414 // temporal
416 case SUMO_ATTR_LENGTH:
417 return (canParse<double>(value) && (parse<double>(value) >= 0));
419 return canParse<SUMOTime>(value) && (parse<SUMOTime>(value) >= 0);
421 return (canParse<double>(value) && (parse<double>(value) >= 0));
423 return (canParse<double>(value) && (parse<double>(value) >= 0));
425 return canParse<bool>(value);
426 default:
427 return isDetectorValid(key, value);
428 }
429}
430
431// ===========================================================================
432// private
433// ===========================================================================
434
435void
437 const double exaggeration, const bool movingGeometryPoints) const {
438 // declare color
439 RGBColor E2Color, textColor;
440 // set color
441 if (drawUsingSelectColor()) {
443 textColor = E2Color.changedBrightness(-32);
444 } else if (areLaneConsecutives(getParentLanes())) {
445 E2Color = s.detectorSettings.E2Color;
446 textColor = RGBColor::BLACK;
447 }
448 // draw parent and child lines
450 // push layer matrix
452 // translate to front
454 // set color
455 GLHelper::setColor(E2Color);
456 // draw geometry
458 // draw arrow
459 if (myAdditionalGeometry.getShape().size() > 1) {
460 glTranslated(0, 0, 0.1);
462 }
463 // draw E2 Logo
464 drawE2DetectorLogo(s, d, exaggeration, "E2", textColor);
465 // check if draw geometry points
466 if (movingGeometryPoints) {
469 }
470 // pop layer matrix
472}
473
474
475void
477 const GNESegment* segment, const double offsetFront,
478 const GUIGeometry& geometry, const double exaggeration, const bool movingGeometryPoints) const {
479 // obtain color
481 // push layer matrix
483 // Start with the drawing of the area traslating matrix to origin
484 glTranslated(0, 0, getType() + offsetFront);
485 // Set color
486 GLHelper::setColor(E2Color);
487 // draw geometry
488 GUIGeometry::drawGeometry(d, geometry, s.detectorSettings.E2Width * exaggeration);
489 // check if draw moving geometry points
490 if (movingGeometryPoints) {
491 if (segment->isFirstSegment()) {
492 // calculate and draw left geometry point
495 drawLeftGeometryPoint(s, d, geometry.getShape().front(), geometry.getShapeRotations().front(), E2Color, true);
496 }
497 if (segment->isLastSegment()) {
498 // calculate and draw right geometry point
501 drawRightGeometryPoint(s, d, geometry.getShape().back(), geometry.getShapeRotations().back(), E2Color, true);
502 // draw arrow
503 if (geometry.getShape().size() > 1) {
504 glTranslated(0, 0, 0.1);
505 GLHelper::drawTriangleAtEnd(geometry.getShape()[-2], geometry.getShape()[-1], (double) 0.5, (double) 1, 0.5);
506 }
507 }
508 }
509 // Pop layer matrix
511 // check if this is the label segment
512 if (segment->isLabelSegment()) {
513 // calculate middle point
514 const double middlePoint = (geometry.getShape().length2D() * 0.5);
515 // calculate position
516 const Position pos = geometry.getShape().positionAtOffset2D(middlePoint);
517 // calculate rotation
518 const double rot = s.getTextAngle((geometry.getShape().rotationDegreeAtOffset(middlePoint) * -1) + 90);
519 // Start pushing matrix
521 // Traslate to position
522 glTranslated(pos.x(), pos.y(), getType() + offsetFront + 0.1);
523 // rotate
524 glRotated(rot, 0, 0, 1);
525 // move
526 glTranslated(-1, 0, 0);
527 // scale text
528 glScaled(exaggeration, exaggeration, 1);
529 // draw E1 logo
530 GLHelper::drawText("E2 Multilane", Position(), .1, 1.5, RGBColor::BLACK);
531 // pop matrix
533 }
534
535}
536
537
538void
540 const bool onlyContour, const double offsetFront, const GUIGeometry& geometry,
541 const double exaggeration) const {
542 const bool invalid = geometry.getShape().length() == 2;
543 const double width = s.detectorSettings.E2Width * exaggeration * (invalid ? 0.5 : 1);
544 // Add a draw matrix
546 // Start with the drawing of the area traslating matrix to origin
547 glTranslated(0, 0, getType() + offsetFront);
548 // Set color of the base
549 if (drawUsingSelectColor()) {
551 } else if (invalid) {
553 } else {
555 }
556 // check if draw only contour
557 if (onlyContour) {
558 GUIGeometry::drawContourGeometry(geometry, width);
559 } else {
560 GUIGeometry::drawGeometry(d, geometry, width);
561 }
562 // Pop last matrix
564}
565
566
567void
568GNELaneAreaDetector::setAttribute(SumoXMLAttr key, const std::string& value) {
569 switch (key) {
570 case SUMO_ATTR_LANE:
571 case SUMO_ATTR_LANES:
573 break;
575 myStartPosOverLane = parse<double>(value);
576 // update geometry (except for template)
577 if (getParentLanes().size() > 0) {
579 }
580 break;
581 case SUMO_ATTR_ENDPOS:
582 myEndPosPosOverLane = parse<double>(value);
583 // update geometry (except for template)
584 if (getParentLanes().size() > 0) {
586 }
587 break;
588 case SUMO_ATTR_TLID:
589 myTrafficLight = value;
590 break;
591 case SUMO_ATTR_LENGTH:
592 myEndPosPosOverLane = (myStartPosOverLane + parse<double>(value));
593 // update geometry (except for template)
594 if (getParentLanes().size() > 0) {
596 }
597 break;
599 myTimeThreshold = TIME2STEPS(parse<double>(value));
600 break;
602 mySpeedThreshold = parse<double>(value);
603 break;
605 myJamThreshold = parse<double>(value);
606 break;
608 myShow = parse<bool>(value);
609 break;
610 default:
611 setDetectorAttribute(key, value);
612 break;
613 }
614}
615
616/****************************************************************************/
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
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
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