Eclipse SUMO - Simulation of Urban MObility
GNERouteHandler.h
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 // Builds demand objects for netedit
16 /****************************************************************************/
17 #ifndef GNERouteHandler_h
18 #define GNERouteHandler_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include <config.h>
25 
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 
37 class GNEViewNet;
38 class GNEEdge;
39 class GNETAZ;
40 class GNEDemandElement;
41 class GNEVehicle;
42 class GNEPerson;
43 class GNEUndoList;
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
48 
52 public:
54  struct RouteParameter {
55 
58 
60  RouteParameter(GNEDemandElement* originalDemandElement);
61 
63  void setEdges(GNEViewNet* viewNet, const std::string& edgeIDs);
64 
66  void setEdges(GNEViewNet* viewNet, const std::string& vehicleID, const std::string& fromID, const std::string& toID, const std::string& viaIDs);
67 
69  std::string routeID;
70 
72  std::vector<GNEEdge*> edges;
73 
76 
79 
82  };
83 
85  GNERouteHandler(const std::string& file, GNEViewNet* viewNet, bool undoDemandElements = true);
86 
89 
91  static bool isVehicleIdDuplicated(GNEViewNet* viewNet, const std::string& id);
92 
94  static bool isPersonIdDuplicated(GNEViewNet* viewNet, const std::string& id);
95 
99  static void buildVehicleOverRoute(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter& vehicleParameters);
100 
102  static void buildFlowOverRoute(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter& vehicleParameters);
103 
105  static void buildVehicleWithEmbeddedRoute(GNEViewNet* viewNet, bool undoDemandElements, SUMOVehicleParameter vehicleParameters, GNEDemandElement* embeddedRouteCopy);
106 
108  static void buildFlowWithEmbeddedRoute(GNEViewNet* viewNet, bool undoDemandElements, SUMOVehicleParameter vehicleParameters, GNEDemandElement* embeddedRouteCopy);
109 
111  static void buildTrip(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter& vehicleParameters, const std::vector<GNEEdge*>& edges);
112 
114  static void buildFlow(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter& vehicleParameters, const std::vector<GNEEdge*>& edges);
115 
117  static void buildStop(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter::Stop& stopParameters, GNEDemandElement* stopParent, bool friendlyPosition);
118 
120  static void buildPerson(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter& personParameters);
121 
123  static void buildPersonFlow(GNEViewNet* viewNet, bool undoDemandElements, const SUMOVehicleParameter& personFlowParameters);
124 
126  static void buildPersonTripFromTo(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges,
127  const std::vector<std::string>& types, const std::vector<std::string>& modes, double arrivalPos);
128 
130  static void buildPersonTripBusStop(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges,
131  GNEAdditional* busStop, const std::vector<std::string>& types, const std::vector<std::string>& modes);
132 
134  static void buildWalkEdges(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, double arrivalPos);
135 
137  static void buildWalkFromTo(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, double arrivalPos);
138 
140  static void buildWalkBusStop(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, GNEAdditional* busStop);
141 
143  static void buildWalkRoute(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, GNEDemandElement* routeParent, double arrivalPos);
144 
146  static void buildRideFromTo(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges,
147  const std::vector<std::string>& lines, double arrivalPos);
148 
150  static void buildRideBusStop(GNEViewNet* viewNet, bool undoDemandElements, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges,
151  GNEAdditional* busStop, const std::vector<std::string>& lines);
152 
154 
157 
159  static void transformToVehicle(GNEVehicle* originalVehicle, bool createEmbeddedRoute);
160 
162  static void transformToRouteFlow(GNEVehicle* originalVehicle, bool createEmbeddedRoute);
163 
165  static void transformToTrip(GNEVehicle* originalVehicle);
166 
168  static void transformToFlow(GNEVehicle* originalVehicle);
169 
171 
174 
176  static void transformToPerson(GNEPerson* originalPerson);
177 
179  static void transformToPersonFlow(GNEPerson* originalPerson);
180 
182 
183 protected:
185  static void embebbeRoute(GNEVehicle* vehicle, GNEUndoList* undoList);
186 
188  static GNEVehicle* separateEmbeddedRoute(GNEVehicle* vehicle, GNEUndoList* undoList);
189 
192 
195 
197  void openRoute(const SUMOSAXAttributes& attrs);
198 
200  void openFlow(const SUMOSAXAttributes& attrs);
201 
203  void openTrip(const SUMOSAXAttributes& attrs);
204 
211  void closeRoute(const bool mayBeDisconnected = false);
212 
214  void openRouteDistribution(const SUMOSAXAttributes& attrs);
215 
217  void closeRouteDistribution();
218 
220  void closeVehicle();
221 
223  void closeVType();
224 
226  void closePerson();
227 
229  void closePersonFlow();
230 
232  void closeContainer();
233 
235  void closeFlow();
236 
238  void closeTrip();
239 
241  void addStop(const SUMOSAXAttributes& attrs);
242 
244  void addPersonTrip(const SUMOSAXAttributes& attrs);
245 
247  void addWalk(const SUMOSAXAttributes& attrs);
248 
250  void addPerson(const SUMOSAXAttributes& attrs);
251 
253  void addContainer(const SUMOSAXAttributes& attrs);
254 
256  void addRide(const SUMOSAXAttributes& attrs);
257 
259  void addTransport(const SUMOSAXAttributes& attrs);
260 
262  void addTranship(const SUMOSAXAttributes& attrs);
263 
264 private:
269 
271  GNEEdge* getLastEdge() const;
272 
274  std::vector<GNEEdge*> calculateEdgePath() const;
275 
278 
281 
284 
286  std::vector<GNEEdge*> via;
287 
289  std::vector<GNEEdge*> edges;
290 
293 
296 
298  std::vector<std::string> vTypes;
299 
301  std::vector<std::string> modes;
302 
304  std::vector<std::string> lines;
305 
307  double arrivalPos;
308 
311 
314 
317  };
318 
321 
323  std::vector<PersonPlansValues> myPersonPlanValues;
324 
327 
329  bool myAbort;
330 
333 };
334 
335 
336 #endif
void closeRouteDistribution()
closes (ends) the building of a distribution
RouteParameter myRouteParameter
NETEDIT Route Parameters.
void closeVehicle()
Ends the processing of a vehicle.
void closeFlow()
Ends the processing of a routeFlow.
SUMOVehicleClass VClass
VClass used by this route.
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool myAbort
flag used for parsing values
static void transformToVehicle(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform vehicle functions
~GNERouteHandler()
Destructor.
struct for saving route parameters
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static void buildRideFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, const std::vector< std::string > &lines, double arrivalPos)
build ride using a from-to edges
static bool isPersonIdDuplicated(GNEViewNet *viewNet, const std::string &id)
check if there is already a person (Person or PersonFlow) with the given ID
static void buildTrip(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter &vehicleParameters, const std::vector< GNEEdge *> &edges)
build trip
GNEAdditional * busStop
busStop
std::vector< std::string > modes
modes
void setEdges(GNEViewNet *viewNet, const std::string &edgeIDs)
set edges (list of consecutive edges)
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
opens a type distribution for reading
static void transformToTrip(GNEVehicle *originalVehicle)
transform to trip
RGBColor color
string for saving parsed route colors
static void embebbeRoute(GNEVehicle *vehicle, GNEUndoList *undoList)
embebbe route within a vehicle
void openTrip(const SUMOSAXAttributes &attrs)
opens a trip for reading
void closeContainer()
Ends the processing of a container.
SUMOVehicleParameter::Stop stopParameters
stop parameters
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
std::vector< std::string > lines
lines
static bool isVehicleIdDuplicated(GNEViewNet *viewNet, const std::string &id)
check if there is already a vehicle (Vehicle, Trip, Flow or Flow) with the given ID ...
struct used for load person plans (Rides, Walks, etc.)
static void buildFlow(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter &vehicleParameters, const std::vector< GNEEdge *> &edges)
build flow
Parameterised genericParameters
generic parameters
static void buildRideBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, GNEAdditional *busStop, const std::vector< std::string > &lines)
build ride using a from edge and a busStop
void addRide(const SUMOSAXAttributes &attrs)
Processing of a ride.
static void transformToFlow(GNEVehicle *originalVehicle)
transform to flow
void closePersonFlow()
Ends the processing of a personFlow.
std::vector< GNEEdge * > edges
edges
void openFlow(const SUMOSAXAttributes &attrs)
opens a routeFlow for reading
std::vector< GNEEdge * > edges
list of edges
Encapsulated SAX-Attributes.
void addTranship(const SUMOSAXAttributes &attrs)
Processing of a tranship.
static void buildPerson(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter &personParameters)
build person
void closePerson()
Ends the processing of a person.
void openRoute(const SUMOSAXAttributes &attrs)
opens a route for reading
Definition: GNETAZ.h:35
GNEViewNet * myViewNet
pointer to View&#39;s Net
bool myUndoDemandElements
flag to check if created demand elements must be undo and redo
static void buildWalkFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, double arrivalPos)
build walk using a from-to edges
std::vector< GNEEdge * > via
via edges
void closeRoute(const bool mayBeDisconnected=false)
static void buildPersonFlow(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter &personFlowParameters)
build person flow
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
Definition of vehicle stop (position and duration)
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
Parser for routes during their loading.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
Structure representing possible vehicle parameter.
static void transformToRouteFlow(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform routeFlow over an existent route
void addPerson(const SUMOSAXAttributes &attrs)
Processing of a person.
static void buildWalkRoute(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, GNEDemandElement *routeParent, double arrivalPos)
build walk using a list of consecutive edges
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
static void buildStop(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter::Stop &stopParameters, GNEDemandElement *stopParent, bool friendlyPosition)
build stop
static GNEVehicle * separateEmbeddedRoute(GNEVehicle *vehicle, GNEUndoList *undoList)
separate vehicle and embedded route
void closeVType()
Ends the processing of a vehicle Type.
void addPersonTrip(const SUMOSAXAttributes &attrs)
add a routing request for a walking or intermodal person
std::vector< PersonPlansValues > myPersonPlanValues
container for person trips loaded values
void closeVehicleTypeDistribution()
closes (ends) the building of a distribution
void openRouteDistribution(const SUMOSAXAttributes &attrs)
opens a route distribution for reading
bool friendlyPos
friendly position
static void buildWalkBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, GNEAdditional *busStop)
build walk using a form edge an a busStop
static void buildVehicleWithEmbeddedRoute(GNEViewNet *viewNet, bool undoDemandElements, SUMOVehicleParameter vehicleParameters, GNEDemandElement *embeddedRouteCopy)
build vehicle with a embedded route
static void buildFlowOverRoute(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter &vehicleParameters)
build a flow over an existent route
static void buildPersonTripFromTo(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, const std::vector< std::string > &types, const std::vector< std::string > &modes, double arrivalPos)
build trip using a from-to edges
GNEDemandElement * route
arrival route
static void buildWalkEdges(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, double arrivalPos)
build walk using a list of consecutive edges
std::vector< std::string > vTypes
vehicle types
GNERouteHandler(const std::string &file, GNEViewNet *viewNet, bool undoDemandElements=true)
Constructor.
void addWalk(const SUMOSAXAttributes &attrs)
add a fully specified walk
std::string routeID
string for saving parsed Route ID
void addTransport(const SUMOSAXAttributes &attrs)
Processing of a transport.
void addContainer(const SUMOSAXAttributes &attrs)
Processing of a container.
void closeTrip()
Ends the processing of a trip.
static void buildVehicleOverRoute(GNEViewNet *viewNet, bool undoDemandElements, const SUMOVehicleParameter &vehicleParameters)
build functions
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
static void buildFlowWithEmbeddedRoute(GNEViewNet *viewNet, bool undoDemandElements, SUMOVehicleParameter vehicleParameters, GNEDemandElement *embeddedRouteCopy)
build flow with a embedded route
static void buildPersonTripBusStop(GNEViewNet *viewNet, bool undoDemandElements, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, GNEAdditional *busStop, const std::vector< std::string > &types, const std::vector< std::string > &modes)
build trip using a from edge and a busStop