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 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true, 0, nullptr);
411 }
412}
413
414
415void
417 // only update geometry
419}
420
421
422void
423GNEStop::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
424 // Stops don't use drawJunctionPartialGL
425}
426
427
428void
429GNEStop::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
430 // Stops don't use drawJunctionPartialGL
431}
432
433
434GNELane*
436 // check if stop is placed over a busStop
437 if (getParentAdditionals().size() > 0) {
438 return getParentAdditionals().front()->getParentLanes().front();
439 } else {
440 return getParentLanes().front();
441 }
442}
443
444
445GNELane*
447 // first and last path lane are the same
448 return getFirstPathLane();
449}
450
451
452std::string
454 switch (key) {
455 case SUMO_ATTR_ID:
456 return getMicrosimID();
458 if (isAttributeEnabled(key)) {
459 return time2string(duration);
460 } else {
461 return "";
462 }
463 case SUMO_ATTR_UNTIL:
464 if (isAttributeEnabled(key)) {
465 return time2string(until);
466 } else {
467 return "";
468 }
470 if (isAttributeEnabled(key)) {
471 return time2string(extension);
472 } else {
473 return "";
474 }
476 if (triggered) {
477 return "person";
478 } else if (containerTriggered) {
479 return "container";
480 } else if (joinTriggered) {
481 return "join";
482 } else {
483 return "false";
484 }
486 if (triggered) {
487 return toString(awaitedPersons);
488 } else if (containerTriggered) {
490 } else {
491 return "";
492 }
493 case SUMO_ATTR_JOIN:
494 if (joinTriggered) {
495 return join;
496 } else {
497 return "";
498 }
500 return toString(permitted);
503 return "true";
504 } else {
505 return "false";
506 }
508 return actType;
510 return tripId;
511 case SUMO_ATTR_LINE:
512 return line;
514 return toString(onDemand);
515 case SUMO_ATTR_JUMP:
517 return time2string(jump);
518 } else {
519 return "";
520 }
521 // only for waypoints
522 case SUMO_ATTR_SPEED:
523 return toString(speed);
524 // specific of Stops over stoppingPlaces
530 return getParentAdditionals().front()->getID();
531 // specific of stops over lanes
532 case SUMO_ATTR_LANE:
533 return getParentLanes().front()->getID();
535 if (startPos != INVALID_DOUBLE) {
536 return toString(startPos);
537 } else {
538 return "";
539 }
540 case SUMO_ATTR_ENDPOS:
541 if (endPos != INVALID_DOUBLE) {
542 return toString(endPos);
543 } else {
544 return "";
545 }
547 return toString(friendlyPos);
549 if (posLat == INVALID_DOUBLE) {
550 return "";
551 } else {
552 return toString(posLat);
553 }
554 case SUMO_ATTR_SPLIT:
555 return split;
556 //
559 case GNE_ATTR_PARENT:
560 return getParentDemandElements().front()->getID();
561 case GNE_ATTR_STOPINDEX: {
562 // extract all stops of demandElement parent
563 std::vector<GNEDemandElement*> stops;
564 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
565 if (parent->getTagProperty().isVehicleStop()) {
566 stops.push_back(parent);
567 }
568 }
569 // find index in stops
570 for (int i = 0; i < (int)stops.size(); i++) {
571 if (stops.at(i) == this) {
572 return toString(i);
573 }
574 }
575 return "invalid index";
576 }
578 return toString(getPathStopIndex());
580 return getParametersStr();
581 default:
582 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
583 }
584}
585
586
587double
589 switch (key) {
592 if (getParentAdditionals().size() > 0) {
593 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_STARTPOS);
594 } else if (startPos != INVALID_DOUBLE) {
595 return startPos;
596 } else {
597 return 0;
598 }
599 case SUMO_ATTR_ENDPOS:
601 if (getParentAdditionals().size() > 0) {
602 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
603 } else if (endPos != INVALID_DOUBLE) {
604 return endPos;
605 } else {
606 return getParentLanes().front()->getLaneShapeLength();
607 }
608 case SUMO_ATTR_INDEX: // for writting sorted
609 return (double)myCreationIndex;
610 case GNE_ATTR_STOPINDEX: {
611 // extract all stops of demandElement parent
612 std::vector<GNEDemandElement*> stops, filteredStops;
613 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
614 if (parent->getTagProperty().isVehicleStop()) {
615 stops.push_back(parent);
616 }
617 }
618 // now filter stops with the same startPos
619 for (const auto& stop : stops) {
620 if (stop->getAttributeDouble(SUMO_ATTR_STARTPOS) == getAttributeDouble(SUMO_ATTR_STARTPOS)) {
621 filteredStops.push_back(stop);
622 }
623 }
624 // get index
625 for (int i = 0; i < (int)filteredStops.size(); i++) {
626 if (filteredStops.at(i) == this) {
627 return i;
628 }
629 }
630 return 0;
631 }
633 return (double)getPathStopIndex();
634 default:
635 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
636 }
637}
638
639
642 switch (key) {
644 if (getParentAdditionals().size() > 0) {
645 // return first position of busStop
646 return getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
647 } else {
648 // get lane shape
649 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
650 // continue depending of arrival position
651 if (endPos == 0) {
652 return laneShape.front();
653 } else if ((endPos == -1) || (endPos >= laneShape.length2D())) {
654 return laneShape.back();
655 } else {
656 return laneShape.positionAtOffset2D(endPos);
657 }
658 }
659 }
660 default:
661 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
662 }
663}
664
665
666void
667GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
668 if (value == getAttribute(key)) {
669 return; //avoid needless changes, later logic relies on the fact that attributes have changed
670 }
671 switch (key) {
673 case SUMO_ATTR_UNTIL:
677 case SUMO_ATTR_JOIN:
682 case SUMO_ATTR_LINE:
684 case SUMO_ATTR_JUMP:
685 // only for waypoints
686 case SUMO_ATTR_SPEED:
687 // specific of Stops over stoppingPlaces
693 // specific of stops over lanes
694 case SUMO_ATTR_LANE:
696 case SUMO_ATTR_ENDPOS:
699 case SUMO_ATTR_SPLIT:
700 // other
702 case GNE_ATTR_PARENT:
704 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
705 break;
706 default:
707 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
708 }
709}
710
711
712bool
713GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
714 // declare string error
715 std::string error;
716 switch (key) {
718 case SUMO_ATTR_UNTIL:
720 if (canParse<SUMOTime>(value)) {
721 return parse<SUMOTime>(value) >= 0;
722 } else {
723 return false;
724 }
725 case SUMO_ATTR_TRIGGERED: {
726 const auto expectedValues = myTagProperty.getAttributeProperties(key).getDiscreteValues();
727 const auto triggeredValues = parse<std::vector<std::string> >(value);
728 for (const auto& triggeredValue : triggeredValues) {
729 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
730 return false;
731 }
732 }
733 return true;
734 }
736 if (value.empty()) {
737 return false;
738 } else {
739 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
740 for (const auto& expectedValue : expectedValues) {
741 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
742 return false;
743 }
744 }
745 return true;
746 }
747 case SUMO_ATTR_JOIN:
748 if (value.empty()) {
749 return false;
750 } else {
752 }
753 case SUMO_ATTR_PERMITTED: {
754 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
755 for (const auto& expectedValue : expectedValues) {
756 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
757 return false;
758 }
759 }
760 return true;
761 }
762 case SUMO_ATTR_PARKING: {
763 if (value == "opportunistic") {
764 return false; // Currrently deactivated opportunistic in netedit waiting for the implementation in SUMO
765 }
766 const auto expectedValues = myTagProperty.getAttributeProperties(key).getDiscreteValues();
767 const auto triggeredValues = parse<std::vector<std::string> >(value);
768 for (const auto& triggeredValue : triggeredValues) {
769 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
770 return false;
771 }
772 }
773 return true;
774 }
776 return true;
779 case SUMO_ATTR_LINE:
780 return true;
782 return canParse<bool>(value);
783 case SUMO_ATTR_JUMP:
784 if ((value == "-1") || (value.empty())) {
785 return true;
786 } else if (canParse<double>(value)) {
787 return parse<double>(value) >= 0;
788 } else {
789 return false;
790 }
791 // only for waypoints
792 case SUMO_ATTR_SPEED:
793 if (canParse<double>(value)) {
794 return (parse<double>(value) >= 0);
795 } else {
796 return false;
797 }
798 // specific of Stops over stoppingPlaces
800 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
802 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
804 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
806 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
808 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
809 // specific of stops over lanes
810 case SUMO_ATTR_LANE:
811 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
812 return true;
813 } else {
814 return false;
815 }
817 if (value.empty()) {
818 return true;
819 } else if (canParse<double>(value)) {
820 return SUMORouteHandler::isStopPosValid(parse<double>(value), endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
821 } else {
822 return false;
823 }
824 case SUMO_ATTR_ENDPOS:
825 if (value.empty()) {
826 return true;
827 } else if (canParse<double>(value)) {
828 return SUMORouteHandler::isStopPosValid(startPos, parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
829 } else {
830 return false;
831 }
833 return canParse<bool>(value);
835 if (value.empty()) {
836 return true;
837 } else {
838 return canParse<double>(value);
839 }
840 case SUMO_ATTR_SPLIT:
841 if (value.empty()) {
842 return true;
843 } else {
845 }
846 //
848 return canParse<bool>(value);
849 case GNE_ATTR_PARENT:
850 return false;
852 return areParametersValid(value);
853 default:
854 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
855 }
856}
857
858
859void
861 switch (key) {
863 case SUMO_ATTR_UNTIL:
865 undoList->add(new GNEChange_ToggleAttribute(this, key, true), true);
866 break;
867 default:
868 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
869 }
870}
871
872
873void
875 switch (key) {
877 case SUMO_ATTR_UNTIL:
879 undoList->add(new GNEChange_ToggleAttribute(this, key, false), true);
880 break;
881 default:
882 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
883 }
884}
885
886
887bool
889 switch (key) {
890 // Currently stops parents cannot be edited
896 return false;
898 return (parametersSet & STOP_DURATION_SET) != 0;
899 case SUMO_ATTR_UNTIL:
900 return (parametersSet & STOP_UNTIL_SET) != 0;
902 return (parametersSet & STOP_EXTENSION_SET) != 0;
905 case SUMO_ATTR_JOIN:
906 return joinTriggered;
908 // for stops/waypoints over parking areas, always enabled
910 return false;
911 } else {
912 return true;
913 }
914 default:
915 return true;
916 }
917}
918
919
920std::string
922 return getTagStr();
923}
924
925
926std::string
928 if (getParentAdditionals().size() > 0) {
929 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
930 return "BusStop: " + getParentAdditionals().front()->getID();
931 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_TRAIN_STOP) {
932 return "TrainStop: " + getParentAdditionals().front()->getID();
933 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
934 return "containerStop: " + getParentAdditionals().front()->getID();
935 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CHARGING_STATION) {
936 return "chargingStation: " + getParentAdditionals().front()->getID();
937 } else {
938 return "parkingArea: " + getParentAdditionals().front()->getID();
939 }
940 } else if (getParentLanes().size() > 0) {
941 return "lane: " + getParentLanes().front()->getID();
942 } else {
943 return "";
944 }
945}
946
947
952
953double
955 double fixedPos = startPos;
956 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
957 if (fixedPos < 0) {
958 fixedPos += len;
959 }
960 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
961}
962
963
964double
966 double fixedPos = endPos;
967 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
968 if (fixedPos < 0) {
969 fixedPos += len;
970 }
971 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
972}
973
974// ===========================================================================
975// protected
976// ===========================================================================
977
978bool
980 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
982 return true;
983 } else if (inspectedElements.isACInspected(this)) {
984 return true;
985 } else if (inspectedElements.isACInspected(getParentDemandElements().front())) {
986 return true;
988 return true;
989 } else if ((getParentDemandElements().front()->getTagProperty().getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
991 if (inspectedElements.isACInspected(getParentDemandElements().front()->getChildDemandElements().front())) {
992 return true;
993 } else {
994 return false;
995 }
996 } else {
997 return false;
998 }
999}
1000
1001
1002bool
1004 // get stop frame
1005 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
1006 // check conditions
1008 return true;
1009 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
1010 return true;
1011 } else {
1012 return false;
1013 }
1014}
1015
1016
1017
1018void
1020 const double width, const double exaggeration) const {
1021 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
1025 exaggeration * 0.1, 0, width);
1029 exaggeration * 0.1, 0, width * -1);
1030 // Add a detail matrix
1032 // move to geometry front
1033 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1034 // rotate
1035 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1036 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1037 }
1038 // move again
1039 glTranslated(0, exaggeration * 0.5, 0);
1040 // draw stop front
1041 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1042 // move to symbol position
1043 glTranslated(0, 1, 0.1);
1044 // draw text depending of detail
1046 // draw symbol
1047 GLHelper::drawText(myTagProperty.isVehicleWaypoint() ? "W" : "S", Position(), .1, 2.8, color, 180);
1048 // move to subtitle position
1049 glTranslated(0, 1.4, 0);
1050 // draw subtitle depending of tag
1051 GLHelper::drawText("lane", Position(), .1, 1, color, 180);
1052 // check if draw index
1053 if (drawIndex()) {
1054 // move to index position
1055 glTranslated(-2.1, -2.4, 0);
1056 glRotated(-90, 0, 0, 1);
1057 // draw index
1059 }
1060 } else {
1061 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1062 }
1063 // pop detail matrix
1065 // draw geometry points
1066 drawGeometryPoints(s, d, color);
1067}
1068
1069
1070void
1072 const double width, const double exaggeration) const {
1073 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1075 // only draw text if isn't being drawn for selecting
1077 // Add a detail matrix
1079 // move to geometry front
1080 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1081 // rotate
1082 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1083 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1084 }
1085 // move to index position
1086 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1087 glRotated(-90, 0, 0, 1);
1088 // draw index
1090 // pop detail matrix
1092 }
1093}
1094
1095// ===========================================================================
1096// private
1097// ===========================================================================
1098
1099void
1100GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1101 switch (key) {
1102 case SUMO_ATTR_DURATION:
1103 if (value.empty()) {
1104 toggleAttribute(key, false);
1105 } else {
1106 toggleAttribute(key, true);
1107 duration = string2time(value);
1108 }
1109 break;
1110 case SUMO_ATTR_UNTIL:
1111 if (value.empty()) {
1112 toggleAttribute(key, false);
1113 } else {
1114 toggleAttribute(key, true);
1115 until = string2time(value);
1116 }
1117 break;
1119 if (value.empty()) {
1120 toggleAttribute(key, false);
1121 } else {
1122 toggleAttribute(key, true);
1123 extension = string2time(value);
1124 }
1125 break;
1127 // reset all flags
1128 triggered = false;
1129 containerTriggered = false;
1130 joinTriggered = false;
1131 // disable all flags
1132 parametersSet &= ~STOP_JOIN_SET;
1133 parametersSet &= ~STOP_TRIGGER_SET;
1134 parametersSet &= ~STOP_EXPECTED_SET;
1135 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1136 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1137 // check value
1138 if ((value == "person") || (value == "true")) {
1140 triggered = true;
1141 if (awaitedPersons.size() > 0) {
1143 }
1144 } else if (value == "container") {
1147 containerTriggered = true;
1148 if (awaitedPersons.size() > 0) {
1150 }
1151 } else if (value == "join") {
1153 joinTriggered = true;
1154 }
1155 break;
1156 case SUMO_ATTR_EXPECTED:
1157 if (triggered) {
1158 awaitedPersons = parse<std::set<std::string> >(value);
1159 if (awaitedPersons.size() > 0) {
1161 } else {
1162 parametersSet &= ~STOP_EXPECTED_SET;
1163 }
1164 } else if (containerTriggered) {
1165 awaitedContainers = parse<std::set<std::string> >(value);
1166 if (awaitedContainers.size() > 0) {
1168 } else {
1169 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1170 }
1171 }
1172 break;
1173 case SUMO_ATTR_JOIN:
1174 if (joinTriggered) {
1175 join = value;
1176 if (join.size() > 0) {
1178 } else {
1179 parametersSet &= ~STOP_JOIN_SET;
1180 }
1181 }
1182 break;
1184 if (value.empty()) {
1185 parametersSet &= ~STOP_PERMITTED_SET;
1186 } else {
1188 permitted = parse<std::set<std::string> >(value);
1189 }
1190 break;
1191 case SUMO_ATTR_PARKING:
1194 parametersSet &= ~STOP_PARKING_SET;
1195 } else {
1197 }
1198 break;
1199 case SUMO_ATTR_ACTTYPE:
1200 actType = value;
1201 break;
1202 case SUMO_ATTR_TRIP_ID:
1203 tripId = value;
1204 toggleAttribute(key, (value.size() > 0));
1205 break;
1206 case SUMO_ATTR_LINE:
1207 line = value;
1208 toggleAttribute(key, (value.size() > 0));
1209 break;
1210 case SUMO_ATTR_ONDEMAND:
1211 if (parse<bool>(value)) {
1213 } else {
1214 parametersSet &= ~STOP_ONDEMAND_SET;
1215 }
1216 // set flag
1218 break;
1219 case SUMO_ATTR_JUMP:
1220 if ((value == "-1") || value.empty()) {
1221 parametersSet &= ~STOP_JUMP_SET;
1222 jump = -1;
1223 } else {
1225 jump = string2time(value);
1226 }
1227 break;
1228 // only for waypoints
1229 case SUMO_ATTR_SPEED:
1230 speed = parse<double>(value);
1231 break;
1232 // specific of Stops over stoppingPlaces
1233 case SUMO_ATTR_BUS_STOP:
1236 break;
1240 break;
1244 break;
1248 break;
1252 break;
1253 // specific of Stops over lanes
1254 case SUMO_ATTR_LANE:
1257 break;
1258 case SUMO_ATTR_STARTPOS:
1259 if (value.empty()) {
1261 } else {
1262 startPos = parse<double>(value);
1263 }
1265 break;
1266 case SUMO_ATTR_ENDPOS:
1267 if (value.empty()) {
1269 } else {
1270 endPos = parse<double>(value);
1271 }
1273 break;
1275 friendlyPos = parse<bool>(value);
1276 break;
1278 if (value.empty()) {
1280 parametersSet &= ~STOP_POSLAT_SET;
1281 } else {
1282 posLat = parse<double>(value);
1284 }
1285 break;
1286 case SUMO_ATTR_SPLIT:
1287 split = value;
1288 if (split.size() > 0) {
1290 } else {
1291 parametersSet &= ~STOP_SPLIT_SET;
1292 }
1293 break;
1294 //
1295 case GNE_ATTR_SELECTED:
1296 if (parse<bool>(value)) {
1298 } else {
1300 }
1301 break;
1302 case GNE_ATTR_PARENT:
1304 break;
1306 setParametersStr(value);
1307 break;
1308 default:
1309 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1310 }
1311}
1312
1313
1314void
1316 switch (key) {
1317 case SUMO_ATTR_DURATION:
1318 if (value) {
1320 } else {
1321 parametersSet &= ~STOP_DURATION_SET;
1322 }
1323 break;
1324 case SUMO_ATTR_UNTIL:
1325 if (value) {
1327 } else {
1328 parametersSet &= ~STOP_UNTIL_SET;
1329 }
1330 break;
1332 if (value) {
1334 } else {
1335 parametersSet &= ~STOP_EXTENSION_SET;
1336 }
1337 break;
1338 case SUMO_ATTR_TRIP_ID:
1339 if (value) {
1341 } else {
1342 parametersSet &= ~STOP_TRIP_ID_SET;
1343 }
1344 break;
1345 case SUMO_ATTR_LINE:
1346 if (value) {
1348 } else {
1349 parametersSet &= ~STOP_LINE_SET;
1350 }
1351 break;
1352 case SUMO_ATTR_ONDEMAND:
1353 if (value) {
1355 } else {
1356 parametersSet &= ~STOP_ONDEMAND_SET;
1357 }
1358 break;
1359 default:
1360 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1361 }
1362}
1363
1364
1365void
1368 // change only start position
1369 startPos = moveResult.newFirstPos;
1370 // adjust startPos
1371 if (startPos > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
1372 startPos = (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS);
1373 }
1375 // change only end position
1376 endPos = moveResult.newFirstPos;
1377 // adjust endPos
1378 if (endPos < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
1379 endPos = (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS);
1380 }
1381 } else {
1382 // change both position
1383 startPos = moveResult.newFirstPos;
1384 endPos = moveResult.newLastPos;
1385 // set lateral offset
1387 }
1388 // update geometry
1390}
1391
1392
1393void
1395 // begin change attribute
1396 undoList->begin(this, "position of " + getTagStr());
1397 // set attributes depending of operation type
1399 // set only start position
1402 // set only end position
1404 } else {
1405 // set both
1408 // check if lane has to be changed
1409 if (moveResult.newFirstLane) {
1410 // set new lane
1411 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
1412 }
1413 }
1414 // end change attribute
1415 undoList->end();
1416}
1417
1418
1419void
1421 // first check that we're in move mode and shift key is pressed
1425 // calculate new color
1426 const RGBColor color = baseColor.changedBrightness(-50);
1427 // push matrix
1429 // translated to front
1430 glTranslated(0, 0, 0.1);
1431 // set color
1432 GLHelper::setColor(color);
1433 // draw points
1434 if (startPos != INVALID_DOUBLE) {
1435 // push geometry point matrix
1437 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1438 // draw geometry point
1440 // pop geometry point matrix
1442 }
1443 if (endPos != INVALID_DOUBLE) {
1444 // push geometry point matrix
1446 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1447 // draw geometry point
1449 // pop geometry point matrix
1451 }
1452 // pop draw matrix
1454 }
1455}
1456
1457
1458int
1460 // get edge stop indexes
1461 const auto edgeStopIndex = getEdgeStopIndex();
1462 // finally find stopIndex in edgeStopIndexes
1463 for (const auto& edgeStop : edgeStopIndex) {
1464 for (const auto& stop : edgeStop.stops) {
1465 if (stop == this) {
1466 return edgeStop.stopIndex;
1467 }
1468 }
1469 }
1470 // not found, then return -1
1471 return -1;
1472}
1473
1474
1475void
1477 if (getParentAdditionals().size() > 0) {
1478 setDemandElementID(getMicrosimID() + " (" + getParentAdditionals().front()->getTagStr() + ")");
1479 } else if (getParentLanes().size() > 0) {
1480 setDemandElementID(getMicrosimID() + " (" + getParentLanes().front()->getTagStr() + ")");
1481 }
1482}
1483
1484/****************************************************************************/
@ 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_SELECTED
element is selected
@ 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:654
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
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:347
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition GLHelper.cpp:295
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:539
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
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:756
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
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
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
friend class GNEChange_ToggleAttribute
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
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
calculate contour extruded (used in elements formed by a central shape)
void 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:2155
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:1459
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEStop.cpp:713
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEStop.cpp:275
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:874
~GNEStop()
destructor
Definition GNEStop.cpp:109
void setStopMicrosimID()
set stop microsim ID
Definition GNEStop.cpp:1476
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEStop.cpp:36
bool drawIndex() const
draw index
Definition GNEStop.cpp:1003
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:435
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEStop.cpp:641
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:921
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:888
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:446
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:927
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:1071
std::string getParentName() const
Returns the name of the parent object.
Definition GNEStop.cpp:329
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:860
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEStop.cpp:588
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:453
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEStop.cpp:1394
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:423
void computePathElement()
compute pathElement
Definition GNEStop.cpp:416
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:1019
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:667
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEStop.cpp:1366
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:954
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:429
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1420
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEStop.cpp:949
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:979
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:965
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
Definition GNEStop.cpp:1315
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 (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
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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