Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
RORouteHandler.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-2023 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/****************************************************************************/
20// Parser and container for routes during their loading
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <string>
26#include <vector>
32#include "ROPerson.h"
33
34
35// ===========================================================================
36// class declarations
37// ===========================================================================
39class ROEdge;
40class ROLane;
41class RONet;
42class RORoute;
43class RORouteDef;
44
45
46// ===========================================================================
47// class definitions
48// ===========================================================================
58public:
60 RORouteHandler(RONet& net, const std::string& file,
61 const bool tryRepair,
62 const bool emptyDestinationsAllowed,
63 const bool ignoreErrors,
64 const bool checkSchema);
65
67 virtual ~RORouteHandler();
68
70 bool checkLastDepart();
71
72protected:
74
76
77
85 virtual void myStartElement(int element,
86 const SUMOSAXAttributes& attrs);
88
95 void parseFromViaTo(SumoXMLTag tag, const SUMOSAXAttributes& attrs, bool& ok);
96
99
102
104 void openRoute(const SUMOSAXAttributes& attrs);
105
107 void openFlow(const SUMOSAXAttributes& attrs);
108
110 void openRouteFlow(const SUMOSAXAttributes& attrs);
111
113 void openTrip(const SUMOSAXAttributes& attrs);
114
121 void closeRoute(const bool mayBeDisconnected = false);
122
124 void openRouteDistribution(const SUMOSAXAttributes& attrs);
125
128
130 void closeVehicle();
131
133 void closeVType();
134
136 void closePerson();
137
139 void closePersonFlow();
140
142 void closeContainer();
143
145 void closeContainerFlow();
146
148 void closeFlow();
149
151 void closeTrip();
152
154 const SUMOVehicleParameter::Stop* retrieveStoppingPlace(const SUMOSAXAttributes& attrs, const std::string& errorSuffix, std::string& id, const SUMOVehicleParameter::Stop* stopParam = nullptr);
155
158
160 void addPerson(const SUMOSAXAttributes& attrs);
161
163 void addFlowPerson(SUMOVTypeParameter* type, SUMOTime depart, const std::string& baseID, int i);
164
166 void addContainer(const SUMOSAXAttributes& attrs);
167
169 void addRide(const SUMOSAXAttributes& attrs);
170
172 void addTransport(const SUMOSAXAttributes& attrs);
173
175 void addTranship(const SUMOSAXAttributes& attrs);
176
178 void parseEdges(const std::string& desc, ConstROEdgeVector& into,
179 const std::string& rid, bool& ok);
180
182 void parseGeoEdges(const PositionVector& positions, bool geo,
183 ConstROEdgeVector& into, const std::string& rid, bool isFrom, bool& ok);
184
186 const ROEdge* getClosestEdge(const Position& pos, double distance, SUMOVehicleClass vClass);
187
189 const ROEdge* getJunctionTaz(const Position& pos, const ROEdge* closestEdge, SUMOVehicleClass vClass, bool isFrom);
190
192 void addPersonTrip(const SUMOSAXAttributes& attrs);
193
195 void addWalk(const SUMOSAXAttributes& attrs);
196
198 void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
199 const ROEdge* fromEdge, const ROEdge*& toEdge,
200 double& departPos, double& arrivalPos, std::string& busStopID,
201 const ROPerson::PlanItem* const lastStage, bool& ok);
202
205
206protected:
209
212
216
218 std::vector<ROPerson::PlanItem*>* myActivePlan;
219
222
225
227 const bool myTryRepair;
228
231
234
237
239 const bool myKeepVTypeDist;
240
244
246 const bool myUnsortedInput;
247
250
253
256
259
260private:
262 RORouteHandler(const RORouteHandler& s) = delete;
263
266};
long long int SUMOTime
Definition GUI.h:36
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:54
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
A RT-tree for efficient storing of SUMO's Named objects.
Definition NamedRTree.h:61
An output device that encapsulates an ofstream.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
A basic edge for routing applications.
Definition ROEdge.h:70
A single lane the router may use.
Definition ROLane.h:48
The router's network representation.
Definition RONet.h:62
Every person has a plan comprising of multiple planItems.
Definition ROPerson.h:82
Base class for a vehicle's route definition.
Definition RORouteDef.h:53
Parser and container for routes during their loading.
void closeTrip()
Ends the processing of a trip.
void closeRouteDistribution()
closes (ends) the building of a distribution
const SUMOVehicleParameter::Stop * retrieveStoppingPlace(const SUMOSAXAttributes &attrs, const std::string &errorSuffix, std::string &id, const SUMOVehicleParameter::Stop *stopParam=nullptr)
retrieve stopping place element
NamedRTree * myLaneTree
RTree for finding lanes.
RORouteHandler & operator=(const RORouteHandler &s)=delete
Invalidated assignment operator.
const double myMapMatchingDistance
maximum distance when map-matching
void deleteActivePlanAndVehicleParameter()
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
virtual ~RORouteHandler()
standard destructor
RORouteHandler(const RORouteHandler &s)=delete
Invalidated copy constructor.
void addTranship(const SUMOSAXAttributes &attrs)
Processing of a tranship.
void parseEdges(const std::string &desc, ConstROEdgeVector &into, const std::string &rid, bool &ok)
Parse edges from strings.
void closeVType()
Ends the processing of a vehicle type.
void addRide(const SUMOSAXAttributes &attrs)
Processing of a ride.
void addWalk(const SUMOSAXAttributes &attrs)
add a fully specified walk
RONet & myNet
The current route.
NamedRTree * getLaneTree()
initialize lane-RTree
bool checkLastDepart()
Checks whether the route file is sorted by departure time if needed.
ConstROEdgeVector myActiveRoute
The current route.
const ROEdge * getJunctionTaz(const Position &pos, const ROEdge *closestEdge, SUMOVehicleClass vClass, bool isFrom)
find closest junction taz given the closest edge
std::vector< ROPerson::PlanItem * > * myActivePlan
The plan of the current person.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
const bool myTryRepair
Information whether routes shall be repaired.
OutputDevice_String * myActiveContainerPlan
The plan of the current container.
SUMOTime myActiveRoutePeriod
const SUMOTime myBegin
The begin time.
RandomDistributor< SUMOVTypeParameter * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability->vehicle type)
void closePersonFlow()
Ends the processing of a personFlow.
void closePerson()
Ends the processing of a person.
void openRouteDistribution(const SUMOSAXAttributes &attrs)
opens a route distribution for reading
int myActiveContainerPlanSize
The number of stages in myActiveContainerPlan.
const bool myKeepVTypeDist
whether to keep the the vtype distribution in output
void openRouteFlow(const SUMOSAXAttributes &attrs)
opens a route flow for reading
const bool myUnsortedInput
whether input is read all at once (no sorting check is necessary)
void openTrip(const SUMOSAXAttributes &attrs)
opens a trip for reading
void closeVehicle()
Ends the processing of a vehicle.
const bool myEmptyDestinationsAllowed
Information whether the "to" attribute is mandatory.
void addContainer(const SUMOSAXAttributes &attrs)
Processing of a container.
const bool myMapMatchJunctions
Parameterised * addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
void addTransport(const SUMOSAXAttributes &attrs)
Processing of a transport.
void parseWalkPositions(const SUMOSAXAttributes &attrs, const std::string &personID, const ROEdge *fromEdge, const ROEdge *&toEdge, double &departPos, double &arrivalPos, std::string &busStopID, const ROPerson::PlanItem *const lastStage, bool &ok)
@ brief parse depart- and arrival positions of a walk
MsgHandler *const myErrorOutput
Depending on the "ignore-errors" option different outputs are used.
void closeRoute(const bool mayBeDisconnected=false)
closes (ends) the building of a route.
void closeFlow()
Ends the processing of a flow.
int myActiveRouteRepeat
number of repetitions of the active route
void closeContainer()
Ends the processing of a container.
void closeVehicleTypeDistribution()
closes (ends) the building of a distribution
void addFlowPerson(SUMOVTypeParameter *type, SUMOTime depart, const std::string &baseID, int i)
Processing of a person from a personFlow.
void addPerson(const SUMOSAXAttributes &attrs)
Processing of a person.
void parseGeoEdges(const PositionVector &positions, bool geo, ConstROEdgeVector &into, const std::string &rid, bool isFrom, bool &ok)
Parse edges from coordinates.
RORouteDef * myCurrentAlternatives
The currently parsed route alternatives.
void openFlow(const SUMOSAXAttributes &attrs)
opens a flow for reading
void closeContainerFlow()
Ends the processing of a containerFlow.
void addPersonTrip(const SUMOSAXAttributes &attrs)
add a routing request for a walking or intermodal person
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
opens a type distribution for reading
const ROEdge * getClosestEdge(const Position &pos, double distance, SUMOVehicleClass vClass)
find closest edge within distance for the given position or nullptr
void openRoute(const SUMOSAXAttributes &attrs)
opens a route for reading
void parseFromViaTo(SumoXMLTag tag, const SUMOSAXAttributes &attrs, bool &ok)
Called for parsing from and to and the corresponding taz attributes.
A complete router's route.
Definition RORoute.h:52
Represents a generic random distribution.
Parser for routes during their loading.
Encapsulated SAX-Attributes.
Structure representing possible vehicle parameter.
Definition of vehicle stop (position and duration)