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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // Representation of Stops in NETEDIT
15 /****************************************************************************/
16 
17 // ===========================================================================
18 // included modules
19 // ===========================================================================
20 
21 #include <cmath>
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEUndoList.h>
25 #include <netedit/GNEViewNet.h>
26 #include <netedit/GNEViewParent.h>
33 #include <utils/gui/div/GLHelper.h>
37 
38 #include "GNEStop.h"
39 
40 // ===========================================================================
41 // member method definitions
42 // ===========================================================================
43 
44 GNEStop::GNEStop(SumoXMLTag tag, GNEViewNet* viewNet, const SUMOVehicleParameter::Stop& stopParameter, GNEAdditional* stoppingPlace, GNEDemandElement* stopParent) :
45  GNEDemandElement(stopParent, viewNet, stopParent->getTagProperty().isPerson() ? GLO_PERSONSTOP : GLO_STOP, tag,
46 {}, {}, {}, {stoppingPlace}, {stopParent}, {}, {}, {}, {}, {}),
47 SUMOVehicleParameter::Stop(stopParameter) {
48 }
49 
50 
51 GNEStop::GNEStop(GNEViewNet* viewNet, const SUMOVehicleParameter::Stop& stopParameter, GNELane* lane, GNEDemandElement* stopParent) :
52  GNEDemandElement(stopParent, viewNet,
53  stopParent->getTagProperty().isPerson() ? GLO_PERSONSTOP : GLO_STOP,
54  stopParent->getTagProperty().isPerson() ? SUMO_TAG_PERSONSTOP_LANE : SUMO_TAG_STOP_LANE,
55 {}, {lane}, {}, {}, {stopParent}, {}, {}, {}, {}, {}),
56 SUMOVehicleParameter::Stop(stopParameter) {
57 }
58 
59 
61 
62 
63 std::string
65  return "";
66 }
67 
68 
69 void
71  write(device);
72 }
73 
74 
75 bool
77  // only Stops placed over lanes can be invalid
79  return true;
80  } else if (friendlyPos) {
81  // with friendly position enabled position are "always fixed"
82  return true;
83  } else {
84  // obtain lane length
85  double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
86  // declare a copy of start and end positions
87  double startPosCopy = startPos;
88  double endPosCopy = endPos;
89  // check if position has to be fixed
90  if (startPosCopy < 0) {
91  startPosCopy += laneLength;
92  }
93  if (endPosCopy < 0) {
94  endPosCopy += laneLength;
95  }
96  // check values
98  return true;
99  } else if (!(parametersSet & STOP_START_SET)) {
100  return (endPosCopy <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
101  } else if (!(parametersSet & STOP_END_SET)) {
102  return (startPosCopy >= 0);
103  } else {
104  return ((startPosCopy >= 0) && (endPosCopy <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) && ((endPosCopy - startPosCopy) >= POSITION_EPS));
105  }
106  }
107 }
108 
109 
110 std::string
112  // declare a copy of start and end positions
113  double startPosCopy = startPos;
114  double endPosCopy = endPos;
115  // obtain lane length
116  double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
117  // check if position has to be fixed
118  if (startPosCopy < 0) {
119  startPosCopy += laneLength;
120  }
121  if (endPosCopy < 0) {
122  endPosCopy += laneLength;
123  }
124  // declare variables
125  std::string errorStart, separator, errorEnd;
126  // check positions over lane
127  if (startPosCopy < 0) {
128  errorStart = (toString(SUMO_ATTR_STARTPOS) + " < 0");
129  } else if (startPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
130  errorStart = (toString(SUMO_ATTR_STARTPOS) + " > lanes's length");
131  }
132  if (endPosCopy < 0) {
133  errorEnd = (toString(SUMO_ATTR_ENDPOS) + " < 0");
134  } else if (endPosCopy > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
135  errorEnd = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
136  }
137  // check separator
138  if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
139  separator = " and ";
140  }
141  return errorStart + separator + errorEnd;
142 }
143 
144 
145 void
147  //
148 }
149 
150 
151 GNEEdge*
153  if (getParentAdditionals().size() > 0) {
154  return getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
155  } else {
156  return getParentLanes().front()->getParentEdge();
157  }
158 }
159 
160 
161 GNEEdge*
163  if (getParentAdditionals().size() > 0) {
164  return getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
165  } else {
166  return getParentLanes().front()->getParentEdge();
167  }
168 }
169 
170 
173  return getParentDemandElements().front()->getVClass();
174 }
175 
176 
177 const RGBColor&
179  if (myTagProperty.isPersonStop()) {
181  } else {
183  }
184 }
185 
186 
187 void
189  // only start geometry moving if stop is placed over a lane
190  if (getParentLanes().size() > 0) {
191  // always save original position over view
193  // save start and end position
196  // save current centering boundary
198  }
199 }
200 
201 
202 void
204  // check that stop is placed over a lane and endGeometryMoving was called only once
206  // reset myMovingGeometryBoundary
208  }
209 }
210 
211 
212 void
214  // only move if at leats start or end positions is defined
215  if ((getParentLanes().size() > 0) && ((parametersSet & STOP_START_SET) || (parametersSet & STOP_END_SET))) {
216  // Calculate new position using old position
218  newPosition.add(offset);
219  // filtern position using snap to active grid
220  newPosition = myViewNet->snapToActiveGrid(newPosition);
221  double offsetLane = getParentLanes().front()->getLaneShape().nearest_offset_to_point2D(newPosition, false) - getParentLanes().front()->getLaneShape().nearest_offset_to_point2D(myStopMove.originalViewPosition, false);
222  // check if both position has to be moved
224  // calculate stoppingPlace length and lane length (After apply geometry factor)
225  double stoppingPlaceLength = fabs(parse<double>(myStopMove.secondOriginalPosition) - parse<double>(myStopMove.firstOriginalLanePosition));
226  double laneLengt = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
227  // avoid changing stopping place's length
228  if ((parse<double>(myStopMove.firstOriginalLanePosition) + offsetLane) < 0) {
229  startPos = 0;
230  endPos = stoppingPlaceLength;
231  } else if ((parse<double>(myStopMove.secondOriginalPosition) + offsetLane) > laneLengt) {
232  startPos = laneLengt - stoppingPlaceLength;
233  endPos = laneLengt;
234  } else {
235  startPos = parse<double>(myStopMove.firstOriginalLanePosition) + offsetLane;
236  endPos = parse<double>(myStopMove.secondOriginalPosition) + offsetLane;
237  }
238  } else {
239  // check if start position must be moved
240  if ((parametersSet & STOP_START_SET)) {
241  startPos = parse<double>(myStopMove.firstOriginalLanePosition) + offsetLane;
242  }
243  // check if start position must be moved
244  if ((parametersSet & STOP_END_SET)) {
245  endPos = parse<double>(myStopMove.secondOriginalPosition) + offsetLane;
246  }
247  }
248  // update geometry
249  updateGeometry();
250  }
251 }
252 
253 
254 void
256  // only commit geometry moving if at leats start or end positions is defined
257  if ((getParentLanes().size() > 0) && ((parametersSet & STOP_START_SET) || (parametersSet & STOP_END_SET))) {
258  undoList->p_begin("position of " + getTagStr());
261  }
262  if (parametersSet & STOP_END_SET) {
264  }
265  undoList->p_end();
266  }
267 }
268 
269 
270 void
272  //only update Stops over lanes, because other uses the geometry of stopping place parent
273  if (getParentLanes().size() > 0) {
274  // Cut shape using as delimitators fixed start position and fixed end position
276  } else if (getParentAdditionals().size() > 0) {
277  // use geometry of additional (busStop)
279  }
280  // recompute geometry of all Demand elements related with this this stop
281  if (getParentDemandElements().front()->getTagProperty().isRoute()) {
282  getParentDemandElements().front()->updateGeometry();
283  } else if (getParentDemandElements().front()->getTagProperty().isPerson()) {
284  // compute previous and next person plan
285  GNEDemandElement* previousDemandElement = getParentDemandElements().front()->getPreviousChildDemandElement(this);
286  if (previousDemandElement) {
287  previousDemandElement->updateGeometry();
288  }
289  GNEDemandElement* nextDemandElement = getParentDemandElements().front()->getNextChildDemandElement(this);
290  if (nextDemandElement) {
291  nextDemandElement->updateGeometry();
292  }
293  }
294 }
295 
296 
297 void
299  //only update Stops over lanes, because other uses the geometry of stopping place parent
300  if (getParentLanes().size() > 0) {
301  // Cut shape using as delimitators fixed start position and fixed end position
303  } else if (getParentAdditionals().size() > 0) {
304  // use geometry of additional (busStop)
306  }
307  // recompute geometry of all Demand elements related with this this stop
308  if (getParentDemandElements().front()->getTagProperty().isRoute()) {
309  getParentDemandElements().front()->updatePartialGeometry(edge);
310  } else if (getParentDemandElements().front()->getTagProperty().isPerson()) {
311  // compute previous and next person plan
312  GNEDemandElement* previousDemandElement = getParentDemandElements().front()->getPreviousChildDemandElement(this);
313  if (previousDemandElement) {
314  previousDemandElement->updatePartialGeometry(edge);
315  }
316  GNEDemandElement* nextDemandElement = getParentDemandElements().front()->getNextChildDemandElement(this);
317  if (nextDemandElement) {
318  nextDemandElement->updatePartialGeometry(edge);
319  }
320  }
321 }
322 
323 
324 void
326  // nothing to compute
327 }
328 
329 
330 void
332  // nothing to invalidate
333 }
334 
335 
336 Position
338  if (getParentLanes().size() > 0) {
339  // calculate start and end positions as absolute values
340  double start = fabs(parametersSet & STOP_START_SET ? startPos : 0);
341  double end = fabs(parametersSet & STOP_END_SET ? endPos : getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
342  // obtain position in view depending if both positions are defined
344  return getParentLanes().front()->getLaneShape().positionAtOffset(getParentLanes().front()->getLaneShape().length() / 2);
345  } else if (!(parametersSet & STOP_START_SET)) {
346  return getParentLanes().front()->getLaneShape().positionAtOffset(end);
347  } else if (!(parametersSet & STOP_END_SET)) {
348  return getParentLanes().front()->getLaneShape().positionAtOffset(start);
349  } else {
350  return getParentLanes().front()->getLaneShape().positionAtOffset((start + end) / 2.0);
351  }
352  } else if (getParentDemandElements().size() > 0) {
353  return getParentDemandElements().front()->getPositionInView();
354  } else {
355  throw ProcessError("Invalid Stop parent");
356  }
357 }
358 
359 
360 std::string
362  if (getParentDemandElements().size() > 0) {
363  return getParentDemandElements().front()->getID();
364  } else if (getParentAdditionals().size() > 0) {
365  return getParentAdditionals().front()->getID();
366  } else if (getParentLanes().size() > 0) {
367  return getParentLanes().front()->getID();
368  } else {
369  throw ProcessError("Invalid parent");
370  }
371 }
372 
373 
374 Boundary
376  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
377  if (getParentAdditionals().size() > 0) {
378  return getParentAdditionals().at(0)->getCenteringBoundary();
381  } else if (myDemandElementGeometry.getShape().size() > 0) {
383  b.grow(20);
384  return b;
385  } else {
386  return Boundary(-0.1, -0.1, 0.1, 0.1);
387  }
388 }
389 
390 
391 void
392 GNEStop::splitEdgeGeometry(const double /*splitPosition*/, const GNENetElement* /*originalElement*/, const GNENetElement* /*newElement*/, GNEUndoList* /*undoList*/) {
393  // geometry of this element cannot be splitted
394 }
395 
396 
397 void
399  // declare flag to enable or disable draw person plan
400  bool drawPersonPlan = false;
403  drawPersonPlan = true;
404  }
406  drawPersonPlan = true;
407  } else if (myViewNet->getDottedAC() == getParentDemandElements().front()) {
408  drawPersonPlan = true;
410  drawPersonPlan = true;
413  drawPersonPlan = true;
414  }
415  // check if stop can be drawn
416  if (drawPersonPlan) {
417  // Obtain exaggeration of the draw
418  const double exaggeration = s.addSize.getExaggeration(s, this);
419  // declare value to save stop color
420  RGBColor stopColor;
421  // Set color
422  if (drawUsingSelectColor()) {
423  if (myTagProperty.isPersonStop()) {
425  } else {
426  stopColor = s.colorSettings.selectedRouteColor;
427  }
428  } else if (myTagProperty.isPersonStop()) {
429  stopColor = s.colorSettings.personStops;
430  } else {
431  stopColor = s.colorSettings.stops;
432  }
433  // Start drawing adding an gl identificator
434  glPushName(getGlID());
435  // Add a draw matrix
436  glPushMatrix();
437  // set Color
438  GLHelper::setColor(stopColor);
439  // Start with the drawing of the area traslating matrix to origin
440  glTranslated(0, 0, getType());
441  // draw depending of details
442  if (s.drawDetail(s.detailSettings.stopsDetails, exaggeration) && getParentLanes().size() > 0) {
443  // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
445  getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneWidth(getParentLanes().front()->getIndex()) * 0.5);
447  getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneWidth(getParentLanes().front()->getIndex()) * -0.5);
448  // pop draw matrix
449  glPopMatrix();
450  // Add a draw matrix
451  glPushMatrix();
452  // move to geometry front
453  glTranslated(myDemandElementGeometry.getShape().back().x(), myDemandElementGeometry.getShape().back().y(), getType());
454  glRotated(myDemandElementGeometry.getShapeRotations().back(), 0, 0, 1);
455  // draw front of Stop depending if it's placed over a lane or over a stoppingPlace
456  if (getParentLanes().size() > 0) {
457  // draw front of Stop
458  GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5,
459  getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneWidth(getParentLanes().front()->getIndex()) * 0.5);
460  } else {
461  // draw front of Stop
462  GLHelper::drawBoxLine(Position(0, 0), 0, exaggeration * 0.5, exaggeration);
463  }
464  // move to "S" position
465  glTranslated(0, 1, 0);
466  // only draw text if isn't being drawn for selecting
468  GLHelper::setColor(stopColor);
469  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
470  } else if (s.drawDetail(s.detailSettings.stopsText, exaggeration)) {
471  // draw "S" symbol
472  GLHelper::drawText("S", Position(), .1, 2.8, stopColor);
473  // move to subtitle positin
474  glTranslated(0, 1.4, 0);
475  // draw subtitle depending of tag
476  GLHelper::drawText("lane", Position(), .1, 1, stopColor, 180);
477  }
478  // pop draw matrix
479  glPopMatrix();
480  // Draw name if isn't being drawn for selecting
481  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
482  // check if dotted contour has to be drawn
483  if (myViewNet->getDottedAC() == this) {
484  // draw dooted contour depending if it's placed over a lane or over a stoppingPlace
485  if (getParentLanes().size() > 0) {
486  GLHelper::drawShapeDottedContourAroundShape(s, getType(), myDemandElementGeometry.getShape(), getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneWidth(getParentLanes().front()->getIndex()) * 0.5);
487  } else {
489  }
490  }
491  } else {
492  // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration
494  // pop draw matrix
495  glPopMatrix();
496  }
497  // Pop name
498  glPopName();
499  // draw person parent if this stop if their first person plan child
500  if ((getParentDemandElements().size() == 1) && getParentDemandElements().front()->getChildDemandElements().front() == this) {
501  getParentDemandElements().front()->drawGL(s);
502  }
503  }
504 }
505 
506 
507 void
509  if (!myViewNet) {
510  throw ProcessError("ViewNet cannot be nullptr");
511  } else {
513  // add object of list into selected objects
515  if (changeFlag) {
516  mySelected = true;
517  }
518  }
519 }
520 
521 
522 void
524  if (!myViewNet) {
525  throw ProcessError("ViewNet cannot be nullptr");
526  } else {
528  // remove object of list of selected objects
530  if (changeFlag) {
531  mySelected = false;
532 
533  }
534  }
535 }
536 
537 
538 std::string
540  switch (key) {
541  case SUMO_ATTR_ID:
542  return getDemandElementID();
543  case SUMO_ATTR_DURATION:
545  return time2string(duration);
546  } else {
547  return "";
548  }
549  case SUMO_ATTR_UNTIL:
551  return time2string(until);
552  } else {
553  return "";
554  }
555  case SUMO_ATTR_EXTENSION:
557  return time2string(extension);
558  } else {
559  return "";
560  }
561  case SUMO_ATTR_INDEX:
562  if (index == STOP_INDEX_END) {
563  return "end";
564  } else if (index == STOP_INDEX_FIT) {
565  return "fit";
566  } else {
567  return toString(index);
568  }
569  case SUMO_ATTR_TRIGGERED:
570  // this is an special case
572  return "1";
573  } else {
574  return "0";
575  }
577  // this is an special case
579  return "1";
580  } else {
581  return "0";
582  }
583  case SUMO_ATTR_EXPECTED:
585  return toString(awaitedPersons);
586  } else {
587  return "";
588  }
591  return toString(awaitedContainers);
592  } else {
593  return "";
594  }
595  case SUMO_ATTR_PARKING:
596  return toString(parking);
597  case SUMO_ATTR_ACTTYPE:
598  return actType;
599  case SUMO_ATTR_TRIP_ID:
601  return tripId;
602  } else {
603  return "";
604  }
605  // specific of Stops over stoppingPlaces
606  case SUMO_ATTR_BUS_STOP:
610  return getParentAdditionals().front()->getID();
611  // specific of stops over lanes
612  case SUMO_ATTR_LANE:
613  return getParentLanes().front()->getID();
614  case SUMO_ATTR_STARTPOS:
616  return toString(startPos);
617  } else {
618  return "";
619  }
620  case SUMO_ATTR_ENDPOS:
621  if (parametersSet & STOP_END_SET) {
622  return toString(endPos);
623  } else {
624  return "";
625  }
627  return toString(friendlyPos);
628  //
629  case GNE_ATTR_SELECTED:
631  case GNE_ATTR_PARENT:
632  return getParentDemandElements().front()->getID();
633  default:
634  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
635  }
636 }
637 
638 
639 double
641  switch (key) {
642  case SUMO_ATTR_STARTPOS:
644  return startPos;
645  } else {
646  return 0;
647  }
648  case SUMO_ATTR_ENDPOS:
649  if (parametersSet & STOP_END_SET) {
650  return endPos;
651  } else {
652  return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
653  }
654  default:
655  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
656  }
657 }
658 
659 
660 void
661 GNEStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
662  if (value == getAttribute(key)) {
663  return; //avoid needless changes, later logic relies on the fact that attributes have changed
664  }
665  switch (key) {
666  case SUMO_ATTR_ID:
667  case SUMO_ATTR_DURATION:
668  case SUMO_ATTR_UNTIL:
669  case SUMO_ATTR_EXTENSION:
670  case SUMO_ATTR_INDEX:
671  case SUMO_ATTR_TRIGGERED:
673  case SUMO_ATTR_EXPECTED:
675  case SUMO_ATTR_PARKING:
676  case SUMO_ATTR_ACTTYPE:
677  case SUMO_ATTR_TRIP_ID:
678  // specific of Stops over stoppingPlaces
679  case SUMO_ATTR_BUS_STOP:
683  // specific of stops over lanes
684  case SUMO_ATTR_LANE:
685  case SUMO_ATTR_STARTPOS:
686  case SUMO_ATTR_ENDPOS:
688  //
689  case GNE_ATTR_SELECTED:
690  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
691  break;
692  default:
693  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
694  }
695 }
696 
697 
698 bool
699 GNEStop::isValid(SumoXMLAttr key, const std::string& value) {
700  // declare string error
701  std::string error;
702  switch (key) {
703  case SUMO_ATTR_ID:
704  return isValidDemandElementID(value);
705  case SUMO_ATTR_DURATION:
706  case SUMO_ATTR_UNTIL:
707  case SUMO_ATTR_EXTENSION:
708  if (canParse<SUMOTime>(value)) {
709  return parse<SUMOTime>(value) >= 0;
710  } else {
711  return false;
712  }
713  case SUMO_ATTR_INDEX:
714  if ((value == "fit") || (value == "end")) {
715  return true;
716  } else if (canParse<int>(value)) {
717  return (parse<int>(value) >= 0);
718  } else {
719  return false;
720  }
721  case SUMO_ATTR_TRIGGERED:
722  return canParse<bool>(value);
724  return canParse<bool>(value);
725  case SUMO_ATTR_EXPECTED:
727  if (value.empty()) {
728  return true;
729  } else {
730  std::vector<std::string> IDs = parse<std::vector<std::string>>(value);
731  for (const auto& i : IDs) {
732  if (SUMOXMLDefinitions::isValidVehicleID(i) == false) {
733  return false;
734  }
735  }
736  return true;
737  }
738  case SUMO_ATTR_PARKING:
739  return canParse<bool>(value);
740  case SUMO_ATTR_ACTTYPE:
741  return true;
742  case SUMO_ATTR_TRIP_ID:
744  // specific of Stops over stoppingPlaces
745  case SUMO_ATTR_BUS_STOP:
746  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
748  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
750  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, value, false) != nullptr);
752  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
753  // specific of stops over lanes
754  case SUMO_ATTR_LANE:
755  if (myViewNet->getNet()->retrieveLane(value, false) != nullptr) {
756  return true;
757  } else {
758  return false;
759  }
760  case SUMO_ATTR_STARTPOS:
761  if (value.empty()) {
762  return true;
763  } else if (canParse<double>(value)) {
764  return SUMORouteHandler::isStopPosValid(parse<double>(value), endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
765  } else {
766  return false;
767  }
768  case SUMO_ATTR_ENDPOS:
769  if (value.empty()) {
770  return true;
771  } else if (canParse<double>(value)) {
772  return SUMORouteHandler::isStopPosValid(startPos, parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPos);
773  } else {
774  return false;
775  }
777  return canParse<bool>(value);
778  //
779  case GNE_ATTR_SELECTED:
780  return canParse<bool>(value);
781  default:
782  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
783  }
784 }
785 
786 
787 void
789  // obtain a copy of parameter sets
790  int newParametersSet = parametersSet;
791  // modify parametersSetCopy depending of attr
792  switch (key) {
793  case SUMO_ATTR_STARTPOS:
794  newParametersSet |= STOP_START_SET;
795  break;
796  case SUMO_ATTR_ENDPOS:
797  newParametersSet |= STOP_END_SET;
798  break;
799  case SUMO_ATTR_DURATION:
800  newParametersSet |= STOP_DURATION_SET;
801  break;
802  case SUMO_ATTR_UNTIL:
803  newParametersSet |= STOP_UNTIL_SET;
804  break;
805  case SUMO_ATTR_EXTENSION:
806  newParametersSet |= STOP_EXTENSION_SET;
807  break;
808  case SUMO_ATTR_EXPECTED:
809  newParametersSet |= STOP_TRIGGER_SET;
810  break;
812  newParametersSet |= STOP_CONTAINER_TRIGGER_SET;
813  break;
814  case SUMO_ATTR_PARKING:
815  newParametersSet |= STOP_PARKING_SET;
816  break;
817  default:
818  break;
819  }
820  // add GNEChange_EnableAttribute
821  undoList->add(new GNEChange_EnableAttribute(this, myViewNet->getNet(), parametersSet, newParametersSet), true);
822  // modify parametersSetCopy depending of attr
823  switch (key) {
824  case SUMO_ATTR_STARTPOS:
825  if (parametersSet & STOP_END_SET) {
826  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, toString(endPos - MIN_STOP_LENGTH)));
827  } else {
828  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, toString(getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() - MIN_STOP_LENGTH)));
829  }
830  break;
831  case SUMO_ATTR_ENDPOS:
832  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, toString(getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength())));
833  break;
834  case SUMO_ATTR_DURATION:
836  break;
837  case SUMO_ATTR_UNTIL:
838  case SUMO_ATTR_EXTENSION:
840  break;
841  default:
842  break;
843  }
844 }
845 
846 
847 void
849  // obtain a copy of parameter sets
850  int newParametersSet = parametersSet;
851  // modify parametersSetCopy depending of attr
852  switch (key) {
853  case SUMO_ATTR_STARTPOS:
854  newParametersSet &= ~STOP_START_SET;
855  break;
856  case SUMO_ATTR_ENDPOS:
857  newParametersSet &= ~STOP_END_SET;
858  break;
859  case SUMO_ATTR_DURATION:
860  newParametersSet &= ~STOP_DURATION_SET;
861  break;
862  case SUMO_ATTR_UNTIL:
863  newParametersSet &= ~STOP_UNTIL_SET;
864  break;
865  case SUMO_ATTR_EXTENSION:
866  newParametersSet &= ~STOP_EXTENSION_SET;
867  break;
868  case SUMO_ATTR_EXPECTED:
869  newParametersSet &= ~STOP_TRIGGER_SET;
870  break;
872  newParametersSet &= ~STOP_CONTAINER_TRIGGER_SET;
873  break;
874  case SUMO_ATTR_PARKING:
875  newParametersSet &= ~STOP_PARKING_SET;
876  break;
877  default:
878  break;
879  }
880  // add GNEChange_EnableAttribute
881  undoList->add(new GNEChange_EnableAttribute(this, myViewNet->getNet(), parametersSet, newParametersSet), true);
882 }
883 
884 
885 bool
887  switch (key) {
888  // Currently stops parents cannot be edited
889  case SUMO_ATTR_BUS_STOP:
893  return false;
894  case SUMO_ATTR_STARTPOS:
895  return (parametersSet & STOP_START_SET) != 0;
896  case SUMO_ATTR_ENDPOS:
897  return (parametersSet & STOP_END_SET) != 0;
898  case SUMO_ATTR_DURATION:
899  return (parametersSet & STOP_DURATION_SET) != 0;
900  case SUMO_ATTR_UNTIL:
901  return (parametersSet & STOP_UNTIL_SET) != 0;
902  case SUMO_ATTR_EXTENSION:
903  return (parametersSet & STOP_EXTENSION_SET) != 0;
904  case SUMO_ATTR_EXPECTED:
905  return (parametersSet & STOP_TRIGGER_SET) != 0;
908  case SUMO_ATTR_PARKING:
909  return (parametersSet & STOP_PARKING_SET) != 0;
910  default:
911  return true;
912  }
913 }
914 
915 
916 std::string
918  return getTagStr();
919 }
920 
921 
922 std::string
924  std::string stopType;
925  // first distinguish between person stops and vehicles stops
926  if (getParentDemandElements().front()->getTagProperty().isPerson()) {
927  stopType = "person stop";
928  } else {
929  stopType = "vehicle stop";
930  }
931  if (getParentAdditionals().size() > 0) {
932  return stopType + ": " + getParentAdditionals().front()->getTagStr();
933  } else {
934  return stopType + ": lane";
935  }
936 }
937 
938 
939 double
941  double fixedPos = 0;
943  fixedPos = startPos;
944  } else if (parametersSet & STOP_END_SET) {
945  fixedPos = endPos - MIN_STOP_LENGTH;
946  } else {
947  fixedPos = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() - MIN_STOP_LENGTH;
948  }
949  const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
950  if (fixedPos < 0) {
951  fixedPos += len;
952  }
953  return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
954 }
955 
956 
957 double
959  double fixedPos = 0;
960  if (parametersSet & STOP_END_SET) {
961  fixedPos = endPos;
962  } else {
963  fixedPos = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
964  }
965  const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
966  if (fixedPos < 0) {
967  fixedPos += len;
968  }
969  return fixedPos * getParentLanes().front()->getLengthGeometryFactor();
970 }
971 
972 // ===========================================================================
973 // private
974 // ===========================================================================
975 
976 void
977 GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) {
978  switch (key) {
979  case SUMO_ATTR_ID:
980  changeDemandElementID(value);
981  break;
982  case SUMO_ATTR_DURATION:
983  if (value.empty()) {
985  } else {
986  duration = string2time(value);
988  }
989  break;
990  case SUMO_ATTR_UNTIL:
991  if (value.empty()) {
993  } else {
994  until = string2time(value);
996  }
997  break;
998  case SUMO_ATTR_EXTENSION:
999  if (value.empty()) {
1001  } else {
1002  extension = string2time(value);
1004  }
1005  break;
1006  case SUMO_ATTR_INDEX:
1007  if (value == "fit") {
1009  } else if (value == "end") {
1011  } else {
1012  index = parse<int>(value);
1013  }
1014  break;
1015  case SUMO_ATTR_TRIGGERED:
1016  triggered = parse<bool>(value);
1017  // this is an special case: only if SUMO_ATTR_TRIGGERED is true, it will be written in XML
1018  if (triggered) {
1020  } else {
1022  }
1023  break;
1025  containerTriggered = parse<bool>(value);
1026  // this is an special case: only if SUMO_ATTR_CONTAINER_TRIGGERED is true, it will be written in XML
1027  if (containerTriggered) {
1029  } else {
1031  }
1032  break;
1033  case SUMO_ATTR_EXPECTED:
1034  if (value.empty()) {
1036  } else {
1037  awaitedPersons = parse<std::set<std::string> >(value);
1039  }
1040  break;
1042  if (value.empty()) {
1044  } else {
1045  awaitedContainers = parse<std::set<std::string> >(value);
1047  }
1048  break;
1049  case SUMO_ATTR_PARKING:
1050  parking = parse<bool>(value);
1051  break;
1052  case SUMO_ATTR_ACTTYPE:
1053  actType = value;
1054  break;
1055  case SUMO_ATTR_TRIP_ID:
1056  if (value.empty()) {
1058  } else {
1059  tripId = value;
1061  }
1062  break;
1063  // specific of Stops over stoppingPlaces
1064  case SUMO_ATTR_BUS_STOP:
1068  replaceParentAdditional(this, value, 0);
1069  updateGeometry();
1070  break;
1071  // specific of Stops over lanes
1072  case SUMO_ATTR_LANE:
1073  replaceParentLanes(this, value);
1074  updateGeometry();
1075  break;
1076  case SUMO_ATTR_STARTPOS:
1077  if (value.empty()) {
1079  } else {
1080  startPos = parse<double>(value);
1082  }
1083  updateGeometry();
1084  break;
1085  case SUMO_ATTR_ENDPOS:
1086  if (value.empty()) {
1088  } else {
1089  endPos = parse<double>(value);
1091  }
1092  updateGeometry();
1093  break;
1095  friendlyPos = parse<bool>(value);
1096  break;
1097  //
1098  case GNE_ATTR_SELECTED:
1099  if (parse<bool>(value)) {
1101  } else {
1103  }
1104  break;
1105  default:
1106  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1107  }
1108 }
1109 
1110 
1111 void
1112 GNEStop::setEnabledAttribute(const int enabledAttributes) {
1113  parametersSet = enabledAttributes;
1114 }
1115 
1116 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:186
SUMOVehicleParameter::Stop::awaitedPersons
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
Definition: SUMOVehicleParameter.h:625
GNEStop::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEStop.cpp:76
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:376
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEStop::endGeometryMoving
void endGeometryMoving()
end movement
Definition: GNEStop.cpp:203
GNENet::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2183
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEStop::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:375
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:788
GNEDemandElement::isValidDemandElementID
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
Definition: GNEDemandElement.cpp:375
GNEGeometry::Geometry::updateGeometryShape
void updateGeometryShape(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
Definition: GNEGeometry.cpp:48
SUMO_ATTR_PARKING_AREA
Definition: SUMOXMLDefinitions.h:771
SUMOVehicleParameter::Stop::friendlyPos
bool friendlyPos
enable or disable friendly position (used by NETEDIT)
Definition: SUMOVehicleParameter.h:631
SUMO_ATTR_CONTAINER_STOP
Definition: SUMOXMLDefinitions.h:770
GNEStop::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStop.cpp:392
GNEDemandElement::DemandElementMove::firstOriginalLanePosition
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:67
GNEHierarchicalChildElements::getChildDemandElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Definition: GNEHierarchicalChildElements.cpp:296
SUMO_TAG_STOP_LANE
stop placed over a lane (used in netedit)
Definition: SUMOXMLDefinitions.h:180
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GUIGlObject::drawName
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Definition: GUIGlObject.cpp:354
SUMO_ATTR_UNTIL
Definition: SUMOXMLDefinitions.h:668
GNEViewNetHelper::DemandViewOptions::getLockedPerson
const GNEDemandElement * getLockedPerson() const
get locked person
Definition: GNEViewNetHelper.cpp:1811
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:79
GUIVisualizationSettings::drawForRectangleSelection
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Definition: GUIVisualizationSettings.h:647
GLHelper::drawBoxLines
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:182
GNEGeometry::Geometry::getShapeLengths
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
Definition: GNEGeometry.cpp:159
GNEAttributeCarrier::GNEChange_EnableAttribute
friend class GNEChange_EnableAttribute
Definition: GNEAttributeCarrier.h:58
GNEStop::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:788
GUIVisualizationDetailSettings::stopsText
static const double stopsText
details for stop texts
Definition: GUIVisualizationSettings.h:316
GLO_PERSONSTOP
a person stop
Definition: GUIGlObjectTypes.h:135
SUMO_TAG_CONTAINER_STOP
A container stop.
Definition: SUMOXMLDefinitions.h:105
STOP_UNTIL_SET
const int STOP_UNTIL_SET
Definition: SUMOVehicleParameter.h:77
GUIGlobalSelection.h
SUMOVehicleParameter::Stop::parametersSet
int parametersSet
Information for the output which parameter were set.
Definition: SUMOVehicleParameter.h:652
GNEStop::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:271
GNEStop::myStopMove
DemandElementMove myStopMove
variable demand element move
Definition: GNEStop.h:207
GNEHierarchicalParentElements::getParentLanes
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
Definition: GNEHierarchicalParentElements.cpp:235
GNEViewNetHelper::NetworkViewOptions::showDemandElements
bool showDemandElements() const
check if show demand elements checkbox is enabled
Definition: GNEViewNetHelper.cpp:1616
GNEViewNet
Definition: GNEViewNet.h:42
GNEAttributeCarrier::TagProperties::isStop
bool isStop() const
return true if tag correspond to a stop element
Definition: GNEAttributeCarrier.cpp:750
GNEStop::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEStop.cpp:298
GUIVisualizationColorSettings::selectedRouteColor
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
Definition: GUIVisualizationSettings.h:150
GNEStop::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:398
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
GLHelper.h
SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
SUMO_ATTR_CHARGING_STATION
Definition: SUMOXMLDefinitions.h:774
STOP_EXTENSION_SET
const int STOP_EXTENSION_SET
Definition: SUMOVehicleParameter.h:78
SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
GNEDemandElement::DemandElementMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:64
STOP_TRIP_ID_SET
const int STOP_TRIP_ID_SET
Definition: SUMOVehicleParameter.h:84
SUMOVehicleParameter::Stop::triggered
bool triggered
whether an arriving person lets the vehicle continue
Definition: SUMOVehicleParameter.h:616
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
GNEStop::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEStop.cpp:70
PositionVector::getBoxBoundary
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Definition: PositionVector.cpp:390
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
STOP_START_SET
const int STOP_START_SET
Definition: SUMOVehicleParameter.h:74
GUISUMOAbstractView::snapToActiveGrid
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
Definition: GUISUMOAbstractView.cpp:196
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
GNEDemandElement::updatePartialGeometry
virtual void updatePartialGeometry(const GNEEdge *edge)=0
partial update pre-computed geometry information
GNEStop::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEStop.cpp:162
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEDemandElement::DemandElementMove::secondOriginalPosition
std::string secondOriginalPosition
value for saving second original position over lane before moving
Definition: GNEDemandElement.h:70
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:131
GNEDemandElement::changeDemandElementID
void changeDemandElementID(const std::string &newID)
change ID of demand element
Definition: GNEDemandElement.cpp:385
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEStop::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:640
GNEHierarchicalParentElements::getParentAdditionals
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
Definition: GNEHierarchicalParentElements.cpp:85
GLHelper::drawText
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, int align=0, double width=-1)
Definition: GLHelper.cpp:673
RGBColor
Definition: RGBColor.h:39
SUMO_ATTR_TRIP_ID
Definition: SUMOXMLDefinitions.h:777
GUIVisualizationSettings::addName
GUIVisualizationTextSettings addName
Definition: GUIVisualizationSettings.h:591
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
GNEDemandElement::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
GNEStop::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:886
SUMOVehicleParameter::Stop::tripId
std::string tripId
id of the trip within a cyclical public transport route
Definition: SUMOVehicleParameter.h:637
GUIVisualizationSettings::detailSettings
GUIVisualizationDetailSettings detailSettings
detail settings
Definition: GUIVisualizationSettings.h:683
GNEAttributeCarrier::getTagProperty
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Definition: GNEAttributeCarrier.cpp:1273
GNEHierarchicalParentElements::getParentDemandElements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
Definition: GNEHierarchicalParentElements.cpp:114
SUMO_ATTR_STARTPOS
Definition: SUMOXMLDefinitions.h:797
SUMO_TAG_CHARGING_STATION
A Charging Station.
Definition: SUMOXMLDefinitions.h:111
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:113
GNEStop::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:64
GNEGeometry::Geometry::getShape
const PositionVector & getShape() const
The shape of the additional element.
Definition: GNEGeometry.cpp:147
GNEStop::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:958
GNEStop::startGeometryMoving
void startGeometryMoving()
Definition: GNEStop.cpp:188
SUMO_TAG_PERSONSTOP_LANE
Definition: SUMOXMLDefinitions.h:313
GUISUMOAbstractView::getVisualisationSettings
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
Definition: GUISUMOAbstractView.cpp:1395
SUMOVehicleParameter::Stop::until
SUMOTime until
The time at which the vehicle may continue its journey.
Definition: SUMOVehicleParameter.h:610
GNEViewNet::getNetworkViewOptions
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:452
GNEViewNet.h
STOP_INDEX_FIT
const int STOP_INDEX_FIT
Definition: SUMOVehicleParameter.h:72
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:1026
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
SUMO_TAG_PARKING_AREA
A parking area.
Definition: SUMOXMLDefinitions.h:107
GNEHierarchicalParentElements::replaceParentLanes
void replaceParentLanes(GNEShape *elementChild, const std::string &newLaneIDs)
replace the parent edges of a shape
Definition: GNEHierarchicalParentElements.cpp:469
GNEStop::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEStop.cpp:539
GNEStop::computePath
void computePath()
compute path
Definition: GNEStop.cpp:325
GNEStop::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEStop.cpp:213
SUMO_ATTR_TRIGGERED
Definition: SUMOXMLDefinitions.h:799
GNEGeometry::drawGeometry
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
Definition: GNEGeometry.cpp:795
GNEStop::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:940
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:632
ProcessError
Definition: UtilExceptions.h:39
GNEStop::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:508
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEStop::setAttribute
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:661
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:785
GNEAttributeCarrier::AttributeProperties::getDefaultValue
const std::string & getDefaultValue() const
get default value
Definition: GNEAttributeCarrier.cpp:217
time2string
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:552
GNEViewNet::getDemandViewOptions
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:458
SUMOVehicleParameter::Stop::write
void write(OutputDevice &dev) const
Writes the stop as XML.
Definition: SUMOVehicleParameter.cpp:175
GNEStop::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEStop.cpp:255
GNEStop::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:848
SUMOVehicleParameter::Stop::endPos
double endPos
The stopping position end.
Definition: SUMOVehicleParameter.h:604
GNEStop::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEStop.cpp:331
GNENetElement
Definition: GNENetElement.h:43
GLHelper::drawShapeDottedContourAroundShape
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
Definition: GLHelper.cpp:461
SUMO_ATTR_FRIENDLY_POS
Definition: SUMOXMLDefinitions.h:765
string2time
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:44
SUMO_ATTR_EXTENSION
Definition: SUMOXMLDefinitions.h:669
GNELane.h
GNEHierarchicalParentElements::replaceParentAdditional
void replaceParentAdditional(GNEShape *shapeTobeChanged, const std::string &newParentAdditionalID, int additionalParentIndex)
replace the parent additional of a shape
Definition: GNEHierarchicalParentElements.cpp:489
GNEChange_EnableAttribute.h
SUMOVehicleParameter::Stop::actType
std::string actType
act Type (only used by Persons) (used by NETEDIT)
Definition: SUMOVehicleParameter.h:634
SUMO_ATTR_INDEX
Definition: SUMOXMLDefinitions.h:804
GNEStop::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:917
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:677
SUMOVehicleParameter::Stop::startPos
double startPos
The stopping position start.
Definition: SUMOVehicleParameter.h:601
GNEStop::GNEStop
GNEStop(SumoXMLTag tag, GNEViewNet *viewNet, const SUMOVehicleParameter::Stop &stopParameter, GNEAdditional *stoppingPlace, GNEDemandElement *stopParent)
constructor used for stops over stoppingPlaces
Definition: GNEStop.cpp:44
GNEStop::getColor
const RGBColor & getColor() const
get color
Definition: GNEStop.cpp:178
GNEViewParent.h
GNEViewNetHelper::DemandViewOptions::showNonInspectedDemandElements
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
Definition: GNEViewNetHelper.cpp:1741
GLIncludes.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEAttributeCarrier::TagProperties::isPersonPlan
bool isPersonPlan() const
return true if tag correspond to a person plan
Definition: GNEAttributeCarrier.cpp:762
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:97
GNESelectorFrame.h
GNEStop::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStop.cpp:111
GNEStop::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEStop.cpp:152
SUMOVehicleParameter::Stop::containerTriggered
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: SUMOVehicleParameter.h:619
SUMO_ATTR_DURATION
Definition: SUMOXMLDefinitions.h:667
GNEStop::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEStop.cpp:699
SUMO_ATTR_EXPECTED
Definition: SUMOXMLDefinitions.h:802
GNEAttributeCarrier::TagProperties::isPersonStop
bool isPersonStop() const
return true if tag correspond to a person stop element
Definition: GNEAttributeCarrier.cpp:786
SUMOVehicleParameter::Stop::index
int index
at which position in the stops list
Definition: SUMOVehicleParameter.h:649
SUMO_ATTR_EXPECTED_CONTAINERS
Definition: SUMOXMLDefinitions.h:803
InvalidArgument
Definition: UtilExceptions.h:56
GLHelper::drawBoxLine
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
GNEStop::~GNEStop
~GNEStop()
destructor
Definition: GNEStop.cpp:60
SUMOXMLDefinitions::isValidVehicleID
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
Definition: SUMOXMLDefinitions.cpp:973
SUMOVehicleParameter::Stop::extension
SUMOTime extension
The maximum time extension for boarding / loading.
Definition: SUMOVehicleParameter.h:613
SUMO_ATTR_CONTAINER_TRIGGERED
Definition: SUMOXMLDefinitions.h:800
GNEAttributeCarrier::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
SUMORouteHandler.h
STOP_DURATION_SET
const int STOP_DURATION_SET
Definition: SUMOVehicleParameter.h:76
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:33
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:369
STOP_INDEX_END
const int STOP_INDEX_END
Definition: SUMOVehicleParameter.h:71
STOP_EXPECTED_SET
const int STOP_EXPECTED_SET
Definition: SUMOVehicleParameter.h:81
GNEStoppingPlace.h
GNEDemandElement::myDemandElementGeometry
GNEGeometry::Geometry myDemandElementGeometry
demand element geometry
Definition: GNEDemandElement.h:379
SUMO_ATTR_PARKING
Definition: SUMOXMLDefinitions.h:801
STOP_TRIGGER_SET
const int STOP_TRIGGER_SET
Definition: SUMOVehicleParameter.h:79
STOP_CONTAINER_TRIGGER_SET
const int STOP_CONTAINER_TRIGGER_SET
Definition: SUMOVehicleParameter.h:82
GNENet::retrieveLane
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1228
GUIVisualizationColorSettings::selectedPersonPlanColor
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, personStops...)
Definition: GUIVisualizationSettings.h:159
GNEAttributeCarrier::TagProperties::getAttributeProperties
const AttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
Definition: GNEAttributeCarrier.cpp:623
GUIVisualizationSettings::addSize
GUIVisualizationSizeSettings addSize
Definition: GUIVisualizationSettings.h:589
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:126
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:216
STOP_EXPECTED_CONTAINERS_SET
const int STOP_EXPECTED_CONTAINERS_SET
Definition: SUMOVehicleParameter.h:83
STOP_PARKING_SET
const int STOP_PARKING_SET
Definition: SUMOVehicleParameter.h:80
GNEGeometry::Geometry::getShapeRotations
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
Definition: GNEGeometry.cpp:153
GNEStop::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStop.cpp:923
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
GNEStop::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:146
StringTokenizer.h
GNEStop.h
GUIVisualizationColorSettings::stops
static const RGBColor stops
color for Stops
Definition: GUIVisualizationSettings.h:231
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GNEStop::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:337
GUIVisualizationSettings::drawDetail
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
Definition: GUIVisualizationSettings.cpp:1669
STOP_END_SET
const int STOP_END_SET
Definition: SUMOVehicleParameter.h:75
GNESelectorFrame::LockGLObjectTypes::removeLockedObject
void removeLockedObject(const GUIGlObjectType type)
set object unselected
Definition: GNESelectorFrame.cpp:573
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
GUIVisualizationDetailSettings::stopsDetails
static const double stopsDetails
details for stops
Definition: GUIVisualizationSettings.h:313
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SUMOVehicleParameter::Stop::duration
SUMOTime duration
The stopping duration.
Definition: SUMOVehicleParameter.h:607
GNEStop::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEStop.cpp:523
GNEStop::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:361
GNEStop::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEStop.cpp:1112
GUIVisualizationColorSettings::personStops
static const RGBColor personStops
color for personStops
Definition: GUIVisualizationSettings.h:237
SUMO_ATTR_BUS_STOP
Definition: SUMOXMLDefinitions.h:769
GNEUndoList::p_begin
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:72
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEViewNetHelper::DemandViewOptions::showAllPersonPlans
bool showAllPersonPlans() const
check all person plans has to be show
Definition: GNEViewNetHelper.cpp:1789
SUMO_ATTR_ACTTYPE
Definition: SUMOXMLDefinitions.h:874
GNEDemandElement::DemandElementMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEDemandElement.h:61
SUMOVehicleParameter::Stop::awaitedContainers
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
Definition: SUMOVehicleParameter.h:628
SUMOVehicleParameter::Stop::parking
bool parking
whether the vehicle is removed from the net while stopping
Definition: SUMOVehicleParameter.h:622
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
MIN_STOP_LENGTH
const double MIN_STOP_LENGTH
Definition: SUMOVehicleParameter.h:88
SUMORouteHandler::isStopPosValid
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: SUMORouteHandler.cpp:320
GNEGeometry::Geometry::updateGeometry
void updateGeometry(const GNEAdditional *additional)
update geometry (using geometry of another additional)
Definition: GNEGeometry.cpp:118
GNEDemandElement::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEDemandElement.cpp:558
GNEChange_Attribute.h
GNENet.h
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
GUISelectedStorage::deselect
void deselect(GUIGlID id)
Deselects the object with the given id.
Definition: GUISelectedStorage.cpp:130
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:1008
GLO_STOP
Definition: GUIGlObjectTypes.h:133
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:459
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:572
GNEUndoList.h
GNE_ATTR_PARENT
parent of an additional element
Definition: SUMOXMLDefinitions.h:987
GNEStop::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEStop.cpp:172
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:567