Eclipse SUMO - Simulation of Urban MObility
GNEDemandElement.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A abstract class for demand elements
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <netbuild/NBNetBuilder.h>
25 #include <netedit/GNENet.h>
26 #include <netedit/GNEViewNet.h>
32 
33 #include "GNEDemandElement.h"
34 
35 // ===========================================================================
36 // static members
37 // ===========================================================================
38 
40 
41 // ===========================================================================
42 // member method definitions
43 // ===========================================================================
44 
45 // ---------------------------------------------------------------------------
46 // GNEDemandElement::DemandElementGeometry - methods
47 // ---------------------------------------------------------------------------
48 
50 
51 
52 void
54  shape.clear();
55  shapeRotations.clear();
56  shapeLengths.clear();
57 }
58 
59 
60 void
62  // Get number of parts of the shape
63  int numberOfSegments = (int)shape.size() - 1;
64  // If number of segments is more than 0
65  if (numberOfSegments >= 0) {
66  // Reserve memory (To improve efficiency)
67  shapeRotations.reserve(numberOfSegments);
68  shapeLengths.reserve(numberOfSegments);
69  // For every part of the shape
70  for (int i = 0; i < numberOfSegments; ++i) {
71  // Obtain first position
72  const Position& f = shape[i];
73  // Obtain next position
74  const Position& s = shape[i + 1];
75  // Save distance between position into myShapeLengths
76  shapeLengths.push_back(f.distanceTo(s));
77  // Save rotation (angle) of the vector constructed by points f and s
78  shapeRotations.push_back((double)atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double)M_PI);
79  }
80  }
81 }
82 
83 // ---------------------------------------------------------------------------
84 // GNEDemandElement::DemandElementSegmentGeometry::Segment - methods
85 // ---------------------------------------------------------------------------
86 
87 GNEDemandElement::DemandElementSegmentGeometry::Segment::Segment(const GNEDemandElement* _element, const GNEEdge* _edge, const Position _pos, const bool _visible, const bool _valid) :
88  element(_element),
89  edge(_edge),
90  junction(nullptr),
91  pos(_pos),
92  visible(_visible),
93  valid(_valid),
94  length(-1),
95  rotation(0) {
96 }
97 
98 
99 GNEDemandElement::DemandElementSegmentGeometry::Segment::Segment(const GNEDemandElement* _element, const GNEEdge* _edge, const Position _pos, double _length, double _rotation, const bool _visible, const bool _valid) :
100  element(_element),
101  edge(_edge),
102  junction(nullptr),
103  pos(_pos),
104  visible(_visible),
105  valid(_valid),
106  length(_length),
107  rotation(_rotation) {
108 }
109 
110 
111 GNEDemandElement::DemandElementSegmentGeometry::Segment::Segment(const GNEDemandElement* _element, const GNEJunction* _junction, const Position _pos, const bool _visible, const bool _valid) :
112  element(_element),
113  edge(nullptr),
114  junction(_junction),
115  pos(_pos),
116  visible(_visible),
117  valid(_valid),
118  length(-1),
119  rotation(0) {
120 }
121 
122 
123 // ---------------------------------------------------------------------------
124 // GNEDemandElement::DemandElementGeometry - methods
125 // ---------------------------------------------------------------------------
126 
128  geometryDeprecated(true) {
129 }
130 
131 
132 void
133 GNEDemandElement::DemandElementSegmentGeometry::insertEdgeSegment(const GNEDemandElement* element, const GNEEdge* edge, const Position pos, const bool visible, const bool valid) {
134  // add segment in myShapeSegments
135  myShapeSegments.push_back(Segment(element, edge, pos, visible, valid));
136 }
137 
138 
139 void
140 GNEDemandElement::DemandElementSegmentGeometry::insertEdgeLengthRotSegment(const GNEDemandElement* element, const GNEEdge* edge, const Position pos, double length, double rotation, const bool visible, const bool valid) {
141  // add segment in myShapeSegments
142  myShapeSegments.push_back(Segment(element, edge, pos, length, rotation, visible, valid));
143 }
144 
145 
146 void
147 GNEDemandElement::DemandElementSegmentGeometry::insertJunctionSegment(const GNEDemandElement* element, const GNEJunction* junction, const Position pos, const bool visible, const bool valid) {
148  // add segment in myShapeSegments
149  myShapeSegments.push_back(Segment(element, junction, pos, visible, valid));
150 }
151 
152 
153 void
155  // clear segments
156  myShapeSegments.clear();
157 }
158 
159 
160 void
162  // Get number of parts of the shapeSegments
163  int numberOfSegments = (int)myShapeSegments.size() - 1;
164  // If number of segments is more than 0
165  if (numberOfSegments >= 0) {
166  // Iterate over every segment
167  for (int i = 0; i < numberOfSegments; ++i) {
168  // check if length and rotation has to be calculated
169  if (myShapeSegments[i].length == -1) {
170  // Obtain first position
171  const Position& f = myShapeSegments[i].pos;
172  // Obtain next position
173  const Position& s = myShapeSegments[i + 1].pos;
174  // Save distance between position into myShapeLengths
175  myShapeSegments[i].length = f.distanceTo2D(s);
176  // Save rotation (angle) of the vector constructed by points f and s
177  myShapeSegments[i].rotation = ((double)atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double)M_PI);
178  }
179  }
180  }
181 }
182 
183 
184 std::vector<GNEDemandElement::DemandElementSegmentGeometry::Segment>::const_iterator
186  return myShapeSegments.cbegin();
187 }
188 
189 
190 std::vector<GNEDemandElement::DemandElementSegmentGeometry::Segment>::const_iterator
192  return myShapeSegments.cend();
193 }
194 
195 // ---------------------------------------------------------------------------
196 // GNEDemandElement::RouteCalculator - methods
197 // ---------------------------------------------------------------------------
198 
200  myNet(net) {
203  true, &NBRouterEdge::getTravelTimeStatic, nullptr, true);
204 }
205 
206 
208  delete myDijkstraRouter;
209 }
210 
211 
212 void
214  // simply delete and create myDijkstraRouter again
215  if (myDijkstraRouter) {
216  delete myDijkstraRouter;
217  }
220  true, &NBRouterEdge::getTravelTimeStatic, nullptr, true);
221 }
222 
223 
224 std::vector<GNEEdge*>
225 GNEDemandElement::RouteCalculator::calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector<GNEEdge*>& partialEdges) const {
226  // declare a solution vector
227  std::vector<GNEEdge*> solution;
228  // calculate route depending of number of partial edges
229  if (partialEdges.size() == 1) {
230  // if there is only one partialEdges, route has only one edge
231  solution.push_back(partialEdges.front());
232  } else {
233  // declare temporal vehicle
234  NBVehicle tmpVehicle("temporalNBVehicle", vClass);
235  // obtain pointer to GNENet
236  GNENet* net = partialEdges.front()->getNet();
237  // iterate over every selected edges
238  for (int i = 1; i < (int)partialEdges.size(); i++) {
239  // declare a temporal route in which save route between two last edges
240  std::vector<const NBRouterEdge*> partialRoute;
241  myDijkstraRouter->compute(partialEdges.at(i - 1)->getNBEdge(), partialEdges.at(i)->getNBEdge(), &tmpVehicle, 10, partialRoute);
242  // save partial route in solution
243  for (const auto& j : partialRoute) {
244  solution.push_back(net->retrieveEdge(j->getID()));
245  }
246  }
247  }
248  // filter solution
249  auto solutionIt = solution.begin();
250  // iterate over solution
251  while (solutionIt != solution.end()) {
252  if ((solutionIt + 1) != solution.end()) {
253  // if next edge is the same of current edge, remove it
254  if (*solutionIt == *(solutionIt + 1)) {
255  solutionIt = solution.erase(solutionIt);
256  } else {
257  solutionIt++;
258  }
259  } else {
260  solutionIt++;
261  }
262  }
263  return solution;
264 }
265 
266 
267 std::vector<GNEEdge*>
268 GNEDemandElement::RouteCalculator::calculateDijkstraRoute(GNENet* net, SUMOVehicleClass vClass, const std::vector<std::string>& partialEdgesStr) const {
269  // declare a vector of GNEEdges
270  std::vector<GNEEdge*> partialEdges;
271  partialEdges.reserve(partialEdgesStr.size());
272  // convert to vector of GNEEdges
273  for (const auto& i : partialEdgesStr) {
274  partialEdges.push_back(net->retrieveEdge(i));
275  }
276  // calculate DijkstraRoute using partialEdges
277  return calculateDijkstraRoute(vClass, partialEdges);
278 }
279 
280 
281 bool
283  // the same edge cannot be consecutive of itself
284  if (from == to) {
285  return false;
286  }
287  // for pedestrian edges are always consecutives
288  if (vClass == SVC_PEDESTRIAN) {
289  return true;
290  }
291  // obtain NBEdges from both edges
292  NBEdge* nbFrom = from->getNBEdge();
293  NBEdge* nbTo = to->getNBEdge();
294  // iterate over all connections of NBFrom
295  for (NBEdge::Connection c : nbFrom->getConnectionsFromLane(-1, nbTo, -1)) {
296  //check if given VClass is allowed for from and to lanes
297  if ((nbFrom->getPermissions(c.fromLane) & nbTo->getPermissions(c.toLane) & vClass) == vClass) {
298  return true;
299  }
300  }
301  return false;
302 }
303 
304 // ---------------------------------------------------------------------------
305 // GNEDemandElement - methods
306 // ---------------------------------------------------------------------------
307 
308 GNEDemandElement::GNEDemandElement(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag,
309  const std::vector<GNEEdge*>& edgeParents,
310  const std::vector<GNELane*>& laneParents,
311  const std::vector<GNEShape*>& shapeParents,
312  const std::vector<GNEAdditional*>& additionalParents,
313  const std::vector<GNEDemandElement*>& demandElementParents,
314  const std::vector<GNEEdge*>& edgeChildren,
315  const std::vector<GNELane*>& laneChildren,
316  const std::vector<GNEShape*>& shapeChildren,
317  const std::vector<GNEAdditional*>& additionalChildren,
318  const std::vector<GNEDemandElement*>& demandElementChildren) :
319  GUIGlObject(type, id),
320  GNEAttributeCarrier(tag),
321  GNEHierarchicalElementParents(this, edgeParents, laneParents, shapeParents, additionalParents, demandElementParents),
322  GNEHierarchicalElementChildren(this, edgeChildren, laneChildren, shapeChildren, additionalChildren, demandElementChildren),
323  myViewNet(viewNet) {
324 }
325 
326 
328  const std::vector<GNEEdge*>& edgeParents,
329  const std::vector<GNELane*>& laneParents,
330  const std::vector<GNEShape*>& shapeParents,
331  const std::vector<GNEAdditional*>& additionalParents,
332  const std::vector<GNEDemandElement*>& demandElementParents,
333  const std::vector<GNEEdge*>& edgeChildren,
334  const std::vector<GNELane*>& laneChildren,
335  const std::vector<GNEShape*>& shapeChildren,
336  const std::vector<GNEAdditional*>& additionalChildren,
337  const std::vector<GNEDemandElement*>& demandElementChildren) :
338  GUIGlObject(type, demandElementParent->generateChildID(tag)),
339  GNEAttributeCarrier(tag),
340  GNEHierarchicalElementParents(this, edgeParents, laneParents, shapeParents, additionalParents, demandElementParents),
341  GNEHierarchicalElementChildren(this, edgeChildren, laneChildren, shapeChildren, additionalChildren, demandElementChildren),
342  myViewNet(viewNet) {
343 }
344 
345 
346 std::string
348  int counter = (int)getDemandElementChildren().size();
349  while (myViewNet->getNet()->retrieveDemandElement(childTag, getID() + toString(childTag) + toString(counter), false) != nullptr) {
350  counter++;
351  }
352  return (getID() + toString(childTag) + toString(counter));
353 }
354 
355 
357 
358 
362 }
363 
364 
368 }
369 
370 
371 void
374 }
375 
376 
377 bool
379  return true;
380 }
381 
382 
383 std::string
385  return "";
386 }
387 
388 
389 void
391  throw InvalidArgument(getTagStr() + " cannot fix any problem");
392 }
393 
394 
395 void
397  throw InvalidArgument(getTagStr() + " doesn't have an demand element dialog");
398 }
399 
400 
401 std::string
403  throw InvalidArgument(getTagStr() + " doesn't have an begin time");
404 }
405 
406 
407 GNEViewNet*
409  return myViewNet;
410 }
411 
412 
413 void
415  if (myRouteCalculatorInstance == nullptr) {
417  } else {
418  throw ProcessError("Instance already created");
419  }
420 }
421 
422 
423 void
427  myRouteCalculatorInstance = nullptr;
428  } else {
429  throw ProcessError("Instance wasn't created");
430  }
431 }
432 
433 
438  } else {
439  throw ProcessError("Instance wasn't created");
440  }
441 }
442 
443 
446  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
447  // build header
448  buildPopupHeader(ret, app);
449  // build menu command for center button and copy cursor position to clipboard
451  buildPositionCopyEntry(ret, false);
452  // buld menu commands for names
453  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
454  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
455  new FXMenuSeparator(ret);
456  // build selection and show parameters menu
459  // show option to open demand element dialog
460  if (myTagProperty.hasDialog()) {
461  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
462  new FXMenuSeparator(ret);
463  }
464  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
465  return ret;
466 }
467 
468 
471  // Create table
473  // Iterate over attributes
474  for (const auto& i : myTagProperty) {
475  // Add attribute and set it dynamic if aren't unique
476  if (i.isUnique()) {
477  ret->mkItem(i.getAttrStr().c_str(), false, getAttribute(i.getAttr()));
478  } else {
479  ret->mkItem(i.getAttrStr().c_str(), true, getAttribute(i.getAttr()));
480  }
481  }
482  // close building
483  ret->closeBuilding();
484  return ret;
485 }
486 
487 
488 bool
489 GNEDemandElement::isRouteValid(const std::vector<GNEEdge*>& edges, bool report) {
490  if (edges.size() == 0) {
491  // routes cannot be empty
492  return false;
493  } else if (edges.size() == 1) {
494  // routes with a single edge are valid
495  return true;
496  } else {
497  // iterate over edges to check that compounds a chain
498  auto it = edges.begin();
499  while (it != edges.end() - 1) {
500  GNEEdge* currentEdge = *it;
501  GNEEdge* nextEdge = *(it + 1);
502  // consecutive edges aren't allowed
503  if (currentEdge->getID() == nextEdge->getID()) {
504  return false;
505  }
506  // make sure that edges are consecutives
507  if (std::find(currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().begin(),
508  currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().end(),
509  nextEdge) == currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().end()) {
510  if (report) {
511  WRITE_WARNING("Parameter 'Route' invalid. " + currentEdge->getTagStr() + " '" + currentEdge->getID() +
512  "' ins't consecutive to " + nextEdge->getTagStr() + " '" + nextEdge->getID() + "'");
513  }
514  return false;
515  }
516  it++;
517  }
518  }
519  return true;
520 }
521 
522 
523 const std::string&
525  return getMicrosimID();
526 }
527 
528 
529 bool
530 GNEDemandElement::isValidDemandElementID(const std::string& newID) const {
531  if (SUMOXMLDefinitions::isValidVehicleID(newID) && (myViewNet->getNet()->retrieveDemandElement(myTagProperty.getTag(), newID, false) == nullptr)) {
532  return true;
533  } else {
534  return false;
535  }
536 }
537 
538 
539 void
540 GNEDemandElement::changeDemandElementID(const std::string& newID) {
541  if (myViewNet->getNet()->retrieveDemandElement(myTagProperty.getTag(), newID, false) != nullptr) {
542  throw InvalidArgument("An DemandElement with tag " + getTagStr() + " and ID = " + newID + " already exists");
543  } else {
544  // Save old ID
545  std::string oldID = getMicrosimID();
546  // set New ID
547  setMicrosimID(newID);
548  // update demand element ID in the container of net
549  myViewNet->getNet()->updateDemandElementID(oldID, this);
550  }
551 }
552 
553 
554 bool
556  return mySelected;
557 }
558 
559 
560 bool
563  return true;
564  } else {
565  return false;
566  }
567 }
568 
569 
570 bool
572  // throw exception because this function mus be implemented in child (see GNEE3Detector)
573  throw ProcessError("Calling non-implemented function checkDemandElementChildRestriction during saving of " + getTagStr() + ". It muss be reimplemented in child class");
574 }
575 
576 /****************************************************************************/
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
struct for pack all variables related with geometry of elemements divided in segments ...
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
static bool isRouteValid(const std::vector< GNEEdge *> &edges, bool report)
check if a route is valid
Copy object name - popup entry.
Definition: GUIAppEnum.h:369
DemandElementGeometry myDemandElementGeometry
demand element geometry
An special type of Attribute carrier that owns hierarchical elements.
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge *> &partialEdges) const
calculate Dijkstra route between a list of partial edges
SumoXMLTag
Numbers representing SUMO-XML - element names.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1020
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
GNEDemandElement(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, const std::vector< GNEEdge *> &edgeParents, const std::vector< GNELane *> &laneParents, const std::vector< GNEShape *> &shapeParents, const std::vector< GNEAdditional *> &additionalParents, const std::vector< GNEDemandElement *> &demandElementParents, const std::vector< GNEEdge *> &edgeChildren, const std::vector< GNELane *> &laneChildren, const std::vector< GNEShape *> &shapeChildren, const std::vector< GNEAdditional *> &additionalChildren, const std::vector< GNEDemandElement *> &demandElementChildren)
Constructor.
Segment(const GNEDemandElement *_element, const GNEEdge *_edge, const Position _pos, const bool _visible, const bool _valid)
parameter constructor for edges
GUIGlObjectType
virtual void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children) ...
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNetBuilder * getNetBuilder() const
get net builder
Definition: GNENet.cpp:1543
virtual std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
virtual Position getPositionInView() const =0
Returns position of demand element in view.
double y() const
Returns the y-position.
Definition: Position.h:62
The representation of a single edge during network building.
Definition: NBEdge.h:86
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
double x() const
Returns the x-position.
Definition: Position.h:57
void insertEdgeLengthRotSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, double length, double rotation, const bool visible, const bool valid)
insert edge segment with length and rotation (used to avoid unnecessary calculation in calculateParti...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
class used to calculate routes in nets
FXIcon * getIcon() const
get FXIcon associated to this AC
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
void changeDemandElementID(const std::string &newID)
change ID of demand element
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
PositionVector shape
The shape of the additional element.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const DemandElementGeometry & getDemandElementGeometry() const
get demand element geometry
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:625
RouterEdgeVector getAllRouterEdges() const
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
An special type of Attribute carrier that owns hierarchical elements.
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:76
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Computes the shortest path through a network using the Dijkstra algorithm.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2266
~GNEDemandElement()
Destructor.
int getNumberOfAttributes() const
get number of attributes
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
std::vector< double > shapeLengths
The lengths of the single shape parts.
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:151
Supermode currentSupermode
the current supermode
void markSegmentGeometryDeprecated()
mark demand element segment geometry as deprecated
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:505
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E *> &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
const std::string & getDemandElementID() const
returns DemandElement ID
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
Definition: GNENet.cpp:2305
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
A vehicle as used by router.
Definition: NBVehicle.h:44
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
const std::string getID() const
function to support debugging
void clearDemandElementSegmentGeometry()
clear demand element geometry
static RouteCalculator * myRouteCalculatorInstance
RouteCalculator instance.
virtual bool checkDemandElementChildRestriction() const
check restriction with the number of children
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3441
struct used for represent segments of demand element geometry
virtual void openDemandElementDialog()
open DemandElement Dialog
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const DemandElementSegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
std::vector< Segment >::const_iterator end() const
end iterator
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
#define M_PI
Definition: odrSpiral.cpp:40
void updateDijkstraRouter()
update DijkstraRoute (called when SuperMode Demand is selected)
const std::string & getTagStr() const
get tag assigned to this object in string format
Demanding mode (Routes, Vehicles etc..)
RouteCalculator(GNENet *net)
constructor
The popup menu of a globject.
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:379
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1127
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:234
std::vector< Segment >::const_iterator begin() const
begin iterator
virtual std::string getBegin() const
get begin time of demand element
struct for pack all variables related with geometry of stop
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
std::vector< double > shapeRotations
The rotations of the single shape parts.
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
SUMOAbstractRouter< NBRouterEdge, NBVehicle > * myDijkstraRouter
SUMO Abstract DijkstraRouter.
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:371
A window containing a gl-object&#39;s parameter.
virtual std::string getAttribute(SumoXMLAttr key) const =0
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
virtual bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
std::vector< Segment > myShapeSegments
vector of segments that constitutes the shape