Eclipse SUMO - Simulation of Urban MObility
GNEStop.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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 <cmath>
21#include <netedit/GNENet.h>
22#include <netedit/GNEUndoList.h>
23#include <netedit/GNEViewNet.h>
34
35#include "GNEStop.h"
36
37
38// ===========================================================================
39// member method definitions
40// ===========================================================================
41
43 GNEDemandElement("", net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
44 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
45myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
46 // reset default values
47 resetDefaultValues();
48 // enable parking for stops in parkin)gAreas
50 parametersSet |= STOP_PARKING_SET;
51 }
52 // set parking
53 if (parametersSet & STOP_PARKING_SET) {
54 parking = ParkingType::OFFROAD;
55 }
56 // set waypoint speed
57 myTagProperty.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
58}
59
60
61GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter) :
62 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
63 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {stoppingPlace}, {stopParent}, {}),
64SUMOVehicleParameter::Stop(stopParameter),
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.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
80}
81
82
83GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter) :
84 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
85 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {lane}, {}, {stopParent}, {}),
86SUMOVehicleParameter::Stop(stopParameter),
87myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
88 // set parking
89 if (parametersSet & STOP_PARKING_SET) {
90 parking = ParkingType::OFFROAD;
91 }
92 // set tripID and line
93 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
94 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
95 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
96 // set waypoint speed
97 myTagProperty.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
98}
99
100
101GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter) :
102 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
103 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {edge}, {}, {}, {stopParent}, {}),
104SUMOVehicleParameter::Stop(stopParameter),
105myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
106 // enable parking for stops in parkingAreas
108 parametersSet |= STOP_PARKING_SET;
109 }
110 // set flags
111 if (parametersSet & STOP_PARKING_SET) {
112 parking = ParkingType::OFFROAD;
113 }
114 triggered = (parametersSet & STOP_TRIGGER_SET);
115 containerTriggered = (parametersSet & STOP_CONTAINER_TRIGGER_SET);
116 joinTriggered = (parametersSet & STOP_JOIN_SET);
117 // set tripID and line
118 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
119 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
120 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
121 // set waypoint speed
122 myTagProperty.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
123}
124
125
127
128
132 // return move operation for additional placed over shape
133 return new GNEMoveOperation(this, getParentEdges().front()->getLanes().front(), endPos, false);
135 // get allow change lane
136 const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonModeOptions()->getAllowChangeLane();
137 // fist check if we're moving only extremes
141 // get snap radius
143 // get mouse position
144 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
145 // check if we clicked over start or end position
146 if ((startPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
147 // move only start position
148 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
150 } else if ((endPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
151 // move only end position
152 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
154 } else {
155 return nullptr;
156 }
157 } else if ((startPos != INVALID_DOUBLE) && (endPos != INVALID_DOUBLE)) {
158 // move both start and end positions
159 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
161 } else if (startPos != INVALID_DOUBLE) {
162 // move only start position
163 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
165 } else if (startPos != INVALID_DOUBLE) {
166 // move only end position
167 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
169 } else {
170 // start and end positions undefined, then nothing to move
171 return nullptr;
172 }
173 } else {
174 return nullptr;
175 }
176}
177
178
179std::string
181 return "";
182}
183
184
185void
187 device.openTag(SUMO_TAG_STOP);
188 if (getParentAdditionals().size() > 0) {
189 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
191 }
192 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
194 }
197 }
198 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA) {
200 }
201 } else {
202 if (getParentLanes().size() > 0) {
203 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
204 } else {
205 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
206 }
207 if ((parametersSet & STOP_START_SET) != 0) {
209 }
210 if ((parametersSet & STOP_END_SET) != 0) {
212 }
213 }
214 // write rest of attributes
215 write(device, true, false);
216}
217
218
222 // get lane
223 const GNELane* firstLane = getFirstAllowedLane();
224 // only Stops placed over lanes can be invalid
226 return isPersonPlanValid();
227 } else if (friendlyPos) {
228 // with friendly position enabled position are "always fixed"
229 return isPersonPlanValid();
230 } else if (firstLane != nullptr) {
231 // obtain lane length
232 const double laneLength = getParentEdges().front()->getNBEdge()->getFinalLength() * firstLane->getLengthGeometryFactor();
233 // declare end pos fixed
234 const double endPosFixed = (endPos < 0) ? (endPos + laneLength) : endPos;
235 // check values
236 if ((endPosFixed <= getParentEdges().front()->getNBEdge()->getFinalLength()) && (endPosFixed > 0)) {
237 return isPersonPlanValid();
238 } else {
240 }
241 } else {
243 }
244 } else {
245 // only Stops placed over lanes can be invalid
247 return Problem::OK;
248 } else if (friendlyPos) {
249 // with friendly position enabled position are "always fixed"
250 return Problem::OK;
251 } else {
252 // obtain lane length
253 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
254 // declare a copy of start and end positions
255 double startPosCopy = startPos;
256 double endPosCopy = endPos;
257 // check if position has to be fixed
258 if (startPosCopy < 0) {
259 startPosCopy += laneLength;
260 }
261 if (endPosCopy < 0) {
262 endPosCopy += laneLength;
263 }
264 // check values
265 if ((startPosCopy >= 0) && (endPosCopy <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) && ((endPosCopy - startPosCopy) >= POSITION_EPS)) {
266 return Problem::OK;
267 } else {
269 }
270 }
271 }
272}
273
274
275std::string
278 if (friendlyPos) {
279 return getPersonPlanProblem();
280 } else {
281 // obtain lane length
282 const double laneLength = getParentEdges().front()->getNBEdge()->getFinalLength();
283 // declare end pos fixed
284 const double endPosFixed = (endPos < 0) ? (endPos + laneLength) : endPos;
285 // check positions over lane
286 if (endPosFixed < 0) {
287 return (toString(SUMO_ATTR_ENDPOS) + " < 0");
288 } else if (endPosFixed > getParentEdges().front()->getNBEdge()->getFinalLength()) {
289 return (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
290 } else {
291 return getPersonPlanProblem();
292 }
293 }
294 } else {
295 // declare a copy of start and end positions
296 double startPosCopy = startPos;
297 double endPosCopy = endPos;
298 // obtain lane length
299 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
300 // check if position has to be fixed
301 if (startPosCopy < 0) {
302 startPosCopy += laneLength;
303 }
304 if (endPosCopy < 0) {
305 endPosCopy += laneLength;
306 }
307 // declare variables
308 std::string errorStart, separator, errorEnd;
309 // check positions over lane
310 if (startPosCopy < 0) {
311 errorStart = (toString(SUMO_ATTR_STARTPOS) + " < 0");
312 } else if (startPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
313 errorStart = (toString(SUMO_ATTR_STARTPOS) + " > lanes's length");
314 }
315 if (endPosCopy < 0) {
316 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " < 0");
317 } else if (endPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
318 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
319 }
320 // check separator
321 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
322 separator = " and ";
323 }
324 return errorStart + separator + errorEnd;
325 }
326}
327
328
329void
331 //
332}
333
334
337 return getParentDemandElements().front()->getVClass();
338}
339
340
341const RGBColor&
343 if (getTagProperty().isPersonPlan() || getTagProperty().isContainerPlan()) {
345 } else if (myNet->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
346 // get inspected AC
347 const auto AC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
348 // check if is a route or a vehicle
349 if ((AC->getTagProperty().isRoute() || AC->getTagProperty().isVehicle()) && (AC != getParentDemandElements().front())) {
350 return RGBColor::GREY;
351 }
352 } else if (myNet->getViewNet()->getViewParent()->getStopFrame()->shown()) {
354 return RGBColor::GREY;
355 }
356 }
357 // return default color
360 } else {
362 }
363}
364
365
366void
368 // update geometry depending of parent
369 if (getParentLanes().size() > 0) {
370 // Cut shape using as delimitators fixed start position and fixed end position
372 } else if (getParentAdditionals().size() > 0) {
373 if (getTagProperty().isPersonPlan() || getTagProperty().isContainerPlan()) {
374 // get busStop shape
375 const PositionVector& busStopShape = getParentAdditionals().front()->getAdditionalGeometry().getShape();
376 // update demand element geometry using both positions
377 myDemandElementGeometry.updateGeometry(busStopShape, busStopShape.length2D() - 0.6, busStopShape.length2D(), 0);
378 } else {
379 // use geometry of additional (busStop)
380 myDemandElementGeometry = getParentAdditionals().at(0)->getAdditionalGeometry();
381 }
382 } else if (getParentEdges().size() > 0) {
383 // get front and back lane
384 const GNELane* frontLane = getParentEdges().front()->getLanes().front();
385 const GNELane* backLane = getParentEdges().front()->getLanes().back();
386 // get lane drawing constants
387 GNELane::LaneDrawingConstants laneDrawingConstantsFront(myNet->getViewNet()->getVisualisationSettings(), frontLane);
388 GNELane::LaneDrawingConstants laneDrawingConstantBack(myNet->getViewNet()->getVisualisationSettings(), backLane);
389 // calculate front position
390 const Position frontPosition = frontLane->getLaneShape().positionAtOffset2D(getAttributeDouble(SUMO_ATTR_ARRIVALPOS), laneDrawingConstantsFront.halfWidth);
391 // calulate length between both shapes
392 const double length = backLane->getLaneShape().distance2D(frontPosition, true);
393 // calculate back position
394 const Position backPosition = frontLane->getLaneShape().positionAtOffset2D(getAttributeDouble(SUMO_ATTR_ARRIVALPOS), (length + laneDrawingConstantBack.halfWidth - laneDrawingConstantsFront.halfWidth) * -1);
395 // update demand element geometry using both positions
396 myDemandElementGeometry.updateGeometry({frontPosition, backPosition});
397 }
398 /*
399 // recompute geometry of all Demand elements related with this this stop
400 if (getParentDemandElements().front()->getTagProperty().isRoute()) {
401 getParentDemandElements().front()->updateGeometry();
402 }
403 */
404}
405
406
410 // check if is placed over a busStop
411 if (getParentAdditionals().size() > 0) {
412 return getParentAdditionals().front()->getPositionInView();
413 } else {
414 // get lane
415 const GNELane* personLane = getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
416 // get position over lane shape
417 if (endPos <= 0) {
418 return personLane->getLaneShape().front();
419 } else if (endPos >= personLane->getLaneShape().length2D()) {
420 return personLane->getLaneShape().back();
421 } else {
422 return personLane->getLaneShape().positionAtOffset2D(endPos);
423 }
424 }
425 } else {
426 if (getParentLanes().size() > 0) {
427 return getParentLanes().front()->getLaneShape().positionAtOffset((startPos + endPos) / 2.0);
428 } else if (getParentAdditionals().size() > 0) {
429 return getParentAdditionals().front()->getPositionInView();
430 } else {
431 throw ProcessError("Invalid Stop parent");
432 }
433 }
434}
435
436
437std::string
439 if (getParentDemandElements().size() > 0) {
440 return getParentDemandElements().front()->getID();
441 } else if (getParentAdditionals().size() > 0) {
442 return getParentAdditionals().front()->getID();
443 } else if (getParentLanes().size() > 0) {
444 return getParentLanes().front()->getID();
445 } else {
446 throw ProcessError("Invalid parent");
447 }
448}
449
450
451double
453 return s.addSize.getExaggeration(s, this);
454}
455
456
459 Boundary b;
460 // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
461 if (getParentAdditionals().size() > 0) {
462 return getParentAdditionals().at(0)->getCenteringBoundary();
465 } else if (myDemandElementGeometry.getShape().size() > 0) {
467 } else {
469 }
470 b.grow(20);
471 return b;
472}
473
474
475void
476GNEStop::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
477 // geometry of this element cannot be splitted
478}
479
480
481void
483 bool drawStop = false;
484 if (getTagProperty().isStopPerson()) {
485 drawStop = drawPersonPlan();
486 } else if (getTagProperty().isStopContainer()) {
487 drawStop = drawContainerPlan();
488 } else {
489 drawStop = canDrawVehicleStop();
490 }
491 // check if stop can be drawn
492 if (drawStop) {
493 // Obtain exaggeration of the draw
494 const double exaggeration = getExaggeration(s);
495 // check if draw an stop for person/containers or for vehicles/routes
496 if (getTagProperty().isStopPerson() || getTagProperty().isStopContainer()) {
497 // check if draw stopPerson over busStop oder over lane
498 if (getParentAdditionals().size() > 0) {
499 drawStopPersonOverBusStop(s, exaggeration);
500 } else {
501 drawStopPersonOverEdge(s, exaggeration);
502 }
503 // draw person parent if this stop if their first person plan child
504 if ((getParentDemandElements().size() == 1) && getParentDemandElements().front()->getChildDemandElements().front() == this) {
505 getParentDemandElements().front()->drawGL(s);
506 }
507 } else {
508 // draw vehicle over stop
509 drawVehicleStop(s, exaggeration);
510 }
511 // Draw name
512 drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
513 }
514}
515
516
517void
519 // only update geometry
521}
522
523
524void
525GNEStop::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*lane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
526 // Stops don't use drawPartialGL
527}
528
529
530void
531GNEStop::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*fromLane*/, const GNELane* /*toLane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
532 // Stops don't use drawPartialGL
533}
534
535
536GNELane*
538 // check if stop is placed over a busStop
539 if (getParentAdditionals().size() > 0) {
540 return getParentAdditionals().front()->getParentLanes().front();
541 } else if (getParentEdges().size() > 0) {
542 return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
543 } else {
544 return getParentLanes().front();
545 }
546}
547
548
549GNELane*
551 // first and last path lane are the same
552 return getFirstPathLane();
553}
554
555
556std::string
558 switch (key) {
559 case SUMO_ATTR_ID:
560 return getMicrosimID();
562 if (isAttributeEnabled(key)) {
563 return time2string(duration);
564 } else {
565 return "";
566 }
567 case SUMO_ATTR_UNTIL:
568 if (isAttributeEnabled(key)) {
569 return time2string(until);
570 } else {
571 return "";
572 }
574 if (isAttributeEnabled(key)) {
575 return time2string(extension);
576 } else {
577 return "";
578 }
580 if ((parametersSet & STOP_TRIGGER_SET) == false) {
581 return "false";
582 } else if (triggered) {
583 return "person";
584 } else if (containerTriggered) {
585 return "container";
586 } else {
587 return "join";
588 }
590 if ((parametersSet & STOP_TRIGGER_SET) == false) {
591 return "";
592 } else if (triggered) {
593 return toString(awaitedPersons);
594 } else if (containerTriggered) {
596 } else {
597 return "";
598 }
600 return toString(permitted);
603 return "true";
604 } else {
605 return "false";
606 }
608 return actType;
610 return tripId;
611 case SUMO_ATTR_LINE:
612 return line;
614 return toString(onDemand);
615 // only for waypoints
616 case SUMO_ATTR_SPEED:
617 return toString(speed);
618 // specific of Stops over stoppingPlaces
623 return getParentAdditionals().front()->getID();
624 // specific of stops over edges
625 case SUMO_ATTR_EDGE:
626 return getParentEdges().front()->getID();
627 // specific of stops over lanes
628 case SUMO_ATTR_LANE:
629 return getParentLanes().front()->getID();
631 return toString(startPos);
632 case SUMO_ATTR_ENDPOS:
633 return toString(endPos);
635 return toString(friendlyPos);
637 if (posLat == INVALID_DOUBLE) {
638 return "";
639 } else {
640 return toString(posLat);
641 }
642 //
645 case GNE_ATTR_PARENT:
646 return getParentDemandElements().front()->getID();
647 case GNE_ATTR_STOPINDEX: {
648 // extract all stops of demandElement parent
649 std::vector<GNEDemandElement*> stops;
650 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
651 if (parent->getTagProperty().isStop()) {
652 stops.push_back(parent);
653 }
654 }
655 // find index in stops
656 for (int i = 0; i < (int)stops.size(); i++) {
657 if (stops.at(i) == this) {
658 return toString(i);
659 }
660 }
661 return "invalid index";
662 }
663 default:
664 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
665 }
666}
667
668
669double
671 switch (key) {
673 if (getParentAdditionals().size() > 0) {
674 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_STARTPOS);
675 } else {
676 return startPos;
677 }
678 case SUMO_ATTR_ENDPOS:
679 case SUMO_ATTR_ARRIVALPOS: // for person plans
680 if (getParentAdditionals().size() > 0) {
681 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
682 } else {
683 return endPos;
684 }
685 case SUMO_ATTR_INDEX: // for writting sorted
686 return (double)myCreationIndex;
687 case GNE_ATTR_STOPINDEX: {
688 // extract all stops of demandElement parent
689 std::vector<GNEDemandElement*> stops, filteredStops;
690 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
691 if (parent->getTagProperty().isStop()) {
692 stops.push_back(parent);
693 }
694 }
695 // now filter stops with the same startPos
696 for (const auto& stop : stops) {
697 if (stop->getAttributeDouble(SUMO_ATTR_STARTPOS) == getAttributeDouble(SUMO_ATTR_STARTPOS)) {
698 filteredStops.push_back(stop);
699 }
700 }
701 // get index
702 for (int i = 0; i < (int)filteredStops.size(); i++) {
703 if (filteredStops.at(i) == this) {
704 return i;
705 }
706 }
707 return 0;
708 }
709 default:
710 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
711 }
712}
713
714
717 switch (key) {
718 // we use SUMO_ATTR_ARRIVALPOS instead SUMO_ATTR_ENDPOS due it's a person plan
720 if (getParentAdditionals().size() > 0) {
721 // return first position of busStop
722 return getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
723 } else {
724 // get lane shape
725 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
726 // continue depending of arrival position
727 if (endPos == 0) {
728 return laneShape.front();
729 } else if ((endPos == -1) || (endPos >= laneShape.length2D())) {
730 return laneShape.back();
731 } else {
732 return laneShape.positionAtOffset2D(endPos);
733 }
734 }
735 }
736 default:
737 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
738 }
739}
740
741
742void
743GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
744 if (value == getAttribute(key)) {
745 return; //avoid needless changes, later logic relies on the fact that attributes have changed
746 }
747 switch (key) {
749 case SUMO_ATTR_UNTIL:
757 case SUMO_ATTR_LINE:
759 // only for waypoints
760 case SUMO_ATTR_SPEED:
761 // specific of Stops over stoppingPlaces
764 // specific of stops over lanes
765 case SUMO_ATTR_LANE:
769 //
771 case GNE_ATTR_PARENT:
772 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
773 break;
774 // special case for person plans
775 case SUMO_ATTR_EDGE: {
776 // get next personPlan
777 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
778 // continue depending of nextPersonPlan
779 if (nextPersonPlan) {
780 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
781 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
782 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
783 undoList->end();
784 } else {
785 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
786 }
787 break;
788 }
791 // get next person plan
792 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
793 // continue depending of nextPersonPlan
794 if (nextPersonPlan) {
795 // obtain busStop
797 // change from attribute using edge ID
798 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
799 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
800 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
801 undoList->end();
802 } else {
803 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
804 }
805 } else {
806 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
807 }
808 break;
811 // get next person plan
812 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
813 // continue depending of nextPersonPlan
814 if (nextPersonPlan) {
815 // obtain containerStop
817 // change from attribute using edge ID
818 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
819 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, containerStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
820 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
821 undoList->end();
822 } else {
823 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
824 }
825 } else {
826 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
827 }
828 break;
829 case SUMO_ATTR_ENDPOS:
831 // get previous person plan
832 GNEDemandElement* previousPersonPlan = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
833 // check if leave presonStop connected is enabled
835 previousPersonPlan && previousPersonPlan->getTagProperty().hasAttribute(SUMO_ATTR_ARRIVALPOS)) {
836 // change from attribute using edge ID
837 undoList->begin(myTagProperty.getGUIIcon(), "Change arrivalPos attribute of previous personPlan");
838 previousPersonPlan->setAttribute(SUMO_ATTR_ARRIVALPOS, value, undoList);
839 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
840 undoList->end();
841 } else {
842 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
843 }
844 } else {
845 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
846 }
847 break;
848 default:
849 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
850 }
851}
852
853
854bool
855GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
856 // declare string error
857 std::string error;
858 switch (key) {
860 case SUMO_ATTR_UNTIL:
862 if (canParse<SUMOTime>(value)) {
863 return parse<SUMOTime>(value) >= 0;
864 } else {
865 return false;
866 }
868 if (value.empty()) {
869 return false;
870 } else {
871 const std::set<std::string> expectedValues = {"true", "false", "person", "container", "join"};
872 const std::vector<std::string> triggeredValues = parse<std::vector<std::string> >(value);
873 for (const auto& triggeredValue : triggeredValues) {
874 if (expectedValues.find(triggeredValue) == expectedValues.end()) {
875 return false;
876 }
877 }
878 return true;
879 }
881 if (value.empty()) {
882 return false;
883 } else {
884 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
885 for (const auto& expectedValue : expectedValues) {
886 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
887 return false;
888 }
889 }
890 return true;
891 }
892 case SUMO_ATTR_PERMITTED: {
893 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
894 for (const auto& expectedValue : expectedValues) {
895 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
896 return false;
897 }
898 }
899 return true;
900 }
902 if (value == "opportunistic") {
903 return false; // Currrently deactivated opportunistic in NETEDIT waiting for the implementation in SUMO
904 } else {
905 return canParse<bool>(value);
906 }
908 return true;
911 case SUMO_ATTR_LINE:
912 return true;
914 return canParse<bool>(value);
915 // only for waypoints
916 case SUMO_ATTR_SPEED:
917 if (canParse<double>(value)) {
918 return (parse<double>(value) >= 0);
919 } else {
920 return false;
921 }
922 // specific of Stops over stoppingPlaces
924 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
926 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
928 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
930 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
931 // specific of stops over edges
932 case SUMO_ATTR_EDGE:
933 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
934 return true;
935 } else {
936 return false;
937 }
938 // specific of stops over lanes
939 case SUMO_ATTR_LANE:
940 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
941 return true;
942 } else {
943 return false;
944 }
946 if (canParse<double>(value)) {
947 return SUMORouteHandler::isStopPosValid(parse<double>(value), endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
948 } else {
949 return false;
950 }
951 case SUMO_ATTR_ENDPOS:
953 return canParse<double>(value) && fabs(parse<double>(value)) < getParentEdges().front()->getNBEdge()->getFinalLength();
954 } else if (canParse<double>(value)) {
955 return SUMORouteHandler::isStopPosValid(startPos, parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
956 } else {
957 return false;
958 }
960 return canParse<bool>(value);
962 if (value.empty()) {
963 return true;
964 } else {
965 return canParse<double>(value);
966 }
967 //
969 return canParse<bool>(value);
970 case GNE_ATTR_PARENT:
971 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
972 return true;
973 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
974 return true;
975 } else {
976 return false;
977 }
978 default:
979 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
980 }
981}
982
983
984void
986 switch (key) {
988 case SUMO_ATTR_UNTIL:
992 undoList->add(new GNEChange_EnableAttribute(this, key, true), true);
993 break;
994 default:
995 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
996 }
997}
998
999
1000void
1002 switch (key) {
1003 case SUMO_ATTR_DURATION:
1004 case SUMO_ATTR_UNTIL:
1006 case SUMO_ATTR_EXPECTED:
1008 undoList->add(new GNEChange_EnableAttribute(this, key, false), true);
1009 break;
1010 default:
1011 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1012 }
1013}
1014
1015
1016bool
1018 switch (key) {
1019 // Currently stops parents cannot be edited
1020 case SUMO_ATTR_BUS_STOP:
1024 return false;
1025 case SUMO_ATTR_DURATION:
1026 return (parametersSet & STOP_DURATION_SET) != 0;
1027 case SUMO_ATTR_UNTIL:
1028 return (parametersSet & STOP_UNTIL_SET) != 0;
1030 return (parametersSet & STOP_EXTENSION_SET) != 0;
1031 case SUMO_ATTR_EXPECTED:
1032 return (parametersSet & STOP_TRIGGER_SET) != 0;
1033 case SUMO_ATTR_PARKING:
1035 return false;
1037 return false;
1038 } else {
1039 return true;
1040 }
1041 default:
1042 return true;
1043 }
1044}
1045
1046
1047std::string
1049 return getTagStr();
1050}
1051
1052
1053std::string
1055 if (getParentAdditionals().size() > 0) {
1056 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
1057 return "BusStop: " + getParentAdditionals().front()->getID();
1058 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
1059 return "containerStop: " + getParentAdditionals().front()->getID();
1060 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CHARGING_STATION) {
1061 return "chargingStation: " + getParentAdditionals().front()->getID();
1062 } else {
1063 return "parkingArea: " + getParentAdditionals().front()->getID();
1064 }
1065 } else if (getParentEdges().size() > 0) {
1066 return "edge: " + getParentEdges().front()->getID();
1067 } else if (getParentLanes().size() > 0) {
1068 return "lane: " + getParentLanes().front()->getID();
1069 } else {
1070 return "";
1071 }
1072}
1073
1074
1075const Parameterised::Map&
1077 return getParametersMap();
1078}
1079
1080double
1082 double fixedPos = startPos;
1083 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
1084 if (fixedPos < 0) {
1085 fixedPos += len;
1086 }
1087 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
1088}
1089
1090
1091double
1093 double fixedPos = endPos;
1094 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
1095 if (fixedPos < 0) {
1096 fixedPos += len;
1097 }
1098 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
1099}
1100
1101// ===========================================================================
1102// protected
1103// ===========================================================================
1104
1105const GNELane*
1107 if (getParentEdges().empty()) {
1108 return nullptr;
1109 }
1110 for (const auto& pLane : getParentEdges().front()->getLanes()) {
1111 if (pLane->allowPedestrians()) {
1112 return pLane;
1113 }
1114 }
1115 return getParentEdges().front()->getLanes().front();
1116}
1117
1118
1119bool
1122 return true;
1123 } else if (myNet->getViewNet()->isAttributeCarrierInspected(this)) {
1124 return true;
1126 return true;
1128 return true;
1129 } else if ((getParentDemandElements().front()->getTagProperty().getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
1132 return true;
1133 } else {
1134 return false;
1135 }
1136 } else {
1137 return false;
1138 }
1139}
1140
1141
1142void
1143GNEStop::drawVehicleStop(const GUIVisualizationSettings& s, const double exaggeration) const {
1144 // declare value to save stop color
1146 // get lane
1147 const auto& stopLane = getParentLanes().size() > 0 ? getParentLanes().front() : nullptr;
1148 // get lane width
1149 const double width = stopLane ? stopLane->getParentEdge()->getNBEdge()->getLaneWidth(stopLane->getIndex()) * 0.5 : exaggeration * 0.8;
1150 // Start drawing adding an gl identificator
1152 // Add a layer matrix
1154 // set Color
1155 GLHelper::setColor(stopColor);
1156 // Start with the drawing of the area traslating matrix to origin
1158 // draw depending of details
1159 if (s.drawDetail(s.detailSettings.stopsDetails, exaggeration) && stopLane) {
1160 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
1164 exaggeration * 0.1, 0, width);
1168 exaggeration * 0.1, 0, width * -1);
1169 // Add a detail matrix
1171 // move to geometry front
1172 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1173 // rotate
1174 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1175 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1176 }
1177 // move again
1178 glTranslated(0, exaggeration * 0.5, 0);
1179 // draw stop front
1180 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1181 // move to "S" position
1182 glTranslated(0, 1, 0.1);
1183 // only draw text if isn't being drawn for selecting
1185 GLHelper::setColor(stopColor);
1186 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1187 } else if (s.drawDetail(s.detailSettings.stopsText, exaggeration)) {
1188 // draw "S" symbol
1189 GLHelper::drawText(myTagProperty.isWaypoint() ? "W" : "S", Position(), .1, 2.8, stopColor, 180);
1190 // move to subtitle position
1191 glTranslated(0, 1.4, 0);
1192 // draw subtitle depending of tag
1193 GLHelper::drawText("lane", Position(), .1, 1, stopColor, 180);
1194 // check if draw index
1195 if (drawIndex()) {
1196 // move to index position
1197 glTranslated(-2.1, -2.4, 0);
1198 glRotated(-90, 0, 0, 1);
1199 // draw index
1201 }
1202 }
1203 // pop detail matrix
1205 // draw geometry points
1206 drawGeometryPoints(s, stopColor);
1207 } else {
1208 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1210 // only draw text if isn't being drawn for selecting
1211 if (s.drawDetail(s.detailSettings.stopsText, exaggeration) && drawIndex()) {
1212 // Add a detail matrix
1214 // move to geometry front
1215 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1216 // rotate
1217 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1218 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1219 }
1220 // move to index position
1221 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1222 glRotated(-90, 0, 0, 1);
1223 // draw index
1225 }
1226 // pop detail matrix
1228 }
1229 // pop layer matrix
1231 // Pop name
1233 // draw lock icon
1235 // check if mouse is over element
1237 // inspect contour
1240 width, exaggeration, true, true);
1241 }
1242 // front element contour
1243 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
1245 width, exaggeration, true, true);
1246 }
1247 // delete contour
1248 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1250 width, exaggeration, true, true);
1251 }
1252 // select contour
1253 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1255 width, exaggeration, true, true);
1256 }
1257}
1258
1259
1260void
1261GNEStop::drawStopPersonOverEdge(const GUIVisualizationSettings& s, const double exaggeration) const {
1262 // Start drawing adding an gl identificator
1264 // Add layer matrix matrix
1266 // translate to front
1268 // declare stop color
1270 // declare central line color
1271 const RGBColor centralLineColor = drawUsingSelectColor() ? stopColor.changedBrightness(-32) : RGBColor::WHITE;
1272 // set base color
1273 GLHelper::setColor(stopColor);
1274 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
1276 // move to front
1277 glTranslated(0, 0, .1);
1278 // set central color
1279 GLHelper::setColor(centralLineColor);
1280 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
1282 // move to icon position and front
1283 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), .1);
1284 // rotate over lane
1286 // move again
1287 glTranslated(0, s.additionalSettings.vaporizerSize * exaggeration, 0);
1288 // Draw icon depending of Route Probe is selected and if isn't being drawn for selecting
1289 if (!s.drawForRectangleSelection && s.drawDetail(s.detailSettings.laneTextures, exaggeration)) {
1290 // set color
1291 glColor3d(1, 1, 1);
1292 // rotate texture
1293 glRotated(180, 0, 0, 1);
1294 // draw texture
1295 if (drawUsingSelectColor()) {
1297 } else {
1299 }
1300 } else {
1301 // rotate
1302 glRotated(22.5, 0, 0, 1);
1303 // set stop color
1304 GLHelper::setColor(stopColor);
1305 // move matrix
1306 glTranslated(0, 0, 0);
1307 // draw filled circle
1309 }
1310 // pop layer matrix
1312 // Pop name
1314 // draw lock icon
1316 // check if mouse is over element
1318 // inspect contour
1321 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1322 }
1323 // front contour
1324 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
1326 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1327 }
1328 // delete contour
1329 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1331 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1332 }
1333 // select contour
1334 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1336 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1337 }
1338}
1339
1340
1341void
1342GNEStop::drawStopPersonOverBusStop(const GUIVisualizationSettings& s, const double exaggeration) const {
1343 // Start drawing adding an gl identificator
1345 // Add layer matrix matrix
1347 // translate to front
1349 // declare stop color
1351 // set base color
1352 GLHelper::setColor(stopColor);
1353 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
1355 // move to icon position and front
1357 // rotate over lane
1359 // move again
1360 glTranslated(s.stoppingPlaceSettings.busStopWidth * exaggeration * -2, 0, 0);
1361 // Draw icon depending of Route Probe is selected and if isn't being drawn for selecting
1362 if (!s.drawForRectangleSelection && s.drawDetail(s.detailSettings.laneTextures, exaggeration)) {
1363 // set color
1364 glColor3d(1, 1, 1);
1365 // rotate texture
1366 glRotated(-90, 0, 0, 1);
1367 // draw texture
1368 if (drawUsingSelectColor()) {
1370 } else {
1372 }
1373 } else {
1374 // rotate
1375 glRotated(22.5, 0, 0, 1);
1376 // set stop color
1377 GLHelper::setColor(stopColor);
1378 // move matrix
1379 glTranslated(0, 0, 0);
1380 // draw filled circle
1382 }
1383 // pop layer matrix
1385 // Pop name
1387 // draw lock icon
1389 // inspect contour
1392 exaggeration, true, true);
1393 }
1394 // front contour
1395 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
1397 exaggeration, true, true);
1398 }
1399 // delete contour
1400 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1402 exaggeration, true, true);
1403 }
1404 // select contour
1405 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1407 exaggeration, true, true);
1408 }
1409}
1410
1411
1412bool
1414 // get stop frame
1415 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
1416 // check conditions
1418 return true;
1419 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
1420 return true;
1421 } else {
1422 return false;
1423 }
1424}
1425
1426// ===========================================================================
1427// private
1428// ===========================================================================
1429
1430void
1431GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1432 switch (key) {
1433 case SUMO_ATTR_DURATION:
1434 if (value.empty()) {
1435 toggleAttribute(key, false);
1436 } else {
1437 toggleAttribute(key, true);
1438 duration = string2time(value);
1439 }
1440 break;
1441 case SUMO_ATTR_UNTIL:
1442 if (value.empty()) {
1443 toggleAttribute(key, false);
1444 } else {
1445 toggleAttribute(key, true);
1446 until = string2time(value);
1447 }
1448 break;
1450 if (value.empty()) {
1451 toggleAttribute(key, false);
1452 } else {
1453 toggleAttribute(key, true);
1454 extension = string2time(value);
1455 }
1456 break;
1458 // reset all flags
1459 triggered = false;
1460 containerTriggered = false;
1461 joinTriggered = false;
1462 // disable all flags
1463 parametersSet &= ~STOP_JOIN_SET;
1464 parametersSet &= ~STOP_TRIGGER_SET;
1465 parametersSet &= ~STOP_EXPECTED_SET;
1466 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1467 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1468 // check value
1469 if (value == "person") {
1471 triggered = true;
1472 if (awaitedPersons.size() > 0) {
1474 }
1475 } else if (value == "container") {
1478 containerTriggered = true;
1479 if (awaitedPersons.size() > 0) {
1481 }
1482 } else if (value == "join") {
1484 joinTriggered = true;
1485 }
1486 break;
1487 case SUMO_ATTR_EXPECTED:
1488 if (triggered) {
1489 awaitedPersons = parse<std::set<std::string> >(value);
1490 if (awaitedPersons.size() > 0) {
1492 } else {
1493 parametersSet &= ~STOP_EXPECTED_SET;
1494 }
1495 } else if (containerTriggered) {
1496 awaitedContainers = parse<std::set<std::string> >(value);
1497 if (awaitedContainers.size() > 0) {
1499 } else {
1500 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1501 }
1502 }
1503 break;
1505 if (value.empty()) {
1506 parametersSet &= ~STOP_PERMITTED_SET;
1507 } else {
1509 permitted = parse<std::set<std::string> >(value);
1510 }
1511 break;
1512 case SUMO_ATTR_PARKING:
1515 parametersSet &= ~STOP_PARKING_SET;
1516 } else {
1518 }
1519 break;
1520 case SUMO_ATTR_ACTTYPE:
1521 actType = value;
1522 break;
1523 case SUMO_ATTR_TRIP_ID:
1524 tripId = value;
1525 toggleAttribute(key, (value.size() > 0));
1526 break;
1527 case SUMO_ATTR_LINE:
1528 line = value;
1529 toggleAttribute(key, (value.size() > 0));
1530 break;
1531 case SUMO_ATTR_ONDEMAND:
1532 if (parse<bool>(value)) {
1534 } else {
1535 parametersSet &= ~STOP_ONDEMAND_SET;
1536 }
1537 // set flag
1539 break;
1540 // only for waypoints
1541 case SUMO_ATTR_SPEED:
1542 speed = parse<double>(value);
1543 break;
1544 // specific of Stops over stoppingPlaces
1545 case SUMO_ATTR_BUS_STOP:
1548 break;
1552 break;
1556 break;
1560 break;
1561 // specific of Stops over edges
1562 case SUMO_ATTR_EDGE:
1565 edge = value;
1566 break;
1567 // specific of Stops over lanes
1568 case SUMO_ATTR_LANE:
1571 break;
1572 case SUMO_ATTR_STARTPOS:
1573 startPos = parse<double>(value);
1575 break;
1576 case SUMO_ATTR_ENDPOS:
1577 endPos = parse<double>(value);
1579 break;
1581 friendlyPos = parse<bool>(value);
1582 break;
1584 if (value.empty()) {
1586 parametersSet &= ~STOP_POSLAT_SET;
1587 } else {
1588 posLat = parse<double>(value);
1590 }
1591 break;
1592 //
1593 case GNE_ATTR_SELECTED:
1594 if (parse<bool>(value)) {
1596 } else {
1598 }
1599 break;
1600 case GNE_ATTR_PARENT:
1601 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
1603 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
1605 }
1607 break;
1608 default:
1609 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1610 }
1611}
1612
1613
1614void
1616 switch (key) {
1617 case SUMO_ATTR_DURATION:
1618 if (value) {
1620 } else {
1621 parametersSet &= ~STOP_DURATION_SET;
1622 }
1623 break;
1624 case SUMO_ATTR_UNTIL:
1625 if (value) {
1627 } else {
1628 parametersSet &= ~STOP_UNTIL_SET;
1629 }
1630 break;
1632 if (value) {
1634 } else {
1635 parametersSet &= ~STOP_EXTENSION_SET;
1636 }
1637 break;
1638 case SUMO_ATTR_TRIP_ID:
1639 if (value) {
1641 } else {
1642 parametersSet &= ~STOP_TRIP_ID_SET;
1643 }
1644 break;
1645 case SUMO_ATTR_LINE:
1646 if (value) {
1648 } else {
1649 parametersSet &= ~STOP_LINE_SET;
1650 }
1651 break;
1652 case SUMO_ATTR_ONDEMAND:
1653 if (value) {
1655 } else {
1656 parametersSet &= ~STOP_ONDEMAND_SET;
1657 }
1658 break;
1659 default:
1660 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1661 }
1662}
1663
1664
1665void
1668 // change endPos
1669 endPos = moveResult.newFirstPos;
1670 } else {
1672 // change only start position
1673 startPos = moveResult.newFirstPos;
1674 // adjust startPos
1675 if (startPos > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
1676 startPos = (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS);
1677 }
1679 // change only end position
1680 endPos = moveResult.newFirstPos;
1681 // adjust endPos
1682 if (endPos < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
1683 endPos = (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS);
1684 }
1685 } else {
1686 // change both position
1687 startPos = moveResult.newFirstPos;
1688 endPos = moveResult.newSecondPos;
1689 // set lateral offset
1691 }
1692 }
1693 // update geometry
1695}
1696
1697
1698void
1700 // begin change attribute
1701 undoList->begin(myTagProperty.getGUIIcon(), "position of " + getTagStr());
1703 // now adjust endPos position
1704 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
1705 } else {
1706 // set attributes depending of operation type
1708 // set only start position
1711 // set only end position
1712 undoList->changeAttribute(new GNEChange_Attribute(this, SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos)));
1713 } else {
1714 // set both
1717 // check if lane has to be changed
1718 if (moveResult.newFirstLane) {
1719 // set new lane
1720 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
1721 }
1722 }
1723 }
1724 // end change attribute
1725 undoList->end();
1726}
1727
1728
1729void
1731 // first check that we're in move mode and shift key is pressed
1735 // calculate new color
1736 const RGBColor color = baseColor.changedBrightness(-50);
1737 // push matrix
1739 // translated to front
1740 glTranslated(0, 0, 0.1);
1741 // set color
1742 GLHelper::setColor(color);
1743 // draw points
1744 if (startPos != INVALID_DOUBLE) {
1745 // push geometry point matrix
1747 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1748 // draw geometry point
1750 // pop geometry point matrix
1752 }
1753 if (endPos != INVALID_DOUBLE) {
1754 // push geometry point matrix
1756 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1757 // draw geometry point
1759 // pop geometry point matrix
1761 }
1762 // pop draw matrix
1764 }
1765}
1766
1767/****************************************************************************/
@ 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
@ STOPPERSON_SELECTED
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
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_START_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_ONDEMAND_SET
const int STOP_END_SET
const int STOP_EXPECTED_CONTAINERS_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_WAYPOINT_PARKINGAREA
waypoint placed over a parking area (used in netedit)
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_STOP_LANE
stop placed over a lane (used in netedit)
@ GNE_TAG_STOPCONTAINER_EDGE
@ 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 (used in NETEDIT)
@ SUMO_TAG_PARKING_AREA
A parking area.
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ GNE_TAG_WAYPOINT_LANE
waypoint placed over a lane (used in netedit)
@ SUMO_TAG_PERSON
@ SUMO_TAG_STOP_PARKINGAREA
stop placed over a parking area (used in netedit)
@ GNE_TAG_STOPPERSON_EDGE
@ SUMO_TAG_PERSONFLOW
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_LANE
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_ACTTYPE
@ GNE_ATTR_SELECTED
element is selected
@ 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_FROM
@ SUMO_ATTR_PERMITTED
@ GNE_ATTR_STOPINDEX
stop index
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
const double INVALID_DOUBLE
Definition: StdDefs.h:60
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:216
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GNEDemandElement * getCurrentDemandElement() const
get current demand element
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:583
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:498
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
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:329
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:277
static void popName()
pop Name
Definition: GLHelper.cpp:148
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:685
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_EnableAttribute
friend class GNEChange_Attribute
declare friend class
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.
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
An Element which don't belong to GNENet but has influence in the simulation.
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
Problem isPersonPlanValid() const
check if person plan is valid
GUIGeometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
bool drawContainerPlan() const
check if container plan can be drawn
std::string getPersonPlanProblem() const
get person plan problem
void replaceDemandParentLanes(const std::string &value)
replace demand parent lanes
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
Problem
enum class for demandElement problems
bool drawPersonPlan() const
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
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< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
FOX-declaration.
Definition: GNELane.h:52
const double halfWidth
Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen.
Definition: GNELane.h:68
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:142
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1807
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
bool getAllowChangeLane() const
allow change lane
bool getLeaveStopPersonsConnected() const
check if leave stopPersonConnected is enabled
DemandModeOptions * getDemandModeOptions() const
get demand mode options
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.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
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:132
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
DemandElementSelector * getStopParentSelector() const
get stop parent selector
const RGBColor & getColor() const
get color
Definition: GNEStop.cpp:342
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEStop.cpp:855
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:180
SUMOVehicleClass getVClass() const
Definition: GNEStop.cpp:336
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:1001
~GNEStop()
destructor
Definition: GNEStop.cpp:126
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEStop.cpp:42
bool drawIndex() const
draw index
Definition: GNEStop.cpp:1413
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEStop.cpp:537
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEStop.cpp:716
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:1048
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:408
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStop.cpp:476
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:1017
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEStop.cpp:525
GNELane * getLastPathLane() const
get last path lane
Definition: GNEStop.cpp:550
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEStop.cpp:186
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEStop.cpp:130
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStop.cpp:1054
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEStop.h:221
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:438
void drawStopPersonOverBusStop(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over busStop
Definition: GNEStop.cpp:1342
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:985
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:670
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:557
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEStop.cpp:1699
void drawGeometryPoints(const GUIVisualizationSettings &s, const RGBColor &baseColor) const
draw geometry points
Definition: GNEStop.cpp:1730
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEStop.cpp:220
void computePathElement()
compute pathElement
Definition: GNEStop.cpp:518
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:458
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:482
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:743
void drawStopPersonOverEdge(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over lane
Definition: GNEStop.cpp:1261
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEStop.cpp:1666
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:330
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEStop.cpp:452
const int myCreationIndex
creation index (using for saving sorted)
Definition: GNEStop.h:233
void drawVehicleStop(const GUIVisualizationSettings &s, const double exaggeration) const
draw vehicle stop
Definition: GNEStop.cpp:1143
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:1081
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEStop.cpp:1076
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition: GNEStop.cpp:1120
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:367
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:1092
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEStop.cpp:1615
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStop.cpp:276
const GNELane * getFirstAllowedLane() const
get first valid lane
Definition: GNEStop.cpp:1106
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isWaypoint() const
return true if tag correspond to a waypoint element
bool isStopPerson() const
return true if tag correspond to a person stop element
bool isStopContainer() const
return true if tag correspond to a container stop 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...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:632
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:662
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
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
Definition: GNEViewNet.cpp:650
GNEStopFrame * getStopFrame() const
get frame for DEMAND_STOP
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static void drawDottedContourShape(const GUIVisualizationSettings &s, const DottedContourType type, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given shape (used by additionals)
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, 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
Definition: GUIGeometry.cpp:58
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.
Definition: GUIGlObject.h:141
void mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:154
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:102
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.
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationSizeSettings addSize
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationStoppingPlaceSettings stoppingPlaceSettings
StoppingPlace settings.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getLineCenter() const
get line center
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition: RGBColor.h:192
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)
std::string edge
The edge to stop at (used only in NETEDIT)
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)
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 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 GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, 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
static const double vaporizerSize
Vaporizer size.
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, stopPersons...)
RGBColor stopPersonColor
color for stopPersons
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
RGBColor waypointColor
color for Waypoints
static const double laneTextures
details for lane textures
static const double stopsText
details for stop texts
static const double stopsDetails
details for stops
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
static const double busStopWidth
busStop width