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 GNEPathManager::PathElement::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 GNEPathManager::PathElement::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 GNEPathManager::PathElement::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 if (myNet->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
283 // get inspected AC
284 const auto AC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
285 // check if is a route or a vehicle
286 if ((AC->getTagProperty().isRoute() || AC->getTagProperty().isVehicle()) && (AC != 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);
411 }
412}
413
414
415void
417 // only update geometry
419}
420
421
422void
423GNEStop::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
424 // Stops don't use drawJunctionPartialGL
425}
426
427
428void
429GNEStop::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNEPathManager::Segment* /*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
981 return true;
982 } else if (myNet->getViewNet()->isAttributeCarrierInspected(this)) {
983 return true;
985 return true;
987 return true;
988 } else if ((getParentDemandElements().front()->getTagProperty().getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
991 return true;
992 } else {
993 return false;
994 }
995 } else {
996 return false;
997 }
998}
999
1000
1001bool
1003 // get stop frame
1004 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
1005 // check conditions
1007 return true;
1008 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
1009 return true;
1010 } else {
1011 return false;
1012 }
1013}
1014
1015
1016
1017void
1019 const double width, const double exaggeration) const {
1020 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
1024 exaggeration * 0.1, 0, width);
1028 exaggeration * 0.1, 0, width * -1);
1029 // Add a detail matrix
1031 // move to geometry front
1032 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1033 // rotate
1034 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1035 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1036 }
1037 // move again
1038 glTranslated(0, exaggeration * 0.5, 0);
1039 // draw stop front
1040 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1041 // move to symbol position
1042 glTranslated(0, 1, 0.1);
1043 // draw text depending of detail
1045 // draw symbol
1046 GLHelper::drawText(myTagProperty.isVehicleWaypoint() ? "W" : "S", Position(), .1, 2.8, color, 180);
1047 // move to subtitle position
1048 glTranslated(0, 1.4, 0);
1049 // draw subtitle depending of tag
1050 GLHelper::drawText("lane", Position(), .1, 1, color, 180);
1051 // check if draw index
1052 if (drawIndex()) {
1053 // move to index position
1054 glTranslated(-2.1, -2.4, 0);
1055 glRotated(-90, 0, 0, 1);
1056 // draw index
1058 }
1059 } else {
1060 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1061 }
1062 // pop detail matrix
1064 // draw geometry points
1065 drawGeometryPoints(s, d, color);
1066}
1067
1068
1069void
1071 const double width, const double exaggeration) const {
1072 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1074 // only draw text if isn't being drawn for selecting
1076 // Add a detail matrix
1078 // move to geometry front
1079 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1080 // rotate
1081 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1082 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1083 }
1084 // move to index position
1085 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1086 glRotated(-90, 0, 0, 1);
1087 // draw index
1089 // pop detail matrix
1091 }
1092}
1093
1094// ===========================================================================
1095// private
1096// ===========================================================================
1097
1098void
1099GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1100 switch (key) {
1101 case SUMO_ATTR_DURATION:
1102 if (value.empty()) {
1103 toggleAttribute(key, false);
1104 } else {
1105 toggleAttribute(key, true);
1106 duration = string2time(value);
1107 }
1108 break;
1109 case SUMO_ATTR_UNTIL:
1110 if (value.empty()) {
1111 toggleAttribute(key, false);
1112 } else {
1113 toggleAttribute(key, true);
1114 until = string2time(value);
1115 }
1116 break;
1118 if (value.empty()) {
1119 toggleAttribute(key, false);
1120 } else {
1121 toggleAttribute(key, true);
1122 extension = string2time(value);
1123 }
1124 break;
1126 // reset all flags
1127 triggered = false;
1128 containerTriggered = false;
1129 joinTriggered = false;
1130 // disable all flags
1131 parametersSet &= ~STOP_JOIN_SET;
1132 parametersSet &= ~STOP_TRIGGER_SET;
1133 parametersSet &= ~STOP_EXPECTED_SET;
1134 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1135 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1136 // check value
1137 if ((value == "person") || (value == "true")) {
1139 triggered = true;
1140 if (awaitedPersons.size() > 0) {
1142 }
1143 } else if (value == "container") {
1146 containerTriggered = true;
1147 if (awaitedPersons.size() > 0) {
1149 }
1150 } else if (value == "join") {
1152 joinTriggered = true;
1153 }
1154 break;
1155 case SUMO_ATTR_EXPECTED:
1156 if (triggered) {
1157 awaitedPersons = parse<std::set<std::string> >(value);
1158 if (awaitedPersons.size() > 0) {
1160 } else {
1161 parametersSet &= ~STOP_EXPECTED_SET;
1162 }
1163 } else if (containerTriggered) {
1164 awaitedContainers = parse<std::set<std::string> >(value);
1165 if (awaitedContainers.size() > 0) {
1167 } else {
1168 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1169 }
1170 }
1171 break;
1172 case SUMO_ATTR_JOIN:
1173 if (joinTriggered) {
1174 join = value;
1175 if (join.size() > 0) {
1177 } else {
1178 parametersSet &= ~STOP_JOIN_SET;
1179 }
1180 }
1181 break;
1183 if (value.empty()) {
1184 parametersSet &= ~STOP_PERMITTED_SET;
1185 } else {
1187 permitted = parse<std::set<std::string> >(value);
1188 }
1189 break;
1190 case SUMO_ATTR_PARKING:
1193 parametersSet &= ~STOP_PARKING_SET;
1194 } else {
1196 }
1197 break;
1198 case SUMO_ATTR_ACTTYPE:
1199 actType = value;
1200 break;
1201 case SUMO_ATTR_TRIP_ID:
1202 tripId = value;
1203 toggleAttribute(key, (value.size() > 0));
1204 break;
1205 case SUMO_ATTR_LINE:
1206 line = value;
1207 toggleAttribute(key, (value.size() > 0));
1208 break;
1209 case SUMO_ATTR_ONDEMAND:
1210 if (parse<bool>(value)) {
1212 } else {
1213 parametersSet &= ~STOP_ONDEMAND_SET;
1214 }
1215 // set flag
1217 break;
1218 case SUMO_ATTR_JUMP:
1219 if ((value == "-1") || value.empty()) {
1220 parametersSet &= ~STOP_JUMP_SET;
1221 jump = -1;
1222 } else {
1224 jump = string2time(value);
1225 }
1226 break;
1227 // only for waypoints
1228 case SUMO_ATTR_SPEED:
1229 speed = parse<double>(value);
1230 break;
1231 // specific of Stops over stoppingPlaces
1232 case SUMO_ATTR_BUS_STOP:
1235 break;
1239 break;
1243 break;
1247 break;
1251 break;
1252 // specific of Stops over lanes
1253 case SUMO_ATTR_LANE:
1256 break;
1257 case SUMO_ATTR_STARTPOS:
1258 if (value.empty()) {
1260 } else {
1261 startPos = parse<double>(value);
1262 }
1264 break;
1265 case SUMO_ATTR_ENDPOS:
1266 if (value.empty()) {
1268 } else {
1269 endPos = parse<double>(value);
1270 }
1272 break;
1274 friendlyPos = parse<bool>(value);
1275 break;
1277 if (value.empty()) {
1279 parametersSet &= ~STOP_POSLAT_SET;
1280 } else {
1281 posLat = parse<double>(value);
1283 }
1284 break;
1285 case SUMO_ATTR_SPLIT:
1286 split = value;
1287 if (split.size() > 0) {
1289 } else {
1290 parametersSet &= ~STOP_SPLIT_SET;
1291 }
1292 break;
1293 //
1294 case GNE_ATTR_SELECTED:
1295 if (parse<bool>(value)) {
1297 } else {
1299 }
1300 break;
1301 case GNE_ATTR_PARENT:
1303 break;
1305 setParametersStr(value);
1306 break;
1307 default:
1308 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1309 }
1310}
1311
1312
1313void
1315 switch (key) {
1316 case SUMO_ATTR_DURATION:
1317 if (value) {
1319 } else {
1320 parametersSet &= ~STOP_DURATION_SET;
1321 }
1322 break;
1323 case SUMO_ATTR_UNTIL:
1324 if (value) {
1326 } else {
1327 parametersSet &= ~STOP_UNTIL_SET;
1328 }
1329 break;
1331 if (value) {
1333 } else {
1334 parametersSet &= ~STOP_EXTENSION_SET;
1335 }
1336 break;
1337 case SUMO_ATTR_TRIP_ID:
1338 if (value) {
1340 } else {
1341 parametersSet &= ~STOP_TRIP_ID_SET;
1342 }
1343 break;
1344 case SUMO_ATTR_LINE:
1345 if (value) {
1347 } else {
1348 parametersSet &= ~STOP_LINE_SET;
1349 }
1350 break;
1351 case SUMO_ATTR_ONDEMAND:
1352 if (value) {
1354 } else {
1355 parametersSet &= ~STOP_ONDEMAND_SET;
1356 }
1357 break;
1358 default:
1359 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1360 }
1361}
1362
1363
1364void
1367 // change only start position
1368 startPos = moveResult.newFirstPos;
1369 // adjust startPos
1370 if (startPos > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
1371 startPos = (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS);
1372 }
1374 // change only end position
1375 endPos = moveResult.newFirstPos;
1376 // adjust endPos
1377 if (endPos < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
1378 endPos = (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS);
1379 }
1380 } else {
1381 // change both position
1382 startPos = moveResult.newFirstPos;
1383 endPos = moveResult.newSecondPos;
1384 // set lateral offset
1386 }
1387 // update geometry
1389}
1390
1391
1392void
1394 // begin change attribute
1395 undoList->begin(this, "position of " + getTagStr());
1396 // set attributes depending of operation type
1398 // set only start position
1401 // set only end position
1403 } else {
1404 // set both
1407 // check if lane has to be changed
1408 if (moveResult.newFirstLane) {
1409 // set new lane
1410 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
1411 }
1412 }
1413 // end change attribute
1414 undoList->end();
1415}
1416
1417
1418void
1420 // first check that we're in move mode and shift key is pressed
1424 // calculate new color
1425 const RGBColor color = baseColor.changedBrightness(-50);
1426 // push matrix
1428 // translated to front
1429 glTranslated(0, 0, 0.1);
1430 // set color
1431 GLHelper::setColor(color);
1432 // draw points
1433 if (startPos != INVALID_DOUBLE) {
1434 // push geometry point matrix
1436 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1437 // draw geometry point
1439 // pop geometry point matrix
1441 }
1442 if (endPos != INVALID_DOUBLE) {
1443 // push geometry point matrix
1445 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1446 // draw geometry point
1448 // pop geometry point matrix
1450 }
1451 // pop draw matrix
1453 }
1454}
1455
1456
1457int
1459 // get edge stop indexes
1460 const auto edgeStopIndex = getEdgeStopIndex();
1461 // finally find stopIndex in edgeStopIndexes
1462 for (const auto& edgeStop : edgeStopIndex) {
1463 for (const auto& stop : edgeStop.stops) {
1464 if (stop == this) {
1465 return edgeStop.stopIndex;
1466 }
1467 }
1468 }
1469 // not found, then return -1
1470 return -1;
1471}
1472
1473
1474void
1476 if (getParentAdditionals().size() > 0) {
1477 setDemandElementID(getMicrosimID() + " (" + getParentAdditionals().front()->getTagStr() + ")");
1478 } else if (getParentLanes().size() > 0) {
1479 setDemandElementID(getMicrosimID() + " (" + getParentLanes().front()->getTagStr() + ")");
1480 }
1481}
1482
1483/****************************************************************************/
@ 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
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 newSecondPos
new second 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:125
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2147
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:1458
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:1475
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEStop.cpp:36
bool drawIndex() const
draw index
Definition GNEStop.cpp:1002
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:1070
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:1393
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 GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEStop.cpp:423
void computePathElement()
compute pathElement
Definition GNEStop.cpp:416
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:429
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:1018
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:1365
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 drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1419
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:1314
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...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
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