Eclipse SUMO - Simulation of Urban MObility
GNETranship.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 tranships 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 "GNETranship.h"
30 #include "GNERoute.h"
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
36 
38  GNEDemandElement("", net, GLO_TRANSHIP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
39 {}, {}, {}, {}, {}, {}, {}, {}),
40 mySpeed(0),
41 myDepartPosition(0),
42 myArrivalPosition(0) {
43  // reset default values
44  resetDefaultValues();
45 }
46 
47 
48 GNETranship::GNETranship(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEEdge* toEdge,
49  const double speed, const double departPosition, const double arrivalPosition) :
50  GNEDemandElement(containerParent, net, GLO_TRANSHIP, GNE_TAG_TRANSHIP_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
51 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {containerParent}, {}),
52 mySpeed(speed),
53 myDepartPosition(departPosition),
54 myArrivalPosition(arrivalPosition) {
55 }
56 
57 
58 GNETranship::GNETranship(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEAdditional* toContainerStop,
59  const double speed, const double departPosition, const double arrivalPosition) :
60  GNEDemandElement(containerParent, net, GLO_TRANSHIP, GNE_TAG_TRANSHIP_CONTAINERSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
61 {}, {fromEdge}, {}, {toContainerStop}, {}, {}, {containerParent}, {}),
62 mySpeed(speed),
63 myDepartPosition(departPosition),
64 myArrivalPosition(arrivalPosition) {
65 }
66 
67 
68 GNETranship::GNETranship(GNENet* net, GNEDemandElement* containerParent, std::vector<GNEEdge*> edges,
69  const double speed, const double departPosition, const double arrivalPosition) :
70  GNEDemandElement(containerParent, net, GLO_TRANSHIP, GNE_TAG_TRANSHIP_EDGES, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
71 {}, {edges}, {}, {}, {}, {}, {containerParent}, {}),
72 mySpeed(speed),
73 myDepartPosition(departPosition),
74 myArrivalPosition(arrivalPosition) {
75 }
76 
77 
79 
80 
83  // avoid move container plan that ends in containerStop
84  if (getParentAdditionals().size() > 0) {
85  return nullptr;
86  }
87  // get geometry end pos
88  const Position geometryEndPos = getPathElementArrivalPos();
89  // calculate circle width squared
91  // check if we clicked over a geometry end pos
92  if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= ((circleWidthSquared + 2))) {
93  // continue depending of parent edges
94  if (getParentEdges().size() > 0) {
95  return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
96  } else {
97  return new GNEMoveOperation(this, getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
98  }
99  } else {
100  return nullptr;
101  }
102 }
103 
104 
107  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
108  // build header
109  buildPopupHeader(ret, app);
110  // build menu command for center button and copy cursor position to clipboard
112  buildPositionCopyEntry(ret, false);
113  // buld menu commands for names
114  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
115  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
116  new FXMenuSeparator(ret);
117  // build selection and show parameters menu
120  // show option to open demand element dialog
121  if (myTagProperty.hasDialog()) {
122  GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
123  new FXMenuSeparator(ret);
124  }
125  GUIDesigns::buildFXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
126  return ret;
127 }
128 
129 
130 void
132  // open tag
133  device.openTag(SUMO_TAG_TRANSHIP);
134  // write attributes depending of tranship type
137  } else {
138  // check if from attribute is enabled
140  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
141  }
142  // write to depending if containerplan ends in a containerStop
143  if (getParentAdditionals().size() > 0) {
145  } else {
146  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
147  }
148  }
149  // only write arrivalPos if is different of -1
150  if (myArrivalPosition != -1) {
152  }
153  // write parameters
154  writeParams(device);
155  // close tag
156  device.closeTag();
157 }
158 
159 
162  if (getParentEdges().size() == 2) {
163  if (getParentEdges().at(0) == getParentEdges().at(1)) {
164  // from and to are the same edges, then path is valid
165  return Problem::OK;
166  } else {
167  // check if exist a route between parent edges
169  return Problem::OK;
170  } else {
171  return Problem::INVALID_PATH;
172  }
173  }
174  } else {
176  }
177 }
178 
179 
180 std::string
182  if (getParentEdges().size() == 0) {
183  return ("A tranship need at least one edge");
184  } else {
185  // check if exist at least a connection between every edge
186  for (int i = 1; i < (int)getParentEdges().size(); i++) {
188  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
189  }
190  }
191  // there is connections bewteen all edges, then all ok
192  return "";
193  }
194 }
195 
196 
197 void
199  // currently the only solution is removing Tranship
200 }
201 
202 
205  return getParentDemandElements().front()->getVClass();
206 }
207 
208 
209 const RGBColor&
211  return getParentDemandElements().front()->getColor();
212 }
213 
214 
215 void
217  // update child demand elementss
218  for (const auto& i : getChildDemandElements()) {
219  i->updateGeometry();
220  }
221 }
222 
223 
224 Position
226  return getParentEdges().front()->getPositionInView();
227 }
228 
229 
230 std::string
232  return getParentDemandElements().front()->getID();
233 }
234 
235 
236 double
238  return 1;
239 }
240 
241 
242 Boundary
244  Boundary transhipBoundary;
245  // return the combination of all parent edges's boundaries
246  for (const auto& i : getParentEdges()) {
247  transhipBoundary.add(i->getCenteringBoundary());
248  }
249  // check if is valid
250  if (transhipBoundary.isInitialised()) {
251  return transhipBoundary;
252  } else {
253  return Boundary(-0.1, -0.1, 0.1, 0.1);
254  }
255 }
256 
257 
258 void
259 GNETranship::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
260  // only split geometry of TranshipEdges
262  // obtain new list of tranship edges
263  std::string newTranshipEdges = getNewListOfParents(originalElement, newElement);
264  // update tranship edges
265  if (newTranshipEdges.size() > 0) {
266  setAttribute(SUMO_ATTR_EDGES, newTranshipEdges, undoList);
267  }
268  }
269 }
270 
271 
272 void
274  // Tranships are drawn in drawPartialGL
275 }
276 
277 
278 void
280  // update lanes depending of tranship tag
282  // calculate consecutive path using parent edges
284  } else {
285  // calculate path
287  }
288  // update geometry
289  updateGeometry();
290 }
291 
292 
293 void
294 GNETranship::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
295  // draw container plan over lane
297 }
298 
299 
300 void
301 GNETranship::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
302  // draw container plan over junction
303  drawPersonPlanPartial(drawContainerPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.transhipWidth, s.colorSettings.transhipColor);
304 }
305 
306 
307 GNELane*
309  return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
310 }
311 
312 
313 GNELane*
315  if (getParentAdditionals().size() > 0) {
316  return getParentAdditionals().front()->getParentLanes().front();
317  } else {
318  return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
319  }
320 }
321 
322 
323 std::string
325  switch (key) {
326  // Common container plan attributes
327  case SUMO_ATTR_ID:
328  return getParentDemandElements().front()->getID();
329  case SUMO_ATTR_FROM:
330  return getParentEdges().front()->getID();
331  case SUMO_ATTR_TO:
332  return getParentEdges().back()->getID();
334  return getParentAdditionals().back()->getID();
335  case SUMO_ATTR_EDGES:
336  return parseIDs(getParentEdges());
337  // specific container plan attributes
338  case SUMO_ATTR_SPEED:
339  return toString(mySpeed);
340  case SUMO_ATTR_DEPARTPOS:
341  if (myDepartPosition == -1) {
342  return "";
343  } else {
344  return toString(myDepartPosition);
345  }
347  if (myArrivalPosition == -1) {
348  return "";
349  } else {
350  return toString(myArrivalPosition);
351  }
352  case GNE_ATTR_SELECTED:
354  case GNE_ATTR_PARAMETERS:
355  return getParametersStr();
356  case GNE_ATTR_PARENT:
357  return getParentDemandElements().front()->getID();
358  default:
359  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
360  }
361 }
362 
363 
364 double
366  switch (key) {
368  if (myArrivalPosition != -1) {
369  return myArrivalPosition;
370  } else {
371  return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
372  }
373  default:
374  throw InvalidArgument(getTagStr() + " doesn't have a doubleattribute of type '" + toString(key) + "'");
375  }
376 }
377 
378 
379 Position
381  switch (key) {
382  case SUMO_ATTR_ARRIVALPOS: {
383  // get lane shape
384  const PositionVector& laneShape = getLastPathLane()->getLaneShape();
385  // continue depending of arrival position
386  if (myArrivalPosition == 0) {
387  return laneShape.front();
388  } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
389  return laneShape.back();
390  } else {
391  return laneShape.positionAtOffset2D(myArrivalPosition);
392  }
393  }
394  default:
395  throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
396  }
397 }
398 
399 
400 void
401 GNETranship::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
402  if (value == getAttribute(key)) {
403  return; //avoid needless changes, later logic relies on the fact that attributes have changed
404  }
405  switch (key) {
406  // Common container plan attributes
407  case SUMO_ATTR_FROM:
408  case SUMO_ATTR_SPEED:
409  case SUMO_ATTR_DEPARTPOS:
411  case GNE_ATTR_SELECTED:
412  case GNE_ATTR_PARAMETERS:
413  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
414  break;
415  // special case for "to" attributes
416  case SUMO_ATTR_TO: {
417  // get next containerPlan
418  GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
419  // continue depending of nextContainerPlan
420  if (nextContainerPlan) {
421  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
422  nextContainerPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
423  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
424  undoList->end();
425  } else {
426  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
427  }
428  break;
429  }
431  // get next container plan
432  GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
433  // continue depending of nextContainerPlan
434  if (nextContainerPlan) {
435  // obtain containerStop
437  // change from attribute using edge ID
438  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
439  nextContainerPlan->setAttribute(SUMO_ATTR_FROM, containerStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
440  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
441  undoList->end();
442  } else {
443  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
444  }
445  break;
446  }
447  case SUMO_ATTR_EDGES: {
448  // get next container plan
449  GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
450  // continue depending of nextContainerPlan
451  if (nextContainerPlan) {
452  // obtain edges
453  const std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
454  // change from attribute using edge ID
455  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
456  nextContainerPlan->setAttribute(SUMO_ATTR_FROM, edges.back()->getID(), undoList);
457  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
458  undoList->end();
459  } else {
460  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
461  }
462  break;
463  }
464  default:
465  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
466  }
467 }
468 
469 
470 bool
471 GNETranship::isValid(SumoXMLAttr key, const std::string& value) {
472  switch (key) {
473  // Common container plan attributes
474  case SUMO_ATTR_FROM:
475  case SUMO_ATTR_TO:
476  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
478  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
479  case SUMO_ATTR_EDGES:
480  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
481  // all edges exist, then check if compounds a valid route
482  return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
483  } else {
484  return false;
485  }
486  // specific container plan attributes
487  case SUMO_ATTR_SPEED:
488  return canParse<double>(value) && (parse<double>(value) >= 0);
489  case SUMO_ATTR_DEPARTPOS:
490  if (value.empty()) {
491  return true;
492  } else if (canParse<double>(value)) {
493  const double parsedValue = canParse<double>(value);
494  if ((parsedValue < 0) || (parsedValue > getFirstPathLane()->getLaneShape().length())) {
495  return false;
496  } else {
497  return true;
498  }
499  } else {
500  return false;
501  }
503  if (value.empty()) {
504  return true;
505  } else if (canParse<double>(value)) {
506  const double parsedValue = canParse<double>(value);
507  if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
508  return false;
509  } else {
510  return true;
511  }
512  } else {
513  return false;
514  }
515  case GNE_ATTR_SELECTED:
516  return canParse<bool>(value);
517  case GNE_ATTR_PARAMETERS:
518  return Parameterised::areParametersValid(value);
519  default:
520  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
521  }
522 }
523 
524 
525 void
527  //
528 }
529 
530 
531 void
533  //
534 }
535 
536 
537 bool
539  if (key == SUMO_ATTR_FROM) {
540  return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
541  } else {
542  return true;
543  }
544 }
545 
546 
547 std::string
549  return getTagStr();
550 }
551 
552 
553 std::string
556  return "tranship: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
558  return "tranship: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
559  } else if (myTagProperty.getTag() == GNE_TAG_TRANSHIP_EDGES) {
560  return "tranship: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
561  } else {
562  throw ("Invalid tranship tag");
563  }
564 }
565 
566 
567 const std::map<std::string, std::string>&
569  return getParametersMap();
570 }
571 
572 // ===========================================================================
573 // private
574 // ===========================================================================
575 
576 void
577 GNETranship::setAttribute(SumoXMLAttr key, const std::string& value) {
578  switch (key) {
579  // Common container plan attributes
580  case SUMO_ATTR_FROM:
581  // change first edge
582  replaceFirstParentEdge(value);
583  // compute tranship
585  break;
586  case SUMO_ATTR_TO:
587  // change last edge
588  replaceLastParentEdge(value);
589  // compute tranship
591  break;
594  // compute tranship
596  break;
597  case SUMO_ATTR_EDGES:
599  // compute tranship
601  break;
602  // specific container plan attributes
603  case SUMO_ATTR_SPEED:
604  mySpeed = parse<double>(value);
605  break;
606  case SUMO_ATTR_DEPARTPOS:
607  if (value.empty()) {
608  myDepartPosition = -1;
609  } else {
610  myDepartPosition = parse<double>(value);
611  }
612  updateGeometry();
613  break;
615  if (value.empty()) {
616  myArrivalPosition = -1;
617  } else {
618  myArrivalPosition = parse<double>(value);
619  }
620  updateGeometry();
621  break;
622  case GNE_ATTR_SELECTED:
623  if (parse<bool>(value)) {
625  } else {
627  }
628  break;
629  case GNE_ATTR_PARAMETERS:
630  setParametersStr(value);
631  break;
632  default:
633  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
634  }
635 }
636 
637 
638 void
639 GNETranship::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
640  // nothing to toogle
641 }
642 
643 
644 void
646  // change both position
647  myArrivalPosition = moveResult.newFirstPos;
648  // update geometry
649  updateGeometry();
650 }
651 
652 
653 void
655  undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
656  // now adjust start position
657  setAttribute(SUMO_ATTR_ARRIVALPOS, toString(moveResult.newFirstPos), undoList);
658  undoList->end();
659 }
660 
661 /****************************************************************************/
@ 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_TRANSHIP
a container tranship
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRANSHIP
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ GNE_TAG_TRANSHIP_EDGES
@ GNE_TAG_TRANSHIP_EDGE
@ GNE_TAG_TRANSHIP_CONTAINERSTOP
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_TO_CONTAINERSTOP
to busStop (used by containerPlans)
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_CONTAINER_STOP
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_ID
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
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
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
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
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.
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
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
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
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 calculateConsecutivePathEdges(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > edges)
calculate consecutive path edges
void calculatePathLanes(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNELane * > lanes)
calculate path lanes (using dijkstra, require path calculator updated)
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition: GNERoute.cpp:725
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 drawGL(const GUIVisualizationSettings &s) const
Draws the object.
~GNETranship()
destructor
Definition: GNETranship.cpp:78
SUMOVehicleClass getVClass() const
double mySpeed
speed
Definition: GNETranship.h:253
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNELane * getFirstPathLane() const
get first path lane
GNETranship(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNETranship.cpp:37
bool isAttributeEnabled(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
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.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position getAttributePosition(SumoXMLAttr key) const
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNETranship.cpp:82
Position getPositionInView() const
Returns position of additional in view.
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 setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getAttributeDouble(SumoXMLAttr key) const
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double myArrivalPosition
arrival position
Definition: GNETranship.h:259
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
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
std::string getParentName() const
Returns the name of the parent object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNELane * getLastPathLane() const
get last path lane
const RGBColor & getColor() const
get color
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
double myDepartPosition
depart position
Definition: GNETranship.h:256
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 transhipColor
color for tranships