Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNERouteHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Builds demand objects for netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
34
35
36// ===========================================================================
37// class declarations
38// ===========================================================================
39
40class GNEViewNet;
41class GNEEdge;
42class GNETAZ;
44class GNEVehicle;
45class GNEPerson;
46class GNEContainer;
47class GNEUndoList;
48
49// ===========================================================================
50// class definitions
51// ===========================================================================
52
56
57public:
59 GNERouteHandler(const std::string& file, GNENet* net, const bool allowUndoRedo, const bool overwrite);
60
62 virtual ~GNERouteHandler();
63
65 bool postParserTasks();
66
69
71 bool buildVType(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVTypeParameter& vTypeParameter);
72
74 bool buildVTypeDistribution(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const int deterministic,
75 const std::vector<std::string>& vTypeIDs, const std::vector<double>& probabilities);
76
78 bool buildRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, SUMOVehicleClass vClass,
79 const std::vector<std::string>& edgeIDs, const RGBColor& color, const int repeat, const SUMOTime cycleTime,
80 const double probability, const Parameterised::Map& routeParameters);
81
83 bool buildEmbeddedRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::vector<std::string>& edgeIDs,
84 const RGBColor& color, const int repeat, const SUMOTime cycleTime,
85 const Parameterised::Map& routeParameters);
86
88 bool buildRouteDistribution(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id,
89 const std::vector<std::string>& routeIDs, const std::vector<double>& probabilities);
90
92 bool buildVehicleOverRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters);
93
95 bool buildFlowOverRoute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters);
96
98 bool buildTrip(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
99 const std::string& fromEdgeID, const std::string& toEdgeID);
100
102 bool buildTripJunctions(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
103 const std::string& fromJunctionID, const std::string& toJunctionID);
104
106 bool buildTripTAZs(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
107 const std::string& fromTAZID, const std::string& toTAZID);
108
110 bool buildFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
111 const std::string& fromEdgeID, const std::string& toEdgeIDs);
112
114 bool buildFlowJunctions(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
115 const std::string& fromJunctionID, const std::string& toJunctionID);
116
118 bool buildFlowTAZs(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameters,
119 const std::string& fromTAZID, const std::string& toTAZID);
120
122 bool buildPerson(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& personParameters);
123
125 bool buildPersonFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& personFlowParameters);
126
128 bool buildPersonTrip(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
129 const double arrivalPos, const std::vector<std::string>& types, const std::vector<std::string>& modes,
130 const std::vector<std::string>& lines, const double walkFactor, const std::string& group);
131
133 bool buildWalk(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
134 const double arrivalPos, const double speed, const SUMOTime duration);
135
137 bool buildRide(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
138 const double arrivalPos, const std::vector<std::string>& lines, const std::string& group);
139
141 bool buildContainer(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& containerParameters);
142
144 bool buildContainerFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& containerFlowParameters);
145
147 bool buildTransport(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
148 const double arrivalPos, const std::vector<std::string>& lines, const std::string& group);
149
151 bool buildTranship(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
152 const double arrivalPosition, const double departPosition, const double speed, const SUMOTime duration);
153
155 bool buildPersonStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
156 const double endPos, const SUMOTime duration, const SUMOTime until,
157 const std::string& actType, const bool friendlyPos, const int parameterSet);
158
160 bool buildContainerStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
161 const double endPos, const SUMOTime duration, const SUMOTime until, const std::string& actType, const bool friendlyPos,
162 const int parameterSet);
163
165 bool buildStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const CommonXMLStructure::PlanParameters& planParameters,
166 const SUMOVehicleParameter::Stop& stopParameters);
167
169 bool buildPersonPlan(const GNEDemandElement* planTemplate, GNEDemandElement* personParent, GNEAttributesCreator* personPlanAttributes,
170 GNEPlanCreator* planCreator, const bool centerAfterCreation);
171
173 bool buildContainerPlan(const GNEDemandElement* planTemplate, GNEDemandElement* containerParent, GNEAttributesCreator* containerPlanAttributes,
174 GNEPlanCreator* planCreator, const bool centerAfterCreation);
175
177
179 void duplicatePlan(const GNEDemandElement* originalPlan, GNEDemandElement* newParent);
180
182 bool checkViaAttribute(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& via);
183
186
188 static void transformToVehicle(GNEVehicle* originalVehicle, bool createEmbeddedRoute);
189
191 static void transformToRouteFlow(GNEVehicle* originalVehicle, bool createEmbeddedRoute);
192
194 static void transformToTrip(GNEVehicle* originalVehicle);
195
197 static void transformToFlow(GNEVehicle* originalVehicle);
198
200 static void transformToTripJunctions(GNEVehicle* originalVehicle);
201
203 static void transformToFlowJunctions(GNEVehicle* originalVehicle);
204
206 static void transformToTripTAZs(GNEVehicle* originalVehicle);
207
209 static void transformToFlowTAZs(GNEVehicle* originalVehicle);
210
212
215
217 static void transformToPerson(GNEPerson* originalPerson);
218
220 static void transformToPersonFlow(GNEPerson* originalPerson);
221
223
226
228 static void transformToContainer(GNEContainer* originalContainer);
229
231 static void transformToContainerFlow(GNEContainer* originalContainer);
232
234
237
239 static bool canReverse(const GNEDemandElement* element);
240
242 static bool canReverse(GNENet* net, SUMOVehicleClass vClass, const std::vector<GNEEdge*>& edges);
243
245 static void reverse(GNEDemandElement* element);
246
248 static void addReverse(GNEDemandElement* element);
249
251
252protected:
254 GNEJunction* parseJunction(const SumoXMLTag tag, const std::string &id, const std::string& junctionID);
255
257 GNEAdditional* parseTAZ(const SumoXMLTag tag, const std::string &id, const std::string& TAZID);
258
260 GNEEdge* parseEdge(const SumoXMLTag tag, const std::string &id, const std::string& edgeID,
261 const CommonXMLStructure::SumoBaseObject* sumoBaseObject,
262 const bool firstEdge);
263
265 GNEEdge* parseStopEdge(const CommonXMLStructure::SumoBaseObject* sumoBaseObject) const;
266
268 GNEEdge* parseEdgeFromLaneID(const std::string &laneID) const;
269
271 std::vector<GNEEdge*> parseEdges(const SumoXMLTag tag, const std::string &id, const std::vector<std::string>& edgeIDs);
272
274 GNEDemandElement* getType(const std::string& id) const;
275
278
281
283 bool getDistributionElements(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, SumoXMLTag distributionElementTag,
284 const std::vector<std::string>& distributionElementIDs, const std::vector<double>& probabilities,
285 std::vector<const GNEDemandElement*>& elements);
286
288 bool checkDuplicatedDemandElement(const SumoXMLTag tag, const std::vector<SumoXMLTag> tags, const std::string& id);
289
290private:
293
296
298 std::set<GNEDemandElement*> myParentPlanElements;
299
301 const bool myAllowUndoRedo;
302
304 const bool myOverwrite;
305
307 static const std::vector<SumoXMLTag> myVehicleTags;
308
310 static const std::vector<SumoXMLTag> myPersonTags;
311
313 static const std::vector<SumoXMLTag> myContainerTags;
314};
long long int SUMOTime
Definition GUI.h:36
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
plan parameters (used for group all from-to parameters related with plans)
An Element which don't belong to GNENet but has influence in the simulation.
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
GNEEdge * parseStopEdge(const CommonXMLStructure::SumoBaseObject *sumoBaseObject) const
parse stop edge
const bool myOverwrite
check if overwrite
bool buildTripJunctions(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromJunctionID, const std::string &toJunctionID)
build trip over junctions
static void addReverse(GNEDemandElement *element)
add reverse for given demand element
bool buildPersonPlan(const GNEDemandElement *planTemplate, GNEDemandElement *personParent, GNEAttributesCreator *personPlanAttributes, GNEPlanCreator *planCreator, const bool centerAfterCreation)
build person plan
bool buildRide(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group)
build ride
bool buildVType(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVTypeParameter &vTypeParameter)
build vType
CommonXMLStructure::SumoBaseObject * myPlanObject
pointer for person and container plans
GNEDemandElement * getPersonParent(const CommonXMLStructure::SumoBaseObject *sumoBaseObject) const
get person parent
const bool myAllowUndoRedo
allow undo/redo
GNEEdge * parseEdgeFromLaneID(const std::string &laneID) const
parse edge from lane ID
bool buildWalk(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const double speed, const SUMOTime duration)
build walk
GNEJunction * parseJunction(const SumoXMLTag tag, const std::string &id, const std::string &junctionID)
parse junction
bool buildRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, SUMOVehicleClass vClass, const std::vector< std::string > &edgeIDs, const RGBColor &color, const int repeat, const SUMOTime cycleTime, const double probability, const Parameterised::Map &routeParameters)
build route
bool buildPersonTrip(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &types, const std::vector< std::string > &modes, const std::vector< std::string > &lines, const double walkFactor, const std::string &group)
build person trip
static void transformToRouteFlow(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform routeFlow over an existent route
GNENet * myNet
pointer to GNENet
void duplicatePlan(const GNEDemandElement *originalPlan, GNEDemandElement *newParent)
duplicate given plan in new parent
static void transformToContainerFlow(GNEContainer *originalContainer)
transform routeFlow over an existent route
bool buildPersonFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &personFlowParameters)
build person flow
static void transformToFlow(GNEVehicle *originalVehicle)
transform to flow
bool buildFlowJunctions(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromJunctionID, const std::string &toJunctionID)
build flow over junctions
bool buildFlowTAZs(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromTAZID, const std::string &toTAZID)
build flow over junctions
static const std::vector< SumoXMLTag > myContainerTags
container tags
GNEAdditional * parseTAZ(const SumoXMLTag tag, const std::string &id, const std::string &TAZID)
parse TAZ
static const std::vector< SumoXMLTag > myVehicleTags
vehicle tags
bool buildContainer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &containerParameters)
build container
bool buildTripTAZs(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromTAZID, const std::string &toTAZID)
build trip over TAZs
bool buildTransport(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group)
build transport
static bool canReverse(const GNEDemandElement *element)
reverse functions
bool buildStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const SUMOVehicleParameter::Stop &stopParameters)
build stop
bool postParserTasks()
run post parser tasks
std::vector< GNEEdge * > parseEdges(const SumoXMLTag tag, const std::string &id, const std::vector< std::string > &edgeIDs)
parse edges
bool checkViaAttribute(const SumoXMLTag tag, const std::string &id, const std::vector< std::string > &via)
check if via attribute is valid
bool buildContainerStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double endPos, const SUMOTime duration, const SUMOTime until, const std::string &actType, const bool friendlyPos, const int parameterSet)
build container stop
static void transformToTrip(GNEVehicle *originalVehicle)
transform to trip
bool buildPersonStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double endPos, const SUMOTime duration, const SUMOTime until, const std::string &actType, const bool friendlyPos, const int parameterSet)
build person stop
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
bool buildContainerPlan(const GNEDemandElement *planTemplate, GNEDemandElement *containerParent, GNEAttributesCreator *containerPlanAttributes, GNEPlanCreator *planCreator, const bool centerAfterCreation)
build container plan
static const std::vector< SumoXMLTag > myPersonTags
person tags
GNEDemandElement * getType(const std::string &id) const
get type (Either type o typeDistribution)
virtual ~GNERouteHandler()
Destructor.
bool buildFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromEdgeID, const std::string &toEdgeIDs)
build flow
bool checkDuplicatedDemandElement(const SumoXMLTag tag, const std::vector< SumoXMLTag > tags, const std::string &id)
check if given ID correspond to a duplicated demand element
bool buildContainerFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &containerFlowParameters)
build container flow
bool buildTrip(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromEdgeID, const std::string &toEdgeID)
build trip
bool buildVehicleOverRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters)
build a vehicle over an existent route
bool buildVTypeDistribution(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const int deterministic, const std::vector< std::string > &vTypeIDs, const std::vector< double > &probabilities)
build vType distribution
GNEDemandElement * getContainerParent(const CommonXMLStructure::SumoBaseObject *sumoBaseObject) const
get container parent
static void reverse(GNEDemandElement *element)
reverse given demand element
bool buildPerson(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &personParameters)
build person
static void transformToFlowJunctions(GNEVehicle *originalVehicle)
transform to flow over junctions
static void transformToTripJunctions(GNEVehicle *originalVehicle)
transform to trip over junctions
static void transformToContainer(GNEContainer *originalContainer)
transform container functions
bool buildRouteDistribution(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::vector< std::string > &routeIDs, const std::vector< double > &probabilities)
build route distribution
bool buildTranship(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPosition, const double departPosition, const double speed, const SUMOTime duration)
build tranship
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
GNEEdge * parseEdge(const SumoXMLTag tag, const std::string &id, const std::string &edgeID, const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const bool firstEdge)
parse edge
bool buildEmbeddedRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::vector< std::string > &edgeIDs, const RGBColor &color, const int repeat, const SUMOTime cycleTime, const Parameterised::Map &routeParameters)
build embedded route
bool getDistributionElements(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, SumoXMLTag distributionElementTag, const std::vector< std::string > &distributionElementIDs, const std::vector< double > &probabilities, std::vector< const GNEDemandElement * > &elements)
get distribution elements
bool buildFlowOverRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters)
build a flow over an existent route
static void transformToFlowTAZs(GNEVehicle *originalVehicle)
transform to flow over TAZs
std::set< GNEDemandElement * > myParentPlanElements
demand element parentplans (person and containers, used in postParserTasks)
static void transformToVehicle(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform vehicle functions
static void transformToTripTAZs(GNEVehicle *originalVehicle)
transform to trip over TAZs
std::map< std::string, std::string > Map
parameters map
Structure representing possible vehicle parameter.
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.