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 /****************************************************************************/
14 // A abstract class for demand elements
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <netbuild/NBNetBuilder.h>
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEViewNet.h>
33 
34 #include "GNEDemandElement.h"
35 
36 // ===========================================================================
37 // static members
38 // ===========================================================================
39 
41 
42 // ===========================================================================
43 // member method definitions
44 // ===========================================================================
45 
46 // ---------------------------------------------------------------------------
47 // GNEDemandElement::RouteCalculator - methods
48 // ---------------------------------------------------------------------------
49 
51  myNet(net) {
54  true, &NBRouterEdge::getTravelTimeStatic, nullptr, true);
55 }
56 
57 
59  delete myDijkstraRouter;
60 }
61 
62 
63 void
65  // simply delete and create myDijkstraRouter again
66  if (myDijkstraRouter) {
67  delete myDijkstraRouter;
68  }
69  myDijkstraRouter = new DijkstraRouter<NBRouterEdge, NBVehicle>(
70  myNet->getNetBuilder()->getEdgeCont().getAllRouterEdges(),
71  true, &NBRouterEdge::getTravelTimeStatic, nullptr, true);
72 }
73 
74 
75 std::vector<GNEEdge*>
76 GNEDemandElement::RouteCalculator::calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector<GNEEdge*>& partialEdges) const {
77  // declare a solution vector
78  std::vector<GNEEdge*> solution;
79  // calculate route depending of number of partial edges
80  if (partialEdges.size() == 1) {
81  // if there is only one partialEdges, route has only one edge
82  solution.push_back(partialEdges.front());
83  } else {
84  // declare temporal vehicle
85  NBVehicle tmpVehicle("temporalNBVehicle", vClass);
86  // obtain pointer to GNENet
87  GNENet* net = partialEdges.front()->getNet();
88  // iterate over every selected edges
89  for (int i = 1; i < (int)partialEdges.size(); i++) {
90  // declare a temporal route in which save route between two last edges
91  std::vector<const NBRouterEdge*> partialRoute;
92  myDijkstraRouter->compute(partialEdges.at(i - 1)->getNBEdge(), partialEdges.at(i)->getNBEdge(), &tmpVehicle, 10, partialRoute);
93  // save partial route in solution
94  for (const auto& j : partialRoute) {
95  solution.push_back(net->retrieveEdge(j->getID()));
96  }
97  }
98  }
99  // filter solution
100  auto solutionIt = solution.begin();
101  // iterate over solution
102  while (solutionIt != solution.end()) {
103  if ((solutionIt + 1) != solution.end()) {
104  // if next edge is the same of current edge, remove it
105  if (*solutionIt == *(solutionIt + 1)) {
106  solutionIt = solution.erase(solutionIt);
107  } else {
108  solutionIt++;
109  }
110  } else {
111  solutionIt++;
112  }
113  }
114  return solution;
115 }
116 
117 
118 std::vector<GNEEdge*>
119 GNEDemandElement::RouteCalculator::calculateDijkstraRoute(GNENet* net, SUMOVehicleClass vClass, const std::vector<std::string>& partialEdgesStr) const {
120  // declare a vector of GNEEdges
121  std::vector<GNEEdge*> partialEdges;
122  partialEdges.reserve(partialEdgesStr.size());
123  // convert to vector of GNEEdges
124  for (const auto& i : partialEdgesStr) {
125  partialEdges.push_back(net->retrieveEdge(i));
126  }
127  // calculate DijkstraRoute using partialEdges
128  return calculateDijkstraRoute(vClass, partialEdges);
129 }
130 
131 
132 bool
134  // the same edge cannot be consecutive of itself
135  if (from == to) {
136  return false;
137  }
138  // for pedestrian edges are always consecutives
139  if (vClass == SVC_PEDESTRIAN) {
140  return true;
141  }
142  // obtain NBEdges from both edges
143  NBEdge* nbFrom = from->getNBEdge();
144  NBEdge* nbTo = to->getNBEdge();
145  // iterate over all connections of NBFrom
146  for (NBEdge::Connection c : nbFrom->getConnectionsFromLane(-1, nbTo, -1)) {
147  //check if given VClass is allowed for from and to lanes
148  if ((nbFrom->getPermissions(c.fromLane) & nbTo->getPermissions(c.toLane) & vClass) == vClass) {
149  return true;
150  }
151  }
152  return false;
153 }
154 
155 // ---------------------------------------------------------------------------
156 // GNEDemandElement - methods
157 // ---------------------------------------------------------------------------
158 
159 GNEDemandElement::GNEDemandElement(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag,
160  const std::vector<GNEEdge*>& parentEdges,
161  const std::vector<GNELane*>& parentLanes,
162  const std::vector<GNEShape*>& parentShapes,
163  const std::vector<GNEAdditional*>& parentAdditionals,
164  const std::vector<GNEDemandElement*>& parentDemandElements,
165  const std::vector<GNEEdge*>& childEdges,
166  const std::vector<GNELane*>& childLanes,
167  const std::vector<GNEShape*>& childShapes,
168  const std::vector<GNEAdditional*>& childAdditionals,
169  const std::vector<GNEDemandElement*>& childDemandElements) :
170  GUIGlObject(type, id),
171  GNEAttributeCarrier(tag),
172  GNEHierarchicalParentElements(this, parentEdges, parentLanes, parentShapes, parentAdditionals, parentDemandElements),
173  GNEHierarchicalChildElements(this, childEdges, childLanes, childShapes, childAdditionals, childDemandElements),
174  myViewNet(viewNet) {
175 }
176 
177 
179  const std::vector<GNEEdge*>& parentEdges,
180  const std::vector<GNELane*>& parentLanes,
181  const std::vector<GNEShape*>& parentShapes,
182  const std::vector<GNEAdditional*>& parentAdditionals,
183  const std::vector<GNEDemandElement*>& parentDemandElements,
184  const std::vector<GNEEdge*>& childEdges,
185  const std::vector<GNELane*>& childLanes,
186  const std::vector<GNEShape*>& childShapes,
187  const std::vector<GNEAdditional*>& childAdditionals,
188  const std::vector<GNEDemandElement*>& childDemandElements) :
189  GUIGlObject(type, demandElementParent->generateChildID(tag)),
190  GNEAttributeCarrier(tag),
191  GNEHierarchicalParentElements(this, parentEdges, parentLanes, parentShapes, parentAdditionals, parentDemandElements),
192  GNEHierarchicalChildElements(this, childEdges, childLanes, childShapes, childAdditionals, childDemandElements),
193  myViewNet(viewNet) {
194 }
195 
196 
197 std::string
199  int counter = (int)getChildDemandElements().size();
200  while (myViewNet->getNet()->retrieveDemandElement(childTag, getID() + toString(childTag) + toString(counter), false) != nullptr) {
201  counter++;
202  }
203  return (getID() + toString(childTag) + toString(counter));
204 }
205 
206 
208 
209 
213 }
214 
215 
219 }
220 
221 
222 bool
224  return true;
225 }
226 
227 
228 std::string
230  return "";
231 }
232 
233 
234 void
236  throw InvalidArgument(getTagStr() + " cannot fix any problem");
237 }
238 
239 
240 void
242  throw InvalidArgument(getTagStr() + " doesn't have an demand element dialog");
243 }
244 
245 
246 std::string
248  throw InvalidArgument(getTagStr() + " doesn't have an begin time");
249 }
250 
251 
252 GNEViewNet*
254  return myViewNet;
255 }
256 
257 
258 void
260  if (myRouteCalculatorInstance == nullptr) {
262  } else {
263  throw ProcessError("Instance already created");
264  }
265 }
266 
267 
268 void
272  myRouteCalculatorInstance = nullptr;
273  } else {
274  throw ProcessError("Instance wasn't created");
275  }
276 }
277 
278 
283  } else {
284  throw ProcessError("Instance wasn't created");
285  }
286 }
287 
288 
291  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
292  // build header
293  buildPopupHeader(ret, app);
294  // build menu command for center button and copy cursor position to clipboard
296  buildPositionCopyEntry(ret, false);
297  // buld menu commands for names
298  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
299  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
300  new FXMenuSeparator(ret);
301  // build selection and show parameters menu
304  // show option to open demand element dialog
305  if (myTagProperty.hasDialog()) {
306  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
307  new FXMenuSeparator(ret);
308  }
309  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
310  return ret;
311 }
312 
313 
316  // Create table
318  // Iterate over attributes
319  for (const auto& i : myTagProperty) {
320  // Add attribute and set it dynamic if aren't unique
321  if (i.isUnique()) {
322  ret->mkItem(i.getAttrStr().c_str(), false, getAttribute(i.getAttr()));
323  } else {
324  ret->mkItem(i.getAttrStr().c_str(), true, getAttribute(i.getAttr()));
325  }
326  }
327  // close building
328  ret->closeBuilding();
329  return ret;
330 }
331 
332 
333 bool
334 GNEDemandElement::isRouteValid(const std::vector<GNEEdge*>& edges, bool report) {
335  if (edges.size() == 0) {
336  // routes cannot be empty
337  return false;
338  } else if (edges.size() == 1) {
339  // routes with a single edge are valid
340  return true;
341  } else {
342  // iterate over edges to check that compounds a chain
343  auto it = edges.begin();
344  while (it != edges.end() - 1) {
345  GNEEdge* currentEdge = *it;
346  GNEEdge* nextEdge = *(it + 1);
347  // consecutive edges aren't allowed
348  if (currentEdge->getID() == nextEdge->getID()) {
349  return false;
350  }
351  // make sure that edges are consecutives
352  if (std::find(currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().begin(),
353  currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().end(),
354  nextEdge) == currentEdge->getGNEJunctionDestiny()->getGNEOutgoingEdges().end()) {
355  if (report) {
356  WRITE_WARNING("Parameter 'Route' invalid. " + currentEdge->getTagStr() + " '" + currentEdge->getID() +
357  "' ins't consecutive to " + nextEdge->getTagStr() + " '" + nextEdge->getID() + "'");
358  }
359  return false;
360  }
361  it++;
362  }
363  }
364  return true;
365 }
366 
367 
368 const std::string&
370  return getMicrosimID();
371 }
372 
373 
374 bool
375 GNEDemandElement::isValidDemandElementID(const std::string& newID) const {
376  if (SUMOXMLDefinitions::isValidVehicleID(newID) && (myViewNet->getNet()->retrieveDemandElement(myTagProperty.getTag(), newID, false) == nullptr)) {
377  return true;
378  } else {
379  return false;
380  }
381 }
382 
383 
384 void
385 GNEDemandElement::changeDemandElementID(const std::string& newID) {
386  if (myViewNet->getNet()->retrieveDemandElement(myTagProperty.getTag(), newID, false) != nullptr) {
387  throw InvalidArgument("An DemandElement with tag " + getTagStr() + " and ID = " + newID + " already exists");
388  } else {
389  // Save old ID
390  std::string oldID = getMicrosimID();
391  // set New ID
392  setMicrosimID(newID);
393  // update demand element ID in the container of net
394  myViewNet->getNet()->updateDemandElementID(oldID, this);
395  }
396 }
397 
398 
399 void
400 GNEDemandElement::calculatePersonPlanLaneStartEndPos(double& startPos, double& endPos) const {
401  // obtain pointer to current busStop
402  GNEAdditional* busStop = getParentAdditionals().size() > 0 ? getParentAdditionals().front() : nullptr;
403  // declare pointers for previous elements
404  GNEAdditional* previousBusStop = nullptr;
405  GNEDemandElement* previousPersonPlan = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
406  // declare pointer to next person plan
407  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
408  // obtain departlane throught previous element
409  if (previousPersonPlan && (previousPersonPlan->getParentAdditionals().size() > 0)) {
410  // set previous busStop
411  previousBusStop = previousPersonPlan->getParentAdditionals().front();
412  }
413  // adjust startPos depending of previous busStop
414  if (previousBusStop) {
415  startPos = previousBusStop->getAttributeDouble(SUMO_ATTR_ENDPOS);
416  } else if (previousPersonPlan) {
417  // check if previous element is a stop or another person plan (walk, ride, trip...)
418  if (previousPersonPlan->getTagProperty().isPersonStop()) {
419  startPos = previousPersonPlan->getAttributeDouble(SUMO_ATTR_ENDPOS);
420  } else {
421  startPos = previousPersonPlan->getAttributeDouble(SUMO_ATTR_ARRIVALPOS);
422  }
423  } else {
424  // if this is the first person plan, use departPos of pedestrian
425  startPos = getParentDemandElements().front()->getAttributeDouble(SUMO_ATTR_DEPARTPOS);
426  }
427  // adjust endPos depending of next busStop
428  if (busStop) {
429  endPos = busStop->getAttributeDouble(SUMO_ATTR_STARTPOS);
430  } else if (nextPersonPlan && nextPersonPlan->getTagProperty().isPersonStop()) {
431  endPos = nextPersonPlan->getAttributeDouble(SUMO_ATTR_STARTPOS);
432  } else {
433  // if this is the last element, simply use arrival position
435  }
436 }
437 
438 
439 void
441  // obtain previous demand element
442  GNEDemandElement* previousDemandElmement = getParentDemandElements().front()->getPreviousChildDemandElement(this);
443  if (previousDemandElmement) {
444  // update startPos
445  if ((previousDemandElmement->getParentAdditionals().size() > 0) &&
446  (previousDemandElmement->getParentAdditionals().front()->getAdditionalGeometry().getShape().size() > 0)) {
447  // Previous demand element ends in an busStop
448  startPos = previousDemandElmement->getParentAdditionals().front()->getAdditionalGeometry().getShape().back();
449  } else if (previousDemandElmement->getTagProperty().isPersonStop() && (previousDemandElmement->getDemandElementGeometry().getShape().size() > 0)) {
450  // Previous demand element ends in an Stop
451  startPos = previousDemandElmement->getDemandElementGeometry().getShape().back();
452  } else if ((previousDemandElmement->getDemandElementSegmentGeometry().size() > 0) &&
453  (previousDemandElmement->getDemandElementSegmentGeometry().back().getShape().size() > 0)) {
454  // add last shape segment of previous segment geometry
455  startPos = previousDemandElmement->getDemandElementSegmentGeometry().back().getShape().back();
456  }
457  }
458  // check if demand element ends in an busStop
459  if ((getParentAdditionals().size() > 0) && (getParentAdditionals().front()->getAdditionalGeometry().getShape().size() > 0)) {
460  endPos = getParentAdditionals().front()->getAdditionalGeometry().getShape().front();
461  } else {
462  // obtain next demand element
463  GNEDemandElement* nextDemandElmement = getParentDemandElements().front()->getNextChildDemandElement(this);
464  if (nextDemandElmement) {
465  // update end pos
466  if (nextDemandElmement->getTagProperty().isPersonStop() && (nextDemandElmement->getDemandElementGeometry().getShape().size() > 0)) {
467  // previous demand element ends in an Stop
468  endPos = nextDemandElmement->getDemandElementGeometry().getShape().front();
469  }
470  }
471  }
472 }
473 
474 
475 GNELane*
477  // first check if current demand element has parent edges
479  // use route edges
480  return getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
481  } else if (getParentEdges().size() > 0) {
482  // obtain Lane depending of attribute "departLane"
484  // obtain depart lane
485  std::string departLane = getAttribute(SUMO_ATTR_DEPARTLANE);
486  // check depart lane
487  if ((departLane == "random") || (departLane == "free") || (departLane == "allowed") || (departLane == "best") || (departLane == "first")) {
488  return getParentEdges().front()->getLaneByAllowedVClass(getVClass());
489  }
490  // obtain index
491  const int departLaneIndex = parse<int>(getAttribute(SUMO_ATTR_DEPARTLANE));
492  // if index is correct, return lane. In other case, return nullptr;
493  if ((departLaneIndex >= 0) && (departLaneIndex < getParentEdges().front()->getNBEdge()->getNumLanes())) {
494  return getParentEdges().front()->getLanes().at(departLaneIndex);
495  } else {
496  return nullptr;
497  }
498  } else if (myTagProperty.isRide()) {
499  // special case for rides
500  return getParentEdges().front()->getLaneByDisallowedVClass(getVClass());
501  } else {
502  // in other case, always return the first allowed
503  return getParentEdges().front()->getLaneByAllowedVClass(getVClass());
504  }
505  } else {
506  return nullptr;
507  }
508 }
509 
510 
511 GNELane*
513  // first check if current demand element has parent edges
515  // use route edges
516  return getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(getVClass());
517  } else if (getParentEdges().size() > 0) {
521  // return busStop lane
522  return getParentAdditionals().front()->getParentLanes().front();
524  // obtain Lane depending of attribute "arrivalLane"
525  std::string arrivalLane = getAttribute(SUMO_ATTR_ARRIVALLANE);
526  // check depart lane
527  if (arrivalLane == "current") {
528  return getParentEdges().back()->getLaneByAllowedVClass(getVClass());
529  }
530  // obtain index
531  const int arrivalLaneIndex = parse<int>(getAttribute(SUMO_ATTR_ARRIVALLANE));
532  // if index is correct, return lane. In other case, return nullptr;
533  if ((arrivalLaneIndex >= 0) && (arrivalLaneIndex < getParentEdges().back()->getNBEdge()->getNumLanes())) {
534  return getParentEdges().back()->getLanes().at(arrivalLaneIndex);
535  } else {
536  return nullptr;
537  }
538  } else if (myTagProperty.isRide()) {
539  // special case for rides
540  return getParentEdges().back()->getLaneByDisallowedVClass(getVClass());
541  } else {
542  // in other case, always return the first allowed
543  return getParentEdges().back()->getLaneByAllowedVClass(getVClass());
544  }
545  } else {
546  return nullptr;
547  }
548 }
549 
550 
551 bool
553  return mySelected;
554 }
555 
556 
557 bool
560  return true;
561  } else {
562  return false;
563  }
564 }
565 
566 
567 bool
569  // throw exception because this function mus be implemented in child (see GNEE3Detector)
570  throw ProcessError("Calling non-implemented function checkChildDemandElementRestriction during saving of " + getTagStr() + ". It muss be reimplemented in child class");
571 }
572 
573 /****************************************************************************/
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:376
GNEDemandElement::RouteCalculator::updateDijkstraRouter
void updateDijkstraRouter()
update DijkstraRoute (called when SuperMode Demand is selected)
Definition: GNEDemandElement.cpp:64
SVC_PEDESTRIAN
@ SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEDemandElement::getLastAllowedVehicleLane
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:512
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1279
GNEDemandElement::getDemandElementGeometry
const GNEGeometry::Geometry & getDemandElementGeometry() const
get demand element geometry
Definition: GNEDemandElement.cpp:211
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEDemandElement::createRouteCalculatorInstance
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
Definition: GNEDemandElement.cpp:259
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GNEAdditional.h
GNEDemandElement::getVClass
virtual SUMOVehicleClass getVClass() const =0
obtain VClass related with this demand element
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:788
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
GNEDemandElement::getDemandElementProblem
virtual std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEDemandElement.cpp:229
GNEDemandElement::isValidDemandElementID
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
Definition: GNEDemandElement.cpp:375
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNEDemandElement::getRouteCalculatorInstance
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
Definition: GNEDemandElement.cpp:280
NBRouterEdge::getTravelTimeStatic
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:81
GUIParameterTableWindow.h
GNEHierarchicalChildElements::getChildDemandElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Definition: GNEHierarchicalChildElements.cpp:296
GNEHierarchicalParentElements::getParentEdges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
Definition: GNEHierarchicalParentElements.cpp:181
GNEDemandElement::getDemandElementSegmentGeometry
const GNEGeometry::SegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry
Definition: GNEDemandElement.cpp:217
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
SUMO_TAG_WALK_ROUTE
@ SUMO_TAG_WALK_ROUTE
Definition: SUMOXMLDefinitions.h:309
GUIGLObjectPopupMenu.h
GNEJunction::getGNEOutgoingEdges
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
Definition: GNEJunction.cpp:487
NBEdge::getConnectionsFromLane
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1100
GNEDemandElement::getFirstAllowedVehicleLane
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:476
GNENet::retrieveDemandElement
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2316
GNEViewNet
Definition: GNEViewNet.h:42
GNEDemandElement::GNEDemandElement
GNEDemandElement(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, const std::vector< GNEEdge * > &parentEdges, const std::vector< GNELane * > &parentLanes, const std::vector< GNEShape * > &parentShapes, const std::vector< GNEAdditional * > &parentAdditionals, const std::vector< GNEDemandElement * > &parentDemandElements, const std::vector< GNEEdge * > &childEdges, const std::vector< GNELane * > &childLanes, const std::vector< GNEShape * > &childShapes, const std::vector< GNEAdditional * > &childAdditionals, const std::vector< GNEDemandElement * > &childDemandElements)
Constructor.
Definition: GNEDemandElement.cpp:159
MID_OPEN_ADDITIONAL_DIALOG
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:392
SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_ARRIVALPOS
Definition: SUMOXMLDefinitions.h:437
GNEDemandElement::getViewNet
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Definition: GNEDemandElement.cpp:253
MID_COPY_NAME
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:382
NBEdge::getPermissions
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3404
SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
DijkstraRouter
Computes the shortest path through a network using the Dijkstra algorithm.
Definition: DijkstraRouter.h:61
GUIParameterTableWindow::closeBuilding
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Definition: GUIParameterTableWindow.cpp:219
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:150
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
GNEHierarchicalChildElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalChildElements.h:45
GNEDemandElement::getPopUpMenu
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEDemandElement.cpp:290
GNEJunction.h
GNEDemandElement::myDemandElementSegmentGeometry
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
Definition: GNEDemandElement.h:382
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:39
GNEAttributeCarrier::TagProperties::hasAttribute
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
Definition: GNEAttributeCarrier.cpp:680
GNEDemandElement::fixDemandElementProblem
virtual void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEDemandElement.cpp:235
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEDemandElement::changeDemandElementID
void changeDemandElementID(const std::string &newID)
change ID of demand element
Definition: GNEDemandElement.cpp:385
GNEDemandElement::getPositionInView
virtual Position getPositionInView() const =0
Returns position of demand element in view.
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEHierarchicalParentElements::getParentAdditionals
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
Definition: GNEHierarchicalParentElements.cpp:85
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:173
GNENet::getNetBuilder
NBNetBuilder * getNetBuilder() const
get net builder
Definition: GNENet.cpp:1592
GNEDemandElement::myRouteCalculatorInstance
static RouteCalculator * myRouteCalculatorInstance
RouteCalculator instance.
Definition: GNEDemandElement.h:423
GNEGeometry::SegmentGeometry
struct for pack all variables related with geometry of elemements divided in segments
Definition: GNEGeometry.h:116
GNEDemandElement::RouteCalculator::myDijkstraRouter
SUMOAbstractRouter< NBRouterEdge, NBVehicle > * myDijkstraRouter
SUMO Abstract DijkstraRouter.
Definition: GNEDemandElement.h:100
GNEDemandElement::RouteCalculator::myNet
GNENet * myNet
pointer to net
Definition: GNEDemandElement.h:97
GNEAttributeCarrier::getTagProperty
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Definition: GNEAttributeCarrier.cpp:1273
GNEHierarchicalParentElements::getParentDemandElements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
Definition: GNEHierarchicalParentElements.cpp:114
SUMO_ATTR_STARTPOS
@ SUMO_ATTR_STARTPOS
Definition: SUMOXMLDefinitions.h:797
GNEGeometry::Geometry::getShape
const PositionVector & getShape() const
The shape of the additional element.
Definition: GNEGeometry.cpp:147
GNEDemandElement::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEEdge::getNBEdge
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:631
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
GNEDemandElement::getAttributeDouble
virtual double getAttributeDouble(SumoXMLAttr key) const =0
GUIParameterTableWindow::mkItem
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
Definition: GUIParameterTableWindow.h:108
GNEDemandElement.h
GNEViewNet.h
SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_DEPARTLANE
Definition: SUMOXMLDefinitions.h:432
GNEDemandElement::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEDemandElement.cpp:198
NBNetBuilder.h
ProcessError
Definition: UtilExceptions.h:39
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:305
GNEDemandElement::calculatePersonPlanPositionStartEndPos
void calculatePersonPlanPositionStartEndPos(Position &startPos, Position &endPos) const
calculate personPlan start and end positions
Definition: GNEDemandElement.cpp:440
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NBVehicle
A vehicle as used by router.
Definition: NBVehicle.h:43
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:785
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:552
GNEGeometry::Geometry
struct for pack all variables related with geometry of stop
Definition: GNEGeometry.h:56
SUMO_TAG_PERSONTRIP_BUSSTOP
@ SUMO_TAG_PERSONTRIP_BUSSTOP
Definition: SUMOXMLDefinitions.h:305
GNEAdditional::getAttributeDouble
virtual double getAttributeDouble(SumoXMLAttr key) const =0
GNEDemandElement::openDemandElementDialog
virtual void openDemandElementDialog()
open DemandElement Dialog
Definition: GNEDemandElement.cpp:241
GUIGlObject
Definition: GUIGlObject.h:65
GNEEdge::getGNEJunctionDestiny
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:493
GNENet::updateDemandElementID
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
Definition: GNENet.cpp:2355
GNELane.h
GNEDemandElement::checkChildDemandElementRestriction
virtual bool checkChildDemandElementRestriction() const
check restriction with the number of children
Definition: GNEDemandElement.cpp:568
GNEDemandElement::RouteCalculator::~RouteCalculator
~RouteCalculator()
destructor
Definition: GNEDemandElement.cpp:58
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
GNEDemandElement::RouteCalculator
class used to calculate routes in nets
Definition: GNEDemandElement.h:74
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEDemandElement::calculatePersonPlanLaneStartEndPos
void calculatePersonPlanLaneStartEndPos(double &startPos, double &endPos) const
calculate personPlan start and end positions over lanes
Definition: GNEDemandElement.cpp:400
GNEDemandElement::RouteCalculator::areEdgesConsecutives
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
Definition: GNEDemandElement.cpp:133
GUIMainWindow
Definition: GUIMainWindow.h:46
GNEDemandElement::RouteCalculator::RouteCalculator
RouteCalculator(GNENet *net)
constructor
Definition: GNEDemandElement.cpp:50
GNEAttributeCarrier::TagProperties::isPersonStop
bool isPersonStop() const
return true if tag correspond to a person stop element
Definition: GNEAttributeCarrier.cpp:786
GNE_SUPERMODE_DEMAND
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:48
InvalidArgument
Definition: UtilExceptions.h:56
SUMOXMLDefinitions::isValidVehicleID
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
Definition: SUMOXMLDefinitions.cpp:973
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
SUMO_TAG_RIDE_BUSSTOP
@ SUMO_TAG_RIDE_BUSSTOP
Definition: SUMOXMLDefinitions.h:311
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:369
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
GNEHierarchicalParentElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalParentElements.h:49
GNEDemandElement::isRouteValid
static bool isRouteValid(const std::vector< GNEEdge * > &edges, bool report)
check if a route is valid
Definition: GNEDemandElement.cpp:334
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:846
SUMO_TAG_WALK_BUSSTOP
@ SUMO_TAG_WALK_BUSSTOP
Definition: SUMOXMLDefinitions.h:308
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
GNEDemandElement::myDemandElementGeometry
GNEGeometry::Geometry myDemandElementGeometry
demand element geometry
Definition: GNEDemandElement.h:379
GNEDemandElement::deleteRouteCalculatorInstance
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
Definition: GNEDemandElement.cpp:269
config.h
GNEDemandElement::RouteCalculator::calculateDijkstraRoute
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra route between a list of partial edges
Definition: GNEDemandElement.cpp:76
GNEGeometry::SegmentGeometry::size
int size() const
number of segments
Definition: GNEGeometry.cpp:387
DijkstraRouter.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:434
SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_DEPARTPOS
Definition: SUMOXMLDefinitions.h:433
GNEAttributeCarrier::TagProperties::isRide
bool isRide() const
return true if tag correspond to a ride element
Definition: GNEAttributeCarrier.cpp:780
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
GNEDemandElement::getBegin
virtual std::string getBegin() const
get begin time of demand element
Definition: GNEDemandElement.cpp:247
MID_COPY_TYPED_NAME
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:384
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:189
GNEGeometry::SegmentGeometry::Segment::getShape
const PositionVector & getShape() const
get lane/lane2lane shape
Definition: GNEGeometry.cpp:244
GNEDemandElement::isDemandElementValid
virtual bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEDemandElement.cpp:223
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
GNEDemandElement::~GNEDemandElement
~GNEDemandElement()
Destructor.
Definition: GNEDemandElement.cpp:207
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
SUMO_ATTR_ARRIVALLANE
@ SUMO_ATTR_ARRIVALLANE
Definition: SUMOXMLDefinitions.h:436
GNEDemandElement::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEDemandElement.cpp:315
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNEGeometry::SegmentGeometry::back
const Segment & back() const
back segment
Definition: GNEGeometry.cpp:381
GNEDemandElement::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEDemandElement.cpp:558
GNENet.h
GNEAttributeCarrier::TagProperties::getNumberOfAttributes
int getNumberOfAttributes() const
get number of attributes
Definition: GNEAttributeCarrier.cpp:648
NBEdgeCont::getAllRouterEdges
RouterEdgeVector getAllRouterEdges() const
Definition: NBEdgeCont.cpp:1609