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  }
219  myNet->getNetBuilder()->getEdgeCont().getAllRouterEdges(),
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 /****************************************************************************/
GNEDemandElement::markSegmentGeometryDeprecated
void markSegmentGeometryDeprecated()
mark demand element segment geometry as deprecated
Definition: GNEDemandElement.cpp:372
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:469
GNEDemandElement::RouteCalculator::updateDijkstraRouter
void updateDijkstraRouter()
update DijkstraRoute (called when SuperMode Demand is selected)
Definition: GNEDemandElement.cpp:213
SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:157
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1177
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEDemandElement::createRouteCalculatorInstance
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
Definition: GNEDemandElement.cpp:414
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:63
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:795
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1187
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:384
GNEDemandElement::isValidDemandElementID
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
Definition: GNEDemandElement.cpp:530
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEDemandElement::getRouteCalculatorInstance
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
Definition: GNEDemandElement.cpp:435
GNEDemandElement::DemandElementSegmentGeometry::calculatePartialShapeRotationsAndLengths
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
Definition: GNEDemandElement.cpp:161
NBRouterEdge::getTravelTimeStatic
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:76
GUIParameterTableWindow.h
GNEDemandElement::DemandElementSegmentGeometry::insertEdgeSegment
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
Definition: GNEDemandElement.cpp:133
GNEDemandElement::DemandElementSegmentGeometry::clearDemandElementSegmentGeometry
void clearDemandElementSegmentGeometry()
clear demand element geometry
Definition: GNEDemandElement.cpp:154
GNEDemandElement::myDemandElementGeometry
DemandElementGeometry myDemandElementGeometry
demand element geometry
Definition: GNEDemandElement.h:472
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
GNEDemandElement::DemandElementSegmentGeometry::end
std::vector< Segment >::const_iterator end() const
end iterator
Definition: GNEDemandElement.cpp:191
GUIGLObjectPopupMenu.h
GNEJunction::getGNEOutgoingEdges
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
Definition: GNEJunction.cpp:541
NBEdge::getConnectionsFromLane
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1127
GNENet::retrieveDemandElement
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2266
GNEDemandElement::DemandElementGeometry::calculateShapeRotationsAndLengths
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
Definition: GNEDemandElement.cpp:61
GNEViewNet
Definition: GNEViewNet.h:43
MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:379
GNEDemandElement::getDemandElementSegmentGeometry
const DemandElementSegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry
Definition: GNEDemandElement.cpp:366
GNEDemandElement::getViewNet
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Definition: GNEDemandElement.cpp:408
MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:369
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:3441
GNEHierarchicalElementParents
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalElementParents.h:48
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
DijkstraRouter
Computes the shortest path through a network using the Dijkstra algorithm.
Definition: DijkstraRouter.h:63
GUIParameterTableWindow::closeBuilding
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Definition: GUIParameterTableWindow.cpp:220
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:151
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:521
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:86
GNEDemandElement::getPopUpMenu
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEDemandElement.cpp:445
GNEJunction.h
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
GNEDemandElement::fixDemandElementProblem
virtual void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEDemandElement.cpp:390
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEDemandElement::changeDemandElementID
void changeDemandElementID(const std::string &newID)
change ID of demand element
Definition: GNEDemandElement.cpp:540
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:927
GNEDemandElement::getDemandElementGeometry
const DemandElementGeometry & getDemandElementGeometry() const
get demand element geometry
Definition: GNEDemandElement.cpp:360
GUIGlObject::setMicrosimID
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Definition: GUIGlObject.cpp:174
GNEDemandElement::GNEDemandElement
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.
Definition: GNEDemandElement.cpp:308
GNENet::getNetBuilder
NBNetBuilder * getNetBuilder() const
get net builder
Definition: GNENet.cpp:1543
GNEDemandElement::myRouteCalculatorInstance
static RouteCalculator * myRouteCalculatorInstance
RouteCalculator instance.
Definition: GNEDemandElement.h:504
GNEDemandElement::DemandElementSegmentGeometry::begin
std::vector< Segment >::const_iterator begin() const
begin iterator
Definition: GNEDemandElement.cpp:185
GNEDemandElement::DemandElementSegmentGeometry::insertJunctionSegment
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
Definition: GNEDemandElement.cpp:147
GNEDemandElement::RouteCalculator::myDijkstraRouter
SUMOAbstractRouter< NBRouterEdge, NBVehicle > * myDijkstraRouter
SUMO Abstract DijkstraRouter.
Definition: GNEDemandElement.h:196
GNEDemandElement::checkDemandElementChildRestriction
virtual bool checkDemandElementChildRestriction() const
check restriction with the number of children
Definition: GNEDemandElement.cpp:571
GNEDemandElement::RouteCalculator::myNet
GNENet * myNet
pointer to net
Definition: GNEDemandElement.h:193
GNEDemandElement::DemandElementSegmentGeometry::DemandElementSegmentGeometry
DemandElementSegmentGeometry()
constructor
Definition: GNEDemandElement.cpp:127
GNEDemandElement::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEEdge::getNBEdge
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:625
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
Position::distanceTo
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:234
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:109
GNEDemandElement.h
GNEViewNet.h
GNEDemandElement::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEDemandElement.cpp:347
NBNetBuilder.h
ProcessError
Definition: UtilExceptions.h:40
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:309
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
NBVehicle
A vehicle as used by router.
Definition: NBVehicle.h:44
Position::x
double x() const
Returns the x-position.
Definition: Position.h:57
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:792
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:555
GNEDemandElement::openDemandElementDialog
virtual void openDemandElementDialog()
open DemandElement Dialog
Definition: GNEDemandElement.cpp:396
GUIGlObject
Definition: GUIGlObject.h:66
GNEEdge::getGNEJunctionDestiny
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:505
GNENet::updateDemandElementID
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
Definition: GNENet.cpp:2305
GNEDemandElement::DemandElementGeometry
struct for pack all variables related with geometry of stop
Definition: GNEDemandElement.h:58
GNEDemandElement::RouteCalculator::~RouteCalculator
~RouteCalculator()
destructor
Definition: GNEDemandElement.cpp:207
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:208
GNEDemandElement::DemandElementSegmentGeometry::geometryDeprecated
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
Definition: GNEDemandElement.h:147
GNEDemandElement::RouteCalculator
class used to calculate routes in nets
Definition: GNEDemandElement.h:170
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
GNEDemandElement::DemandElementSegmentGeometry::insertEdgeLengthRotSegment
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...
Definition: GNEDemandElement.cpp:140
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:282
GNEDemandElement::myDemandElementSegmentGeometry
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
Definition: GNEDemandElement.h:475
GUIMainWindow
Definition: GUIMainWindow.h:47
Position::y
double y() const
Returns the y-position.
Definition: Position.h:62
GNEDemandElement::RouteCalculator::RouteCalculator
RouteCalculator(GNENet *net)
constructor
Definition: GNEDemandElement.cpp:199
M_PI
#define M_PI
Definition: odrSpiral.cpp:40
GNEDemandElement::DemandElementSegmentGeometry::Segment
struct used for represent segments of demand element geometry
Definition: GNEDemandElement.h:83
GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:49
InvalidArgument
Definition: UtilExceptions.h:57
GNEDemandElement::DemandElementGeometry::DemandElementGeometry
DemandElementGeometry()
constructor
Definition: GNEDemandElement.cpp:49
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:970
GNEDemandElement::DemandElementSegmentGeometry::Segment::Segment
Segment(const GNEDemandElement *_element, const GNEEdge *_edge, const Position _pos, const bool _visible, const bool _valid)
parameter constructor for edges
Definition: GNEDemandElement.cpp:87
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:524
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:217
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:267
GNEDemandElement::isRouteValid
static bool isRouteValid(const std::vector< GNEEdge * > &edges, bool report)
check if a route is valid
Definition: GNEDemandElement.cpp:489
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:844
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1020
GNEDemandElement::deleteRouteCalculatorInstance
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
Definition: GNEDemandElement.cpp:424
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:225
DijkstraRouter.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
GNEDemandElement::DemandElementSegmentGeometry
struct for pack all variables related with geometry of elemements divided in segments
Definition: GNEDemandElement.h:80
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
GNEDemandElement::getBegin
virtual std::string getBegin() const
get begin time of demand element
Definition: GNEDemandElement.cpp:402
MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:371
GNEJunction
Definition: GNEJunction.h:48
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
GNEHierarchicalElementChildren::getDemandElementChildren
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:297
GNEDemandElement::DemandElementGeometry::clearGeometry
void clearGeometry()
reset geometry
Definition: GNEDemandElement.cpp:53
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:378
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:164
GNEDemandElement::~GNEDemandElement
~GNEDemandElement()
Destructor.
Definition: GNEDemandElement.cpp:356
GNEDemandElement::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEDemandElement.cpp:470
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNEHierarchicalElementChildren
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalElementChildren.h:46
GNEDemandElement::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEDemandElement.cpp:561
GNENet.h
GNEAttributeCarrier::TagProperties::getNumberOfAttributes
int getNumberOfAttributes() const
get number of attributes
Definition: GNEAttributeCarrier.cpp:646
NBEdgeCont::getAllRouterEdges
RouterEdgeVector getAllRouterEdges() const
Definition: NBEdgeCont.cpp:1499