Eclipse SUMO - Simulation of Urban MObility
RORouteHandler.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-2022 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
75
83 virtual void myStartElement(int element,
84 const SUMOSAXAttributes& attrs);
86
93 void parseFromViaTo(SumoXMLTag tag, const SUMOSAXAttributes& attrs, bool& ok);
94
97
100
102 void openRoute(const SUMOSAXAttributes& attrs);
103
105 void openFlow(const SUMOSAXAttributes& attrs);
106
108 void openRouteFlow(const SUMOSAXAttributes& attrs);
109
111 void openTrip(const SUMOSAXAttributes& attrs);
112
119 void closeRoute(const bool mayBeDisconnected = false);
120
122 void openRouteDistribution(const SUMOSAXAttributes& attrs);
123
126
128 void closeVehicle();
129
131 void closeVType();
132
134 void closePerson();
135
137 void closePersonFlow();
138
140 void closeContainer();
141
143 void closeContainerFlow();
144
146 void closeFlow();
147
149 void closeTrip();
150
152 const SUMOVehicleParameter::Stop* retrieveStoppingPlace(const SUMOSAXAttributes& attrs, const std::string& errorSuffix, std::string& id, const SUMOVehicleParameter::Stop* stopParam = nullptr);
153
155 void addStop(const SUMOSAXAttributes& attrs);
156
158 void addPerson(const SUMOSAXAttributes& attrs);
159
161 void addFlowPerson(SUMOVTypeParameter* type, SUMOTime depart, const std::string& baseID, int i);
162
164 void addContainer(const SUMOSAXAttributes& attrs);
165
167 void addRide(const SUMOSAXAttributes& attrs);
168
170 void addTransport(const SUMOSAXAttributes& attrs);
171
173 void addTranship(const SUMOSAXAttributes& attrs);
174
176 void parseEdges(const std::string& desc, ConstROEdgeVector& into,
177 const std::string& rid, bool& ok);
178
180 void parseGeoEdges(const PositionVector& positions, bool geo,
181 ConstROEdgeVector& into, const std::string& rid, bool isFrom, bool& ok);
182
184 const ROEdge* getClosestEdge(const Position& pos, double distance, SUMOVehicleClass vClass);
185
187 const ROEdge* getJunctionTaz(const Position& pos, const ROEdge* closestEdge, SUMOVehicleClass vClass, bool isFrom);
188
190 void addPersonTrip(const SUMOSAXAttributes& attrs);
191
193 void addWalk(const SUMOSAXAttributes& attrs);
194
196 void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID,
197 const ROEdge* fromEdge, const ROEdge*& toEdge,
198 double& departPos, double& arrivalPos, std::string& busStopID,
199 const ROPerson::PlanItem* const lastStage, bool& ok);
200
203
204protected:
207
210
214
216 std::vector<ROPerson::PlanItem*>* myActivePlan;
217
220
223
225 const bool myTryRepair;
226
229
232
235
237 const bool myKeepVTypeDist;
238
242
244 const bool myUnsortedInput;
245
248
251
254
257
258private:
260 RORouteHandler(const RORouteHandler& s) = delete;
261
264};
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.
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.
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
RORouteHandler & operator=(const RORouteHandler &s)=delete
Invalidated assignment operator.
const double myMapMatchingDistance
maximum distance when map-matching
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
virtual ~RORouteHandler()
standard destructor
RORouteHandler(const RORouteHandler &s)=delete
Invalidated copy constructor.
RORouteHandler(RONet &net, const std::string &file, const bool tryRepair, const bool emptyDestinationsAllowed, const bool ignoreErrors, const bool checkSchema)
standard 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
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
Parser for routes during their loading.
Encapsulated SAX-Attributes.
Structure representing possible vehicle parameter.
Definition of vehicle stop (position and duration)