 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
59 delete myDijkstraRouter;
66 if (myDijkstraRouter) {
67 delete myDijkstraRouter;
70 myNet->getNetBuilder()->getEdgeCont().getAllRouterEdges(),
78 std::vector<GNEEdge*> solution;
80 if (partialEdges.size() == 1) {
82 solution.push_back(partialEdges.front());
85 NBVehicle tmpVehicle(
"temporalNBVehicle", vClass);
87 GNENet* net = partialEdges.front()->getNet();
89 for (
int i = 1; i < (int)partialEdges.size(); i++) {
91 std::vector<const NBRouterEdge*> partialRoute;
92 myDijkstraRouter->compute(partialEdges.at(i - 1)->getNBEdge(), partialEdges.at(i)->getNBEdge(), &tmpVehicle, 10, partialRoute);
94 for (
const auto& j : partialRoute) {
100 auto solutionIt = solution.begin();
102 while (solutionIt != solution.end()) {
103 if ((solutionIt + 1) != solution.end()) {
105 if (*solutionIt == *(solutionIt + 1)) {
106 solutionIt = solution.erase(solutionIt);
118 std::vector<GNEEdge*>
121 std::vector<GNEEdge*> partialEdges;
122 partialEdges.reserve(partialEdgesStr.size());
124 for (
const auto& i : partialEdgesStr) {
128 return calculateDijkstraRoute(vClass, partialEdges);
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) :
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)),
298 new FXMenuCommand(ret, (
"Copy " +
getTagStr() +
" name to clipboard").c_str(),
nullptr, ret,
MID_COPY_NAME);
300 new FXMenuSeparator(ret);
307 new FXMenuSeparator(ret);
335 if (edges.size() == 0) {
338 }
else if (edges.size() == 1) {
343 auto it = edges.begin();
344 while (it != edges.end() - 1) {
348 if (currentEdge->
getID() == nextEdge->
getID()) {
357 "' ins't consecutive to " + nextEdge->
getTagStr() +
" '" + nextEdge->
getID() +
"'");
414 if (previousBusStop) {
416 }
else if (previousPersonPlan) {
443 if (previousDemandElmement) {
446 (previousDemandElmement->
getParentAdditionals().front()->getAdditionalGeometry().getShape().size() > 0)) {
448 startPos = previousDemandElmement->
getParentAdditionals().front()->getAdditionalGeometry().getShape().back();
464 if (nextDemandElmement) {
487 if ((departLane ==
"random") || (departLane ==
"free") || (departLane ==
"allowed") || (departLane ==
"best") || (departLane ==
"first")) {
493 if ((departLaneIndex >= 0) && (departLaneIndex <
getParentEdges().front()->getNBEdge()->getNumLanes())) {
527 if (arrivalLane ==
"current") {
533 if ((arrivalLaneIndex >= 0) && (arrivalLaneIndex <
getParentEdges().back()->getNBEdge()->getNumLanes())) {
570 throw ProcessError(
"Calling non-implemented function checkChildDemandElementRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
void updateDijkstraRouter()
update DijkstraRoute (called when SuperMode Demand is selected)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
FXIcon * getIcon() const
get FXIcon associated to this AC
const GNEGeometry::Geometry & getDemandElementGeometry() const
get demand element geometry
An Element which don't belongs to GNENet but has influency in the simulation.
static void createRouteCalculatorInstance(GNENet *net)
create instance of RouteCalculator
An Element which don't belongs to GNENet but has influency in the simulation.
A window containing a gl-object's parameter.
virtual SUMOVehicleClass getVClass() const =0
obtain VClass related with this demand element
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string getID() const
function to support debugging
virtual std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
#define WRITE_WARNING(msg)
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const GNEGeometry::SegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry
A NBNetBuilder extended by visualisation and editing capabilities.
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
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.
open additional dialog (used in netedit)
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Copy object name - popup entry.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
SumoXMLTag
Numbers representing SUMO-XML - element names.
Computes the shortest path through a network using the Dijkstra algorithm.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
NBEdgeCont & getEdgeCont()
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
The representation of a single edge during network building.
An special type of Attribute carrier that owns hierarchical elements.
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute attr
virtual void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
A road/street connecting two junctions (netedit-version)
void changeDemandElementID(const std::string &newID)
change ID of demand element
virtual Position getPositionInView() const =0
Returns position of demand element in view.
GNENet * getNet() const
get the net object
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
NBNetBuilder * getNetBuilder() const
get net builder
static RouteCalculator * myRouteCalculatorInstance
RouteCalculator instance.
struct for pack all variables related with geometry of elemements divided in segments
SUMOAbstractRouter< NBRouterEdge, NBVehicle > * myDijkstraRouter
SUMO Abstract DijkstraRouter.
GNENet * myNet
pointer to net
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const PositionVector & getShape() const
The shape of the additional element.
virtual std::string getAttribute(SumoXMLAttr key) const =0
NBEdge * getNBEdge() const
returns the internal NBEdge
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Supermode currentSupermode
the current supermode
void calculatePersonPlanPositionStartEndPos(Position &startPos, Position &endPos) const
calculate personPlan start and end positions
A point in 2D or 3D with translation and scaling methods.
A vehicle as used by router.
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
struct for pack all variables related with geometry of stop
virtual double getAttributeDouble(SumoXMLAttr key) const =0
virtual void openDemandElementDialog()
open DemandElement Dialog
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
void updateDemandElementID(const std::string &oldID, GNEDemandElement *demandElement)
update demand element ID in container
virtual bool checkChildDemandElementRestriction() const
check restriction with the number of children
~RouteCalculator()
destructor
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
class used to calculate routes in nets
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void calculatePersonPlanLaneStartEndPos(double &startPos, double &endPos) const
calculate personPlan start and end positions over lanes
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
RouteCalculator(GNENet *net)
constructor
bool isPersonStop() const
return true if tag correspond to a person stop element
Demanding mode (Routes, Vehicles etc..)
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
const std::string & getDemandElementID() const
returns DemandElement ID
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
An special type of Attribute carrier that owns hierarchical elements.
static bool isRouteValid(const std::vector< GNEEdge * > &edges, bool report)
check if a route is valid
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
GNEGeometry::Geometry myDemandElementGeometry
demand element geometry
static void deleteRouteCalculatorInstance()
delete instance of RouteCalculator
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra route between a list of partial edges
int size() const
number of segments
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool isRide() const
return true if tag correspond to a ride element
const std::string & getTagStr() const
get tag assigned to this object in string format
virtual std::string getBegin() const
get begin time of demand element
Copy typed object name - popup entry.
A structure which describes a connection between edges or lanes.
const PositionVector & getShape() const
get lane/lane2lane shape
virtual bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
~GNEDemandElement()
Destructor.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
const Segment & back() const
back segment
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
int getNumberOfAttributes() const
get number of attributes
RouterEdgeVector getAllRouterEdges() const