Eclipse SUMO - Simulation of Urban MObility
GNERide.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 // A class for visualizing rides in Netedit
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
26 #include <netedit/GNENet.h>
27 #include <netedit/GNEUndoList.h>
28 #include <netedit/GNEViewNet.h>
29 #include <netedit/GNEViewParent.h>
35 
36 #include "GNERide.h"
37 
38 
39 // ===========================================================================
40 // method definitions
41 // ===========================================================================
42 
43 GNERide::GNERide(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, const std::vector<GNEEdge*>& via,
44  double arrivalPosition, const std::vector<std::string>& lines) :
45  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_RIDE_FROMTO), viewNet, GLO_RIDE, SUMO_TAG_RIDE_FROMTO, {
46  fromEdge, toEdge
47 }, {}, {}, {}, {personParent}, {}, {}, {}, {}, {}),
49 myArrivalPosition(arrivalPosition),
50 myLines(lines) {
51  // set via parameter without updating references
52  replaceMiddleParentEdges(this, via, false);
53  // compute ride
54  computePath();
55 }
56 
57 
58 GNERide::GNERide(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* busStop, const std::vector<GNEEdge*>& via,
59  const std::vector<std::string>& lines) :
60  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_RIDE_BUSSTOP), viewNet, GLO_RIDE, SUMO_TAG_RIDE_BUSSTOP, {
61  fromEdge
62 }, {}, {}, {busStop}, {personParent}, {}, {}, {}, {}, {}),
64 myArrivalPosition(-1),
65 myLines(lines) {
66  // set via parameter without updating references
67  replaceMiddleParentEdges(this, via, false);
68  // compute ride
69  computePath();
70 }
71 
72 
74 
75 
78  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
79  // build header
80  buildPopupHeader(ret, app);
81  // build menu command for center button and copy cursor position to clipboard
83  buildPositionCopyEntry(ret, false);
84  // buld menu commands for names
85  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
86  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
87  new FXMenuSeparator(ret);
88  // build selection and show parameters menu
91  // show option to open demand element dialog
92  if (myTagProperty.hasDialog()) {
93  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
94  new FXMenuSeparator(ret);
95  }
96  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
97  return ret;
98 }
99 
100 
101 void
103  // open tag
104  device.openTag(SUMO_TAG_RIDE);
105  // write attributes depending of ride type
106  if (getParentDemandElements().front()->getChildDemandElements().front() == this) {
107  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
108  }
109  // check if write busStop or edge to
110  if (getParentAdditionals().size() > 0) {
112  } else {
113  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
114  }
115  // only write arrivalPos if is different of -1
116  if (myArrivalPosition != -1) {
118  }
119  // write parameters
120  writeParams(device);
121  // close tag
122  device.closeTag();
123 }
124 
125 
126 bool
128  if (getParentEdges().size() == 0) {
129  return false;
130  } else if (getParentEdges().size() == 1) {
131  return true;
132  } else {
133  // check if exist at least a connection between every edge
134  for (int i = 1; i < (int)getParentEdges().size(); i++) {
135  if (getRouteCalculatorInstance()->areEdgesConsecutives(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
136  return false;
137  }
138  }
139  // there is connections bewteen all edges, then return true
140  return true;
141  }
142 }
143 
144 
145 std::string
147  if (getParentEdges().size() == 0) {
148  return ("A ride need at least one edge");
149  } else {
150  // check if exist at least a connection between every edge
151  for (int i = 1; i < (int)getParentEdges().size(); i++) {
152  if (getRouteCalculatorInstance()->areEdgesConsecutives(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
153  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
154  }
155  }
156  // there is connections bewteen all edges, then all ok
157  return "";
158  }
159 }
160 
161 
162 void
164  // currently the only solution is removing Ride
165 }
166 
167 
168 GNEEdge*
170  if (getParentDemandElements().size() == 2) {
171  // obtain position and rotation of first edge route
172  return getParentDemandElements().at(1)->getFromEdge();
173  } else {
174  return getParentEdges().front();
175  }
176 }
177 
178 
179 GNEEdge*
181  if (getParentDemandElements().size() == 2) {
182  // obtain position and rotation of first edge route
183  return getParentDemandElements().at(1)->getToEdge();
184  } else {
185  return getParentEdges().back();
186  }
187 }
188 
189 
192  return getParentDemandElements().front()->getVClass();
193 }
194 
195 
196 const RGBColor&
198  return getParentDemandElements().front()->getColor();
199 }
200 
201 
202 void
204  // only start geometry moving if arrival position isn't -1
205  if (myArrivalPosition != -1) {
206  // always save original position over view
208  // save arrival position
210  // save current centering boundary
212  }
213 }
214 
215 
216 void
218  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
220  // reset myMovingGeometryBoundary
222  }
223 }
224 
225 
226 void
228  // only move if myArrivalPosition isn't -1
229  if (myArrivalPosition != -1) {
230  // Calculate new position using old position
232  newPosition.add(offset);
233  // filtern position using snap to active grid
234  newPosition = myViewNet->snapToActiveGrid(newPosition);
235  // obtain lane shape (to improve code legibility)
236  const PositionVector& laneShape = getParentEdges().back()->getLanes().front()->getLaneShape();
237  // calculate offset lane
238  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myRideMove.originalViewPosition, false);
239  std::cout << offsetLane << std::endl;
240  // Update arrival Position
241  myArrivalPosition = parse<double>(myRideMove.firstOriginalLanePosition) + offsetLane;
242  // Update geometry
243  updateGeometry();
244  }
245 }
246 
247 
248 void
250  // only commit geometry moving if myArrivalPosition isn't -1
251  if (myArrivalPosition != -1) {
252  undoList->p_begin("arrivalPos of " + getTagStr());
254  undoList->p_end();
255  }
256 }
257 
258 
259 void
261  // declare depart and arrival pos lane
262  double departPosLane = -1;
263  double arrivalPosLane = -1;
264  // declare start and end positions
265  Position startPos = Position::INVALID;
266  Position endPos = Position::INVALID;
267  // calculate person plan start and end lanepositions
268  calculatePersonPlanLaneStartEndPos(departPosLane, arrivalPosLane);
269  // calculate person plan start and end positions
270  calculatePersonPlanPositionStartEndPos(startPos, endPos);
271  // calculate geometry path
272  if (getPathEdges().size() > 0) {
274  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
275  } else {
277  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
278  }
279  // update child demand elementss
280  for (const auto& i : getChildDemandElements()) {
281  i->updateGeometry();
282  }
283 }
284 
285 
286 void
288  // declare depart and arrival pos lane
289  double departPosLane = -1;
290  double arrivalPosLane = -1;
291  // declare start and end positions
292  Position startPos = Position::INVALID;
293  Position endPos = Position::INVALID;
294  // calculate person plan start and end lanepositions
295  calculatePersonPlanLaneStartEndPos(departPosLane, arrivalPosLane);
296  // calculate person plan start and end positions
297  calculatePersonPlanPositionStartEndPos(startPos, endPos);
298  // calculate geometry path
299  GNEGeometry::updateGeometricPath(myDemandElementSegmentGeometry, edge, departPosLane, arrivalPosLane, startPos, endPos);
300  // update child demand elementss
301  for (const auto& i : getChildDemandElements()) {
302  i->updatePartialGeometry(edge);
303  }
304 }
305 
306 
307 void
310  // calculate route and update routeEdges
311  replacePathEdges(this, getRouteCalculatorInstance()->calculateDijkstraRoute(getParentDemandElements().at(0)->getVClass(), getParentEdges()));
312  } else if (myTagProperty.getTag() == SUMO_TAG_RIDE_BUSSTOP) {
313  // declare a from-via-busStop edges vector
314  std::vector<GNEEdge*> fromViaBusStopEdges = getParentEdges();
315  // add busStop edge
316  fromViaBusStopEdges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
317  // calculate route and update routeEdges
318  replacePathEdges(this, getRouteCalculatorInstance()->calculateDijkstraRoute(getParentDemandElements().at(0)->getVClass(), fromViaBusStopEdges));
319  }
320  // update geometry
321  updateGeometry();
322 }
323 
324 
325 void
328  // calculate route and update routeEdges
330  } else if (myTagProperty.getTag() == SUMO_TAG_RIDE_BUSSTOP) {
331  // declare a from-via-busStop edges vector
332  std::vector<GNEEdge*> fromViaBusStopEdges = getParentEdges();
333  // add busStop edge
334  fromViaBusStopEdges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
335  // calculate route and update routeEdges
336  replacePathEdges(this, fromViaBusStopEdges);
337  }
338  // update geometry
339  updateGeometry();
340 }
341 
342 
343 Position
345  return Position();
346 }
347 
348 
349 std::string
351  return myViewNet->getNet()->getMicrosimID();
352 }
353 
354 
355 Boundary
357  Boundary rideBoundary;
358  // return the combination of all parent edges's boundaries
359  for (const auto& i : getParentEdges()) {
360  rideBoundary.add(i->getCenteringBoundary());
361  }
362  // check if is valid
363  if (rideBoundary.isInitialised()) {
364  return rideBoundary;
365  } else {
366  return Boundary(-0.1, -0.1, 0.1, 0.1);
367  }
368 }
369 
370 
371 void
372 GNERide::splitEdgeGeometry(const double /*splitPosition*/, const GNENetElement* /*originalElement*/, const GNENetElement* /*newElement*/, GNEUndoList* /*undoList*/) {
373  // geometry of this element cannot be splitted
374 }
375 
376 
377 void
379  // Rides are drawn in GNEEdges
380 }
381 
382 
383 void
385  if (!myViewNet) {
386  throw ProcessError("ViewNet cannot be nullptr");
387  } else {
389  // add object of list into selected objects
391  if (changeFlag) {
392  mySelected = true;
393  }
394  }
395 }
396 
397 
398 void
400  if (!myViewNet) {
401  throw ProcessError("ViewNet cannot be nullptr");
402  } else {
404  // remove object of list of selected objects
406  if (changeFlag) {
407  mySelected = false;
408 
409  }
410  }
411 }
412 
413 
414 std::string
416  switch (key) {
417  case SUMO_ATTR_ID:
418  return getDemandElementID();
419  case SUMO_ATTR_FROM:
420  return getParentEdges().front()->getID();
421  case SUMO_ATTR_TO:
422  return getParentEdges().back()->getID();
423  case SUMO_ATTR_VIA:
424  return toString(getMiddleParentEdges());
425  case SUMO_ATTR_BUS_STOP:
426  return getParentAdditionals().front()->getID();
427  case SUMO_ATTR_LINES:
428  return joinToString(myLines, " ");
430  if (myArrivalPosition == -1) {
431  return "";
432  } else {
433  return toString(myArrivalPosition);
434  }
435  case GNE_ATTR_SELECTED:
437  case GNE_ATTR_PARAMETERS:
438  return getParametersStr();
439  case GNE_ATTR_PARENT:
440  return getParentDemandElements().front()->getID();
441  default:
442  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
443  }
444 }
445 
446 
447 double
449  switch (key) {
451  if (myArrivalPosition != -1) {
452  return myArrivalPosition;
453  } else {
454  return (getLastAllowedVehicleLane()->getLaneShape().length() - POSITION_EPS);
455  }
456  default:
457  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
458  }
459 }
460 
461 
462 void
463 GNERide::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
464  if (value == getAttribute(key)) {
465  return; //avoid needless changes, later logic relies on the fact that attributes have changed
466  }
467  switch (key) {
468  case SUMO_ATTR_FROM:
469  case SUMO_ATTR_TO:
470  case SUMO_ATTR_VIA:
471  case SUMO_ATTR_BUS_STOP:
472  case SUMO_ATTR_LINES:
474  case GNE_ATTR_SELECTED:
475  case GNE_ATTR_PARAMETERS:
476  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
477  break;
478  default:
479  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
480  }
481 }
482 
483 
484 bool
485 GNERide::isValid(SumoXMLAttr key, const std::string& value) {
486  switch (key) {
487  case SUMO_ATTR_FROM:
488  case SUMO_ATTR_TO:
489  return SUMOXMLDefinitions::isValidNetID(value) && (myViewNet->getNet()->retrieveEdge(value, false) != nullptr);
490  case SUMO_ATTR_VIA:
491  if (value.empty()) {
492  return true;
493  } else {
494  return canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), value, false);
495  }
496  case SUMO_ATTR_BUS_STOP:
497  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
498  case SUMO_ATTR_LINES:
499  return canParse<std::vector<std::string> >(value);
501  if (value.empty()) {
502  return true;
503  } else if (canParse<double>(value)) {
504  const double parsedValue = canParse<double>(value);
505  if ((parsedValue < 0) || (parsedValue > getLastAllowedVehicleLane()->getLaneShape().length())) {
506  return false;
507  } else {
508  return true;
509  }
510  } else {
511  return false;
512  }
513  case GNE_ATTR_SELECTED:
514  return canParse<bool>(value);
515  case GNE_ATTR_PARAMETERS:
516  return Parameterised::areParametersValid(value);
517  default:
518  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
519  }
520 }
521 
522 
523 void
525  //
526 }
527 
528 
529 void
531  //
532 }
533 
534 
535 bool
537  return true;
538 }
539 
540 
541 std::string
543  return getTagStr();
544 }
545 
546 
547 std::string
550  return "ride: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
551  } else {
552  return "ride: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().front()->getID();
553  }
554 }
555 
556 // ===========================================================================
557 // private
558 // ===========================================================================
559 
560 void
561 GNERide::setAttribute(SumoXMLAttr key, const std::string& value) {
562  switch (key) {
563  // Specific of Trips and flow
564  case SUMO_ATTR_FROM: {
565  // change first edge
567  // compute ride
568  computePath();
569  break;
570  }
571  case SUMO_ATTR_TO: {
572  // change last edge
574  // compute ride
575  computePath();
576  break;
577  }
578  case SUMO_ATTR_VIA: {
579  // update via
580  replaceMiddleParentEdges(this, parse<std::vector<GNEEdge*> >(myViewNet->getNet(), value), true);
581  // compute ride
582  computePath();
583  break;
584  }
585  case SUMO_ATTR_BUS_STOP:
586  replaceParentAdditional(this, value, 0);
587  // compute ride
588  computePath();
589  break;
590  case SUMO_ATTR_LINES:
591  myLines = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
592  break;
594  if (value.empty()) {
595  myArrivalPosition = -1;
596  } else {
597  myArrivalPosition = parse<double>(value);
598  }
599  updateGeometry();
600  break;
601  case GNE_ATTR_SELECTED:
602  if (parse<bool>(value)) {
604  } else {
606  }
607  break;
608  case GNE_ATTR_PARAMETERS:
609  setParametersStr(value);
610  break;
611  default:
612  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
613  }
614 }
615 
616 
617 void
618 GNERide::setEnabledAttribute(const int /*enabledAttributes*/) {
619  //
620 }
621 
622 
623 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
GNERide::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERide.cpp:448
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:186
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
GNEHierarchicalParentElements::replaceMiddleParentEdges
void replaceMiddleParentEdges(GNEDemandElement *elementChild, const std::vector< GNEEdge * > &newMiddleEdges, const bool updateChildReferences)
replace middle (via) parent edges
Definition: GNEHierarchicalParentElements.cpp:372
GNEDemandElement::getLastAllowedVehicleLane
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:512
GNENet::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2183
GNERide::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNERide.cpp:287
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1279
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNERide::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNERide.cpp:180
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
Parameterised::getParametersStr
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
Definition: Parameterised.cpp:112
GNEAdditional.h
GNEGeometry::calculateEdgeGeometricPath
static void calculateEdgeGeometricPath(const GNEAttributeCarrier *AC, GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEEdge * > &edges, const SUMOVehicleClass vClass, GNELane *fromLane, GNELane *toLane, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
calculate route between edges
Definition: GNEGeometry.cpp:591
GNERide::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNERide.cpp:77
GNEHierarchicalParentElements::getPathEdges
const std::vector< GNEEdge * > & getPathEdges() const
get path edges
Definition: GNEHierarchicalParentElements.cpp:203
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:788
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
GNEHierarchicalParentElements::replaceLastParentEdge
void replaceLastParentEdge(GNEDemandElement *elementChild, GNEEdge *newLastEdge)
replace the last parent edge (used by demand elements)
Definition: GNEHierarchicalParentElements.cpp:397
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
GNEHierarchicalParentElements::replacePathEdges
void replacePathEdges(GNEDemandElement *elementChild, const std::vector< GNEEdge * > &routeEdges)
replace edge route Parents
Definition: GNEHierarchicalParentElements.cpp:414
GNEHierarchicalParentElements::replaceFirstParentEdge
void replaceFirstParentEdge(GNEDemandElement *elementChild, GNEEdge *newFirstEdge)
replace the first parent edge (used by demand elements)
Definition: GNEHierarchicalParentElements.cpp:356
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNEDemandElement::getRouteCalculatorInstance
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
Definition: GNEDemandElement.cpp:280
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
GNERide::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNERide.cpp:384
GNERide::computePath
void computePath()
compute path
Definition: GNERide.cpp:308
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEHierarchicalParentElements::getParentEdges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
Definition: GNEHierarchicalParentElements.cpp:181
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
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:284
GNERide::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERide.cpp:548
GNERide::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERide.cpp:485
GNERide::~GNERide
~GNERide()
destructor
Definition: GNERide.cpp:73
GUIGlobalSelection.h
GNEDemandElement::getFirstAllowedVehicleLane
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:476
GNERide::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNERide.cpp:217
GNERide::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERide.cpp:536
SUMO_ATTR_LINES
Definition: SUMOXMLDefinitions.h:776
GNERide::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNERide.cpp:146
GNEHierarchicalParentElements::getParentLanes
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
Definition: GNEHierarchicalParentElements.cpp:235
GNERide.h
GNEViewNet
Definition: GNEViewNet.h:42
MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:392
GNERide::myRideMove
DemandElementMove myRideMove
variable for move rides
Definition: GNERide.h:221
SUMO_ATTR_ARRIVALPOS
Definition: SUMOXMLDefinitions.h:437
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
GNERide::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNERide.cpp:102
MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:382
GNERide::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERide.cpp:378
GNERide::GNERide
GNERide(GNEViewNet *viewNet, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, const std::vector< GNEEdge * > &via, double arrivalPosition, const std::vector< std::string > &lines)
parameter constructor for rideEdges
Definition: GNERide.cpp:43
GNEDemandElement::DemandElementMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:64
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNERide::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERide.cpp:542
GLO_RIDE
Definition: GUIGlObjectTypes.h:123
GNERide::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNERide.cpp:227
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
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:154
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
GUIAppEnum.h
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
GNEDemandElement::myDemandElementSegmentGeometry
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
Definition: GNEDemandElement.h:382
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
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:131
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEHierarchicalParentElements::getParentAdditionals
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
Definition: GNEHierarchicalParentElements.cpp:85
PositionVector::nearest_offset_to_point2D
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Definition: PositionVector.cpp:817
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
RGBColor
Definition: RGBColor.h:39
GNERide::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNERide.cpp:169
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
GNEHierarchicalParentElements::getParentDemandElements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
Definition: GNEHierarchicalParentElements.cpp:114
GNERide::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: GNERide.cpp:463
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:113
SUMO_TAG_RIDE
Definition: SUMOXMLDefinitions.h:297
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
GNEViewNet.h
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
GNERide::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNERide.cpp:260
ProcessError
Definition: UtilExceptions.h:39
GNERide::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNERide.cpp:163
GNEDemandElement::calculatePersonPlanPositionStartEndPos
void calculatePersonPlanPositionStartEndPos(Position &startPos, Position &endPos) const
calculate personPlan start and end positions
Definition: GNEDemandElement.cpp:440
GNERide::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNERide.h:224
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEHierarchicalParentElements::getMiddleParentEdges
std::vector< GNEEdge * > getMiddleParentEdges() const
get middle (via) parent edges
Definition: GNEHierarchicalParentElements.cpp:187
GNERide::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNERide.cpp:249
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:785
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:552
GNEGeometry::updateGeometricPath
static void updateGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const GNEEdge *edge, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
calculate route between edges
Definition: GNEGeometry.cpp:719
GNERide::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNERide.cpp:618
GNENetElement
Definition: GNENetElement.h:43
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
GNERide::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNERide.cpp:191
GNERide::myLines
std::vector< std::string > myLines
valid line or vehicle ids or ANY
Definition: GNERide.h:227
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
GNERide::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNERide.cpp:399
GNEAttributeCarrier::parse
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
Parameterised::setParametersStr
void setParametersStr(const std::string &paramsString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
Definition: Parameterised.cpp:139
GNEViewParent.h
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEDemandElement::calculatePersonPlanLaneStartEndPos
void calculatePersonPlanLaneStartEndPos(double &startPos, double &endPos) const
calculate personPlan start and end positions over lanes
Definition: GNEDemandElement.cpp:400
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:97
GNERide::invalidatePath
void invalidatePath()
invalidate path
Definition: GNERide.cpp:326
GNEDemandElement::RouteCalculator::areEdgesConsecutives
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
Definition: GNEDemandElement.cpp:133
GNESelectorFrame.h
GNERide::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNERide.cpp:415
SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:723
GUIMainWindow
Definition: GUIMainWindow.h:46
Parameterised::areParametersValid
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
Definition: Parameterised.cpp:166
InvalidArgument
Definition: UtilExceptions.h:56
SUMOXMLDefinitions::isValidNetID
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Definition: SUMOXMLDefinitions.cpp:967
GNERide::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNERide.cpp:350
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
SUMO_TAG_RIDE_BUSSTOP
Definition: SUMOXMLDefinitions.h:311
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
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:246
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:846
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
GNERide::getColor
const RGBColor & getColor() const
get color
Definition: GNERide.cpp:197
config.h
GNERide::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERide.cpp:524
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
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
StringTokenizer.h
GNERide::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNERide.cpp:127
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
GNEUndoList
Definition: GNEUndoList.h:48
MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:384
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNERide::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERide.cpp:344
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
GNEDemandElement::DemandElementMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEDemandElement.h:61
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
SUMO_TAG_RIDE_FROMTO
Definition: SUMOXMLDefinitions.h:310
GNEChange_Attribute.h
GNENet.h
GNERide::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNERide.cpp:372
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
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:459
GNEUndoList.h
GNERide::startGeometryMoving
void startGeometryMoving()
Definition: GNERide.cpp:203
GNE_ATTR_PARENT
parent of an additional element
Definition: SUMOXMLDefinitions.h:987
GNERide::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERide.cpp:530
GNERide::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERide.cpp:356
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:567