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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // 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 
37  GNEDemandElement("", net, GLO_RIDE, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
38 {}, {}, {}, {}, {}, {}, {}, {}),
39 myArrivalPosition(0) {
40  // reset default values
42 }
43 
44 
45 GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
46  double arrivalPosition, const std::vector<std::string>& lines) :
47  GNEDemandElement(personParent, net, GLO_RIDE, GNE_TAG_RIDE_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
48 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {personParent}, {}),
49 myArrivalPosition(arrivalPosition),
50 myLines(lines) {
51 }
52 
53 
54 GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
55  double arrivalPosition, const std::vector<std::string>& lines) :
56  GNEDemandElement(personParent, net, GLO_RIDE, GNE_TAG_RIDE_BUSSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
57 {}, {fromEdge}, {}, {toBusStop}, {}, {}, {personParent}, {}),
58 myArrivalPosition(arrivalPosition),
59 myLines(lines) {
60 }
61 
62 
64 
65 
68  // avoid move person plan that ends in busStop
69  if (getParentAdditionals().size() > 0) {
70  return nullptr;
71  }
72  // get geometry end pos
73  const Position geometryEndPos = getPathElementArrivalPos();
74  // calculate circle width squared
76  // check if we clicked over a geometry end pos
77  if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= ((circleWidthSquared + 2))) {
78  return new GNEMoveOperation(this, getParentEdges().back()->getLaneByDisallowedVClass(getVClass()), myArrivalPosition, false);
79  } else {
80  return nullptr;
81  }
82 }
83 
84 
87  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
88  // build header
89  buildPopupHeader(ret, app);
90  // build menu command for center button and copy cursor position to clipboard
92  buildPositionCopyEntry(ret, false);
93  // buld menu commands for names
94  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
95  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
96  new FXMenuSeparator(ret);
97  // build selection and show parameters menu
100  // show option to open demand element dialog
101  if (myTagProperty.hasDialog()) {
102  GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
103  new FXMenuSeparator(ret);
104  }
105  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
106  return ret;
107 }
108 
109 
110 void
112  // open tag
113  device.openTag(SUMO_TAG_RIDE);
114  // check if from attribute is enabled
116  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
117  }
118  // write to depending if personplan ends in a busStop
119  if (getParentAdditionals().size() > 0) {
121  } else {
122  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
123  }
124  // avoid writte arrival positions in ride to busStop
126  // only write arrivalPos if is different of -1
127  if (myArrivalPosition != -1) {
129  }
130  }
131  // write lines
132  if (myLines.empty()) {
133  device.writeAttr(SUMO_ATTR_LINES, "ANY");
134  } else {
136  }
137  // write parameters
138  writeParams(device);
139  // close tag
140  device.closeTag();
141 }
142 
143 
146  return isPersonPlanValid();
147 }
148 
149 
150 std::string
152  return getPersonPlanProblem();
153 }
154 
155 
156 void
158  // currently the only solution is removing Ride
159 }
160 
161 
164  return getParentDemandElements().front()->getVClass();
165 }
166 
167 
168 const RGBColor&
170  return getParentDemandElements().front()->getColor();
171 }
172 
173 
174 void
176  // update child demand elementss
177  for (const auto& i : getChildDemandElements()) {
178  i->updateGeometry();
179  }
180 }
181 
182 
183 Position
185  return getParentEdges().front()->getPositionInView();
186 }
187 
188 
189 std::string
191  return getParentDemandElements().front()->getID();
192 }
193 
194 
195 double
197  return 1;
198 }
199 
200 
201 Boundary
203  Boundary rideBoundary;
204  // return the combination of all parent edges's boundaries
205  for (const auto& i : getParentEdges()) {
206  rideBoundary.add(i->getCenteringBoundary());
207  }
208  // check if is valid
209  if (rideBoundary.isInitialised()) {
210  return rideBoundary;
211  } else {
212  return Boundary(-0.1, -0.1, 0.1, 0.1);
213  }
214 }
215 
216 
217 void
218 GNERide::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
219  // geometry of this element cannot be splitted
220 }
221 
222 
223 void
225  // force draw path
226  myNet->getPathManager()->forceDrawPath(s, this);
227 }
228 
229 
230 void
232  // get lanes
233  const std::vector<GNELane*> lanes = {getFirstPathLane(), getLastPathLane()};
234  // calculate path
236  // check path (taxis)
237  if (!myNet->getPathManager()->isPathValid(this)) {
239  }
240  // check path (bus)
241  if (!myNet->getPathManager()->isPathValid(this)) {
243  }
244  // check path (bicycle)
245  if (!myNet->getPathManager()->isPathValid(this)) {
247  }
248  // check path (pedestrian)
249  if (!myNet->getPathManager()->isPathValid(this)) {
251  }
252  // update geometry
253  updateGeometry();
254 }
255 
256 
257 void
258 GNERide::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
259  // draw person plan over lane
260  drawPersonPlanPartial(drawPersonPlan(), s, lane, segment, offsetFront, s.widthSettings.rideWidth, s.colorSettings.rideColor);
261 }
262 
263 
264 void
265 GNERide::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
266  // draw person plan over junction
267  drawPersonPlanPartial(drawPersonPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.rideWidth, s.colorSettings.rideColor);
268 }
269 
270 
271 GNELane*
273  return getParentEdges().front()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
274 }
275 
276 
277 GNELane*
279  // check if personPlan ends in a BusStop
280  if (getParentAdditionals().size() > 0) {
281  return getParentAdditionals().front()->getParentLanes().front();
282  } else {
283  return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
284  }
285 }
286 
287 
288 std::string
290  switch (key) {
291  // Common person plan attributes
292  case SUMO_ATTR_ID:
293  return getParentDemandElements().front()->getID();
294  case SUMO_ATTR_FROM:
295  return getParentEdges().front()->getID();
296  case SUMO_ATTR_TO:
297  return getParentEdges().back()->getID();
298  case GNE_ATTR_TO_BUSSTOP:
299  return getParentAdditionals().back()->getID();
300  // specific person plan attributes
301  case SUMO_ATTR_LINES:
302  return joinToString(myLines, " ");
304  if (myArrivalPosition == -1) {
305  return "";
306  } else {
307  return toString(myArrivalPosition);
308  }
309  case GNE_ATTR_SELECTED:
311  case GNE_ATTR_PARAMETERS:
312  return getParametersStr();
313  case GNE_ATTR_PARENT:
314  return getParentDemandElements().front()->getID();
315  default:
316  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
317  }
318 }
319 
320 
321 double
323  switch (key) {
325  if (myArrivalPosition != -1) {
326  return myArrivalPosition;
327  } else {
328  return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
329  }
330  default:
331  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
332  }
333 }
334 
335 
336 Position
338  switch (key) {
339  case SUMO_ATTR_ARRIVALPOS: {
340  // get lane shape
341  const PositionVector& laneShape = getLastPathLane()->getLaneShape();
342  // continue depending of arrival position
343  if (myArrivalPosition == 0) {
344  return laneShape.front();
345  } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
346  return laneShape.back();
347  } else {
348  return laneShape.positionAtOffset2D(myArrivalPosition);
349  }
350  }
351  default:
352  throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
353  }
354 }
355 
356 
357 void
358 GNERide::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
359  switch (key) {
360  // Common person plan attributes
361  case SUMO_ATTR_FROM:
363  case SUMO_ATTR_LINES:
364  case GNE_ATTR_SELECTED:
365  case GNE_ATTR_PARAMETERS:
366  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
367  break;
368  // special case for "to" attributes
369  case SUMO_ATTR_TO: {
370  // get next personPlan
371  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
372  // continue depending of nextPersonPlan
373  if (nextPersonPlan) {
374  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
375  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
376  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
377  undoList->end();
378  } else {
379  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
380  }
381  break;
382  }
383  case GNE_ATTR_TO_BUSSTOP: {
384  // get next person plan
385  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
386  // continue depending of nextPersonPlan
387  if (nextPersonPlan) {
388  // obtain busStop
390  // change from attribute using edge ID
391  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
392  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
393  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
394  undoList->end();
395  } else {
396  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
397  }
398  break;
399  }
400  default:
401  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
402  }
403 }
404 
405 
406 bool
407 GNERide::isValid(SumoXMLAttr key, const std::string& value) {
408  switch (key) {
409  // Common person plan attributes
410  case SUMO_ATTR_FROM:
411  case SUMO_ATTR_TO:
412  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
413  case GNE_ATTR_TO_BUSSTOP:
414  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
415  // specific person plan attributes
416  case SUMO_ATTR_LINES:
417  return canParse<std::vector<std::string> >(value);
419  if (value.empty()) {
420  return true;
421  } else if (canParse<double>(value)) {
422  const double parsedValue = canParse<double>(value);
423  if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
424  return false;
425  } else {
426  return true;
427  }
428  } else {
429  return false;
430  }
431  case GNE_ATTR_SELECTED:
432  return canParse<bool>(value);
433  case GNE_ATTR_PARAMETERS:
434  return Parameterised::areParametersValid(value);
435  default:
436  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
437  }
438 }
439 
440 
441 void
443  //
444 }
445 
446 
447 void
449  //
450 }
451 
452 
453 bool
455  if (key == SUMO_ATTR_FROM) {
456  return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
457  } else {
458  return true;
459  }
460 }
461 
462 
463 std::string
465  return getTagStr();
466 }
467 
468 
469 std::string
472  return "ride: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
473  } else if (myTagProperty.getTag() == GNE_TAG_RIDE_BUSSTOP) {
474  return "ride: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
475  } else {
476  throw ("Invalid ride tag");
477  }
478 }
479 
480 
481 const std::map<std::string, std::string>&
483  return getParametersMap();
484 }
485 
486 // ===========================================================================
487 // private
488 // ===========================================================================
489 
490 void
491 GNERide::setAttribute(SumoXMLAttr key, const std::string& value) {
492  switch (key) {
493  // Common person plan attributes
494  case SUMO_ATTR_FROM:
495  // change first edge
496  replaceFirstParentEdge(value);
497  // compute ride
499  break;
500  case SUMO_ATTR_TO:
501  // change last edge
502  replaceLastParentEdge(value);
503  // compute ride
505  break;
506  case GNE_ATTR_TO_BUSSTOP:
508  // compute ride
510  break;
511  // specific person plan attributes
512  case SUMO_ATTR_LINES:
513  myLines = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
514  break;
516  if (value.empty()) {
517  myArrivalPosition = -1;
518  } else {
519  myArrivalPosition = parse<double>(value);
520  }
521  updateGeometry();
522  break;
523  case GNE_ATTR_SELECTED:
524  if (parse<bool>(value)) {
526  } else {
528  }
529  break;
530  case GNE_ATTR_PARAMETERS:
531  setParametersStr(value);
532  break;
533  default:
534  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
535  }
536 }
537 
538 
539 void
540 GNERide::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
541  // nothing to toogle
542 }
543 
544 
545 void
547  // change both position
548  myArrivalPosition = moveResult.newSecondPos;
549  // update geometry
550  updateGeometry();
551 }
552 
553 
554 void
555 GNERide::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
556  undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
557  // now adjust start position
558  setAttribute(SUMO_ATTR_ARRIVALPOS, toString(moveResult.newFirstPos), undoList);
559  undoList->end();
560 }
561 
562 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:413
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:423
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:411
@ GLO_RIDE
a ride
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_RIDE
@ GNE_TAG_RIDE_EDGE
@ GNE_TAG_RIDE_BUSSTOP
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LINES
@ 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:269
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:215
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
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
void resetDefaultValues()
reset attribute carrier to their default values
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
An Element which don't belongs to GNENet but has influency in the simulation.
Problem isPersonPlanValid() const
check if person plan is valid
Position getPathElementArrivalPos() const
get path element arrival position
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
std::string getPersonPlanProblem() const
get person plan problem
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
Problem
enum class for demandElement problems
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
static const double myPersonPlanArrivalPositionDiameter
person plans arrival position radius
bool drawPersonPlan() const
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
move operation
move result
double newFirstPos
new first position
double newSecondPos
new second position
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
void forceDrawPath(const GUIVisualizationSettings &s, const PathElement *pathElement) const
force draw path (used carefully, ONLY when we're inspecting a path element, due slowdowns)
void calculatePathLanes(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNELane * > lanes)
calculate path lanes (using dijkstra, require path calculator updated)
bool isPathValid(const PathElement *pathElement) const
check if path element is valid
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERide.cpp:322
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNERide.cpp:482
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNERide.cpp:258
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERide.cpp:184
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNERide.cpp:157
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNERide.cpp:218
SUMOVehicleClass getVClass() const
Definition: GNERide.cpp:163
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNERide.cpp:151
GNERide(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNERide.cpp:36
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERide.cpp:464
double myArrivalPosition
arrival position
Definition: GNERide.h:239
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERide.cpp:202
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNERide.cpp:555
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERide.cpp:224
std::string getParentName() const
Returns the name of the parent object.
Definition: GNERide.cpp:190
~GNERide()
destructor
Definition: GNERide.cpp:63
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNERide.cpp:67
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERide.cpp:442
void updateGeometry()
update pre-computed geometry information
Definition: GNERide.cpp:175
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNERide.cpp:145
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNERide.cpp:86
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERide.cpp:407
const RGBColor & getColor() const
get color
Definition: GNERide.cpp:169
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNERide.cpp:337
std::vector< std::string > myLines
valid line or vehicle ids or ANY
Definition: GNERide.h:242
GNELane * getLastPathLane() const
get last path lane
Definition: GNERide.cpp:278
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNERide.cpp:196
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERide.cpp:454
void computePathElement()
compute pathElement
Definition: GNERide.cpp:231
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:358
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNERide.cpp:289
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNERide.cpp:540
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNERide.cpp:546
GNELane * getFirstPathLane() const
get first path lane
Definition: GNERide.cpp:272
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERide.cpp:448
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERide.cpp:470
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNERide.cpp:111
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
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 end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
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 getPositionInformation() const
Returns the cursor's x/y position within the network.
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:61
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:248
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, 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:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:257
A list of positions.
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element