Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEStop.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Representation of Stops in netedit
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNEUndoList.h>
23#include <netedit/GNEViewNet.h>
32
33#include "GNEStop.h"
34
35// ===========================================================================
36// member method definitions
37// ===========================================================================
38#ifdef _MSC_VER
39#pragma warning(push)
40#pragma warning(disable: 4355) // mask warning about "this" in initializers
41#endif
43 GNEDemandElement("", net, "", tag, GNEPathElement::Options::DEMAND_ELEMENT),
44 GNEDemandElementPlan(this, -1, -1),
45 myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
46 // enable parking for stops in parkin)gAreas
49 }
50 // set parking
53 }
54 // set waypoint speed
56 // set jump
57 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
58 // set locator sufix
60}
61
62
63GNEStop::GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter) :
64 GNEDemandElement(stopParent, tag, GNEPathElement::Options::DEMAND_ELEMENT),
65 SUMOVehicleParameter::Stop(stopParameter),
66 GNEDemandElementPlan(this, -1, -1),
67 myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
68 // set parents
69 setParent<GNEAdditional*>(stoppingPlace);
70 setParent<GNEDemandElement*>(stopParent);
71 // set triggered values
72 if (triggered) {
74 if (awaitedPersons.size() > 0) {
76 }
77 } else if (containerTriggered) {
80 if (awaitedPersons.size() > 0) {
82 }
83 } else if (joinTriggered) {
85 }
86 // set parking
89 }
90 // set tripID and line
91 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
92 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
93 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
94 // set waypoint speed
96 // set jump
97 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
98 // set locator sufix
100}
101
102
103GNEStop::GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter) :
104 GNEDemandElement(stopParent, tag, GNEPathElement::Options::DEMAND_ELEMENT),
105 SUMOVehicleParameter::Stop(stopParameter),
106 GNEDemandElementPlan(this, -1, -1),
107 myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
108 // set parents
109 setParent<GNELane*>(lane);
110 setParent<GNEDemandElement*>(stopParent);
111 // set triggered values
112 if (triggered) {
114 if (awaitedPersons.size() > 0) {
116 }
117 } else if (containerTriggered) {
120 if (awaitedPersons.size() > 0) {
122 }
123 } else if (joinTriggered) {
125 }
126 // set parking
129 }
130 // set trigger
131 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
132 // set tripID and line
133 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
134 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
135 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
136 // set waypoint speed
138 // set jump
139 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
140 // set locator sufix
142}
143#ifdef _MSC_VER
144#pragma warning(pop)
145#endif
146
148
149
153 // get allow change lane
154 const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonMoveOptions()->getAllowChangeLane();
155 // fist check if we're moving only extremes
159 // get snap radius
161 // get mouse position
162 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
163 // check if we clicked over start or end position
164 if ((startPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
165 // move only start position
166 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
168 } else if ((endPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
169 // move only end position
170 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
172 } else {
173 return nullptr;
174 }
175 } else if ((startPos != INVALID_DOUBLE) && (endPos != INVALID_DOUBLE)) {
176 // move both start and end positions
177 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
179 } else if (startPos != INVALID_DOUBLE) {
180 // move only start position
181 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
183 } else if (startPos != INVALID_DOUBLE) {
184 // move only end position
185 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
187 } else {
188 // start and end positions undefined, then nothing to move
189 return nullptr;
190 }
191 } else {
192 return nullptr;
193 }
194}
195
196
197void
199 device.openTag(SUMO_TAG_STOP);
200 if (getParentAdditionals().size() > 0) {
201 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_BUS_STOP) {
203 }
204 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_TRAIN_STOP) {
206 }
207 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CONTAINER_STOP) {
209 }
210 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CHARGING_STATION) {
212 }
213 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA) {
215 }
216 } else {
217 if (getParentLanes().size() > 0) {
218 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
219 }
220 if (startPos != INVALID_DOUBLE) {
222 }
223 if (endPos != INVALID_DOUBLE) {
225 }
226 }
227 // write rest of attributes
228 write(device, true, false);
229}
230
231
234 if (getPathStopIndex() == -1) {
236 } else {
237 // only Stops placed over lanes can be invalid
239 return Problem::OK;
240 } else if (friendlyPos) {
241 // with friendly position enabled position are "always fixed"
242 return Problem::OK;
243 } else {
244 // obtain lane length
245 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
246 // declare a copy of start and end positions
247 double startPosCopy = startPos;
248 double endPosCopy = endPos;
249 // check if position has to be fixed
250 if (startPosCopy < 0) {
251 startPosCopy += laneLength;
252 }
253 if (endPosCopy < 0) {
254 endPosCopy += laneLength;
255 }
256 // check values
257 if ((startPosCopy >= 0) && (endPosCopy <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) && ((endPosCopy - startPosCopy) >= POSITION_EPS)) {
258 return Problem::OK;
259 } else {
261 }
262 }
263 }
264}
265
266
267std::string
269 if (getPathStopIndex() == -1) {
270 return ("Downstream stop");
271 } else {
272 // declare a copy of start and end positions
273 double startPosCopy = startPos;
274 double endPosCopy = endPos;
275 // obtain lane length
276 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
277 // check if position has to be fixed
278 if (startPosCopy < 0) {
279 startPosCopy += laneLength;
280 }
281 if (endPosCopy < 0) {
282 endPosCopy += laneLength;
283 }
284 // declare variables
285 std::string errorStart, separator, errorEnd;
286 // check positions over lane
287 if (startPosCopy < 0) {
288 errorStart = (toString(SUMO_ATTR_STARTPOS) + " < 0");
289 } else if (startPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
290 errorStart = (toString(SUMO_ATTR_STARTPOS) + " > lanes's length");
291 }
292 if (endPosCopy < 0) {
293 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " < 0");
294 } else if (endPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
295 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
296 }
297 // check separator
298 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
299 separator = " and ";
300 }
301 return errorStart + separator + errorEnd;
302 }
303}
304
305
306void
310
311
314 return getParentDemandElements().front()->getVClass();
315}
316
317
318const RGBColor&
320 // get inspected AC
321 const auto inspectedAC = myNet->getViewNet()->getInspectedElements().getFirstAC();
322 if (inspectedAC) {
323 // check if is a route or a vehicle
324 if ((inspectedAC->getTagProperty()->isRoute() || inspectedAC->getTagProperty()->isVehicle()) && (inspectedAC != getParentDemandElements().front())) {
325 return RGBColor::GREY;
326 }
327 } else if (myNet->getViewNet()->getViewParent()->getStopFrame()->shown()) {
329 return RGBColor::GREY;
330 }
331 }
332 // return default color
335 } else {
337 }
338}
339
340
341void
343 // update geometry depending of parent
344 if (getParentLanes().size() > 0) {
345 // Cut shape using as delimitators fixed start position and fixed end position
347 } else if (getParentAdditionals().size() > 0) {
348 // use geometry of additional (busStop)
349 myDemandElementGeometry = getParentAdditionals().at(0)->getAdditionalGeometry();
350 }
351}
352
353
356 if (getParentLanes().size() > 0) {
357 return getParentLanes().front()->getLaneShape().positionAtOffset((startPos + endPos) / 2.0);
358 } else if (getParentAdditionals().size() > 0) {
359 return getParentAdditionals().front()->getPositionInView();
360 } else {
361 throw ProcessError(TL("Invalid Stop parent"));
362 }
363}
364
365
366std::string
368 if (getParentDemandElements().size() > 0) {
369 return getParentDemandElements().front()->getID();
370 } else if (getParentAdditionals().size() > 0) {
371 return getParentAdditionals().front()->getID();
372 } else if (getParentLanes().size() > 0) {
373 return getParentLanes().front()->getID();
374 } else {
375 throw ProcessError(TL("Invalid parent"));
376 }
377}
378
379
380double
382 return s.addSize.getExaggeration(s, this);
383}
384
385
388 Boundary b;
389 // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
390 if (getParentAdditionals().size() > 0) {
391 return getParentAdditionals().at(0)->getCenteringBoundary();
394 } else if (myDemandElementGeometry.getShape().size() > 0) {
396 } else {
398 }
399 b.grow(20);
400 return b;
401}
402
403
404void
405GNEStop::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
406 // geometry of this element cannot be splitted
407}
408
409
410void
412 // check if draw an stop for person/containers or for vehicles/routes
413 if (canDrawVehicleStop()) {
414 // get exaggeration
415 const auto exaggeration = getExaggeration(s);
416 // get lane
417 const auto& stopLane = getParentLanes().size() > 0 ? getParentLanes().front() : nullptr;
418 // get lane width
419 const double width = stopLane ? stopLane->getParentEdge()->getNBEdge()->getLaneWidth(stopLane->getIndex()) * 0.5 : exaggeration * 0.8;
420 // get detail level
421 const auto d = s.getDetailLevel(exaggeration);
422 // draw geometry only if we'rent in drawForObjectUnderCursor mode
424 // get color
426 // Add a layer matrix
428 // set Color
429 GLHelper::setColor(color);
430 // Start with the drawing of the area traslating matrix to origin
432 // draw depending if is over lane or over stoppingP
433 if (getParentLanes().size() > 0) {
434 drawStopOverLane(s, d, color, width, exaggeration);
435 } else {
436 drawStopOverStoppingPlace(d, color, width, exaggeration);
437 }
438 // pop layer matrix
440 // draw lock icon
442 // Draw name
443 drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
444 // draw dotted contour
446 }
447 // calculate contour and draw dotted geometry
448 if (getParentAdditionals().size() > 0) {
449 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true,
450 0, nullptr, getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
451 } else {
452 myStopContour.calculateContourExtrudedShape(s, d, this, myDemandElementGeometry.getShape(), getType(), width, exaggeration, true, true,
453 0, nullptr, getParentLanes().front()->getParentEdge());
454 }
455 }
456}
457
458
459void
461 // only update geometry
463}
464
465
466void
467GNEStop::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
468 // Stops don't use drawJunctionPartialGL
469}
470
471
472void
473GNEStop::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
474 // Stops don't use drawJunctionPartialGL
475}
476
477
478GNELane*
480 // check if stop is placed over a busStop
481 if (getParentAdditionals().size() > 0) {
482 return getParentAdditionals().front()->getParentLanes().front();
483 } else {
484 return getParentLanes().front();
485 }
486}
487
488
489GNELane*
491 // first and last path lane are the same
492 return getFirstPathLane();
493}
494
495
496std::string
498 switch (key) {
499 case SUMO_ATTR_ID:
500 return getMicrosimID();
502 if (isAttributeEnabled(key)) {
503 return time2string(duration);
504 } else {
505 return "";
506 }
507 case SUMO_ATTR_UNTIL:
508 if (isAttributeEnabled(key)) {
509 return time2string(until);
510 } else {
511 return "";
512 }
514 if (isAttributeEnabled(key)) {
515 return time2string(extension);
516 } else {
517 return "";
518 }
520 if (triggered) {
521 return "person";
522 } else if (containerTriggered) {
523 return "container";
524 } else if (joinTriggered) {
525 return "join";
526 } else {
527 return "false";
528 }
530 if (triggered) {
531 return toString(awaitedPersons);
532 } else if (containerTriggered) {
534 } else {
535 return "";
536 }
537 case SUMO_ATTR_JOIN:
538 if (joinTriggered) {
539 return join;
540 } else {
541 return "";
542 }
544 return toString(permitted);
547 return "true";
548 } else {
549 return "false";
550 }
552 return actType;
554 return tripId;
555 case SUMO_ATTR_LINE:
556 return line;
558 return toString(onDemand);
559 case SUMO_ATTR_JUMP:
561 return time2string(jump);
562 } else {
563 return "";
564 }
565 // only for waypoints
566 case SUMO_ATTR_SPEED:
567 return toString(speed);
568 // specific of Stops over stoppingPlaces
574 return getParentAdditionals().front()->getID();
575 // specific of stops over lanes
576 case SUMO_ATTR_LANE:
577 return getParentLanes().front()->getID();
579 if (startPos != INVALID_DOUBLE) {
580 return toString(startPos);
581 } else {
582 return "";
583 }
584 case SUMO_ATTR_ENDPOS:
585 if (endPos != INVALID_DOUBLE) {
586 return toString(endPos);
587 } else {
588 return "";
589 }
591 return toString(friendlyPos);
593 if (posLat == INVALID_DOUBLE) {
594 return "";
595 } else {
596 return toString(posLat);
597 }
598 case SUMO_ATTR_SPLIT:
599 return split;
600 //
601 case GNE_ATTR_PARENT:
602 return getParentDemandElements().front()->getID();
603 case GNE_ATTR_STOPINDEX: {
604 // extract all stops of demandElement parent
605 std::vector<GNEDemandElement*> stops;
606 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
607 if (parent->getTagProperty()->isVehicleStop()) {
608 stops.push_back(parent);
609 }
610 }
611 // find index in stops
612 for (int i = 0; i < (int)stops.size(); i++) {
613 if (stops.at(i) == this) {
614 return toString(i);
615 }
616 }
617 return "invalid index";
618 }
620 return toString(getPathStopIndex());
621 default:
622 return getCommonAttribute(this, key);
623 }
624}
625
626
627double
629 switch (key) {
632 if (getParentAdditionals().size() > 0) {
633 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_STARTPOS);
634 } else if (startPos != INVALID_DOUBLE) {
635 return startPos;
636 } else {
637 return 0;
638 }
639 case SUMO_ATTR_ENDPOS:
641 if (getParentAdditionals().size() > 0) {
642 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
643 } else if (endPos != INVALID_DOUBLE) {
644 return endPos;
645 } else {
646 return getParentLanes().front()->getLaneShapeLength();
647 }
648 case SUMO_ATTR_INDEX: // for writting sorted
649 return (double)myCreationIndex;
650 case GNE_ATTR_STOPINDEX: {
651 // extract all stops of demandElement parent
652 std::vector<GNEDemandElement*> stops, filteredStops;
653 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
654 if (parent->getTagProperty()->isVehicleStop()) {
655 stops.push_back(parent);
656 }
657 }
658 // now filter stops with the same startPos
659 for (const auto& stop : stops) {
660 if (stop->getAttributeDouble(SUMO_ATTR_STARTPOS) == getAttributeDouble(SUMO_ATTR_STARTPOS)) {
661 filteredStops.push_back(stop);
662 }
663 }
664 // get index
665 for (int i = 0; i < (int)filteredStops.size(); i++) {
666 if (filteredStops.at(i) == this) {
667 return i;
668 }
669 }
670 return 0;
671 }
673 return (double)getPathStopIndex();
674 default:
675 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
676 }
677}
678
679
682 switch (key) {
684 if (getParentAdditionals().size() > 0) {
685 // return first position of busStop
686 return getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
687 } else {
688 // get lane shape
689 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
690 // continue depending of arrival position
691 if (endPos == 0) {
692 return laneShape.front();
693 } else if ((endPos == -1) || (endPos >= laneShape.length2D())) {
694 return laneShape.back();
695 } else {
696 return laneShape.positionAtOffset2D(endPos);
697 }
698 }
699 }
700 default:
701 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
702 }
703}
704
705
706void
707GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
708 if (value == getAttribute(key)) {
709 return; //avoid needless changes, later logic relies on the fact that attributes have changed
710 }
711 switch (key) {
713 case SUMO_ATTR_UNTIL:
717 case SUMO_ATTR_JOIN:
722 case SUMO_ATTR_LINE:
724 case SUMO_ATTR_JUMP:
725 // only for waypoints
726 case SUMO_ATTR_SPEED:
727 // specific of Stops over stoppingPlaces
733 // specific of stops over lanes
734 case SUMO_ATTR_LANE:
736 case SUMO_ATTR_ENDPOS:
739 case SUMO_ATTR_SPLIT:
740 // other
741 case GNE_ATTR_PARENT:
742 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
743 break;
744 default:
745 setCommonAttribute(key, value, undoList);
746 break;
747 }
748}
749
750
751bool
752GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
753 // declare string error
754 std::string error;
755 switch (key) {
757 case SUMO_ATTR_UNTIL:
759 if (canParse<SUMOTime>(value)) {
760 return parse<SUMOTime>(value) >= 0;
761 } else {
762 return false;
763 }
764 case SUMO_ATTR_TRIGGERED: {
765 const auto expectedValues = myTagProperty->getAttributeProperties(key)->getDiscreteValues();
766 const auto triggeredValues = parse<std::vector<std::string> >(value);
767 for (const auto& triggeredValue : triggeredValues) {
768 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
769 return false;
770 }
771 }
772 return true;
773 }
775 if (value.empty()) {
776 return false;
777 } else {
778 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
779 for (const auto& expectedValue : expectedValues) {
780 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
781 return false;
782 }
783 }
784 return true;
785 }
786 case SUMO_ATTR_JOIN:
787 if (value.empty()) {
788 return false;
789 } else {
791 }
792 case SUMO_ATTR_PERMITTED: {
793 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
794 for (const auto& expectedValue : expectedValues) {
795 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
796 return false;
797 }
798 }
799 return true;
800 }
801 case SUMO_ATTR_PARKING: {
802 if (value == "opportunistic") {
803 return false; // Currrently deactivated opportunistic in netedit waiting for the implementation in SUMO
804 }
805 const auto expectedValues = myTagProperty->getAttributeProperties(key)->getDiscreteValues();
806 const auto triggeredValues = parse<std::vector<std::string> >(value);
807 for (const auto& triggeredValue : triggeredValues) {
808 if (std::find(expectedValues.begin(), expectedValues.end(), triggeredValue) == expectedValues.end()) {
809 return false;
810 }
811 }
812 return true;
813 }
815 return true;
818 case SUMO_ATTR_LINE:
819 return true;
821 return canParse<bool>(value);
822 case SUMO_ATTR_JUMP:
823 if ((value == "-1") || (value.empty())) {
824 return true;
825 } else if (canParse<double>(value)) {
826 return parse<double>(value) >= 0;
827 } else {
828 return false;
829 }
830 // only for waypoints
831 case SUMO_ATTR_SPEED:
832 if (canParse<double>(value)) {
833 return (parse<double>(value) >= 0);
834 } else {
835 return false;
836 }
837 // specific of Stops over stoppingPlaces
839 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
841 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
843 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
845 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
847 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
848 // specific of stops over lanes
849 case SUMO_ATTR_LANE:
850 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
851 return true;
852 } else {
853 return false;
854 }
856 if (value.empty()) {
857 return true;
858 } else if (canParse<double>(value)) {
859 return SUMORouteHandler::isStopPosValid(parse<double>(value), endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
860 } else {
861 return false;
862 }
863 case SUMO_ATTR_ENDPOS:
864 if (value.empty()) {
865 return true;
866 } else if (canParse<double>(value)) {
867 return SUMORouteHandler::isStopPosValid(startPos, parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
868 } else {
869 return false;
870 }
872 return canParse<bool>(value);
874 if (value.empty()) {
875 return true;
876 } else {
877 return canParse<double>(value);
878 }
879 case SUMO_ATTR_SPLIT:
880 if (value.empty()) {
881 return true;
882 } else {
884 }
885 //
886 case GNE_ATTR_PARENT:
887 return false;
888 default:
889 return isCommonValid(key, value);
890 }
891}
892
893
894void
896 switch (key) {
898 case SUMO_ATTR_UNTIL:
900 undoList->add(new GNEChange_ToggleAttribute(this, key, true), true);
901 break;
902 default:
903 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
904 }
905}
906
907
908void
910 switch (key) {
912 case SUMO_ATTR_UNTIL:
914 undoList->add(new GNEChange_ToggleAttribute(this, key, false), true);
915 break;
916 default:
917 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
918 }
919}
920
921
922bool
924 switch (key) {
925 // Currently stops parents cannot be edited
931 return false;
933 return (parametersSet & STOP_DURATION_SET) != 0;
934 case SUMO_ATTR_UNTIL:
935 return (parametersSet & STOP_UNTIL_SET) != 0;
937 return (parametersSet & STOP_EXTENSION_SET) != 0;
940 case SUMO_ATTR_JOIN:
941 return joinTriggered;
943 // for stops/waypoints over parking areas, always enabled
945 return false;
946 } else {
947 return true;
948 }
949 default:
950 return true;
951 }
952}
953
954
955std::string
957 return getTagStr();
958}
959
960
961std::string
963 if (getParentAdditionals().size() > 0) {
964 if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_BUS_STOP) {
965 return "BusStop: " + getParentAdditionals().front()->getID();
966 } else if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_TRAIN_STOP) {
967 return "TrainStop: " + getParentAdditionals().front()->getID();
968 } else if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CONTAINER_STOP) {
969 return "containerStop: " + getParentAdditionals().front()->getID();
970 } else if (getParentAdditionals().front()->getTagProperty()->getTag() == SUMO_TAG_CHARGING_STATION) {
971 return "chargingStation: " + getParentAdditionals().front()->getID();
972 } else {
973 return "parkingArea: " + getParentAdditionals().front()->getID();
974 }
975 } else if (getParentLanes().size() > 0) {
976 return "lane: " + getParentLanes().front()->getID();
977 } else {
978 return "";
979 }
980}
981
982
987
988double
990 double fixedPos = startPos;
991 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
992 if (fixedPos < 0) {
993 fixedPos += len;
994 }
995 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
996}
997
998
999double
1001 double fixedPos = endPos;
1002 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
1003 if (fixedPos < 0) {
1004 fixedPos += len;
1005 }
1006 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
1007}
1008
1009// ===========================================================================
1010// protected
1011// ===========================================================================
1012
1013bool
1015 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
1017 return true;
1018 } else if (inspectedElements.isACInspected(this)) {
1019 return true;
1020 } else if (inspectedElements.isACInspected(getParentDemandElements().front())) {
1021 return true;
1023 return true;
1024 } else if ((getParentDemandElements().front()->getTagProperty()->getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
1026 if (inspectedElements.isACInspected(getParentDemandElements().front()->getChildDemandElements().front())) {
1027 return true;
1028 } else {
1029 return false;
1030 }
1031 } else {
1032 return false;
1033 }
1034}
1035
1036
1037bool
1039 // get stop frame
1040 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
1041 // check conditions
1043 return true;
1044 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
1045 return true;
1046 } else {
1047 return false;
1048 }
1049}
1050
1051
1052
1053void
1055 const double width, const double exaggeration) const {
1056 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
1060 exaggeration * 0.1, 0, width);
1064 exaggeration * 0.1, 0, width * -1);
1065 // Add a detail matrix
1067 // move to geometry front
1068 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1069 // rotate
1070 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1071 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1072 }
1073 // move again
1074 glTranslated(0, exaggeration * 0.5, 0);
1075 // draw stop front
1076 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1077 // move to symbol position
1078 glTranslated(0, 1, 0.1);
1079 // draw text depending of detail
1081 // draw symbol
1082 GLHelper::drawText(myTagProperty->isVehicleWaypoint() ? "W" : "S", Position(), .1, 2.8, color, 180);
1083 // move to subtitle position
1084 glTranslated(0, 1.4, 0);
1085 // draw subtitle depending of tag
1086 GLHelper::drawText("lane", Position(), .1, 1, color, 180);
1087 // check if draw index
1088 if (drawIndex()) {
1089 // move to index position
1090 glTranslated(-2.1, -2.4, 0);
1091 glRotated(-90, 0, 0, 1);
1092 // draw index
1094 }
1095 } else {
1096 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1097 }
1098 // pop detail matrix
1100 // draw geometry points
1101 drawGeometryPoints(s, d, color);
1102}
1103
1104
1105void
1107 const double width, const double exaggeration) const {
1108 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1110 // only draw text if isn't being drawn for selecting
1112 // Add a detail matrix
1114 // move to geometry front
1115 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1116 // rotate
1117 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1118 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1119 }
1120 // move to index position
1121 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1122 glRotated(-90, 0, 0, 1);
1123 // draw index
1125 // pop detail matrix
1127 }
1128}
1129
1130// ===========================================================================
1131// private
1132// ===========================================================================
1133
1134void
1135GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1136 switch (key) {
1137 case SUMO_ATTR_DURATION:
1138 if (value.empty()) {
1139 toggleAttribute(key, false);
1140 } else {
1141 toggleAttribute(key, true);
1142 duration = string2time(value);
1143 }
1144 break;
1145 case SUMO_ATTR_UNTIL:
1146 if (value.empty()) {
1147 toggleAttribute(key, false);
1148 } else {
1149 toggleAttribute(key, true);
1150 until = string2time(value);
1151 }
1152 break;
1154 if (value.empty()) {
1155 toggleAttribute(key, false);
1156 } else {
1157 toggleAttribute(key, true);
1158 extension = string2time(value);
1159 }
1160 break;
1162 // reset all flags
1163 triggered = false;
1164 containerTriggered = false;
1165 joinTriggered = false;
1166 // disable all flags
1167 parametersSet &= ~STOP_JOIN_SET;
1168 parametersSet &= ~STOP_TRIGGER_SET;
1169 parametersSet &= ~STOP_EXPECTED_SET;
1170 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1171 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1172 // check value
1173 if ((value == "person") || (value == "true")) {
1175 triggered = true;
1176 if (awaitedPersons.size() > 0) {
1178 }
1179 } else if (value == "container") {
1182 containerTriggered = true;
1183 if (awaitedPersons.size() > 0) {
1185 }
1186 } else if (value == "join") {
1188 joinTriggered = true;
1189 }
1190 break;
1191 case SUMO_ATTR_EXPECTED:
1192 if (triggered) {
1193 awaitedPersons = parse<std::set<std::string> >(value);
1194 if (awaitedPersons.size() > 0) {
1196 } else {
1197 parametersSet &= ~STOP_EXPECTED_SET;
1198 }
1199 } else if (containerTriggered) {
1200 awaitedContainers = parse<std::set<std::string> >(value);
1201 if (awaitedContainers.size() > 0) {
1203 } else {
1204 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1205 }
1206 }
1207 break;
1208 case SUMO_ATTR_JOIN:
1209 if (joinTriggered) {
1210 join = value;
1211 if (join.size() > 0) {
1213 } else {
1214 parametersSet &= ~STOP_JOIN_SET;
1215 }
1216 }
1217 break;
1219 if (value.empty()) {
1220 parametersSet &= ~STOP_PERMITTED_SET;
1221 } else {
1223 permitted = parse<std::set<std::string> >(value);
1224 }
1225 break;
1226 case SUMO_ATTR_PARKING:
1229 parametersSet &= ~STOP_PARKING_SET;
1230 } else {
1232 }
1233 break;
1234 case SUMO_ATTR_ACTTYPE:
1235 actType = value;
1236 break;
1237 case SUMO_ATTR_TRIP_ID:
1238 tripId = value;
1239 toggleAttribute(key, (value.size() > 0));
1240 break;
1241 case SUMO_ATTR_LINE:
1242 line = value;
1243 toggleAttribute(key, (value.size() > 0));
1244 break;
1245 case SUMO_ATTR_ONDEMAND:
1246 if (parse<bool>(value)) {
1248 } else {
1249 parametersSet &= ~STOP_ONDEMAND_SET;
1250 }
1251 // set flag
1253 break;
1254 case SUMO_ATTR_JUMP:
1255 if ((value == "-1") || value.empty()) {
1256 parametersSet &= ~STOP_JUMP_SET;
1257 jump = -1;
1258 } else {
1260 jump = string2time(value);
1261 }
1262 break;
1263 // only for waypoints
1264 case SUMO_ATTR_SPEED:
1265 speed = parse<double>(value);
1266 break;
1267 // specific of Stops over stoppingPlaces
1268 case SUMO_ATTR_BUS_STOP:
1271 break;
1275 break;
1279 break;
1283 break;
1287 break;
1288 // specific of Stops over lanes
1289 case SUMO_ATTR_LANE:
1292 break;
1293 case SUMO_ATTR_STARTPOS:
1294 if (value.empty()) {
1296 } else {
1297 startPos = parse<double>(value);
1298 }
1300 break;
1301 case SUMO_ATTR_ENDPOS:
1302 if (value.empty()) {
1304 } else {
1305 endPos = parse<double>(value);
1306 }
1308 break;
1310 friendlyPos = parse<bool>(value);
1311 break;
1313 if (value.empty()) {
1315 parametersSet &= ~STOP_POSLAT_SET;
1316 } else {
1317 posLat = parse<double>(value);
1319 }
1320 break;
1321 case SUMO_ATTR_SPLIT:
1322 split = value;
1323 if (split.size() > 0) {
1325 } else {
1326 parametersSet &= ~STOP_SPLIT_SET;
1327 }
1328 break;
1329 //
1330 case GNE_ATTR_PARENT:
1332 break;
1333 default:
1334 setCommonAttribute(this, key, value);
1335 break;
1336 }
1337}
1338
1339
1340void
1342 switch (key) {
1343 case SUMO_ATTR_DURATION:
1344 if (value) {
1346 } else {
1347 parametersSet &= ~STOP_DURATION_SET;
1348 }
1349 break;
1350 case SUMO_ATTR_UNTIL:
1351 if (value) {
1353 } else {
1354 parametersSet &= ~STOP_UNTIL_SET;
1355 }
1356 break;
1358 if (value) {
1360 } else {
1361 parametersSet &= ~STOP_EXTENSION_SET;
1362 }
1363 break;
1364 case SUMO_ATTR_TRIP_ID:
1365 if (value) {
1367 } else {
1368 parametersSet &= ~STOP_TRIP_ID_SET;
1369 }
1370 break;
1371 case SUMO_ATTR_LINE:
1372 if (value) {
1374 } else {
1375 parametersSet &= ~STOP_LINE_SET;
1376 }
1377 break;
1378 case SUMO_ATTR_ONDEMAND:
1379 if (value) {
1381 } else {
1382 parametersSet &= ~STOP_ONDEMAND_SET;
1383 }
1384 break;
1385 default:
1386 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1387 }
1388}
1389
1390
1391void
1394 // change only start position
1395 startPos = moveResult.newFirstPos;
1396 // adjust startPos
1397 if (startPos > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
1398 startPos = (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS);
1399 }
1401 // change only end position
1402 endPos = moveResult.newFirstPos;
1403 // adjust endPos
1404 if (endPos < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
1405 endPos = (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS);
1406 }
1407 } else {
1408 // change both position
1409 startPos = moveResult.newFirstPos;
1410 endPos = moveResult.newLastPos;
1411 // set lateral offset
1413 }
1414 // update geometry
1416}
1417
1418
1419void
1421 // begin change attribute
1422 undoList->begin(this, "position of " + getTagStr());
1423 // set attributes depending of operation type
1425 // set only start position
1428 // set only end position
1430 } else {
1431 // set both
1434 // check if lane has to be changed
1435 if (moveResult.newFirstLane) {
1436 // set new lane
1437 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
1438 }
1439 }
1440 // end change attribute
1441 undoList->end();
1442}
1443
1444
1445void
1447 // first check that we're in move mode and shift key is pressed
1451 // calculate new color
1452 const RGBColor color = baseColor.changedBrightness(-50);
1453 // push matrix
1455 // translated to front
1456 glTranslated(0, 0, 0.1);
1457 // set color
1458 GLHelper::setColor(color);
1459 // draw points
1460 if (startPos != INVALID_DOUBLE) {
1461 // push geometry point matrix
1463 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1464 // draw geometry point
1466 // pop geometry point matrix
1468 }
1469 if (endPos != INVALID_DOUBLE) {
1470 // push geometry point matrix
1472 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1473 // draw geometry point
1475 // pop geometry point matrix
1477 }
1478 // pop draw matrix
1480 }
1481}
1482
1483
1484int
1486 // get edge stop indexes
1487 const auto edgeStopIndex = getEdgeStopIndex();
1488 // finally find stopIndex in edgeStopIndexes
1489 for (const auto& edgeStop : edgeStopIndex) {
1490 for (const auto& stop : edgeStop.stops) {
1491 if (stop == this) {
1492 return edgeStop.stopIndex;
1493 }
1494 }
1495 }
1496 // not found, then return -1
1497 return -1;
1498}
1499
1500
1501void
1503 if (getParentAdditionals().size() > 0) {
1504 setDemandElementID(getMicrosimID() + " (" + getParentAdditionals().front()->getTagStr() + ")");
1505 } else if (getParentLanes().size() > 0) {
1506 setDemandElementID(getMicrosimID() + " (" + getParentLanes().front()->getTagStr() + ")");
1507 }
1508}
1509
1510/****************************************************************************/
@ DEMAND_MOVE
mode for moving demand elements
#define TL(string)
Definition MsgHandler.h:305
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
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
@ 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:75
bool isInitialised() const
check if Boundary is Initialised
Definition Boundary.cpp:256
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition GLHelper.cpp:348
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition GLHelper.cpp:296
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition GLHelper.cpp:534
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition GLHelper.cpp:748
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
std::string getCommonAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
friend class GNEChange_ToggleAttribute
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
bool isCommonValid(SumoXMLAttr key, const std::string &value) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
GUIGeometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
void replaceFirstParentAdditional(SumoXMLTag tag, const std::string &value)
replace the first parent additional
void setDemandElementID(const std::string &newID)
set demand element id
std::vector< EdgeStopIndex > getEdgeStopIndex() const
get edgeStopIndex
Problem
enum class for demandElement problems
void replaceFirstParentLane(const std::string &value)
replace the first parent lane
GNEDemandElement * getCurrentDemandElement() const
get current demand element
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
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:220
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
bool getAllowChangeLane() const
allow change lane
CommonMoveOptions * getCommonMoveOptions() 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:146
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
GNEDemandElementSelector * getStopParentSelector() const
get stop parent selector
const RGBColor & getColor() const
get color
Definition GNEStop.cpp:319
int getPathStopIndex() const
get pathStopIndex
Definition GNEStop.cpp:1485
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEStop.cpp:752
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEStop.cpp:313
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:909
~GNEStop()
destructor
Definition GNEStop.cpp:147
void setStopMicrosimID()
set stop microsim ID
Definition GNEStop.cpp:1502
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEStop.cpp:42
bool drawIndex() const
draw index
Definition GNEStop.cpp:1038
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:479
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEStop.cpp:681
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:956
GNEContour myStopContour
variable used for draw contours
Definition GNEStop.h:208
Position getPositionInView() const
Returns position of demand element in view.
Definition GNEStop.cpp:355
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEStop.cpp:405
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEStop.cpp:923
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:490
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEStop.cpp:198
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEStop.cpp:151
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEStop.cpp:962
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:1106
std::string getParentName() const
Returns the name of the parent object.
Definition GNEStop.cpp:367
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:895
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEStop.cpp:628
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:497
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEStop.cpp:1420
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNEStop.cpp:233
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEStop.cpp:467
void computePathElement()
compute pathElement
Definition GNEStop.cpp:460
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEStop.cpp:387
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:1054
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEStop.cpp:411
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:707
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEStop.cpp:1392
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEStop.cpp:307
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNEStop.cpp:381
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:989
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:473
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1446
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEStop.cpp:984
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:1014
void updateGeometry()
update pre-computed geometry information
Definition GNEStop.cpp:342
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition GNEStop.cpp:1000
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
Definition GNEStop.cpp:1341
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEStop.cpp:268
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isVehicleWaypoint() const
return true if tag correspond to a vehicle waypoint element
const std::vector< const GNEAttributeProperties * > & getAttributeProperties() const
get all attribute properties
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
bool isACInspected(GNEAttributeCarrier *AC) const
GNEAttributeCarrier * getFirstAC() const
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEViewParent * getViewParent() const
get the net object
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
GNEStopFrame * getStopFrame() const
get frame for DEMAND_STOP
GNEMoveFrame * getMoveFrame() const
get frame for move elements
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings addSize
bool checkDrawAdditional(Detail d, const bool selected) const
check if draw additionals
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
double length2D() const
Returns the length.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
static const RGBColor GREY
Definition RGBColor.h:197
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
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
std::string lane
The lane to stop at.
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.
Structure representing possible vehicle parameter.
static ParkingType parseParkingType(const std::string &value)
parses parking type value
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
Definition of vehicle stop (position and duration)
bool showAllTrips() const
check if trips has to be drawn
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