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-2024 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#include <netedit/GNENet.h>
21#include <netedit/GNEUndoList.h>
22#include <netedit/GNEViewNet.h>
29
30#include "GNEStop.h"
31
32// ===========================================================================
33// member method definitions
34// ===========================================================================
35
37 GNEDemandElement("", net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
38 GNEPathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
39 GNEDemandElementPlan(this, -1, -1),
40myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
41 // reset default values
42 resetDefaultValues();
43 // enable parking for stops in parkin)gAreas
45 parametersSet |= STOP_PARKING_SET;
46 }
47 // set parking
48 if (parametersSet & STOP_PARKING_SET) {
49 parking = ParkingType::OFFROAD;
50 }
51 // set waypoint speed
52 myTagProperty.isVehicleWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
53 // set jump
54 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
55 // set locator sufix
56 setStopMicrosimID();
57}
58
59
60GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter) :
61 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
62 GNEPathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {stoppingPlace}, {stopParent}, {}),
63SUMOVehicleParameter::Stop(stopParameter),
64GNEDemandElementPlan(this, -1, -1),
65myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
66 // enable parking for stops in parkingAreas
68 parametersSet |= STOP_PARKING_SET;
69 }
70 // set parking
71 if (parametersSet & STOP_PARKING_SET) {
72 parking = ParkingType::OFFROAD;
73 }
74 // set tripID and line
75 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
76 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
77 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
78 // set waypoint speed
79 myTagProperty.isVehicleWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
80 // set jump
81 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
82 // set locator sufix
83 setStopMicrosimID();
84}
85
86
87GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter) :
88 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
89 GNEPathElement::Options::DEMAND_ELEMENT, {}, {}, {lane}, {}, {stopParent}, {}),
90SUMOVehicleParameter::Stop(stopParameter),
91GNEDemandElementPlan(this, -1, -1),
92myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
93 // set parking
94 if (parametersSet & STOP_PARKING_SET) {
95 parking = ParkingType::OFFROAD;
96 }
97 // set tripID and line
98 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
99 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
100 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
101 // set waypoint speed
102 myTagProperty.isVehicleWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
103 // set jump
104 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
105 // set locator sufix
106 setStopMicrosimID();
107}
108
110
111
115 // get allow change lane
116 const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonModeOptions()->getAllowChangeLane();
117 // fist check if we're moving only extremes
121 // get snap radius
123 // get mouse position
124 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
125 // check if we clicked over start or end position
126 if ((startPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
127 // move only start position
128 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
130 } else if ((endPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
131 // move only end position
132 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
134 } else {
135 return nullptr;
136 }
137 } else if ((startPos != INVALID_DOUBLE) && (endPos != INVALID_DOUBLE)) {
138 // move both start and end positions
139 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
141 } else if (startPos != INVALID_DOUBLE) {
142 // move only start position
143 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
145 } else if (startPos != INVALID_DOUBLE) {
146 // move only end position
147 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
149 } else {
150 // start and end positions undefined, then nothing to move
151 return nullptr;
152 }
153 } else {
154 return nullptr;
155 }
156}
157
158
159void
161 device.openTag(SUMO_TAG_STOP);
162 if (getParentAdditionals().size() > 0) {
163 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
165 }
166 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_TRAIN_STOP) {
168 }
169 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
171 }
174 }
175 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA) {
177 }
178 } else {
179 if (getParentLanes().size() > 0) {
180 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
181 }
182 if (startPos != INVALID_DOUBLE) {
184 }
185 if (endPos != INVALID_DOUBLE) {
187 }
188 }
189 // write rest of attributes
190 write(device, true, false);
191}
192
193
196 if (getPathStopIndex() == -1) {
198 } else {
199 // only Stops placed over lanes can be invalid
201 return Problem::OK;
202 } else if (friendlyPos) {
203 // with friendly position enabled position are "always fixed"
204 return Problem::OK;
205 } else {
206 // obtain lane length
207 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
208 // declare a copy of start and end positions
209 double startPosCopy = startPos;
210 double endPosCopy = endPos;
211 // check if position has to be fixed
212 if (startPosCopy < 0) {
213 startPosCopy += laneLength;
214 }
215 if (endPosCopy < 0) {
216 endPosCopy += laneLength;
217 }
218 // check values
219 if ((startPosCopy >= 0) && (endPosCopy <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) && ((endPosCopy - startPosCopy) >= POSITION_EPS)) {
220 return Problem::OK;
221 } else {
223 }
224 }
225 }
226}
227
228
229std::string
231 if (getPathStopIndex() == -1) {
232 return ("Downstream stop");
233 } else {
234 // declare a copy of start and end positions
235 double startPosCopy = startPos;
236 double endPosCopy = endPos;
237 // obtain lane length
238 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
239 // check if position has to be fixed
240 if (startPosCopy < 0) {
241 startPosCopy += laneLength;
242 }
243 if (endPosCopy < 0) {
244 endPosCopy += laneLength;
245 }
246 // declare variables
247 std::string errorStart, separator, errorEnd;
248 // check positions over lane
249 if (startPosCopy < 0) {
250 errorStart = (toString(SUMO_ATTR_STARTPOS) + " < 0");
251 } else if (startPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
252 errorStart = (toString(SUMO_ATTR_STARTPOS) + " > lanes's length");
253 }
254 if (endPosCopy < 0) {
255 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " < 0");
256 } else if (endPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
257 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
258 }
259 // check separator
260 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
261 separator = " and ";
262 }
263 return errorStart + separator + errorEnd;
264 }
265}
266
267
268void
272
273
276 return getParentDemandElements().front()->getVClass();
277}
278
279
280const RGBColor&
282 // get inspected AC
283 const auto inspectedAC = myNet->getViewNet()->getInspectedElements().getFirstAC();
284 if (inspectedAC) {
285 // check if is a route or a vehicle
286 if ((inspectedAC->getTagProperty().isRoute() || inspectedAC->getTagProperty().isVehicle()) && (inspectedAC != getParentDemandElements().front())) {
287 return RGBColor::GREY;
288 }
289 } else if (myNet->getViewNet()->getViewParent()->getStopFrame()->shown()) {
291 return RGBColor::GREY;
292 }
293 }
294 // return default color
297 } else {
299 }
300}
301
302
303void
305 // update geometry depending of parent
306 if (getParentLanes().size() > 0) {
307 // Cut shape using as delimitators fixed start position and fixed end position
309 } else if (getParentAdditionals().size() > 0) {
310 // use geometry of additional (busStop)
311 myDemandElementGeometry = getParentAdditionals().at(0)->getAdditionalGeometry();
312 }
313}
314
315
318 if (getParentLanes().size() > 0) {
319 return getParentLanes().front()->getLaneShape().positionAtOffset((startPos + endPos) / 2.0);
320 } else if (getParentAdditionals().size() > 0) {
321 return getParentAdditionals().front()->getPositionInView();
322 } else {
323 throw ProcessError(TL("Invalid Stop parent"));
324 }
325}
326
327
328std::string
330 if (getParentDemandElements().size() > 0) {
331 return getParentDemandElements().front()->getID();
332 } else if (getParentAdditionals().size() > 0) {
333 return getParentAdditionals().front()->getID();
334 } else if (getParentLanes().size() > 0) {
335 return getParentLanes().front()->getID();
336 } else {
337 throw ProcessError(TL("Invalid parent"));
338 }
339}
340
341
342double
344 return s.addSize.getExaggeration(s, this);
345}
346
347
350 Boundary b;
351 // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
352 if (getParentAdditionals().size() > 0) {
353 return getParentAdditionals().at(0)->getCenteringBoundary();
356 } else if (myDemandElementGeometry.getShape().size() > 0) {
358 } else {
360 }
361 b.grow(20);
362 return b;
363}
364
365
366void
367GNEStop::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
368 // geometry of this element cannot be splitted
369}
370
371
372void
374 // check if draw an stop for person/containers or for vehicles/routes
375 if (canDrawVehicleStop()) {
376 // get exaggeration
377 const auto exaggeration = getExaggeration(s);
378 // get lane
379 const auto& stopLane = getParentLanes().size() > 0 ? getParentLanes().front() : nullptr;
380 // get lane width
381 const double width = stopLane ? stopLane->getParentEdge()->getNBEdge()->getLaneWidth(stopLane->getIndex()) * 0.5 : exaggeration * 0.8;
382 // get detail level
383 const auto d = s.getDetailLevel(exaggeration);
384 // draw geometry only if we'rent in drawForObjectUnderCursor mode
386 // get color
388 // Add a layer matrix
390 // set Color
391 GLHelper::setColor(color);
392 // Start with the drawing of the area traslating matrix to origin
394 // draw depending if is over lane or over stoppingP
395 if (getParentLanes().size() > 0) {
396 drawStopOverLane(s, d, color, width, exaggeration);
397 } else {
398 drawStopOverStoppingPlace(d, color, width, exaggeration);
399 }
400 // pop layer matrix
402 // draw lock icon
404 // Draw name
405 drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
406 // draw dotted contour
408 }
409 // calculate contour and draw dotted geometry
410 if (getParentAdditionals().size() > 0) {
411 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true,
412 0, nullptr, getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
413 } else {
414 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true,
415 0, nullptr, getParentLanes().front()->getParentEdge());
416 }
417 }
418}
419
420
421void
423 // only update geometry
425}
426
427
428void
429GNEStop::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
430 // Stops don't use drawJunctionPartialGL
431}
432
433
434void
435GNEStop::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
436 // Stops don't use drawJunctionPartialGL
437}
438
439
440GNELane*
442 // check if stop is placed over a busStop
443 if (getParentAdditionals().size() > 0) {
444 return getParentAdditionals().front()->getParentLanes().front();
445 } else {
446 return getParentLanes().front();
447 }
448}
449
450
451GNELane*
453 // first and last path lane are the same
454 return getFirstPathLane();
455}
456
457
458std::string
460 switch (key) {
461 case SUMO_ATTR_ID:
462 return getMicrosimID();
464 if (isAttributeEnabled(key)) {
465 return time2string(duration);
466 } else {
467 return "";
468 }
469 case SUMO_ATTR_UNTIL:
470 if (isAttributeEnabled(key)) {
471 return time2string(until);
472 } else {
473 return "";
474 }
476 if (isAttributeEnabled(key)) {
477 return time2string(extension);
478 } else {
479 return "";
480 }
482 if (triggered) {
483 return "person";
484 } else if (containerTriggered) {
485 return "container";
486 } else if (joinTriggered) {
487 return "join";
488 } else {
489 return "false";
490 }
492 if (triggered) {
493 return toString(awaitedPersons);
494 } else if (containerTriggered) {
496 } else {
497 return "";
498 }
499 case SUMO_ATTR_JOIN:
500 if (joinTriggered) {
501 return join;
502 } else {
503 return "";
504 }
506 return toString(permitted);
509 return "true";
510 } else {
511 return "false";
512 }
514 return actType;
516 return tripId;
517 case SUMO_ATTR_LINE:
518 return line;
520 return toString(onDemand);
521 case SUMO_ATTR_JUMP:
523 return time2string(jump);
524 } else {
525 return "";
526 }
527 // only for waypoints
528 case SUMO_ATTR_SPEED:
529 return toString(speed);
530 // specific of Stops over stoppingPlaces
536 return getParentAdditionals().front()->getID();
537 // specific of stops over lanes
538 case SUMO_ATTR_LANE:
539 return getParentLanes().front()->getID();
541 if (startPos != INVALID_DOUBLE) {
542 return toString(startPos);
543 } else {
544 return "";
545 }
546 case SUMO_ATTR_ENDPOS:
547 if (endPos != INVALID_DOUBLE) {
548 return toString(endPos);
549 } else {
550 return "";
551 }
553 return toString(friendlyPos);
555 if (posLat == INVALID_DOUBLE) {
556 return "";
557 } else {
558 return toString(posLat);
559 }
560 case SUMO_ATTR_SPLIT:
561 return split;
562 //
563 case GNE_ATTR_PARENT:
564 return getParentDemandElements().front()->getID();
565 case GNE_ATTR_STOPINDEX: {
566 // extract all stops of demandElement parent
567 std::vector<GNEDemandElement*> stops;
568 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
569 if (parent->getTagProperty().isVehicleStop()) {
570 stops.push_back(parent);
571 }
572 }
573 // find index in stops
574 for (int i = 0; i < (int)stops.size(); i++) {
575 if (stops.at(i) == this) {
576 return toString(i);
577 }
578 }
579 return "invalid index";
580 }
582 return toString(getPathStopIndex());
584 return getParametersStr();
585 default:
586 return getCommonAttribute(key);
587 }
588}
589
590
591double
593 switch (key) {
596 if (getParentAdditionals().size() > 0) {
597 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_STARTPOS);
598 } else if (startPos != INVALID_DOUBLE) {
599 return startPos;
600 } else {
601 return 0;
602 }
603 case SUMO_ATTR_ENDPOS:
605 if (getParentAdditionals().size() > 0) {
606 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
607 } else if (endPos != INVALID_DOUBLE) {
608 return endPos;
609 } else {
610 return getParentLanes().front()->getLaneShapeLength();
611 }
612 case SUMO_ATTR_INDEX: // for writting sorted
613 return (double)myCreationIndex;
614 case GNE_ATTR_STOPINDEX: {
615 // extract all stops of demandElement parent
616 std::vector<GNEDemandElement*> stops, filteredStops;
617 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
618 if (parent->getTagProperty().isVehicleStop()) {
619 stops.push_back(parent);
620 }
621 }
622 // now filter stops with the same startPos
623 for (const auto& stop : stops) {
624 if (stop->getAttributeDouble(SUMO_ATTR_STARTPOS) == getAttributeDouble(SUMO_ATTR_STARTPOS)) {
625 filteredStops.push_back(stop);
626 }
627 }
628 // get index
629 for (int i = 0; i < (int)filteredStops.size(); i++) {
630 if (filteredStops.at(i) == this) {
631 return i;
632 }
633 }
634 return 0;
635 }
637 return (double)getPathStopIndex();
638 default:
639 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
640 }
641}
642
643
646 switch (key) {
648 if (getParentAdditionals().size() > 0) {
649 // return first position of busStop
650 return getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
651 } else {
652 // get lane shape
653 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
654 // continue depending of arrival position
655 if (endPos == 0) {
656 return laneShape.front();
657 } else if ((endPos == -1) || (endPos >= laneShape.length2D())) {
658 return laneShape.back();
659 } else {
660 return laneShape.positionAtOffset2D(endPos);
661 }
662 }
663 }
664 default:
665 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
666 }
667}
668
669
670void
671GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
672 if (value == getAttribute(key)) {
673 return; //avoid needless changes, later logic relies on the fact that attributes have changed
674 }
675 switch (key) {
677 case SUMO_ATTR_UNTIL:
681 case SUMO_ATTR_JOIN:
686 case SUMO_ATTR_LINE:
688 case SUMO_ATTR_JUMP:
689 // only for waypoints
690 case SUMO_ATTR_SPEED:
691 // specific of Stops over stoppingPlaces
697 // specific of stops over lanes
698 case SUMO_ATTR_LANE:
700 case SUMO_ATTR_ENDPOS:
703 case SUMO_ATTR_SPLIT:
704 // other
705 case GNE_ATTR_PARENT:
707 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
708 break;
709 default:
710 setCommonAttribute(key, value, undoList);
711 break;
712 }
713}
714
715
716bool
717GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
718 // declare string error
719 std::string error;
720 switch (key) {
722 case SUMO_ATTR_UNTIL:
724 if (canParse<SUMOTime>(value)) {
725 return parse<SUMOTime>(value) >= 0;
726 } else {
727 return false;
728 }
729 case SUMO_ATTR_TRIGGERED: {
730 const auto expectedValues = myTagProperty.getAttributeProperties(key).getDiscreteValues();
731 const auto triggeredValues = parse<std::vector<std::string> >(value);
732 for (const auto& triggeredValue : triggeredValues) {
733 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
734 return false;
735 }
736 }
737 return true;
738 }
740 if (value.empty()) {
741 return false;
742 } else {
743 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
744 for (const auto& expectedValue : expectedValues) {
745 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
746 return false;
747 }
748 }
749 return true;
750 }
751 case SUMO_ATTR_JOIN:
752 if (value.empty()) {
753 return false;
754 } else {
756 }
757 case SUMO_ATTR_PERMITTED: {
758 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
759 for (const auto& expectedValue : expectedValues) {
760 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
761 return false;
762 }
763 }
764 return true;
765 }
766 case SUMO_ATTR_PARKING: {
767 if (value == "opportunistic") {
768 return false; // Currrently deactivated opportunistic in netedit waiting for the implementation in SUMO
769 }
770 const auto expectedValues = myTagProperty.getAttributeProperties(key).getDiscreteValues();
771 const auto triggeredValues = parse<std::vector<std::string> >(value);
772 for (const auto& triggeredValue : triggeredValues) {
773 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
774 return false;
775 }
776 }
777 return true;
778 }
780 return true;
783 case SUMO_ATTR_LINE:
784 return true;
786 return canParse<bool>(value);
787 case SUMO_ATTR_JUMP:
788 if ((value == "-1") || (value.empty())) {
789 return true;
790 } else if (canParse<double>(value)) {
791 return parse<double>(value) >= 0;
792 } else {
793 return false;
794 }
795 // only for waypoints
796 case SUMO_ATTR_SPEED:
797 if (canParse<double>(value)) {
798 return (parse<double>(value) >= 0);
799 } else {
800 return false;
801 }
802 // specific of Stops over stoppingPlaces
804 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
806 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
808 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
810 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
812 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
813 // specific of stops over lanes
814 case SUMO_ATTR_LANE:
815 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
816 return true;
817 } else {
818 return false;
819 }
821 if (value.empty()) {
822 return true;
823 } else if (canParse<double>(value)) {
824 return SUMORouteHandler::isStopPosValid(parse<double>(value), endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
825 } else {
826 return false;
827 }
828 case SUMO_ATTR_ENDPOS:
829 if (value.empty()) {
830 return true;
831 } else if (canParse<double>(value)) {
832 return SUMORouteHandler::isStopPosValid(startPos, parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
833 } else {
834 return false;
835 }
837 return canParse<bool>(value);
839 if (value.empty()) {
840 return true;
841 } else {
842 return canParse<double>(value);
843 }
844 case SUMO_ATTR_SPLIT:
845 if (value.empty()) {
846 return true;
847 } else {
849 }
850 //
851 case GNE_ATTR_PARENT:
852 return false;
854 return areParametersValid(value);
855 default:
856 return isCommonValid(key, value);
857 }
858}
859
860
861void
863 switch (key) {
865 case SUMO_ATTR_UNTIL:
867 undoList->add(new GNEChange_ToggleAttribute(this, key, true), true);
868 break;
869 default:
870 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
871 }
872}
873
874
875void
877 switch (key) {
879 case SUMO_ATTR_UNTIL:
881 undoList->add(new GNEChange_ToggleAttribute(this, key, false), true);
882 break;
883 default:
884 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
885 }
886}
887
888
889bool
891 switch (key) {
892 // Currently stops parents cannot be edited
898 return false;
900 return (parametersSet & STOP_DURATION_SET) != 0;
901 case SUMO_ATTR_UNTIL:
902 return (parametersSet & STOP_UNTIL_SET) != 0;
904 return (parametersSet & STOP_EXTENSION_SET) != 0;
907 case SUMO_ATTR_JOIN:
908 return joinTriggered;
910 // for stops/waypoints over parking areas, always enabled
912 return false;
913 } else {
914 return true;
915 }
916 default:
917 return true;
918 }
919}
920
921
922std::string
924 return getTagStr();
925}
926
927
928std::string
930 if (getParentAdditionals().size() > 0) {
931 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
932 return "BusStop: " + getParentAdditionals().front()->getID();
933 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_TRAIN_STOP) {
934 return "TrainStop: " + getParentAdditionals().front()->getID();
935 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
936 return "containerStop: " + getParentAdditionals().front()->getID();
937 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CHARGING_STATION) {
938 return "chargingStation: " + getParentAdditionals().front()->getID();
939 } else {
940 return "parkingArea: " + getParentAdditionals().front()->getID();
941 }
942 } else if (getParentLanes().size() > 0) {
943 return "lane: " + getParentLanes().front()->getID();
944 } else {
945 return "";
946 }
947}
948
949
954
955double
957 double fixedPos = startPos;
958 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
959 if (fixedPos < 0) {
960 fixedPos += len;
961 }
962 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
963}
964
965
966double
968 double fixedPos = endPos;
969 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
970 if (fixedPos < 0) {
971 fixedPos += len;
972 }
973 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
974}
975
976// ===========================================================================
977// protected
978// ===========================================================================
979
980bool
982 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
984 return true;
985 } else if (inspectedElements.isACInspected(this)) {
986 return true;
987 } else if (inspectedElements.isACInspected(getParentDemandElements().front())) {
988 return true;
990 return true;
991 } else if ((getParentDemandElements().front()->getTagProperty().getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
993 if (inspectedElements.isACInspected(getParentDemandElements().front()->getChildDemandElements().front())) {
994 return true;
995 } else {
996 return false;
997 }
998 } else {
999 return false;
1000 }
1001}
1002
1003
1004bool
1006 // get stop frame
1007 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
1008 // check conditions
1010 return true;
1011 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
1012 return true;
1013 } else {
1014 return false;
1015 }
1016}
1017
1018
1019
1020void
1022 const double width, const double exaggeration) const {
1023 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
1027 exaggeration * 0.1, 0, width);
1031 exaggeration * 0.1, 0, width * -1);
1032 // Add a detail matrix
1034 // move to geometry front
1035 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1036 // rotate
1037 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1038 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1039 }
1040 // move again
1041 glTranslated(0, exaggeration * 0.5, 0);
1042 // draw stop front
1043 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1044 // move to symbol position
1045 glTranslated(0, 1, 0.1);
1046 // draw text depending of detail
1048 // draw symbol
1049 GLHelper::drawText(myTagProperty.isVehicleWaypoint() ? "W" : "S", Position(), .1, 2.8, color, 180);
1050 // move to subtitle position
1051 glTranslated(0, 1.4, 0);
1052 // draw subtitle depending of tag
1053 GLHelper::drawText("lane", Position(), .1, 1, color, 180);
1054 // check if draw index
1055 if (drawIndex()) {
1056 // move to index position
1057 glTranslated(-2.1, -2.4, 0);
1058 glRotated(-90, 0, 0, 1);
1059 // draw index
1061 }
1062 } else {
1063 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1064 }
1065 // pop detail matrix
1067 // draw geometry points
1068 drawGeometryPoints(s, d, color);
1069}
1070
1071
1072void
1074 const double width, const double exaggeration) const {
1075 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1077 // only draw text if isn't being drawn for selecting
1079 // Add a detail matrix
1081 // move to geometry front
1082 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1083 // rotate
1084 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1085 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1086 }
1087 // move to index position
1088 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1089 glRotated(-90, 0, 0, 1);
1090 // draw index
1092 // pop detail matrix
1094 }
1095}
1096
1097// ===========================================================================
1098// private
1099// ===========================================================================
1100
1101void
1102GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1103 switch (key) {
1104 case SUMO_ATTR_DURATION:
1105 if (value.empty()) {
1106 toggleAttribute(key, false);
1107 } else {
1108 toggleAttribute(key, true);
1109 duration = string2time(value);
1110 }
1111 break;
1112 case SUMO_ATTR_UNTIL:
1113 if (value.empty()) {
1114 toggleAttribute(key, false);
1115 } else {
1116 toggleAttribute(key, true);
1117 until = string2time(value);
1118 }
1119 break;
1121 if (value.empty()) {
1122 toggleAttribute(key, false);
1123 } else {
1124 toggleAttribute(key, true);
1125 extension = string2time(value);
1126 }
1127 break;
1129 // reset all flags
1130 triggered = false;
1131 containerTriggered = false;
1132 joinTriggered = false;
1133 // disable all flags
1134 parametersSet &= ~STOP_JOIN_SET;
1135 parametersSet &= ~STOP_TRIGGER_SET;
1136 parametersSet &= ~STOP_EXPECTED_SET;
1137 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1138 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1139 // check value
1140 if ((value == "person") || (value == "true")) {
1142 triggered = true;
1143 if (awaitedPersons.size() > 0) {
1145 }
1146 } else if (value == "container") {
1149 containerTriggered = true;
1150 if (awaitedPersons.size() > 0) {
1152 }
1153 } else if (value == "join") {
1155 joinTriggered = true;
1156 }
1157 break;
1158 case SUMO_ATTR_EXPECTED:
1159 if (triggered) {
1160 awaitedPersons = parse<std::set<std::string> >(value);
1161 if (awaitedPersons.size() > 0) {
1163 } else {
1164 parametersSet &= ~STOP_EXPECTED_SET;
1165 }
1166 } else if (containerTriggered) {
1167 awaitedContainers = parse<std::set<std::string> >(value);
1168 if (awaitedContainers.size() > 0) {
1170 } else {
1171 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1172 }
1173 }
1174 break;
1175 case SUMO_ATTR_JOIN:
1176 if (joinTriggered) {
1177 join = value;
1178 if (join.size() > 0) {
1180 } else {
1181 parametersSet &= ~STOP_JOIN_SET;
1182 }
1183 }
1184 break;
1186 if (value.empty()) {
1187 parametersSet &= ~STOP_PERMITTED_SET;
1188 } else {
1190 permitted = parse<std::set<std::string> >(value);
1191 }
1192 break;
1193 case SUMO_ATTR_PARKING:
1196 parametersSet &= ~STOP_PARKING_SET;
1197 } else {
1199 }
1200 break;
1201 case SUMO_ATTR_ACTTYPE:
1202 actType = value;
1203 break;
1204 case SUMO_ATTR_TRIP_ID:
1205 tripId = value;
1206 toggleAttribute(key, (value.size() > 0));
1207 break;
1208 case SUMO_ATTR_LINE:
1209 line = value;
1210 toggleAttribute(key, (value.size() > 0));
1211 break;
1212 case SUMO_ATTR_ONDEMAND:
1213 if (parse<bool>(value)) {
1215 } else {
1216 parametersSet &= ~STOP_ONDEMAND_SET;
1217 }
1218 // set flag
1220 break;
1221 case SUMO_ATTR_JUMP:
1222 if ((value == "-1") || value.empty()) {
1223 parametersSet &= ~STOP_JUMP_SET;
1224 jump = -1;
1225 } else {
1227 jump = string2time(value);
1228 }
1229 break;
1230 // only for waypoints
1231 case SUMO_ATTR_SPEED:
1232 speed = parse<double>(value);
1233 break;
1234 // specific of Stops over stoppingPlaces
1235 case SUMO_ATTR_BUS_STOP:
1238 break;
1242 break;
1246 break;
1250 break;
1254 break;
1255 // specific of Stops over lanes
1256 case SUMO_ATTR_LANE:
1259 break;
1260 case SUMO_ATTR_STARTPOS:
1261 if (value.empty()) {
1263 } else {
1264 startPos = parse<double>(value);
1265 }
1267 break;
1268 case SUMO_ATTR_ENDPOS:
1269 if (value.empty()) {
1271 } else {
1272 endPos = parse<double>(value);
1273 }
1275 break;
1277 friendlyPos = parse<bool>(value);
1278 break;
1280 if (value.empty()) {
1282 parametersSet &= ~STOP_POSLAT_SET;
1283 } else {
1284 posLat = parse<double>(value);
1286 }
1287 break;
1288 case SUMO_ATTR_SPLIT:
1289 split = value;
1290 if (split.size() > 0) {
1292 } else {
1293 parametersSet &= ~STOP_SPLIT_SET;
1294 }
1295 break;
1296 //
1297 case GNE_ATTR_PARENT:
1299 break;
1301 setParametersStr(value);
1302 break;
1303 default:
1304 setCommonAttribute(key, value);
1305 break;
1306 }
1307}
1308
1309
1310void
1312 switch (key) {
1313 case SUMO_ATTR_DURATION:
1314 if (value) {
1316 } else {
1317 parametersSet &= ~STOP_DURATION_SET;
1318 }
1319 break;
1320 case SUMO_ATTR_UNTIL:
1321 if (value) {
1323 } else {
1324 parametersSet &= ~STOP_UNTIL_SET;
1325 }
1326 break;
1328 if (value) {
1330 } else {
1331 parametersSet &= ~STOP_EXTENSION_SET;
1332 }
1333 break;
1334 case SUMO_ATTR_TRIP_ID:
1335 if (value) {
1337 } else {
1338 parametersSet &= ~STOP_TRIP_ID_SET;
1339 }
1340 break;
1341 case SUMO_ATTR_LINE:
1342 if (value) {
1344 } else {
1345 parametersSet &= ~STOP_LINE_SET;
1346 }
1347 break;
1348 case SUMO_ATTR_ONDEMAND:
1349 if (value) {
1351 } else {
1352 parametersSet &= ~STOP_ONDEMAND_SET;
1353 }
1354 break;
1355 default:
1356 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1357 }
1358}
1359
1360
1361void
1364 // change only start position
1365 startPos = moveResult.newFirstPos;
1366 // adjust startPos
1367 if (startPos > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
1368 startPos = (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS);
1369 }
1371 // change only end position
1372 endPos = moveResult.newFirstPos;
1373 // adjust endPos
1374 if (endPos < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
1375 endPos = (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS);
1376 }
1377 } else {
1378 // change both position
1379 startPos = moveResult.newFirstPos;
1380 endPos = moveResult.newLastPos;
1381 // set lateral offset
1383 }
1384 // update geometry
1386}
1387
1388
1389void
1391 // begin change attribute
1392 undoList->begin(this, "position of " + getTagStr());
1393 // set attributes depending of operation type
1395 // set only start position
1398 // set only end position
1400 } else {
1401 // set both
1404 // check if lane has to be changed
1405 if (moveResult.newFirstLane) {
1406 // set new lane
1407 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
1408 }
1409 }
1410 // end change attribute
1411 undoList->end();
1412}
1413
1414
1415void
1417 // first check that we're in move mode and shift key is pressed
1421 // calculate new color
1422 const RGBColor color = baseColor.changedBrightness(-50);
1423 // push matrix
1425 // translated to front
1426 glTranslated(0, 0, 0.1);
1427 // set color
1428 GLHelper::setColor(color);
1429 // draw points
1430 if (startPos != INVALID_DOUBLE) {
1431 // push geometry point matrix
1433 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1434 // draw geometry point
1436 // pop geometry point matrix
1438 }
1439 if (endPos != INVALID_DOUBLE) {
1440 // push geometry point matrix
1442 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1443 // draw geometry point
1445 // pop geometry point matrix
1447 }
1448 // pop draw matrix
1450 }
1451}
1452
1453
1454int
1456 // get edge stop indexes
1457 const auto edgeStopIndex = getEdgeStopIndex();
1458 // finally find stopIndex in edgeStopIndexes
1459 for (const auto& edgeStop : edgeStopIndex) {
1460 for (const auto& stop : edgeStop.stops) {
1461 if (stop == this) {
1462 return edgeStop.stopIndex;
1463 }
1464 }
1465 }
1466 // not found, then return -1
1467 return -1;
1468}
1469
1470
1471void
1473 if (getParentAdditionals().size() > 0) {
1474 setDemandElementID(getMicrosimID() + " (" + getParentAdditionals().front()->getTagStr() + ")");
1475 } else if (getParentLanes().size() > 0) {
1476 setDemandElementID(getMicrosimID() + " (" + getParentLanes().front()->getTagStr() + ")");
1477 }
1478}
1479
1480/****************************************************************************/
@ DEMAND_MOVE
mode for moving demand elements
@ GLO_STOP
a stop
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define TL(string)
Definition MsgHandler.h:315
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:69
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
@ GNE_TAG_WAYPOINT_LANE
@ GNE_TAG_STOP_LANE
stop placed over a lane
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_LANE
@ GNE_ATTR_PLAN_GEOMETRY_STARTPOS
person/container geometry start position
@ 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
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ 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
@ SUMO_ATTR_FRIENDLY_POS
@ 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:64
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:78
bool isInitialised() const
check if Boundary is Initialised
Definition Boundary.cpp:259
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:343
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:751
An Element which don't belong to GNENet but has influence in the simulation.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool isCommonValid(SumoXMLAttr key, const std::string &value)
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
friend class GNEChange_ToggleAttribute
GNENet * myNet
pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
const std::vector< std::string > & getDiscreteValues() const
get discrete values
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
void replaceDemandParentLanes(const std::string &value)
replace demand parent lanes
Problem
enum class for demandElement problems
GNEDemandElement * getCurrentDemandElement() const
get current demand element
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:214
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
move result
const GNELane * newFirstLane
new first Lane
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
double firstLaneOffset
lane offset
double newLastPos
new last position
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
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:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2163
GNEDemandElementSelector * getStopParentSelector() const
get stop parent selector
const RGBColor & getColor() const
get color
Definition GNEStop.cpp:281
int getPathStopIndex() const
get pathStopIndex
Definition GNEStop.cpp:1455
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEStop.cpp:717
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEStop.cpp:275
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:876
~GNEStop()
destructor
Definition GNEStop.cpp:109
void setStopMicrosimID()
set stop microsim ID
Definition GNEStop.cpp:1472
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEStop.cpp:36
bool drawIndex() const
draw index
Definition GNEStop.cpp:1005
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:441
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEStop.cpp:645
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:923
GNEContour myStopContour
variable used for draw contours
Definition GNEStop.h:208
Position getPositionInView() const
Returns position of demand element in view.
Definition GNEStop.cpp:317
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEStop.cpp:367
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEStop.cpp:890
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:452
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEStop.cpp:160
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEStop.cpp:113
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEStop.cpp:929
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition GNEStop.h:211
void drawStopOverStoppingPlace(const GUIVisualizationSettings::Detail d, const RGBColor &color, const double width, const double exaggeration) const
draw stop over stoppingPlace
Definition GNEStop.cpp:1073
std::string getParentName() const
Returns the name of the parent object.
Definition GNEStop.cpp:329
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:862
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEStop.cpp:592
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:459
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEStop.cpp:1390
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNEStop.cpp:195
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEStop.cpp:429
void computePathElement()
compute pathElement
Definition GNEStop.cpp:422
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEStop.cpp:349
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:1021
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEStop.cpp:373
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition GNEStop.cpp:671
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEStop.cpp:1362
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEStop.cpp:269
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNEStop.cpp:343
const int myCreationIndex
creation index (using for saving sorted)
Definition GNEStop.h:223
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition GNEStop.cpp:956
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:435
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1416
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEStop.cpp:951
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:981
void updateGeometry()
update pre-computed geometry information
Definition GNEStop.cpp:304
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition GNEStop.cpp:967
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
Definition GNEStop.cpp:1311
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEStop.cpp:230
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute propety associated with the given Sumo XML Attribute (throw error if doesn't exist)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isVehicleWaypoint() const
return true if tag correspond to a vehicle waypoint element
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
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
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
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
GNEMoveFrame * getMoveFrame() const
get frame for move elements
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.
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.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings addSize
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)
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.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
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) const
Returns the position at the given length.
static const RGBColor GREY
Definition RGBColor.h:194
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
static bool isStopPosValid(const double startPos, const double endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if start and end position of a stop is valid
Definition of vehicle stop (position and duration)
ParkingType parking
whether the vehicle is removed from the net while stopping
SUMOTime extension
The maximum time extension for boarding / loading.
bool friendlyPos
enable or disable friendly position (used by netedit)
double speed
the speed at which this stop counts as reached (waypoint mode)
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::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.
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.
bool joinTriggered
whether an joined vehicle lets this vehicle continue
std::string tripId
id of the trip within a cyclical public transport route
bool containerTriggered
whether an arriving container lets the vehicle continue
SUMOTime duration
The stopping duration.
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
bool showAllTrips() const
check if trips has to be drawn
DemandEditMode demandEditMode
the current Demand edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
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 shiftKeyPressed() const
check if SHIFT is pressed during current event
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