Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEStop.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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 // set jump
59 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
60}
61
62
63GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter) :
64 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
65 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {stoppingPlace}, {stopParent}, {}),
66SUMOVehicleParameter::Stop(stopParameter),
67myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
68 // enable parking for stops in parkingAreas
70 parametersSet |= STOP_PARKING_SET;
71 }
72 // set parking
73 if (parametersSet & STOP_PARKING_SET) {
74 parking = ParkingType::OFFROAD;
75 }
76 // set tripID and line
77 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
78 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
79 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
80 // set waypoint speed
81 myTagProperty.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
82 // set jump
83 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
84}
85
86
87GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter) :
88 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
89 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {lane}, {}, {stopParent}, {}),
90SUMOVehicleParameter::Stop(stopParameter),
91myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
92 // set parking
93 if (parametersSet & STOP_PARKING_SET) {
94 parking = ParkingType::OFFROAD;
95 }
96 // set tripID and line
97 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
98 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
99 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
100 // set waypoint speed
101 myTagProperty.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
102 // set jump
103 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
104}
105
106
107GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter) :
108 GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
109 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {edge}, {}, {}, {stopParent}, {}),
110SUMOVehicleParameter::Stop(stopParameter),
111myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
112 // enable parking for stops in parkingAreas
114 parametersSet |= STOP_PARKING_SET;
115 }
116 // set flags
117 if (parametersSet & STOP_PARKING_SET) {
118 parking = ParkingType::OFFROAD;
119 }
120 triggered = (parametersSet & STOP_TRIGGER_SET);
121 containerTriggered = (parametersSet & STOP_CONTAINER_TRIGGER_SET);
122 joinTriggered = (parametersSet & STOP_JOIN_SET);
123 // set tripID and line
124 (stopParameter.tripId.size() > 0) ? parametersSet |= STOP_TRIP_ID_SET : parametersSet &= ~STOP_TRIP_ID_SET;
125 (stopParameter.line.size() > 0) ? parametersSet |= STOP_LINE_SET : parametersSet &= ~STOP_LINE_SET;
126 stopParameter.onDemand ? parametersSet |= STOP_ONDEMAND_SET : parametersSet &= ~STOP_ONDEMAND_SET;
127 // set waypoint speed
128 myTagProperty.isWaypoint() ? parametersSet |= STOP_SPEED_SET : parametersSet &= ~STOP_SPEED_SET;
129 // set jump
130 (jump != -1) ? parametersSet |= STOP_JUMP_SET : parametersSet &= ~STOP_JUMP_SET;
131}
132
133
135
136
140 // return move operation for additional placed over shape
141 return new GNEMoveOperation(this, getParentEdges().front()->getLanes().front(), endPos, false);
143 // get allow change lane
144 const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonModeOptions()->getAllowChangeLane();
145 // fist check if we're moving only extremes
149 // get snap radius
151 // get mouse position
152 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
153 // check if we clicked over start or end position
154 if ((startPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
155 // move only start position
156 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
158 } else if ((endPos != INVALID_DOUBLE) && (myDemandElementGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius))) {
159 // move only end position
160 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
162 } else {
163 return nullptr;
164 }
165 } else if ((startPos != INVALID_DOUBLE) && (endPos != INVALID_DOUBLE)) {
166 // move both start and end positions
167 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
169 } else if (startPos != INVALID_DOUBLE) {
170 // move only start position
171 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
173 } else if (startPos != INVALID_DOUBLE) {
174 // move only end position
175 return new GNEMoveOperation(this, getParentLanes().front(), 0, endPos,
177 } else {
178 // start and end positions undefined, then nothing to move
179 return nullptr;
180 }
181 } else {
182 return nullptr;
183 }
184}
185
186
187std::string
189 return "";
190}
191
192
193void
195 device.openTag(SUMO_TAG_STOP);
196 if (getParentAdditionals().size() > 0) {
197 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
199 }
200 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_TRAIN_STOP) {
202 }
203 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
205 }
208 }
209 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA) {
211 }
212 } else {
213 if (getParentLanes().size() > 0) {
214 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
215 } else {
216 device.writeAttr(SUMO_ATTR_EDGE, getParentEdges().front()->getID());
217 }
218 if ((parametersSet & STOP_START_SET) != 0) {
220 }
221 if ((parametersSet & STOP_END_SET) != 0) {
223 }
224 }
225 // write rest of attributes
226 write(device, true, false);
227}
228
229
233 // get lane
234 const GNELane* firstLane = getFirstAllowedLane();
235 // only Stops placed over lanes can be invalid
237 return isPersonPlanValid();
238 } else if (friendlyPos) {
239 // with friendly position enabled position are "always fixed"
240 return isPersonPlanValid();
241 } else if (firstLane != nullptr) {
242 // obtain lane length
243 const double laneLength = getParentEdges().front()->getNBEdge()->getFinalLength() * firstLane->getLengthGeometryFactor();
244 // declare end pos fixed
245 const double endPosFixed = (endPos < 0) ? (endPos + laneLength) : endPos;
246 // check values
247 if ((endPosFixed <= getParentEdges().front()->getNBEdge()->getFinalLength()) && (endPosFixed > 0)) {
248 return isPersonPlanValid();
249 } else {
251 }
252 } else {
254 }
255 } else if (getPathStopIndex() == -1) {
257 } else {
258 // only Stops placed over lanes can be invalid
260 return Problem::OK;
261 } else if (friendlyPos) {
262 // with friendly position enabled position are "always fixed"
263 return Problem::OK;
264 } else {
265 // obtain lane length
266 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
267 // declare a copy of start and end positions
268 double startPosCopy = startPos;
269 double endPosCopy = endPos;
270 // check if position has to be fixed
271 if (startPosCopy < 0) {
272 startPosCopy += laneLength;
273 }
274 if (endPosCopy < 0) {
275 endPosCopy += laneLength;
276 }
277 // check values
278 if ((startPosCopy >= 0) && (endPosCopy <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) && ((endPosCopy - startPosCopy) >= POSITION_EPS)) {
279 return Problem::OK;
280 } else {
282 }
283 }
284 }
285}
286
287
288std::string
291 if (friendlyPos || (getParentAdditionals().size() > 0)) {
292 return getPersonPlanProblem();
293 } else {
294 // obtain lane length
295 const double laneLength = getParentEdges().front()->getNBEdge()->getFinalLength();
296 // declare end pos fixed
297 const double endPosFixed = (endPos < 0) ? (endPos + laneLength) : endPos;
298 // check positions over lane
299 if (endPosFixed < 0) {
300 return (toString(SUMO_ATTR_ENDPOS) + " < 0");
301 } else if (endPosFixed > getParentEdges().front()->getNBEdge()->getFinalLength()) {
302 return (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
303 } else {
304 return getPersonPlanProblem();
305 }
306 }
307 } else if (getPathStopIndex() == -1) {
308 return ("Downstream stop");
309 } else {
310 // declare a copy of start and end positions
311 double startPosCopy = startPos;
312 double endPosCopy = endPos;
313 // obtain lane length
314 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
315 // check if position has to be fixed
316 if (startPosCopy < 0) {
317 startPosCopy += laneLength;
318 }
319 if (endPosCopy < 0) {
320 endPosCopy += laneLength;
321 }
322 // declare variables
323 std::string errorStart, separator, errorEnd;
324 // check positions over lane
325 if (startPosCopy < 0) {
326 errorStart = (toString(SUMO_ATTR_STARTPOS) + " < 0");
327 } else if (startPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
328 errorStart = (toString(SUMO_ATTR_STARTPOS) + " > lanes's length");
329 }
330 if (endPosCopy < 0) {
331 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " < 0");
332 } else if (endPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
333 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
334 }
335 // check separator
336 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
337 separator = " and ";
338 }
339 return errorStart + separator + errorEnd;
340 }
341}
342
343
344void
348
349
352 return getParentDemandElements().front()->getVClass();
353}
354
355
356const RGBColor&
358 if (getTagProperty().isPersonPlan() || getTagProperty().isContainerPlan()) {
360 } else if (myNet->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
361 // get inspected AC
362 const auto AC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
363 // check if is a route or a vehicle
364 if ((AC->getTagProperty().isRoute() || AC->getTagProperty().isVehicle()) && (AC != getParentDemandElements().front())) {
365 return RGBColor::GREY;
366 }
367 } else if (myNet->getViewNet()->getViewParent()->getStopFrame()->shown()) {
369 return RGBColor::GREY;
370 }
371 }
372 // return default color
375 } else {
377 }
378}
379
380
381void
383 // update geometry depending of parent
384 if (getParentLanes().size() > 0) {
385 // Cut shape using as delimitators fixed start position and fixed end position
387 } else if (getParentAdditionals().size() > 0) {
388 if (getTagProperty().isPersonPlan() || getTagProperty().isContainerPlan()) {
389 // get busStop shape
390 const PositionVector& busStopShape = getParentAdditionals().front()->getAdditionalGeometry().getShape();
391 // update demand element geometry using both positions
392 myDemandElementGeometry.updateGeometry(busStopShape, busStopShape.length2D() - 0.6, busStopShape.length2D(), 0);
393 } else {
394 // use geometry of additional (busStop)
395 myDemandElementGeometry = getParentAdditionals().at(0)->getAdditionalGeometry();
396 }
397 } else if (getParentEdges().size() > 0) {
398 // get front and back lane
399 const GNELane* frontLane = getParentEdges().front()->getLanes().front();
400 const GNELane* backLane = getParentEdges().front()->getLanes().back();
401 // get lane drawing constants
402 GNELane::LaneDrawingConstants laneDrawingConstantsFront(myNet->getViewNet()->getVisualisationSettings(), frontLane);
403 GNELane::LaneDrawingConstants laneDrawingConstantBack(myNet->getViewNet()->getVisualisationSettings(), backLane);
404 // calculate front position
405 const Position frontPosition = frontLane->getLaneShape().positionAtOffset2D(getAttributeDouble(SUMO_ATTR_ARRIVALPOS), laneDrawingConstantsFront.halfWidth);
406 // calulate length between both shapes
407 const double length = backLane->getLaneShape().distance2D(frontPosition, true);
408 // calculate back position
409 const Position backPosition = frontLane->getLaneShape().positionAtOffset2D(getAttributeDouble(SUMO_ATTR_ARRIVALPOS), (length + laneDrawingConstantBack.halfWidth - laneDrawingConstantsFront.halfWidth) * -1);
410 // update demand element geometry using both positions
411 myDemandElementGeometry.updateGeometry({frontPosition, backPosition});
412 }
413 /*
414 // recompute geometry of all Demand elements related with this this stop
415 if (getParentDemandElements().front()->getTagProperty().isRoute()) {
416 getParentDemandElements().front()->updateGeometry();
417 }
418 */
419}
420
421
425 // check if is placed over a busStop
426 if (getParentAdditionals().size() > 0) {
427 return getParentAdditionals().front()->getPositionInView();
428 } else {
429 // get lane
430 const GNELane* personLane = getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
431 // get position over lane shape
432 if (endPos <= 0) {
433 return personLane->getLaneShape().front();
434 } else if (endPos >= personLane->getLaneShape().length2D()) {
435 return personLane->getLaneShape().back();
436 } else {
437 return personLane->getLaneShape().positionAtOffset2D(endPos);
438 }
439 }
440 } else {
441 if (getParentLanes().size() > 0) {
442 return getParentLanes().front()->getLaneShape().positionAtOffset((startPos + endPos) / 2.0);
443 } else if (getParentAdditionals().size() > 0) {
444 return getParentAdditionals().front()->getPositionInView();
445 } else {
446 throw ProcessError(TL("Invalid Stop parent"));
447 }
448 }
449}
450
451
452std::string
454 if (getParentDemandElements().size() > 0) {
455 return getParentDemandElements().front()->getID();
456 } else if (getParentAdditionals().size() > 0) {
457 return getParentAdditionals().front()->getID();
458 } else if (getParentLanes().size() > 0) {
459 return getParentLanes().front()->getID();
460 } else {
461 throw ProcessError(TL("Invalid parent"));
462 }
463}
464
465
466double
468 return s.addSize.getExaggeration(s, this);
469}
470
471
474 Boundary b;
475 // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
476 if (getParentAdditionals().size() > 0) {
477 return getParentAdditionals().at(0)->getCenteringBoundary();
480 } else if (myDemandElementGeometry.getShape().size() > 0) {
482 } else {
484 }
485 b.grow(20);
486 return b;
487}
488
489
490void
491GNEStop::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
492 // geometry of this element cannot be splitted
493}
494
495
496void
498 // Obtain exaggeration of the draw
499 const double exaggeration = getExaggeration(s);
500 // check if draw an stop for person/containers or for vehicles/routes
501 if (getTagProperty().isStopPerson() || getTagProperty().isStopContainer()) {
502 // check if stop can be draw
503 if ((getTagProperty().isStopPerson() && drawPersonPlan()) ||
504 (getTagProperty().isStopContainer() && drawContainerPlan())) {
505 // check if draw stopPerson over busStop oder over lane
506 if (getParentAdditionals().size() > 0) {
507 drawStopPersonOverStoppingPlace(s, exaggeration);
508 } else {
509 drawStopPersonOverEdge(s, exaggeration);
510 }
511 }
512 // draw person parent if this stop if their first person plan child
513 if ((getParentDemandElements().size() == 1) && getParentDemandElements().front()->getChildDemandElements().front() == this) {
514 getParentDemandElements().front()->drawGL(s);
515 }
516 // Draw name
517 drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
518 } else if (canDrawVehicleStop()) {
519 // draw vehicle over stop
520 drawVehicleStop(s, exaggeration);
521 // Draw name
522 drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
523 }
524}
525
526
527void
529 // only update geometry
531}
532
533
534void
535GNEStop::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*lane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
536 // Stops don't use drawPartialGL
537}
538
539
540void
541GNEStop::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*fromLane*/, const GNELane* /*toLane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
542 // Stops don't use drawPartialGL
543}
544
545
546GNELane*
548 // check if stop is placed over a busStop
549 if (getParentAdditionals().size() > 0) {
550 return getParentAdditionals().front()->getParentLanes().front();
551 } else if (getParentEdges().size() > 0) {
552 return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
553 } else {
554 return getParentLanes().front();
555 }
556}
557
558
559GNELane*
561 // first and last path lane are the same
562 return getFirstPathLane();
563}
564
565
566std::string
568 switch (key) {
569 case SUMO_ATTR_ID:
570 return getMicrosimID();
572 if (isAttributeEnabled(key)) {
573 return time2string(duration);
574 } else {
575 return "";
576 }
577 case SUMO_ATTR_UNTIL:
578 if (isAttributeEnabled(key)) {
579 return time2string(until);
580 } else {
581 return "";
582 }
584 if (isAttributeEnabled(key)) {
585 return time2string(extension);
586 } else {
587 return "";
588 }
590 if ((parametersSet & STOP_TRIGGER_SET) == false) {
591 return "false";
592 } else if (triggered) {
593 return "person";
594 } else if (containerTriggered) {
595 return "container";
596 } else {
597 return "join";
598 }
600 if ((parametersSet & STOP_TRIGGER_SET) == false) {
601 return "";
602 } else if (triggered) {
603 return toString(awaitedPersons);
604 } else if (containerTriggered) {
606 } else {
607 return "";
608 }
610 return toString(permitted);
613 return "true";
614 } else {
615 return "false";
616 }
618 return actType;
620 return tripId;
621 case SUMO_ATTR_LINE:
622 return line;
624 return toString(onDemand);
625 case SUMO_ATTR_JUMP:
627 return time2string(jump);
628 } else {
629 return "";
630 }
631 // only for waypoints
632 case SUMO_ATTR_SPEED:
633 return toString(speed);
634 // specific of Stops over stoppingPlaces
640 return getParentAdditionals().front()->getID();
641 // specific of stops over edges
642 case SUMO_ATTR_EDGE:
643 return getParentEdges().front()->getID();
644 // specific of stops over lanes
645 case SUMO_ATTR_LANE:
646 return getParentLanes().front()->getID();
648 return toString(startPos);
649 case SUMO_ATTR_ENDPOS:
650 return toString(endPos);
652 return toString(friendlyPos);
654 if (posLat == INVALID_DOUBLE) {
655 return "";
656 } else {
657 return toString(posLat);
658 }
659 //
662 case GNE_ATTR_PARENT:
663 return getParentDemandElements().front()->getID();
664 case GNE_ATTR_STOPINDEX: {
665 // extract all stops of demandElement parent
666 std::vector<GNEDemandElement*> stops;
667 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
668 if (parent->getTagProperty().isStop()) {
669 stops.push_back(parent);
670 }
671 }
672 // find index in stops
673 for (int i = 0; i < (int)stops.size(); i++) {
674 if (stops.at(i) == this) {
675 return toString(i);
676 }
677 }
678 return "invalid index";
679 }
681 return toString(getPathStopIndex());
683 return getParametersStr();
684 default:
685 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
686 }
687}
688
689
690double
692 switch (key) {
694 if (getParentAdditionals().size() > 0) {
695 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_STARTPOS);
696 } else {
697 return startPos;
698 }
699 case SUMO_ATTR_ENDPOS:
700 case SUMO_ATTR_ARRIVALPOS: // for person plans
701 if (getParentAdditionals().size() > 0) {
702 return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
703 } else {
704 return endPos;
705 }
706 case SUMO_ATTR_INDEX: // for writting sorted
707 return (double)myCreationIndex;
708 case GNE_ATTR_STOPINDEX: {
709 // extract all stops of demandElement parent
710 std::vector<GNEDemandElement*> stops, filteredStops;
711 for (const auto& parent : getParentDemandElements().front()->getChildDemandElements()) {
712 if (parent->getTagProperty().isStop()) {
713 stops.push_back(parent);
714 }
715 }
716 // now filter stops with the same startPos
717 for (const auto& stop : stops) {
718 if (stop->getAttributeDouble(SUMO_ATTR_STARTPOS) == getAttributeDouble(SUMO_ATTR_STARTPOS)) {
719 filteredStops.push_back(stop);
720 }
721 }
722 // get index
723 for (int i = 0; i < (int)filteredStops.size(); i++) {
724 if (filteredStops.at(i) == this) {
725 return i;
726 }
727 }
728 return 0;
729 }
731 return (double)getPathStopIndex();
732 default:
733 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
734 }
735}
736
737
740 switch (key) {
741 // we use SUMO_ATTR_ARRIVALPOS instead SUMO_ATTR_ENDPOS due it's a person plan
743 if (getParentAdditionals().size() > 0) {
744 // return first position of busStop
745 return getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
746 } else {
747 // get lane shape
748 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
749 // continue depending of arrival position
750 if (endPos == 0) {
751 return laneShape.front();
752 } else if ((endPos == -1) || (endPos >= laneShape.length2D())) {
753 return laneShape.back();
754 } else {
755 return laneShape.positionAtOffset2D(endPos);
756 }
757 }
758 }
759 default:
760 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
761 }
762}
763
764
765void
766GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
767 if (value == getAttribute(key)) {
768 return; //avoid needless changes, later logic relies on the fact that attributes have changed
769 }
770 switch (key) {
772 case SUMO_ATTR_UNTIL:
780 case SUMO_ATTR_LINE:
782 case SUMO_ATTR_JUMP:
783 // only for waypoints
784 case SUMO_ATTR_SPEED:
785 // specific of Stops over stoppingPlaces
788 // specific of stops over lanes
789 case SUMO_ATTR_LANE:
793 //
795 case GNE_ATTR_PARENT:
797 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
798 break;
799 // special case for person plans
800 case SUMO_ATTR_EDGE: {
801 // get next personPlan
803 // continue depending of nextPersonPlan
804 if (nextPersonPlan) {
805 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
806 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
807 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
808 undoList->end();
809 } else {
810 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
811 }
812 break;
813 }
816 // get next person plan
818 // continue depending of nextPersonPlan
819 if (nextPersonPlan) {
820 // obtain busStop
822 // change from attribute using edge ID
823 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
824 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
825 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
826 undoList->end();
827 } else {
828 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
829 }
830 } else {
831 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
832 }
833 break;
836 // get next person plan
838 // continue depending of nextPersonPlan
839 if (nextPersonPlan) {
840 // obtain busStop
842 // change from attribute using edge ID
843 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
844 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
845 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
846 undoList->end();
847 } else {
848 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
849 }
850 } else {
851 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
852 }
853 break;
856 // get next person plan
858 // continue depending of nextPersonPlan
859 if (nextPersonPlan) {
860 // obtain containerStop
862 // change from attribute using edge ID
863 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
864 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, containerStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
865 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
866 undoList->end();
867 } else {
868 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
869 }
870 } else {
871 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
872 }
873 break;
874 case SUMO_ATTR_ENDPOS:
876 // get previous person plan
878 // check if leave presonStop connected is enabled
880 previousPersonPlan && previousPersonPlan->getTagProperty().hasAttribute(SUMO_ATTR_ARRIVALPOS)) {
881 // change from attribute using edge ID
882 undoList->begin(myTagProperty.getGUIIcon(), "Change arrivalPos attribute of previous personPlan");
883 previousPersonPlan->setAttribute(SUMO_ATTR_ARRIVALPOS, value, undoList);
884 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
885 undoList->end();
886 } else {
887 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
888 }
889 } else {
890 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
891 }
892 break;
893 default:
894 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
895 }
896}
897
898
899bool
900GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
901 // declare string error
902 std::string error;
903 switch (key) {
905 case SUMO_ATTR_UNTIL:
907 if (canParse<SUMOTime>(value)) {
908 return parse<SUMOTime>(value) >= 0;
909 } else {
910 return false;
911 }
913 if (value.empty()) {
914 return false;
915 } else {
916 const std::set<std::string> expectedValues = {"true", "false", "person", "container", "join"};
917 const std::vector<std::string> triggeredValues = parse<std::vector<std::string> >(value);
918 for (const auto& triggeredValue : triggeredValues) {
919 if (expectedValues.find(triggeredValue) == expectedValues.end()) {
920 return false;
921 }
922 }
923 return true;
924 }
926 if (value.empty()) {
927 return false;
928 } else {
929 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
930 for (const auto& expectedValue : expectedValues) {
931 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
932 return false;
933 }
934 }
935 return true;
936 }
937 case SUMO_ATTR_PERMITTED: {
938 const std::vector<std::string> expectedValues = parse<std::vector<std::string> >(value);
939 for (const auto& expectedValue : expectedValues) {
940 if (!SUMOXMLDefinitions::isValidVehicleID(expectedValue)) {
941 return false;
942 }
943 }
944 return true;
945 }
947 if (value == "opportunistic") {
948 return false; // Currrently deactivated opportunistic in netedit waiting for the implementation in SUMO
949 } else {
950 return canParse<bool>(value);
951 }
953 return true;
956 case SUMO_ATTR_LINE:
957 return true;
959 return canParse<bool>(value);
960 case SUMO_ATTR_JUMP:
961 if ((value == "-1") || (value.empty())) {
962 return true;
963 } else if (canParse<double>(value)) {
964 return parse<double>(value) >= 0;
965 } else {
966 return false;
967 }
968 // only for waypoints
969 case SUMO_ATTR_SPEED:
970 if (canParse<double>(value)) {
971 return (parse<double>(value) >= 0);
972 } else {
973 return false;
974 }
975 // specific of Stops over stoppingPlaces
977 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
979 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
981 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
983 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
985 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
986 // specific of stops over edges
987 case SUMO_ATTR_EDGE:
988 if (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr) {
989 return true;
990 } else {
991 return false;
992 }
993 // specific of stops over lanes
994 case SUMO_ATTR_LANE:
995 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
996 return true;
997 } else {
998 return false;
999 }
1000 case SUMO_ATTR_STARTPOS:
1001 if (canParse<double>(value)) {
1002 return SUMORouteHandler::isStopPosValid(parse<double>(value), endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
1003 } else {
1004 return false;
1005 }
1006 case SUMO_ATTR_ENDPOS:
1008 return canParse<double>(value) && fabs(parse<double>(value)) < getParentEdges().front()->getNBEdge()->getFinalLength();
1009 } else if (canParse<double>(value)) {
1010 return SUMORouteHandler::isStopPosValid(startPos, parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
1011 } else {
1012 return false;
1013 }
1015 return canParse<bool>(value);
1017 if (value.empty()) {
1018 return true;
1019 } else {
1020 return canParse<double>(value);
1021 }
1022 //
1023 case GNE_ATTR_SELECTED:
1024 return canParse<bool>(value);
1025 case GNE_ATTR_PARENT:
1026 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
1027 return true;
1028 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
1029 return true;
1030 } else {
1031 return false;
1032 }
1034 return areParametersValid(value);
1035 default:
1036 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1037 }
1038}
1039
1040
1041void
1043 switch (key) {
1044 case SUMO_ATTR_DURATION:
1045 case SUMO_ATTR_UNTIL:
1047 case SUMO_ATTR_EXPECTED:
1049 undoList->add(new GNEChange_EnableAttribute(this, key, true), true);
1050 break;
1051 default:
1052 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1053 }
1054}
1055
1056
1057void
1059 switch (key) {
1060 case SUMO_ATTR_DURATION:
1061 case SUMO_ATTR_UNTIL:
1063 case SUMO_ATTR_EXPECTED:
1065 undoList->add(new GNEChange_EnableAttribute(this, key, false), true);
1066 break;
1067 default:
1068 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1069 }
1070}
1071
1072
1073bool
1075 switch (key) {
1076 // Currently stops parents cannot be edited
1077 case SUMO_ATTR_BUS_STOP:
1082 return false;
1083 case SUMO_ATTR_DURATION:
1084 return (parametersSet & STOP_DURATION_SET) != 0;
1085 case SUMO_ATTR_UNTIL:
1086 return (parametersSet & STOP_UNTIL_SET) != 0;
1088 return (parametersSet & STOP_EXTENSION_SET) != 0;
1089 case SUMO_ATTR_EXPECTED:
1090 return (parametersSet & STOP_TRIGGER_SET) != 0;
1091 case SUMO_ATTR_PARKING:
1093 return false;
1095 return false;
1096 } else {
1097 return true;
1098 }
1099 default:
1100 return true;
1101 }
1102}
1103
1104
1105std::string
1107 return getTagStr();
1108}
1109
1110
1111std::string
1113 if (getParentAdditionals().size() > 0) {
1114 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
1115 return "BusStop: " + getParentAdditionals().front()->getID();
1116 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_TRAIN_STOP) {
1117 return "TrainStop: " + getParentAdditionals().front()->getID();
1118 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CONTAINER_STOP) {
1119 return "containerStop: " + getParentAdditionals().front()->getID();
1120 } else if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_CHARGING_STATION) {
1121 return "chargingStation: " + getParentAdditionals().front()->getID();
1122 } else {
1123 return "parkingArea: " + getParentAdditionals().front()->getID();
1124 }
1125 } else if (getParentEdges().size() > 0) {
1126 return "edge: " + getParentEdges().front()->getID();
1127 } else if (getParentLanes().size() > 0) {
1128 return "lane: " + getParentLanes().front()->getID();
1129 } else {
1130 return "";
1131 }
1132}
1133
1134
1135const Parameterised::Map&
1137 return getParametersMap();
1138}
1139
1140double
1142 double fixedPos = startPos;
1143 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
1144 if (fixedPos < 0) {
1145 fixedPos += len;
1146 }
1147 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
1148}
1149
1150
1151double
1153 double fixedPos = endPos;
1154 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
1155 if (fixedPos < 0) {
1156 fixedPos += len;
1157 }
1158 return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
1159}
1160
1161// ===========================================================================
1162// protected
1163// ===========================================================================
1164
1165const GNELane*
1167 if (getParentEdges().empty()) {
1168 return nullptr;
1169 }
1170 for (const auto& pLane : getParentEdges().front()->getLanes()) {
1171 if (pLane->allowPedestrians()) {
1172 return pLane;
1173 }
1174 }
1175 return getParentEdges().front()->getLanes().front();
1176}
1177
1178
1179bool
1182 return true;
1183 } else if (myNet->getViewNet()->isAttributeCarrierInspected(this)) {
1184 return true;
1186 return true;
1188 return true;
1189 } else if ((getParentDemandElements().front()->getTagProperty().getTag() == GNE_TAG_VEHICLE_WITHROUTE) ||
1192 return true;
1193 } else {
1194 return false;
1195 }
1196 } else {
1197 return false;
1198 }
1199}
1200
1201
1202void
1203GNEStop::drawVehicleStop(const GUIVisualizationSettings& s, const double exaggeration) const {
1204 // declare value to save stop color
1206 // get lane
1207 const auto& stopLane = getParentLanes().size() > 0 ? getParentLanes().front() : nullptr;
1208 // get lane width
1209 const double width = stopLane ? stopLane->getParentEdge()->getNBEdge()->getLaneWidth(stopLane->getIndex()) * 0.5 : exaggeration * 0.8;
1210 // Start drawing adding an gl identificator
1212 // Add a layer matrix
1214 // set Color
1215 GLHelper::setColor(stopColor);
1216 // Start with the drawing of the area traslating matrix to origin
1218 // draw depending of details
1219 if (s.drawDetail(s.detailSettings.stopsDetails, exaggeration) && stopLane) {
1220 // Draw top and bot lines using shape, shapeRotations, shapeLengths and value of exaggeration
1224 exaggeration * 0.1, 0, width);
1228 exaggeration * 0.1, 0, width * -1);
1229 // Add a detail matrix
1231 // move to geometry front
1232 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1233 // rotate
1234 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1235 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1236 }
1237 // move again
1238 glTranslated(0, exaggeration * 0.5, 0);
1239 // draw stop front
1240 GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, width);
1241 // move to "S" position
1242 glTranslated(0, 1, 0.1);
1243 // only draw text if isn't being drawn for selecting
1245 GLHelper::setColor(stopColor);
1246 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
1247 } else if (s.drawDetail(s.detailSettings.stopsText, exaggeration)) {
1248 // draw "S" symbol
1249 GLHelper::drawText(myTagProperty.isWaypoint() ? "W" : "S", Position(), .1, 2.8, stopColor, 180);
1250 // move to subtitle position
1251 glTranslated(0, 1.4, 0);
1252 // draw subtitle depending of tag
1253 GLHelper::drawText("lane", Position(), .1, 1, stopColor, 180);
1254 // check if draw index
1255 if (drawIndex()) {
1256 // move to index position
1257 glTranslated(-2.1, -2.4, 0);
1258 glRotated(-90, 0, 0, 1);
1259 // draw index
1261 }
1262 }
1263 // pop detail matrix
1265 // draw geometry points
1266 drawGeometryPoints(s, stopColor);
1267 } else {
1268 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration taked from stoppingPlace parent
1270 // only draw text if isn't being drawn for selecting
1271 if (s.drawDetail(s.detailSettings.stopsText, exaggeration) && drawIndex()) {
1272 // Add a detail matrix
1274 // move to geometry front
1275 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1276 // rotate
1277 if (myDemandElementGeometry.getShapeRotations().size() > 0) {
1278 glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
1279 }
1280 // move to index position
1281 glTranslated(-1.4, exaggeration * 0.5, 0.1);
1282 glRotated(-90, 0, 0, 1);
1283 // draw index
1285 }
1286 // pop detail matrix
1288 }
1289 // pop layer matrix
1291 // Pop name
1293 // draw lock icon
1295 // check if mouse is over element
1297 // inspect contour
1300 width, exaggeration, true, true);
1301 }
1302 // front element contour
1303 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
1305 width, exaggeration, true, true);
1306 }
1307 // delete contour
1308 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1310 width, exaggeration, true, true);
1311 }
1312 // select contour
1313 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1315 width, exaggeration, true, true);
1316 }
1317}
1318
1319
1320void
1321GNEStop::drawStopPersonOverEdge(const GUIVisualizationSettings& s, const double exaggeration) const {
1322 // declare stop color
1324 // avoid draw invisible elements
1325 if (stopColor.alpha() != 0) {
1326 // Start drawing adding an gl identificator
1328 // Add layer matrix matrix
1330 // translate to front
1332 // declare stop color
1333 // declare central line color
1334 const RGBColor centralLineColor = drawUsingSelectColor() ? stopColor.changedBrightness(-32) : RGBColor::WHITE;
1335 // set base color
1336 GLHelper::setColor(stopColor);
1337 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
1339 // move to front
1340 glTranslated(0, 0, .1);
1341 // set central color
1342 GLHelper::setColor(centralLineColor);
1343 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
1345 // move to icon position and front
1346 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), .1);
1347 // rotate over lane
1349 // move again
1350 glTranslated(0, s.additionalSettings.vaporizerSize * exaggeration, 0);
1351 // Draw icon depending of Route Probe is selected and if isn't being drawn for selecting
1352 if (!s.drawForRectangleSelection && s.drawDetail(s.detailSettings.laneTextures, exaggeration)) {
1353 // set color
1354 glColor3d(1, 1, 1);
1355 // rotate texture
1356 glRotated(180, 0, 0, 1);
1357 // draw texture
1358 if (drawUsingSelectColor()) {
1360 } else {
1362 }
1363 } else {
1364 // rotate
1365 glRotated(22.5, 0, 0, 1);
1366 // set stop color
1367 GLHelper::setColor(stopColor);
1368 // move matrix
1369 glTranslated(0, 0, 0);
1370 // draw filled circle
1372 }
1373 // pop layer matrix
1375 // Pop name
1377 // draw lock icon
1379 }
1380 // check if mouse is over element
1382 // inspect contour
1385 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1386 }
1387 // front contour
1388 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
1390 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1391 }
1392 // delete contour
1393 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1395 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1396 }
1397 // select contour
1398 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1400 myDemandElementGeometry.getShape(), 0.3, exaggeration, true, true);
1401 }
1402}
1403
1404
1405void
1406GNEStop::drawStopPersonOverStoppingPlace(const GUIVisualizationSettings& s, const double exaggeration) const {
1407 // declare stop color
1409 // avoid draw invisible elements
1410 if (stopColor.alpha() != 0) {
1411 // Start drawing adding an gl identificator
1413 // Add layer matrix matrix
1415 // translate to front
1417 // set base color
1418 GLHelper::setColor(stopColor);
1419 // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
1420 if (getParentAdditionals().front()->getTagProperty().getTag() == SUMO_TAG_TRAIN_STOP) {
1422 } else {
1424 }
1425 // move to icon position and front
1427 // rotate over lane
1429 // move again
1430 glTranslated(s.stoppingPlaceSettings.busStopWidth * exaggeration * -2, 0, 0);
1431 // Draw icon depending of Route Probe is selected and if isn't being drawn for selecting
1432 if (!s.drawForRectangleSelection && s.drawDetail(s.detailSettings.laneTextures, exaggeration)) {
1433 // set color
1434 glColor3d(1, 1, 1);
1435 // rotate texture
1436 glRotated(-90, 0, 0, 1);
1437 // draw texture
1438 if (drawUsingSelectColor()) {
1440 } else {
1442 }
1443 } else {
1444 // rotate
1445 glRotated(22.5, 0, 0, 1);
1446 // set stop color
1447 GLHelper::setColor(stopColor);
1448 // move matrix
1449 glTranslated(0, 0, 0);
1450 // draw filled circle
1452 }
1453 // pop layer matrix
1455 // Pop name
1457 // draw lock icon
1459 }
1460 // inspect contour
1463 exaggeration, true, true);
1464 }
1465 // front contour
1466 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
1468 exaggeration, true, true);
1469 }
1470 // delete contour
1471 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1473 exaggeration, true, true);
1474 }
1475 // select contour
1476 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1478 exaggeration, true, true);
1479 }
1480}
1481
1482
1483bool
1485 // get stop frame
1486 const auto stopFrame = myNet->getViewNet()->getViewParent()->getStopFrame();
1487 // check conditions
1489 return true;
1490 } else if (stopFrame->shown() && (stopFrame->getStopParentSelector()->getCurrentDemandElement() == getParentDemandElements().front())) {
1491 return true;
1492 } else {
1493 return false;
1494 }
1495}
1496
1497// ===========================================================================
1498// private
1499// ===========================================================================
1500
1501void
1502GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
1503 switch (key) {
1504 case SUMO_ATTR_DURATION:
1505 if (value.empty()) {
1506 toggleAttribute(key, false);
1507 } else {
1508 toggleAttribute(key, true);
1509 duration = string2time(value);
1510 }
1511 break;
1512 case SUMO_ATTR_UNTIL:
1513 if (value.empty()) {
1514 toggleAttribute(key, false);
1515 } else {
1516 toggleAttribute(key, true);
1517 until = string2time(value);
1518 }
1519 break;
1521 if (value.empty()) {
1522 toggleAttribute(key, false);
1523 } else {
1524 toggleAttribute(key, true);
1525 extension = string2time(value);
1526 }
1527 break;
1529 // reset all flags
1530 triggered = false;
1531 containerTriggered = false;
1532 joinTriggered = false;
1533 // disable all flags
1534 parametersSet &= ~STOP_JOIN_SET;
1535 parametersSet &= ~STOP_TRIGGER_SET;
1536 parametersSet &= ~STOP_EXPECTED_SET;
1537 parametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
1538 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1539 // check value
1540 if (value == "person") {
1542 triggered = true;
1543 if (awaitedPersons.size() > 0) {
1545 }
1546 } else if (value == "container") {
1549 containerTriggered = true;
1550 if (awaitedPersons.size() > 0) {
1552 }
1553 } else if (value == "join") {
1555 joinTriggered = true;
1556 }
1557 break;
1558 case SUMO_ATTR_EXPECTED:
1559 if (triggered) {
1560 awaitedPersons = parse<std::set<std::string> >(value);
1561 if (awaitedPersons.size() > 0) {
1563 } else {
1564 parametersSet &= ~STOP_EXPECTED_SET;
1565 }
1566 } else if (containerTriggered) {
1567 awaitedContainers = parse<std::set<std::string> >(value);
1568 if (awaitedContainers.size() > 0) {
1570 } else {
1571 parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET;
1572 }
1573 }
1574 break;
1576 if (value.empty()) {
1577 parametersSet &= ~STOP_PERMITTED_SET;
1578 } else {
1580 permitted = parse<std::set<std::string> >(value);
1581 }
1582 break;
1583 case SUMO_ATTR_PARKING:
1586 parametersSet &= ~STOP_PARKING_SET;
1587 } else {
1589 }
1590 break;
1591 case SUMO_ATTR_ACTTYPE:
1592 actType = value;
1593 break;
1594 case SUMO_ATTR_TRIP_ID:
1595 tripId = value;
1596 toggleAttribute(key, (value.size() > 0));
1597 break;
1598 case SUMO_ATTR_LINE:
1599 line = value;
1600 toggleAttribute(key, (value.size() > 0));
1601 break;
1602 case SUMO_ATTR_ONDEMAND:
1603 if (parse<bool>(value)) {
1605 } else {
1606 parametersSet &= ~STOP_ONDEMAND_SET;
1607 }
1608 // set flag
1610 break;
1611 case SUMO_ATTR_JUMP:
1612 if ((value == "-1") || value.empty()) {
1613 parametersSet &= ~STOP_JUMP_SET;
1614 jump = -1;
1615 } else {
1617 jump = string2time(value);
1618 }
1619 break;
1620 // only for waypoints
1621 case SUMO_ATTR_SPEED:
1622 speed = parse<double>(value);
1623 break;
1624 // specific of Stops over stoppingPlaces
1625 case SUMO_ATTR_BUS_STOP:
1628 break;
1632 break;
1636 break;
1640 break;
1644 break;
1645 // specific of Stops over edges
1646 case SUMO_ATTR_EDGE:
1649 edge = value;
1650 break;
1651 // specific of Stops over lanes
1652 case SUMO_ATTR_LANE:
1655 break;
1656 case SUMO_ATTR_STARTPOS:
1657 startPos = parse<double>(value);
1659 break;
1660 case SUMO_ATTR_ENDPOS:
1661 endPos = parse<double>(value);
1663 break;
1665 friendlyPos = parse<bool>(value);
1666 break;
1668 if (value.empty()) {
1670 parametersSet &= ~STOP_POSLAT_SET;
1671 } else {
1672 posLat = parse<double>(value);
1674 }
1675 break;
1676 //
1677 case GNE_ATTR_SELECTED:
1678 if (parse<bool>(value)) {
1680 } else {
1682 }
1683 break;
1684 case GNE_ATTR_PARENT:
1685 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
1687 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
1689 }
1691 break;
1693 setParametersStr(value);
1694 break;
1695 default:
1696 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1697 }
1698}
1699
1700
1701void
1703 switch (key) {
1704 case SUMO_ATTR_DURATION:
1705 if (value) {
1707 } else {
1708 parametersSet &= ~STOP_DURATION_SET;
1709 }
1710 break;
1711 case SUMO_ATTR_UNTIL:
1712 if (value) {
1714 } else {
1715 parametersSet &= ~STOP_UNTIL_SET;
1716 }
1717 break;
1719 if (value) {
1721 } else {
1722 parametersSet &= ~STOP_EXTENSION_SET;
1723 }
1724 break;
1725 case SUMO_ATTR_TRIP_ID:
1726 if (value) {
1728 } else {
1729 parametersSet &= ~STOP_TRIP_ID_SET;
1730 }
1731 break;
1732 case SUMO_ATTR_LINE:
1733 if (value) {
1735 } else {
1736 parametersSet &= ~STOP_LINE_SET;
1737 }
1738 break;
1739 case SUMO_ATTR_ONDEMAND:
1740 if (value) {
1742 } else {
1743 parametersSet &= ~STOP_ONDEMAND_SET;
1744 }
1745 break;
1746 default:
1747 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1748 }
1749}
1750
1751
1752void
1755 // change endPos
1756 endPos = moveResult.newFirstPos;
1757 } else {
1759 // change only start position
1760 startPos = moveResult.newFirstPos;
1761 // adjust startPos
1762 if (startPos > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
1763 startPos = (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS);
1764 }
1766 // change only end position
1767 endPos = moveResult.newFirstPos;
1768 // adjust endPos
1769 if (endPos < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
1770 endPos = (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS);
1771 }
1772 } else {
1773 // change both position
1774 startPos = moveResult.newFirstPos;
1775 endPos = moveResult.newSecondPos;
1776 // set lateral offset
1778 }
1779 }
1780 // update geometry
1782}
1783
1784
1785void
1787 // begin change attribute
1788 undoList->begin(myTagProperty.getGUIIcon(), "position of " + getTagStr());
1790 // now adjust endPos position
1791 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
1792 } else {
1793 // set attributes depending of operation type
1795 // set only start position
1798 // set only end position
1799 undoList->changeAttribute(new GNEChange_Attribute(this, SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos)));
1800 } else {
1801 // set both
1804 // check if lane has to be changed
1805 if (moveResult.newFirstLane) {
1806 // set new lane
1807 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
1808 }
1809 }
1810 }
1811 // end change attribute
1812 undoList->end();
1813}
1814
1815
1816void
1818 // first check that we're in move mode and shift key is pressed
1822 // calculate new color
1823 const RGBColor color = baseColor.changedBrightness(-50);
1824 // push matrix
1826 // translated to front
1827 glTranslated(0, 0, 0.1);
1828 // set color
1829 GLHelper::setColor(color);
1830 // draw points
1831 if (startPos != INVALID_DOUBLE) {
1832 // push geometry point matrix
1834 glTranslated(myDemandElementGeometry.getShape().front().x(), myDemandElementGeometry.getShape().front().y(), 0.1);
1835 // draw geometry point
1837 // pop geometry point matrix
1839 }
1840 if (endPos != INVALID_DOUBLE) {
1841 // push geometry point matrix
1843 glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), 0.1);
1844 // draw geometry point
1846 // pop geometry point matrix
1848 }
1849 // pop draw matrix
1851 }
1852}
1853
1854
1855int
1857 // get edge stop indexes
1858 const auto edgeStopIndex = getEdgeStopIndex();
1859 // finally find stopIndex in edgeStopIndexes
1860 for (const auto& edgeStop : edgeStopIndex) {
1861 for (const auto& stop : edgeStop.stops) {
1862 if (stop == this) {
1863 return edgeStop.stopIndex;
1864 }
1865 }
1866 }
1867 // not found, then return -1
1868 return -1;
1869}
1870
1871/****************************************************************************/
@ 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
#define TL(string)
Definition MsgHandler.h:287
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ 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_JUMP_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
@ GNE_TAG_STOP_PARKINGAREA
stop placed over a parking area
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ 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
@ 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
waypoint placed over a lane
@ SUMO_TAG_PERSON
@ GNE_TAG_STOP_LANE
stop placed over a lane
@ 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_TRAIN_STOP
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_ACTTYPE
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_FROM
@ SUMO_ATTR_PERMITTED
@ GNE_ATTR_STOPINDEX
stop index (position in the parent's children
@ SUMO_ATTR_JUMP
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
@ GNE_ATTR_PATHSTOPINDEX
stop index (position in the parent's path)
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:78
bool isInitialised() const
check if Boundary is Initialised
Definition Boundary.cpp: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.
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")
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
void replaceFirstParentAdditional(SumoXMLTag tag, const std::string &value)
replace the first parent additional
bool drawContainerPlan() const
check if container plan can be drawn
std::string getPersonPlanProblem() const
get person plan problem
std::vector< EdgeStopIndex > getEdgeStopIndex() const
get edgeStopIndex
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
Problem
enum class for demandElement problems
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
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
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:136
double getLengthGeometryFactor() const
get length geometry factor
Definition GNELane.cpp:1824
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:120
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
DemandElementSelector * getStopParentSelector() const
get stop parent selector
const RGBColor & getColor() const
get color
Definition GNEStop.cpp:357
int getPathStopIndex() const
get pathStopIndex
Definition GNEStop.cpp:1856
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEStop.cpp:900
std::string getBegin() const
get begin time of demand element
Definition GNEStop.cpp:188
SUMOVehicleClass getVClass() const
Definition GNEStop.cpp:351
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:1058
~GNEStop()
destructor
Definition GNEStop.cpp:134
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEStop.cpp:42
bool drawIndex() const
draw index
Definition GNEStop.cpp:1484
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:547
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEStop.cpp:739
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:1106
Position getPositionInView() const
Returns position of demand element in view.
Definition GNEStop.cpp:423
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEStop.cpp:491
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEStop.cpp:1074
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition GNEStop.cpp:535
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:560
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEStop.cpp:194
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEStop.cpp:138
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEStop.cpp:1112
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:453
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:1042
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEStop.cpp:691
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:567
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEStop.cpp:1786
void drawGeometryPoints(const GUIVisualizationSettings &s, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1817
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition GNEStop.cpp:231
void computePathElement()
compute pathElement
Definition GNEStop.cpp:528
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEStop.cpp:473
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEStop.cpp:497
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:766
void drawStopPersonOverEdge(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over lane
Definition GNEStop.cpp:1321
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEStop.cpp:1753
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEStop.cpp:345
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNEStop.cpp:467
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:1203
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition GNEStop.cpp:1141
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEStop.cpp:1136
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:1180
void drawStopPersonOverStoppingPlace(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over stoppingPlace
Definition GNEStop.cpp:1406
void updateGeometry()
update pre-computed geometry information
Definition GNEStop.cpp:382
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition GNEStop.cpp:1152
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition GNEStop.cpp:1702
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEStop.cpp:289
const GNELane * getFirstAllowedLane() const
get first valid lane
Definition GNEStop.cpp:1166
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
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
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
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
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.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
GUIGlID getGlID() const
Returns the numerical id of the object.
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.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
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
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition RGBColor.cpp:92
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 jump
transfer time if there shall be a jump from this stop to the next route edge
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
static const double trainStopWidth
trainStop width