Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEStop.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// Representation of Stops in netedit
19/****************************************************************************/
20
26#include <netedit/GNENet.h>
27#include <netedit/GNEUndoList.h>
30
31#include "GNEStop.h"
32
33// ===========================================================================
34// member method definitions
35// ===========================================================================
36#ifdef _MSC_VER
37#pragma warning(push)
38#pragma warning(disable: 4355) // mask warning about "this" in initializers
39#endif
41 GNEDemandElement("", net, "", tag, GNEPathElement::Options::DEMAND_ELEMENT),
42 GNEDemandElementPlan(this, -1, -1),
43 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_STARTPOS, startPos, SUMO_ATTR_ENDPOS, endPos, friendlyPos)),
44 myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
45 // enable parking for stops in parkin)gAreas
48 }
49 // set parking
52 }
53 // set waypoint speed
55 // set jump
56 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
57 // set locator sufix
59}
60
61
62GNEStop::GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter) :
63 GNEDemandElement(stopParent, tag, GNEPathElement::Options::DEMAND_ELEMENT),
64 SUMOVehicleParameter::Stop(stopParameter),
65 GNEDemandElementPlan(this, -1, -1),
66 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_STARTPOS, startPos, SUMO_ATTR_ENDPOS, endPos, friendlyPos)),
67 myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
68 // set parents
69 setParent<GNEAdditional*>(stoppingPlace);
70 setParent<GNEDemandElement*>(stopParent);
71 // set triggered values
72 if (triggered) {
74 if (awaitedPersons.size() > 0) {
76 }
77 } else if (containerTriggered) {
80 if (awaitedPersons.size() > 0) {
82 }
83 } else if (joinTriggered) {
85 }
86 // set parking
89 }
90 // set tripID and line
91 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
92 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
93 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
94 // set waypoint speed
96 // set jump
97 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
98 // set locator sufix
100}
101
102
103GNEStop::GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter) :
104 GNEDemandElement(stopParent, tag, GNEPathElement::Options::DEMAND_ELEMENT),
105 SUMOVehicleParameter::Stop(stopParameter),
106 GNEDemandElementPlan(this, -1, -1),
107 myMoveElementLaneDouble(new GNEMoveElementLaneDouble(this, SUMO_ATTR_STARTPOS, startPos, SUMO_ATTR_ENDPOS, endPos, friendlyPos)),
108 myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
109 // set parents
110 setParent<GNELane*>(lane);
111 setParent<GNEDemandElement*>(stopParent);
112 // set triggered values
113 if (triggered) {
115 if (awaitedPersons.size() > 0) {
117 }
118 } else if (containerTriggered) {
121 if (awaitedPersons.size() > 0) {
123 }
124 } else if (joinTriggered) {
126 }
127 // set parking
130 }
131 // set trigger
132 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
133 // set tripID and line
134 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
135 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
136 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
137 // set waypoint speed
139 // set jump
140 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
141 // set locator sufix
143}
144#ifdef _MSC_VER
145#pragma warning(pop)
146#endif
147
149
150
155
156
159 return this;
160}
161
162
163const Parameterised*
165 return this;
166}
167
168
169void
171 device.openTag(SUMO_TAG_STOP);
172 if (getParentAdditionals().size() > 0) {
173 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_BUS_STOP) {
175 }
176 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_TRAIN_STOP) {
178 }
179 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CONTAINER_STOP) {
181 }
182 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CHARGING_STATION) {
184 }
185 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA) {
187 }
188 } else {
189 if (getParentLanes().size() > 0) {
190 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
191 }
192 if (startPos != INVALID_DOUBLE) {
194 }
195 if (endPos != INVALID_DOUBLE) {
197 }
198 }
199 // write rest of attributes
200 write(device, true, false);
201}
202
203
206 if (getPathStopIndex() == -1) {
208 } else if ((getParentLanes().size() > 0) && !myMoveElementLaneDouble->isMoveElementValid()) {
210 } else {
211 return Problem::OK;
212 }
213}
214
215
216std::string
218 if (getPathStopIndex() == -1) {
219 return ("Downstream stop");
220 } else if (getParentLanes().size() > 0) {
222 } else {
223 return "";
224 }
225}
226
227
228void
235
236
239 return getParentDemandElements().front()->getVClass();
240}
241
242
243const RGBColor&
245 // get inspected AC
246 const auto inspectedAC = myNet->getViewNet()->getInspectedElements().getFirstAC();
247 if (inspectedAC) {
248 // check if is a route or a vehicle
249 if ((inspectedAC->getTagProperty()->isRoute() || inspectedAC->getTagProperty()->isVehicle()) && (inspectedAC != getParentDemandElements().front())) {
250 return RGBColor::GREY;
251 }
252 } else if (myNet->getViewNet()->getViewParent()->getStopFrame()->shown()) {
254 return RGBColor::GREY;
255 }
256 }
257 // return default color
260 } else {
262 }
263}
264
265
266void
268 // update geometry depending of parent
269 if (getParentLanes().size() > 0) {
270 // Cut shape using as delimitators fixed start position and fixed end position
272 } else if (getParentAdditionals().size() > 0) {
273 // use geometry of additional (busStop)
274 myDemandElementGeometry = getParentAdditionals().at(0)->getAdditionalGeometry();
275 }
276}
277
278
281 if (getParentLanes().size() > 0) {
282 return getParentLanes().front()->getLaneShape().positionAtOffset((startPos + endPos) / 2.0);
283 } else if (getParentAdditionals().size() > 0) {
284 return getParentAdditionals().front()->getPositionInView();
285 } else {
286 throw ProcessError(TL("Invalid Stop parent"));
287 }
288}
289
290
291std::string
293 if (getParentDemandElements().size() > 0) {
294 return getParentDemandElements().front()->getID();
295 } else if (getParentAdditionals().size() > 0) {
296 return getParentAdditionals().front()->getID();
297 } else if (getParentLanes().size() > 0) {
298 return getParentLanes().front()->getID();
299 } else {
300 throw ProcessError(TL("Invalid parent"));
301 }
302}
303
304
305double
307 return s.addSize.getExaggeration(s, this);
308}
309
310
313 Boundary b;
314 // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
315 if (getParentAdditionals().size() > 0) {
316 return getParentAdditionals().at(0)->getCenteringBoundary();
319 } else if (myDemandElementGeometry.getShape().size() > 0) {
321 } else {
323 }
324 b.grow(20);
325 return b;
326}
327
328
329void
330GNEStop::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
331 // geometry of this element cannot be splitted
332}
333
334
335void
337 // check if draw an stop for person/containers or for vehicles/routes
338 if (canDrawVehicleStop()) {
339 // get exaggeration
340 const auto exaggeration = getExaggeration(s);
341 // get lane
342 const auto& stopLane = getParentLanes().size() > 0 ? getParentLanes().front() : nullptr;
343 // get lane width
344 const double width = stopLane ? stopLane->getParentEdge()->getNBEdge()->getLaneWidth(stopLane->getIndex()) * 0.5 : exaggeration * 0.8;
345 // get detail level
346 const auto d = s.getDetailLevel(exaggeration);
347 // draw geometry only if we'rent in drawForObjectUnderCursor mode
349 // get color
351 // Add a layer matrix
353 // set Color
354 GLHelper::setColor(color);
355 // Start with the drawing of the area traslating matrix to origin
357 // draw depending if is over lane or over stoppingP
358 if (getParentLanes().size() > 0) {
359 drawStopOverLane(s, d, color, width, exaggeration);
360 } else {
361 drawStopOverStoppingPlace(d, color, width, exaggeration);
362 }
363 // pop layer matrix
365 if (s.showParkingInfo) {
366 // draw above demand elements
369 drawStopLabel(s);
371 }
372 // draw lock icon
374 // draw dotted contour
376 }
377 // calculate contour and draw dotted geometry
378 if (getParentAdditionals().size() > 0) {
379 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true,
380 0, nullptr, getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
381 } else {
382 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true,
383 0, nullptr, getParentLanes().front()->getParentEdge());
384 }
385 }
386}
387
388
389void
391 const SUMOVehicleParameter::Stop& stop = *this;
392 std::string label;
393 if (stop.speed > 0) {
394 label += "waypoint";
395 } else if (stop.busstop != "") {
396 label += "busStop:" + stop.busstop;
397 } else if (stop.containerstop != "") {
398 label += "containerStop:" + stop.containerstop;
399 } else if (stop.parkingarea != "") {
400 label += "parkingArea:" + stop.parkingarea;
401 } else if (stop.chargingStation != "") {
402 label += "chargingStation:" + stop.chargingStation;
403 } else if (stop.overheadWireSegment != "") {
404 label += "overheadWireSegment:" + stop.overheadWireSegment;
405 } else {
406 label += "stop";
407 }
408 if (stop.triggered || stop.containerTriggered || stop.joinTriggered) {
409 label += " triggered:";
410 if (stop.triggered) {
411 label += "person";
412 if (!stop.awaitedPersons.empty()) {
413 label += "(" + toString(stop.awaitedPersons) + ")";
414 }
415 }
416 if (stop.containerTriggered) {
417 label += "container";
418 if (!stop.awaitedContainers.empty()) {
419 label += "(" + toString(stop.awaitedContainers) + ")";
420 }
421 }
422 if (stop.joinTriggered) {
423 label += "join";
424 if (stop.join != "") {
425 label += "(" + stop.join + ")";
426 }
427 }
428 }
429 if (stop.arrival >= 0) {
430 label += " arrival:" + time2string(stop.arrival);
431 }
432 if (stop.until >= 0) {
433 label += " until:" + time2string(stop.until);
434 }
435 if (stop.started >= 0) {
436 label += " started:" + time2string(stop.started);
437 }
438 if (stop.ended >= 0) {
439 label += " ended:" + time2string(stop.ended);
440 }
441 if (stop.duration >= 0 || stop.duration > 0) {
442 if (STEPS2TIME(stop.duration) > 3600 * 24) {
443 label += " duration:1day+";
444 } else {
445 label += " duration:" + time2string(stop.duration);
446 }
447 }
448 if (stop.actType != "") {
449 label += " actType:" + stop.actType;
450 }
452}
453
454
455void
457 // only update geometry
459}
460
461
462void
463GNEStop::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
464 // Stops don't use drawJunctionPartialGL
465}
466
467
468void
469GNEStop::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
470 // Stops don't use drawJunctionPartialGL
471}
472
473
474GNELane*
476 // check if stop is placed over a busStop
477 if (getParentAdditionals().size() > 0) {
478 return getParentAdditionals().front()->getParentLanes().front();
479 } else {
480 return getParentLanes().front();
481 }
482}
483
484
485GNELane*
487 // first and last path lane are the same
488 return getFirstPathLane();
489}
490
491
492std::string
494 switch (key) {
495 case SUMO_ATTR_ID:
496 return getMicrosimID();
498 if (isAttributeEnabled(key)) {
499 return time2string(duration);
500 } else {
501 return "";
502 }
503 case SUMO_ATTR_UNTIL:
504 if (isAttributeEnabled(key)) {
505 return time2string(until);
506 } else {
507 return "";
508 }
510 if (isAttributeEnabled(key)) {
511 return time2string(extension);
512 } else {
513 return "";
514 }
516 if (triggered) {
517 return "person";
518 } else if (containerTriggered) {
519 return "container";
520 } else if (joinTriggered) {
521 return "join";
522 } else {
523 return "false";
524 }
526 if (triggered) {
527 return toString(awaitedPersons);
528 } else if (containerTriggered) {
530 } else {
531 return "";
532 }
533 case SUMO_ATTR_JOIN:
534 if (joinTriggered) {
535 return join;
536 } else {
537 return "";
538 }
540 return toString(permitted);
543 return "true";
544 } else {
545 return "false";
546 }
548 return actType;
550 return tripId;
551 case SUMO_ATTR_LINE:
552 return line;
554 return toString(onDemand);
555 case SUMO_ATTR_JUMP:
557 return time2string(jump);
558 } else {
559 return "";
560 }
561 // only for waypoints
562 case SUMO_ATTR_SPEED:
563 return toString(speed);
564 // specific of Stops over stoppingPlaces
570 return getParentAdditionals().front()->getID();
571 // specific of stops over lanes
573 if (posLat == INVALID_DOUBLE) {
574 return "";
575 } else {
576 return toString(posLat);
577 }
578 case SUMO_ATTR_SPLIT:
579 return split;
580 //
581 case GNE_ATTR_PARENT:
582 return getParentDemandElements().front()->getID();
583 case GNE_ATTR_STOPINDEX: {
584 // extract all stops of demandElement parent
585 std::vector<GNEDemandElement*> stops;
586 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
587 if (parent->getTagProperty()->isVehicleStop()) {
588 stops.push_back(parent);
589 }
590 }
591 // find index in stops
592 for (int i = 0; i < (int)stops.size(); i++) {
593 if (stops.at(i) == this) {
594 return toString(i);
595 }
596 }
597 return "invalid index";
598 }
600 return toString(getPathStopIndex());
601 default:
603 }
604}
605
606
607double
609 switch (key) {
610 case SUMO_ATTR_INDEX: // for writting sorted
611 return (double)myCreationIndex;
612 case GNE_ATTR_STOPINDEX: {
613 // extract all stops of demandElement parent
614 std::vector<GNEDemandElement*> stops, filteredStops;
615 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
616 if (parent->getTagProperty()->isVehicleStop()) {
617 stops.push_back(parent);
618 }
619 }
620 // now filter stops with the same startPos
621 for (const auto& stop : stops) {
622 if (stop->getAttributeDouble(SUMO_ATTR_STARTPOS) == getAttributeDouble(SUMO_ATTR_STARTPOS)) {
623 filteredStops.push_back(stop);
624 }
625 }
626 // get index
627 for (int i = 0; i < (int)filteredStops.size(); i++) {
628 if (filteredStops.at(i) == this) {
629 return i;
630 }
631 }
632 return 0;
633 }
635 return (double)getPathStopIndex();
636 default:
638 }
639}
640
641
644 switch (key) {
646 if (getParentAdditionals().size() > 0) {
647 // return first position of busStop
648 return getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
649 } else {
650 // get lane shape
651 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
652 // continue depending of arrival position
653 if (endPos == 0) {
654 return laneShape.front();
655 } else if ((endPos == -1) || (endPos >= laneShape.length2D())) {
656 return laneShape.back();
657 } else {
658 return laneShape.positionAtOffset2D(endPos);
659 }
660 }
661 }
662 default:
663 return getCommonAttributePosition(key);
664 }
665}
666
667
668void
669GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
670 if (value == getAttribute(key)) {
671 return; //avoid needless changes, later logic relies on the fact that attributes have changed
672 }
673 switch (key) {
675 case SUMO_ATTR_UNTIL:
679 case SUMO_ATTR_JOIN:
684 case SUMO_ATTR_LINE:
686 case SUMO_ATTR_JUMP:
687 // only for waypoints
688 case SUMO_ATTR_SPEED:
689 // specific of Stops over stoppingPlaces
695 // specific of stops over lanes
697 case SUMO_ATTR_SPLIT:
698 // other
699 case GNE_ATTR_PARENT:
700 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
701 break;
702 default:
703 myMoveElementLaneDouble->setMovingAttribute(key, value, undoList);
704 break;
705 }
706}
707
708
709bool
710GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
711 // declare string error
712 std::string error;
713 switch (key) {
715 case SUMO_ATTR_UNTIL:
717 if (canParse<SUMOTime>(value)) {
718 return parse<SUMOTime>(value) >= 0;
719 } else {
720 return false;
721 }
722 case SUMO_ATTR_TRIGGERED: {
723 const auto expectedValues = myTagProperty->getAttributeProperties(key)->getDiscreteValues();
724 const auto triggeredValues = parse<std::vector<std::string> >(value);
725 for (const auto& triggeredValue : triggeredValues) {
726 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
727 return false;
728 }
729 }
730 return true;
731 }
733 if (value.empty()) {
734 return false;
735 } else {
736 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
737 for (const auto& expectedValue : expectedValues) {
738 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
739 return false;
740 }
741 }
742 return true;
743 }
744 case SUMO_ATTR_JOIN:
745 if (value.empty()) {
746 return false;
747 } else {
749 }
750 case SUMO_ATTR_PERMITTED: {
751 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
752 for (const auto& expectedValue : expectedValues) {
753 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
754 return false;
755 }
756 }
757 return true;
758 }
759 case SUMO_ATTR_PARKING: {
760 if (value == "opportunistic") {
761 return false; // Currrently deactivated opportunistic in netedit waiting for the implementation in SUMO
762 }
763 const auto expectedValues = myTagProperty->getAttributeProperties(key)->getDiscreteValues();
764 const auto triggeredValues = parse<std::vector<std::string> >(value);
765 for (const auto& triggeredValue : triggeredValues) {
766 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
767 return false;
768 }
769 }
770 return true;
771 }
773 return true;
776 case SUMO_ATTR_LINE:
777 return true;
779 return canParse<bool>(value);
780 case SUMO_ATTR_JUMP:
781 if ((value == "-1") || (value.empty())) {
782 return true;
783 } else if (canParse<double>(value)) {
784 return parse<double>(value) >= 0;
785 } else {
786 return false;
787 }
788 // only for waypoints
789 case SUMO_ATTR_SPEED:
790 if (canParse<double>(value)) {
791 return (parse<double>(value) >= 0);
792 } else {
793 return false;
794 }
795 // specific of Stops over stoppingPlaces
797 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
799 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
801 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
803 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
805 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
806 // specific of stops over lanes
808 if (value.empty()) {
809 return true;
810 } else {
811 return canParse<double>(value);
812 }
813 case SUMO_ATTR_SPLIT:
814 if (value.empty()) {
815 return true;
816 } else {
818 }
819 //
820 case GNE_ATTR_PARENT:
821 return false;
822 default:
824 }
825}
826
827
828void
830 switch (key) {
832 case SUMO_ATTR_UNTIL:
834 undoList->add(new GNEChange_ToggleAttribute(this, key, true), true);
835 break;
836 default:
837 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
838 }
839}
840
841
842void
844 switch (key) {
846 case SUMO_ATTR_UNTIL:
848 undoList->add(new GNEChange_ToggleAttribute(this, key, false), true);
849 break;
850 default:
851 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
852 }
853}
854
855
856bool
858 switch (key) {
859 // Currently stops parents cannot be edited
865 return false;
867 return (parametersSet & STOP_DURATION_SET) != 0;
868 case SUMO_ATTR_UNTIL:
869 return (parametersSet & STOP_UNTIL_SET) != 0;
871 return (parametersSet & STOP_EXTENSION_SET) != 0;
874 case SUMO_ATTR_JOIN:
875 return joinTriggered;
877 // for stops/waypoints over parking areas, always enabled
879 return false;
880 } else {
881 return true;
882 }
883 default:
884 return true;
885 }
886}
887
888
889std::string
891 return getTagStr();
892}
893
894
895std::string
897 if (getParentAdditionals().size() > 0) {
898 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_BUS_STOP) {
899 return "BusStop: " + getParentAdditionals().front()->getID();
900 } else if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_TRAIN_STOP) {
901 return "TrainStop: " + getParentAdditionals().front()->getID();
902 } else if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CONTAINER_STOP) {
903 return "containerStop: " + getParentAdditionals().front()->getID();
904 } else if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CHARGING_STATION) {
905 return "chargingStation: " + getParentAdditionals().front()->getID();
906 } else {
907 return "parkingArea: " + getParentAdditionals().front()->getID();
908 }
909 } else if (getParentLanes().size() > 0) {
910 return "lane: " + getParentLanes().front()->getID();
911 } else {
912 return "";
913 }
914}
915
916
917double
919 double fixedPos = startPos;
920 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
921 if (fixedPos < 0) {
922 fixedPos += len;
923 }
924 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
925}
926
927
928double
930 double fixedPos = endPos;
931 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
932 if (fixedPos < 0) {
933 fixedPos += len;
934 }
935 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
936}
937
938// ===========================================================================
939// protected
940// ===========================================================================
941
942bool
944 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
946 return true;
947 } else if (inspectedElements.isACInspected(this)) {
948 return true;
949 } else if (inspectedElements.isACInspected(getParentDemandElements().front())) {
950 return true;
952 return true;
953 } else if ((getParentDemandElements().front()->getTagProperty()->getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
955 if (inspectedElements.isACInspected(getParentDemandElements().front()->getChildDemandElements().front())) {
956 return true;
957 } else {
958 return false;
959 }
960 } else {
961 return false;
962 }
963}
964
965
966bool
968 // get stop frame
969 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
970 // check conditions
972 return true;
973 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
974 return true;
975 } else {
976 return false;
977 }
978}
979
980
981
982void
984 const double width, const double exaggeration) const {
985 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
989 exaggeration * 0.1, 0, width);
993 exaggeration * 0.1, 0, width * -1);
994 // Add a detail matrix
996 // move to geometry front
997 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
998 // rotate
1000 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1001 }
1002 // move again
1003 glTranslated(0, exaggeration * 0.5, 0);
1004 // draw stop front
1005 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1006 // move to symbol position
1007 glTranslated(0, 1, 0.1);
1008 // draw text depending of detail
1010 // draw symbol
1011 GLHelper::drawText(myTagProperty->isVehicleWaypoint() ? "W" : "S", Position(), .1, 2.8, color, 180);
1012 // move to subtitle position
1013 glTranslated(0, 1.4, 0);
1014 // draw subtitle depending of tag
1015 GLHelper::drawText("lane", Position(), .1, 1, color, 180);
1016 // check if draw index
1017 if (drawIndex()) {
1018 // move to index position
1019 glTranslated(-2.1, -2.4, 0);
1020 glRotated(-90, 0, 0, 1);
1021 // draw index
1023 }
1024 } else {
1025 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1026 }
1027 // pop detail matrix
1029 // draw geometry points
1030 drawGeometryPoints(s, d, color);
1031}
1032
1033
1034void
1036 const double width, const double exaggeration) const {
1037 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1039 // only draw text if isn't being drawn for selecting
1041 // Add a detail matrix
1043 // move to geometry front
1044 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1045 // rotate
1046 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1047 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1048 }
1049 // move to index position
1050 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1051 glRotated(-90, 0, 0, 1);
1052 // draw index
1054 // pop detail matrix
1056 }
1057}
1058
1059// ===========================================================================
1060// private
1061// ===========================================================================
1062
1063void
1064GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1065 switch (key) {
1066 case SUMO_ATTR_DURATION:
1067 if (value.empty()) {
1068 toggleAttribute(key, false);
1069 } else {
1070 toggleAttribute(key, true);
1071 duration = string2time(value);
1072 }
1073 break;
1074 case SUMO_ATTR_UNTIL:
1075 if (value.empty()) {
1076 toggleAttribute(key, false);
1077 } else {
1078 toggleAttribute(key, true);
1079 until = string2time(value);
1080 }
1081 break;
1083 if (value.empty()) {
1084 toggleAttribute(key, false);
1085 } else {
1086 toggleAttribute(key, true);
1087 extension = string2time(value);
1088 }
1089 break;
1091 // reset all flags
1092 triggered = false;
1093 containerTriggered = false;
1094 joinTriggered = false;
1095 // disable all flags
1096 parametersSet &= ~STOP_JOIN_SET;
1097 parametersSet &= ~STOP_TRIGGER_SET;
1098 parametersSet &= ~STOP_EXPECTED_SET;
1099 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1100 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1101 // check value
1102 if ((value == "person") || (value == "true")) {
1104 triggered = true;
1105 if (awaitedPersons.size() > 0) {
1107 }
1108 } else if (value == "container") {
1111 containerTriggered = true;
1112 if (awaitedPersons.size() > 0) {
1114 }
1115 } else if (value == "join") {
1117 joinTriggered = true;
1118 }
1119 break;
1120 case SUMO_ATTR_EXPECTED:
1121 if (triggered) {
1122 awaitedPersons = parse<std::set<std::string> >(value);
1123 if (awaitedPersons.size() > 0) {
1125 } else {
1126 parametersSet &= ~STOP_EXPECTED_SET;
1127 }
1128 } else if (containerTriggered) {
1129 awaitedContainers = parse<std::set<std::string> >(value);
1130 if (awaitedContainers.size() > 0) {
1132 } else {
1133 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1134 }
1135 }
1136 break;
1137 case SUMO_ATTR_JOIN:
1138 if (joinTriggered) {
1139 join = value;
1140 if (join.size() > 0) {
1142 } else {
1143 parametersSet &= ~STOP_JOIN_SET;
1144 }
1145 }
1146 break;
1148 if (value.empty()) {
1149 parametersSet &= ~STOP_PERMITTED_SET;
1150 } else {
1152 permitted = parse<std::set<std::string> >(value);
1153 }
1154 break;
1155 case SUMO_ATTR_PARKING:
1158 parametersSet &= ~STOP_PARKING_SET;
1159 } else {
1161 }
1162 break;
1163 case SUMO_ATTR_ACTTYPE:
1164 actType = value;
1165 break;
1166 case SUMO_ATTR_TRIP_ID:
1167 tripId = value;
1168 toggleAttribute(key, (value.size() > 0));
1169 break;
1170 case SUMO_ATTR_LINE:
1171 line = value;
1172 toggleAttribute(key, (value.size() > 0));
1173 break;
1174 case SUMO_ATTR_ONDEMAND:
1175 if (parse<bool>(value)) {
1177 } else {
1178 parametersSet &= ~STOP_ONDEMAND_SET;
1179 }
1180 // set flag
1182 break;
1183 case SUMO_ATTR_JUMP:
1184 if ((value == "-1") || value.empty()) {
1185 parametersSet &= ~STOP_JUMP_SET;
1186 jump = -1;
1187 } else {
1189 jump = string2time(value);
1190 }
1191 break;
1192 // only for waypoints
1193 case SUMO_ATTR_SPEED:
1194 speed = parse<double>(value);
1195 break;
1196 // specific of Stops over stoppingPlaces
1197 case SUMO_ATTR_BUS_STOP:
1200 break;
1204 break;
1208 break;
1212 break;
1216 break;
1217 // specific of Stops over lanes
1218 case SUMO_ATTR_LANE:
1221 break;
1223 if (value.empty()) {
1225 parametersSet &= ~STOP_POSLAT_SET;
1226 } else {
1227 posLat = parse<double>(value);
1229 }
1230 break;
1231 case SUMO_ATTR_SPLIT:
1232 split = value;
1233 if (split.size() > 0) {
1235 } else {
1236 parametersSet &= ~STOP_SPLIT_SET;
1237 }
1238 break;
1239 //
1240 case GNE_ATTR_PARENT:
1242 break;
1243 default:
1245 break;
1246 }
1247}
1248
1249
1250void
1252 switch (key) {
1253 case SUMO_ATTR_DURATION:
1254 if (value) {
1256 } else {
1257 parametersSet &= ~STOP_DURATION_SET;
1258 }
1259 break;
1260 case SUMO_ATTR_UNTIL:
1261 if (value) {
1263 } else {
1264 parametersSet &= ~STOP_UNTIL_SET;
1265 }
1266 break;
1268 if (value) {
1270 } else {
1271 parametersSet &= ~STOP_EXTENSION_SET;
1272 }
1273 break;
1274 case SUMO_ATTR_TRIP_ID:
1275 if (value) {
1277 } else {
1278 parametersSet &= ~STOP_TRIP_ID_SET;
1279 }
1280 break;
1281 case SUMO_ATTR_LINE:
1282 if (value) {
1284 } else {
1285 parametersSet &= ~STOP_LINE_SET;
1286 }
1287 break;
1288 case SUMO_ATTR_ONDEMAND:
1289 if (value) {
1291 } else {
1292 parametersSet &= ~STOP_ONDEMAND_SET;
1293 }
1294 break;
1295 default:
1296 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1297 }
1298}
1299
1300
1301void
1303 // first check that we're in move mode and shift key is pressed
1305 // calculate new color
1306 const RGBColor color = baseColor.changedBrightness(-50);
1307 // push matrix
1309 // translated to front
1310 glTranslated(0, 0, 0.1);
1311 // set color
1312 GLHelper::setColor(color);
1313 // draw points
1314 if (startPos != INVALID_DOUBLE) {
1315 // push geometry point matrix
1317 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1318 // draw geometry point
1320 // pop geometry point matrix
1322 }
1323 if (endPos != INVALID_DOUBLE) {
1324 // push geometry point matrix
1326 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1327 // draw geometry point
1329 // pop geometry point matrix
1331 }
1332 // pop draw matrix
1334 }
1335}
1336
1337
1338int
1340 // get edge stop indexes
1341 const auto edgeStopIndex = getEdgeStopIndex();
1342 // finally find stopIndex in edgeStopIndexes
1343 for (const auto& edgeStop : edgeStopIndex) {
1344 for (const auto& stop : edgeStop.stops) {
1345 if (stop == this) {
1346 return edgeStop.stopIndex;
1347 }
1348 }
1349 }
1350 // not found, then return -1
1351 return -1;
1352}
1353
1354
1355void
1357 if (getParentAdditionals().size() > 0) {
1358 setDemandElementID(getMicrosimID() + " (" + getParentAdditionals().front()->getTagStr() + ")");
1359 } else if (getParentLanes().size() > 0) {
1360 setDemandElementID(getMicrosimID() + " (" + getParentLanes().front()->getTagStr() + ")");
1361 }
1362}
1363
1364/****************************************************************************/
@ GLO_VEHICLELABELS
stack and flow labels (used in netedit)
#define TL(string)
Definition MsgHandler.h:304
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define STEPS2TIME(x)
Definition SUMOTime.h:55
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const int STOP_DURATION_SET
const int STOP_POSLAT_SET
const int STOP_EXPECTED_SET
const int STOP_SPEED_SET
const int STOP_UNTIL_SET
const int STOP_LINE_SET
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
const int STOP_PERMITTED_SET
const int STOP_SPLIT_SET
const int STOP_JOIN_SET
const int STOP_CONTAINER_TRIGGER_SET
const int STOP_EXTENSION_SET
const int STOP_TRIGGER_SET
const int STOP_JUMP_SET
const int STOP_ONDEMAND_SET
const int STOP_EXPECTED_CONTAINERS_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_WAYPOINT_PARKINGAREA
@ GNE_TAG_STOP_PARKINGAREA
stop placed over a parking area
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_STOP
stop for vehicles
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_LANE
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_TRAIN_STOP
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_SPLIT
@ SUMO_ATTR_ACTTYPE
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_PERMITTED
@ GNE_ATTR_STOPINDEX
stop index (position in the parent's children
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_JUMP
@ GNE_ATTR_PLAN_GEOMETRY_ENDPOS
person/container geometry end position
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
@ GNE_ATTR_PATHSTOPINDEX
stop index (position in the parent's path)
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:75
bool isInitialised() const
check if Boundary is Initialised
Definition Boundary.cpp:256
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition GLHelper.cpp:348
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition GLHelper.cpp:296
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition GLHelper.cpp:534
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
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition GLHelper.cpp:773
bool drawMovingGeometryPoints() const
check if draw moving geometry points
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::string & getTagStr() const
get tag assigned to this object in string format
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
Position getCommonAttributePosition(SumoXMLAttr key) const
friend class GNEChange_ToggleAttribute
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
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)
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...)
GUIGeometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
void replaceFirstParentAdditional(SumoXMLTag tag, const std::string &value)
replace the first parent additional
void setDemandElementID(const std::string &newID)
set demand element id
std::vector< EdgeStopIndex > getEdgeStopIndex() const
get edgeStopIndex
Problem
enum class for demandElement problems
void replaceFirstParentLane(const std::string &value)
replace the first parent lane
GNEDemandElement * getCurrentDemandElement() const
get current demand element
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:232
double myMovingLateralOffset
move element lateral offset
std::string getMovingAttribute(SumoXMLAttr key) const override
get moving attribute
void fixMovingProblem()
fix moving problem
double getMovingAttributeDouble(SumoXMLAttr key) const override
get moving attribute double
std::string getMovingProblem() const
return a string with the current moving problem
bool isMovingAttributeValid(SumoXMLAttr key, const std::string &value) const override
check if the given moving attribute is valid
bool isMoveElementValid() const
check if current moving element is valid to be written into XML
void setMovingAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
set moving attribute (using undo-list)
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
GNEDemandElementSelector * getStopParentSelector() const
get stop parent selector
const RGBColor & getColor() const
get color
Definition GNEStop.cpp:244
int getPathStopIndex() const
get pathStopIndex
Definition GNEStop.cpp:1339
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this stop
Definition GNEStop.cpp:152
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEStop.cpp:238
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:843
~GNEStop()
destructor
Definition GNEStop.cpp:148
void setStopMicrosimID()
set stop microsim ID
Definition GNEStop.cpp:1356
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEStop.cpp:40
bool drawIndex() const
draw index
Definition GNEStop.cpp:967
GNEMoveElementLaneDouble * myMoveElementLaneDouble
move element lane double
Definition GNEStop.h:221
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:475
GNEContour myStopContour
variable used for draw contours
Definition GNEStop.h:224
Position getPositionInView() const
Returns position of demand element in view.
Definition GNEStop.cpp:280
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEStop.cpp:330
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:493
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEStop.cpp:857
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:486
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEStop.cpp:170
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition GNEStop.h:227
void drawStopOverStoppingPlace(const GUIVisualizationSettings::Detail d, const RGBColor &color, const double width, const double exaggeration) const
draw stop over stoppingPlace
Definition GNEStop.cpp:1035
std::string getParentName() const
Returns the name of the parent object.
Definition GNEStop.cpp:292
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:829
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNEStop.cpp:205
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEStop.cpp:463
void computePathElement()
compute pathElement
Definition GNEStop.cpp:456
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEStop.cpp:312
void drawStopOverLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &color, const double width, const double exaggeration) const
draw stop over lane
Definition GNEStop.cpp:983
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEStop.cpp:608
Parameterised * getParameters() override
get parameters associated with this stop
Definition GNEStop.cpp:158
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEStop.cpp:336
void drawStopLabel(const GUIVisualizationSettings &s) const
Definition GNEStop.cpp:390
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNEStop.cpp:710
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEStop.cpp:229
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNEStop.cpp:306
void updateGeometry() override
update pre-computed geometry information
Definition GNEStop.cpp:267
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEStop.cpp:896
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNEStop.cpp:669
const int myCreationIndex
creation index (using for saving sorted)
Definition GNEStop.h:239
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEStop.cpp:643
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition GNEStop.cpp:918
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:469
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1302
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:943
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:890
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition GNEStop.cpp:929
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
Definition GNEStop.cpp:1251
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEStop.cpp:217
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isVehicleWaypoint() const
return true if tag correspond to a vehicle waypoint element
const std::vector< const GNEAttributeProperties * > & getAttributeProperties() const
get all attribute properties
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
bool isACInspected(GNEAttributeCarrier *AC) const
GNEAttributeCarrier * getFirstAC() const
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEViewParent * getViewParent() const
get the net object
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
GNEStopFrame * getStopFrame() const
get frame for DEMAND_STOP
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
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
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
bool checkDrawAdditional(Detail d, const bool selected) const
check if draw additionals
bool showParkingInfo
Set whether parking related information should be shown.
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)
GUIVisualizationTextSettings vehicleText
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
double angle
The current view rotation angle.
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.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
double length2D() const
Returns the length.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
static const RGBColor GREY
Definition RGBColor.h:197
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
Definition of vehicle stop (position and duration)
SUMOTime started
the time at which this stop was reached
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
SUMOTime extension
The maximum time extension for boarding / loading.
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
double startPos
The stopping position start.
std::string line
the new line id of the trip within a cyclical public transport route
double posLat
the lateral offset when stopping
bool onDemand
whether the stop may be skipped
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::string overheadWireSegment
(Optional) overhead line segment if one is assigned to the stop
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
int parametersSet
Information for the output which parameter were set.
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime until
The time at which the vehicle may continue its journey.
std::string actType
act Type (only used by Persons) (used by netedit)
bool triggered
whether an arriving person lets the vehicle continue
void write(OutputDevice &dev, const bool close=true, const bool writeTagAndParents=true) const
Writes the stop as XML.
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
bool joinTriggered
whether an joined vehicle lets this vehicle continue
std::string tripId
id of the trip within a cyclical public transport route
std::string containerstop
(Optional) container stop if one is assigned to the stop
bool containerTriggered
whether an arriving container lets the vehicle continue
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
Structure representing possible vehicle parameter.
static ParkingType parseParkingType(const std::string &value)
parses parking type value
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
Definition of vehicle stop (position and duration)
bool showAllTrips() const
check if trips has to be drawn
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
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
RGBColor waypointColor
color for Waypoints
static const double segmentWidth
width of dotted contour segments
static const double additionalGeometryPointRadius
moving additional geometry point radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values