Eclipse SUMO - Simulation of Urban MObility
GNETransport.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 transports 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 "GNETransport.h"
30 #include "GNERoute.h"
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
36 
38  GNEDemandElement("", net, GLO_TRANSPORT, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
39 {}, {}, {}, {}, {}, {}, {}, {}),
40 myArrivalPosition(0) {
41  // reset default values
43 }
44 
45 
46 GNETransport::GNETransport(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEEdge* toEdge, const std::vector<std::string>& lines, const double arrivalPosition) :
47  GNEDemandElement(containerParent, net, GLO_TRANSPORT, GNE_TAG_TRANSPORT_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
48 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {containerParent}, {}),
49 myLines(lines),
50 myArrivalPosition(arrivalPosition) {
51 }
52 
53 
54 GNETransport::GNETransport(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEAdditional* toContainerStop, const std::vector<std::string>& lines, const double arrivalPosition) :
55  GNEDemandElement(containerParent, net, GLO_TRANSPORT, GNE_TAG_TRANSPORT_CONTAINERSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
56 {}, {fromEdge}, {}, {toContainerStop}, {}, {}, {containerParent}, {}),
57 myLines(lines),
58 myArrivalPosition(arrivalPosition) {
59 }
60 
61 
63 
64 
67  // avoid move container plan that ends in containerStop
68  if (getParentAdditionals().size() > 0) {
69  return nullptr;
70  }
71  // get geometry end pos
72  const Position geometryEndPos = getPathElementArrivalPos();
73  // calculate circle width squared
75  // check if we clicked over a geometry end pos
76  if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= ((circleWidthSquared + 2))) {
77  // continue depending of parent edges
78  if (getParentEdges().size() > 0) {
79  return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
80  } else {
81  return new GNEMoveOperation(this, getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
82  }
83  } else {
84  return nullptr;
85  }
86 }
87 
88 
91  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
92  // build header
93  buildPopupHeader(ret, app);
94  // build menu command for center button and copy cursor position to clipboard
96  buildPositionCopyEntry(ret, false);
97  // buld menu commands for names
98  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
99  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
100  new FXMenuSeparator(ret);
101  // build selection and show parameters menu
104  // show option to open demand element dialog
105  if (myTagProperty.hasDialog()) {
106  GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
107  new FXMenuSeparator(ret);
108  }
109  GUIDesigns::buildFXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
110  return ret;
111 }
112 
113 
114 void
116  // open tag
117  device.openTag(SUMO_TAG_TRANSPORT);
118  // check if from attribute is enabled
120  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
121  }
122  // write to depending if containerplan ends in a containerStop
123  if (getParentAdditionals().size() > 0) {
125  } else {
126  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
127  }
128  // only write arrivalPos if is different of -1
129  if (myArrivalPosition != -1) {
131  }
132  // write parameters
133  writeParams(device);
134  // close tag
135  device.closeTag();
136 }
137 
138 
141  if (getParentEdges().size() == 2) {
142  if (getParentEdges().at(0) == getParentEdges().at(1)) {
143  // from and to are the same edges, then path is valid
144  return Problem::OK;
145  } else {
146  // check if exist a route between parent edges
148  return Problem::OK;
149  } else {
150  return Problem::INVALID_PATH;
151  }
152  }
153  } else {
154  return Problem::INVALID_ELEMENT;;
155  }
156 }
157 
158 
159 std::string
161  if (getParentEdges().size() == 0) {
162  return ("A transport need at least one edge");
163  } else {
164  // check if exist at least a connection between every edge
165  for (int i = 1; i < (int)getParentEdges().size(); i++) {
167  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
168  }
169  }
170  // there is connections bewteen all edges, then all ok
171  return "";
172  }
173 }
174 
175 
176 void
178  // currently the only solution is removing Transport
179 }
180 
181 
184  return getParentDemandElements().front()->getVClass();
185 }
186 
187 
188 const RGBColor&
190  return getParentDemandElements().front()->getColor();
191 }
192 
193 
194 void
196  // update child demand elementss
197  for (const auto& i : getChildDemandElements()) {
198  i->updateGeometry();
199  }
200 }
201 
202 
203 Position
205  return getParentEdges().front()->getPositionInView();
206 }
207 
208 
209 std::string
211  return getParentDemandElements().front()->getID();
212 }
213 
214 
215 double
217  return 1;
218 }
219 
220 
221 Boundary
223  Boundary transportBoundary;
224  // return the combination of all parent edges's boundaries
225  for (const auto& i : getParentEdges()) {
226  transportBoundary.add(i->getCenteringBoundary());
227  }
228  // check if is valid
229  if (transportBoundary.isInitialised()) {
230  return transportBoundary;
231  } else {
232  return Boundary(-0.1, -0.1, 0.1, 0.1);
233  }
234 }
235 
236 
237 void
238 GNETransport::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
239  // Nothing to do
240 }
241 
242 
243 void
245  // Transports are drawn in drawPartialGL
246 }
247 
248 
249 void
251  // calculate path
253  // update geometry
254  updateGeometry();
255 }
256 
257 
258 void
259 GNETransport::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
260  // draw container plan over lane
262 }
263 
264 
265 void
266 GNETransport::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
267  // draw container plan over junction
268  drawPersonPlanPartial(drawContainerPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.transportWidth, s.colorSettings.transportColor);
269 }
270 
271 
272 GNELane*
274  return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
275 }
276 
277 
278 GNELane*
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 container 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();
299  return getParentAdditionals().back()->getID();
300  // specific container plan attributes
302  if (myArrivalPosition == -1) {
303  return "";
304  } else {
305  return toString(myArrivalPosition);
306  }
307  case SUMO_ATTR_LINES:
308  return joinToString(myLines, " ");
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 doubleattribute 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 GNETransport::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
359  if (value == getAttribute(key)) {
360  return; //avoid needless changes, later logic relies on the fact that attributes have changed
361  }
362  switch (key) {
363  // Common container plan attributes
364  case SUMO_ATTR_FROM:
366  case SUMO_ATTR_LINES:
367  case GNE_ATTR_SELECTED:
368  case GNE_ATTR_PARAMETERS:
369  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
370  break;
371  // special case for "to" attributes
372  case SUMO_ATTR_TO: {
373  // get next containerPlan
374  GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
375  // continue depending of nextContainerPlan
376  if (nextContainerPlan) {
377  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
378  nextContainerPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
379  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
380  undoList->end();
381  } else {
382  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
383  }
384  break;
385  }
387  // get next container plan
388  GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
389  // continue depending of nextContainerPlan
390  if (nextContainerPlan) {
391  // obtain containerStop
393  // change from attribute using edge ID
394  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
395  nextContainerPlan->setAttribute(SUMO_ATTR_FROM, containerStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
396  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
397  undoList->end();
398  } else {
399  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
400  }
401  break;
402  }
403  default:
404  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
405  }
406 }
407 
408 
409 bool
410 GNETransport::isValid(SumoXMLAttr key, const std::string& value) {
411  switch (key) {
412  // Common container plan attributes
413  case SUMO_ATTR_FROM:
414  case SUMO_ATTR_TO:
415  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
417  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
418  // specific container plan attributes
420  if (value.empty()) {
421  return true;
422  } else if (canParse<double>(value)) {
423  const double parsedValue = canParse<double>(value);
424  if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
425  return false;
426  } else {
427  return true;
428  }
429  } else {
430  return false;
431  }
432  case SUMO_ATTR_LINES:
433  return canParse<std::vector<std::string> >(value);
434  case GNE_ATTR_SELECTED:
435  return canParse<bool>(value);
436  case GNE_ATTR_PARAMETERS:
437  return Parameterised::areParametersValid(value);
438  default:
439  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
440  }
441 }
442 
443 
444 void
446  //
447 }
448 
449 
450 void
452  //
453 }
454 
455 
456 bool
458  if (key == SUMO_ATTR_FROM) {
459  return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
460  } else {
461  return true;
462  }
463 }
464 
465 
466 std::string
468  return getTagStr();
469 }
470 
471 
472 std::string
475  return "transport: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
477  return "transport: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
478  } else {
479  throw ("Invalid transport tag");
480  }
481 }
482 
483 
484 const std::map<std::string, std::string>&
486  return getParametersMap();
487 }
488 
489 // ===========================================================================
490 // private
491 // ===========================================================================
492 
493 void
494 GNETransport::setAttribute(SumoXMLAttr key, const std::string& value) {
495  switch (key) {
496  // Common container plan attributes
497  case SUMO_ATTR_FROM:
498  // change first edge
499  replaceFirstParentEdge(value);
500  // compute transport
502  break;
503  case SUMO_ATTR_TO:
504  // change last edge
505  replaceLastParentEdge(value);
506  // compute transport
508  break;
511  // compute transport
513  break;
514  // specific container plan attributes
516  if (value.empty()) {
517  myArrivalPosition = -1;
518  } else {
519  myArrivalPosition = parse<double>(value);
520  }
521  updateGeometry();
522  break;
523  case SUMO_ATTR_LINES:
524  myLines = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
525  break;
526  case GNE_ATTR_SELECTED:
527  if (parse<bool>(value)) {
529  } else {
531  }
532  break;
533  case GNE_ATTR_PARAMETERS:
534  setParametersStr(value);
535  break;
536  default:
537  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
538  }
539 }
540 
541 
542 void
543 GNETransport::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
544  // nothing to toogle
545 }
546 
547 
548 void
550  // change both position
551  myArrivalPosition = moveResult.newFirstPos;
552  // update geometry
553  updateGeometry();
554 }
555 
556 
557 void
559  undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
560  // now adjust start position
561  setAttribute(SUMO_ATTR_ARRIVALPOS, toString(moveResult.newFirstPos), undoList);
562  undoList->end();
563 }
564 
565 /****************************************************************************/
@ 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_TRANSPORT
a container transport
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_TRANSPORT_CONTAINERSTOP
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_TRANSPORT
@ GNE_TAG_TRANSPORT_EDGE
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LINES
@ GNE_ATTR_TO_CONTAINERSTOP
to busStop (used by containerPlans)
@ SUMO_ATTR_CONTAINER_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"
@ 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.
Position getPathElementArrivalPos() const
get path element arrival position
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
bool drawContainerPlan() const
check if container plan can be drawn
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
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
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
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
std::vector< GNEEdge * > calculateDijkstraPath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra path between a list of partial edges
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void calculatePathLanes(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNELane * > lanes)
calculate path lanes (using dijkstra, require path calculator updated)
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
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNELane * getLastPathLane() const
get last path lane
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void computePathElement()
compute pathElement
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
GNELane * getFirstPathLane() const
get first path lane
Position getAttributePosition(SumoXMLAttr key) const
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNEMoveOperation * getMoveOperation()
get move operation
const RGBColor & getColor() const
get color
double myArrivalPosition
arrival position
Definition: GNETransport.h:238
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNETransport(SumoXMLTag tag, GNENet *net)
default constructor
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
double getAttributeDouble(SumoXMLAttr key) const
bool isAttributeEnabled(SumoXMLAttr key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
std::vector< std::string > myLines
The list of lines that are assigned to this stop.
Definition: GNETransport.h:235
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
std::string getParentName() const
Returns the name of the parent object.
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNETransport()
destructor
SUMOVehicleClass getVClass() const
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Position getPositionInView() const
Returns position of additional in view.
void updateGeometry()
update pre-computed geometry information
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
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
RGBColor transportColor
color for transport