37 #include <xercesc/parsers/SAXParser.hpp> 38 #include <xercesc/util/PlatformUtils.hpp> 39 #include <xercesc/util/TransService.hpp> 40 #include <xercesc/sax2/SAX2XMLReader.hpp> 66 double val,
double beg,
double end)
const {
73 WRITE_WARNING(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
75 WRITE_ERROR(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
87 double val,
double beg,
double end)
const {
94 WRITE_WARNING(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
96 WRITE_ERROR(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
110 myLoaders(oc.exists(
"unsorted-input") && oc.getBool(
"unsorted-input") ? 0 :
DELTA_T) {
122 throw ProcessError(
"Missing definition of network to load!");
125 throw ProcessError(
"The network file '" + file +
"' is not accessible.");
142 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
144 throw ProcessError(
"The additional file '" + *fileIt +
"' is not accessible.");
173 const std::string error =
"No route input specified or all routes were invalid.";
199 while (time <= end) {
209 if (time < end && time + increment > end) {
223 RONet& net,
const bool readAll) {
242 WRITE_ERROR(
"The loader for " + optionName +
" from file '" + fileIt +
"' could not be initialised (" + e.what() +
").");
252 const std::string& measure,
const bool useLanes,
const bool boundariesOverride) {
258 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
264 if (measure !=
"traveltime") {
265 std::string umeasure = measure;
266 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
267 umeasure = measure +
"_perVeh";
275 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
286 i.second->buildTimeLines(measure, boundariesOverride);
296 const double perc = (double)(time - start) / (double) absNo;
299 std::cout <<
"Reading up to time step: " +
time2string(time) +
"\r";
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
std::set< std::string > deprecatedVehicleClassesSeen
void addTravelTime(double value, double timeBegin, double timeEnd)
Adds a travel time value.
void loadNext(SUMOTime step)
loads the next routes up to and including the given time step
RONet & myNet
The network edges shall be obtained from.
static bool isReadable(std::string path)
Checks whether the given file is readable.
void openRoutes(RONet &net)
Builds and opens all route loaders.
An XML-handler for network weights.
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
SUMOTime getFirstLoadTime() const
returns the timestamp of the first loaded vehicle or flow
std::string time2string(SUMOTime t)
void add(SUMORouteLoader *loader)
add another loader
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
const bool myLogSteps
Information whether the routing steps should be logged.
void writeStats(const SUMOTime time, const SUMOTime start, const SUMOTime absNo, bool endGiven)
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
Interface for building instances of router-edges.
bool openTypedRoutes(const std::string &optionName, RONet &net, const bool readAll=false)
Opens route handler of the given type.
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
OptionsCont & myOptions
Options to use.
virtual ~ROLoader()
Destructor.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
#define PROGRESS_FAILED_MESSAGE()
void setFileName(const std::string &name)
Sets the current file name.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
Obtains edge weights from a weights handler and stores them within the edges.
SUMORouteLoaderControl myLoaders
List of route loaders.
void addEffort(double value, double timeBegin, double timeEnd)
Adds a weight value.
const bool myEmptyDestinationsAllowed
Information whether empty destinations are allowed.
virtual bool furtherStored()
Returns the information whether further vehicles, persons or containers are stored.
SUMOTime string2time(const std::string &r)
#define PROGRESS_BEGIN_MESSAGE(msg)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool wasInformed() const
Returns the information whether any messages were added.
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
A basic edge for routing applications.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
Complete definition about what shall be retrieved and where to store it.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
The router's network representation.
Obtains edge travel times from a weights handler and stores them within the edges.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
A storage for options typed value containers)
The handler that parses a SUMO-network for its usage in a router.
Parser and container for routes during their loading.
#define PROGRESS_DONE_MESSAGE()
#define WRITE_MESSAGE(msg)
ROLoader(OptionsCont &oc, const bool emptyDestinationsAllowed, const bool logSteps)
Constructor.
bool haveAllLoaded() const
returns whether loading is completed
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.
SUMOTime saveAndRemoveRoutesUntil(OptionsCont &options, const RORouterProvider &provider, SUMOTime time)
Computes routes described by their definitions and saves them.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.