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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing rides in Netedit
19 /****************************************************************************/
20 #include <config.h>
21 
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
28 
29 #include "GNERide.h"
30 
31 
32 // ===========================================================================
33 // method definitions
34 // ===========================================================================
35 
36 GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
37  double arrivalPosition, const std::vector<std::string>& lines) :
39 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {personParent}, {}),
40 myArrivalPosition(arrivalPosition),
41 myLines(lines) {
42  // compute ride
43  computePath();
44 }
45 
46 
47 GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
48  double arrivalPosition, const std::vector<std::string>& lines) :
50 {}, {fromEdge}, {}, {toBusStop}, {}, {}, {personParent}, {}),
51 myArrivalPosition(arrivalPosition),
52 myLines(lines) {
53  // compute ride
54  computePath();
55 }
56 
57 GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEEdge* toEdge,
58  double arrivalPosition, const std::vector<std::string>& lines) :
60 {}, {toEdge}, {}, {fromBusStop}, {}, {}, {personParent}, {}),
61 myArrivalPosition(arrivalPosition),
62 myLines(lines) {
63  // compute ride
64  computePath();
65 }
66 
67 
68 GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEAdditional* toBusStop,
69  double arrivalPosition, const std::vector<std::string>& lines) :
71 {}, {}, {}, {fromBusStop, toBusStop}, {}, {}, {personParent}, {}),
72 myArrivalPosition(arrivalPosition),
73 myLines(lines) {
74  // compute ride
75  computePath();
76 }
77 
78 
80 
81 
84  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
85  // build header
86  buildPopupHeader(ret, app);
87  // build menu command for center button and copy cursor position to clipboard
89  buildPositionCopyEntry(ret, false);
90  // buld menu commands for names
91  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
92  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
93  new FXMenuSeparator(ret);
94  // build selection and show parameters menu
97  // show option to open demand element dialog
98  if (myTagProperty.hasDialog()) {
99  GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
100  new FXMenuSeparator(ret);
101  }
102  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
103  return ret;
104 }
105 
106 
107 void
109  // open tag
110  device.openTag(SUMO_TAG_RIDE);
111  // check if we have to write "from" attributes
112  if (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr) {
113  // write "to" attributes depending of start and end
115  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
116  } else if (myTagProperty.personPlanStartBusStop()) {
117  device.writeAttr(SUMO_ATTR_FROM, getParentAdditionals().front()->getID());
118  }
119  }
120  // write "to" attributes depending of start and end
122  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
123  } else if (myTagProperty.personPlanStartBusStop()) {
125  }
126  // only write arrivalPos if is different of -1
127  if (myArrivalPosition != -1) {
129  }
130  // write lines
131  if (myLines.empty()) {
132  device.writeAttr(SUMO_ATTR_LINES, "ANY");
133  } else {
135  }
136  // write parameters
137  writeParams(device);
138  // close tag
139  device.closeTag();
140 }
141 
142 
143 bool
145  if ((getParentEdges().size() == 2) && (getParentEdges().at(0) == getParentEdges().at(1))) {
146  // from and to are the same edges
147  return true;
148  } else if (getPath().size() > 0) {
149  // if path edges isn't empty, then there is a valid route
150  return true;
151  } else {
152  return false;
153  }
154 }
155 
156 
157 std::string
159  if (getParentEdges().size() == 0) {
160  return ("A ride need at least one edge");
161  } else {
162  // check if exist at least a connection between every edge
163  for (int i = 1; i < (int)getParentEdges().size(); i++) {
164  if (myNet->getPathCalculator()->consecutiveEdgesConnected(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
165  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
166  }
167  }
168  // there is connections bewteen all edges, then all ok
169  return "";
170  }
171 }
172 
173 
174 void
176  // currently the only solution is removing Ride
177 }
178 
179 
182  return getParentDemandElements().front()->getVClass();
183 }
184 
185 
186 const RGBColor&
188  return getParentDemandElements().front()->getColor();
189 }
190 
191 
192 void
194  // only start geometry moving if arrival position isn't -1
195  if (myArrivalPosition != -1) {
196  // always save original position over view
198  // save arrival position
200  // save current centering boundary
202  }
203 }
204 
205 
206 void
208  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
210  // reset myMovingGeometryBoundary
212  }
213 }
214 
215 
216 void
218  // only move if myArrivalPosition isn't -1
219  if (myArrivalPosition != -1) {
220  // Calculate new position using old position
222  newPosition.add(offset);
223  // filtern position using snap to active grid
224  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition);
225  // obtain lane shape (to improve code legibility)
226  const PositionVector& laneShape = getParentEdges().back()->getLanes().front()->getLaneShape();
227  // calculate offset lane
228  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myRideMove.originalViewPosition, false);
229  // Update arrival Position
230  myArrivalPosition = parse<double>(myRideMove.firstOriginalLanePosition) + offsetLane;
231  // Update geometry
232  updateGeometry();
233  }
234 }
235 
236 
237 void
239  // only commit geometry moving if myArrivalPosition isn't -1
240  if (myArrivalPosition != -1) {
241  undoList->p_begin("arrivalPos of " + getTagStr());
243  undoList->p_end();
244  }
245 }
246 
247 
248 void
250  // calculate person plan start and end positions
252  // calculate edge geometry path using path
254  // update child demand elementss
255  for (const auto& i : getChildDemandElements()) {
256  i->updateGeometry();
257  }
258 }
259 
260 
261 void
263  // update lanes depending of walk tag
265  calculatePathLanes(getVClass(), false,
268  {});
270  calculatePathLanes(getVClass(), false,
272  getParentAdditionals().back()->getParentLanes().front(),
273  {});
275  calculatePathLanes(getVClass(), false,
276  getParentAdditionals().front()->getParentLanes().front(),
278  {});
280  calculatePathLanes(getVClass(), false,
281  getParentAdditionals().front()->getParentLanes().front(),
282  getParentAdditionals().back()->getParentLanes().front(),
283  {});
284  }
285  // update geometry
286  updateGeometry();
287 }
288 
289 
290 void
292  // update lanes depending of walk tag
294  resetPathLanes(getVClass(), false,
297  {});
299  resetPathLanes(getVClass(), false,
301  getParentAdditionals().back()->getParentLanes().front(),
302  {});
304  resetPathLanes(getVClass(), false,
305  getParentAdditionals().front()->getParentLanes().front(),
307  {});
309  resetPathLanes(getVClass(), false,
310  getParentAdditionals().front()->getParentLanes().front(),
311  getParentAdditionals().back()->getParentLanes().front(),
312  {});
313  }
314  // update geometry
315  updateGeometry();
316 }
317 
318 
319 Position
321  return Position();
322 }
323 
324 
325 std::string
327  return getParentDemandElements().front()->getID();
328 }
329 
330 
331 Boundary
333  Boundary rideBoundary;
334  // return the combination of all parent edges's boundaries
335  for (const auto& i : getParentEdges()) {
336  rideBoundary.add(i->getCenteringBoundary());
337  }
338  // check if is valid
339  if (rideBoundary.isInitialised()) {
340  return rideBoundary;
341  } else {
342  return Boundary(-0.1, -0.1, 0.1, 0.1);
343  }
344 }
345 
346 
347 void
348 GNERide::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
349  // geometry of this element cannot be splitted
350 }
351 
352 
353 void
355  // Rides are drawn in drawPartialGL
356 }
357 
358 
359 void
360 GNERide::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const {
361  // draw person plan over lane
362  drawPersonPlanPartialLane(s, lane, offsetFront, s.widthSettings.ride, s.colorSettings.ride);
363 }
364 
365 
366 void
367 GNERide::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const {
368  // draw person plan over junction
369  drawPersonPlanPartialJunction(s, fromLane, toLane, offsetFront, s.widthSettings.ride, s.colorSettings.ride);
370 }
371 
372 
373 std::string
375  switch (key) {
376  // Common person plan attributes
377  case SUMO_ATTR_ID:
378  return getParentDemandElements().front()->getID();
379  case SUMO_ATTR_FROM:
380  return getParentEdges().front()->getID();
381  case SUMO_ATTR_TO:
382  return getParentEdges().back()->getID();
384  return getParentAdditionals().front()->getID();
385  case GNE_ATTR_TO_BUSSTOP:
386  return getParentAdditionals().back()->getID();
387  // specific person plan attributes
388  case SUMO_ATTR_LINES:
389  return joinToString(myLines, " ");
391  if (myArrivalPosition == -1) {
392  return "";
393  } else {
394  return toString(myArrivalPosition);
395  }
396  case GNE_ATTR_SELECTED:
398  case GNE_ATTR_PARAMETERS:
399  return getParametersStr();
400  case GNE_ATTR_PARENT:
401  return getParentDemandElements().front()->getID();
402  default:
403  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
404  }
405 }
406 
407 
408 double
410  switch (key) {
412  if (myArrivalPosition != -1) {
413  return myArrivalPosition;
414  } else {
415  return (getLastAllowedVehicleLane()->getLaneShape().length() - POSITION_EPS);
416  }
417  default:
418  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
419  }
420 }
421 
422 
423 void
424 GNERide::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
425  if (value == getAttribute(key)) {
426  return; //avoid needless changes, later logic relies on the fact that attributes have changed
427  }
428  switch (key) {
429  // Common person plan attributes
430  case SUMO_ATTR_FROM:
431  case SUMO_ATTR_TO:
433  case GNE_ATTR_TO_BUSSTOP:
434  // specific person plan attributes
435  case SUMO_ATTR_LINES:
437  case GNE_ATTR_SELECTED:
438  case GNE_ATTR_PARAMETERS:
439  undoList->p_add(new GNEChange_Attribute(this, key, value));
440  break;
441  default:
442  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
443  }
444 }
445 
446 
447 bool
448 GNERide::isValid(SumoXMLAttr key, const std::string& value) {
449  switch (key) {
450  // Common person plan attributes
451  case SUMO_ATTR_FROM:
452  case SUMO_ATTR_TO:
453  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrieveEdge(value, false) != nullptr);
455  case GNE_ATTR_TO_BUSSTOP:
456  return (myNet->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
457  // specific person plan attributes
458  case SUMO_ATTR_LINES:
459  return canParse<std::vector<std::string> >(value);
461  if (value.empty()) {
462  return true;
463  } else if (canParse<double>(value)) {
464  const double parsedValue = canParse<double>(value);
465  if ((parsedValue < 0) || (parsedValue > getLastAllowedVehicleLane()->getLaneShape().length())) {
466  return false;
467  } else {
468  return true;
469  }
470  } else {
471  return false;
472  }
473  case GNE_ATTR_SELECTED:
474  return canParse<bool>(value);
475  case GNE_ATTR_PARAMETERS:
476  return Parameterised::areParametersValid(value);
477  default:
478  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
479  }
480 }
481 
482 
483 void
485  //
486 }
487 
488 
489 void
491  //
492 }
493 
494 
495 bool
497  return true;
498 }
499 
500 
501 std::string
503  return getTagStr();
504 }
505 
506 
507 std::string
510  return "ride: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
512  return "ride: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
514  return "ride: " + getParentAdditionals().front()->getID() + " -> " + getParentEdges().back()->getID();
516  return "ride: " + getParentAdditionals().front()->getID() + " -> " + getParentAdditionals().back()->getID();
517  } else {
518  throw ("Invalid ride tag");
519  }
520 }
521 
522 
523 const std::map<std::string, std::string>&
525  return getParametersMap();
526 }
527 
528 // ===========================================================================
529 // private
530 // ===========================================================================
531 
532 void
533 GNERide::setAttribute(SumoXMLAttr key, const std::string& value) {
534  switch (key) {
535  // Common person plan attributes
536  case SUMO_ATTR_FROM:
537  // change first edge
538  replaceFirstParentEdge(value);
539  // compute person trip
540  computePath();
541  break;
542  case SUMO_ATTR_TO:
543  // change last edge
544  replaceLastParentEdge(value);
545  // compute person trip
546  computePath();
547  break;
550  // compute person trip
551  computePath();
552  break;
553  case GNE_ATTR_TO_BUSSTOP:
554  // -> check this
555  if (getParentAdditionals().size() > 1) {
557  } else {
559  }
560  // compute person trip
561  computePath();
562  break;
563  // specific person plan attributes
564  case SUMO_ATTR_LINES:
565  myLines = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
566  break;
568  if (value.empty()) {
569  myArrivalPosition = -1;
570  } else {
571  myArrivalPosition = parse<double>(value);
572  }
573  updateGeometry();
574  break;
575  case GNE_ATTR_SELECTED:
576  if (parse<bool>(value)) {
578  } else {
580  }
581  break;
582  case GNE_ATTR_PARAMETERS:
583  setParametersStr(value);
584  break;
585  default:
586  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
587  }
588 }
589 
590 
591 void
592 GNERide::setEnabledAttribute(const int /*enabledAttributes*/) {
593  //
594 }
595 
596 
597 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:403
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:411
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:401
@ GLO_RIDE
a ride
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ GNE_TAG_RIDE_BUSSTOP_BUSSTOP
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_RIDE_BUSSTOP_EDGE
@ GNE_TAG_RIDE_EDGE_EDGE
@ SUMO_TAG_RIDE
@ GNE_TAG_RIDE_EDGE_BUSSTOP
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LINES
@ GNE_ATTR_FROM_BUSSTOP
from busStop (used by personPlans)
@ SUMO_ATTR_BUS_STOP
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_TO_BUSSTOP
to busStop (used by personPlans)
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_ID
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:250
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:215
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
FXIcon * getIcon() const
get FXIcon associated to this AC
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry (also called "stacked geometry")
void drawPersonPlanPartialLane(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
GNEGeometry::ExtremeGeometry calculatePersonPlanLaneStartEndPos() const
calculate extreme geometry
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
void drawPersonPlanPartialJunction(const GUIVisualizationSettings &s, const GNELane *fromLane, const GNELane *toLane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial junction
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge *from, const GNEEdge *to) const
check if exist a path between the two given consecutives edges for the given VClass
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
Definition: GNENet.cpp:1141
GNENetHelper::PathCalculator * getPathCalculator()
obtain instance of PathCalculator
Definition: GNENet.cpp:136
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2316
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
void calculatePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
calculate path lanes (Dijkstra)
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
void resetPathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
reset path lanes
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNERide.cpp:217
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERide.cpp:409
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNERide.cpp:524
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERide.cpp:320
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNERide.cpp:175
void endGeometryMoving()
end geometry movement
Definition: GNERide.cpp:207
void startGeometryMoving()
Definition: GNERide.cpp:193
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNERide.cpp:348
void invalidatePath()
invalidate path
Definition: GNERide.cpp:291
SUMOVehicleClass getVClass() const
Definition: GNERide.cpp:181
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNERide.cpp:158
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERide.cpp:502
double myArrivalPosition
arrival position
Definition: GNERide.h:254
void computePath()
compute path
Definition: GNERide.cpp:262
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERide.cpp:332
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERide.cpp:354
std::string getParentName() const
Returns the name of the parent object.
Definition: GNERide.cpp:326
~GNERide()
destructor
Definition: GNERide.cpp:79
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNERide.cpp:592
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNERide.cpp:238
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERide.cpp:484
void updateGeometry()
update pre-computed geometry information
Definition: GNERide.cpp:249
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNERide.cpp:83
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERide.cpp:448
const RGBColor & getColor() const
get color
Definition: GNERide.cpp:187
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNERide.cpp:144
GNERide(GNENet *net, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, double arrivalPosition, const std::vector< std::string > &lines)
parameter constructor for person edge->edge
Definition: GNERide.cpp:36
std::vector< std::string > myLines
valid line or vehicle ids or ANY
Definition: GNERide.h:257
DemandElementMove myRideMove
variable for move rides
Definition: GNERide.h:251
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERide.cpp:496
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:424
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNERide.cpp:374
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNERide.cpp:360
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERide.cpp:490
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERide.cpp:508
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNERide.cpp:108
bool personPlanStartEdge() const
return true if tag correspond to a person plan that starts in an edge
bool personPlanStartBusStop() const
return true if tag correspond to a person plan that starts in a busStop
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
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:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
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.
Stores the information about how to visualize structures.
GUIVisualizationWidthSettings widthSettings
width settings
GUIVisualizationColorSettings colorSettings
color settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:124
A list of positions.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Position originalViewPosition
value for saving first original position over lane before moving
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
struct for variables used in Geometry extremes
Definition: GNEGeometry.h:58
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static const RGBColor ride
color for rides
static const double ride
width for rides