33#include <xercesc/sax/SAXException.hpp>
34#include <xercesc/sax/SAXParseException.hpp>
79 const std::vector<double>& turnDefs) {
85 static_cast<ROJTREdge*
>(i.second)->setTurnDefaults(turnDefs);
91 std::vector<double> ret;
93 if (defs.size() < 2) {
94 throw ProcessError(
TL(
"The defaults for turnings must be a tuple of at least two numbers divided by ','."));
96 for (std::vector<std::string>::const_iterator i = defs.begin(); i != defs.end(); ++i) {
111 if (oc.
isSet(
"turn-ratio-files")) {
113 std::vector<std::string> ratio_files = oc.
getStringVector(
"turn-ratio-files");
114 for (std::vector<std::string>::const_iterator i = ratio_files.begin(); i != ratio_files.end(); ++i) {
120 if (oc.
getBool(
"sources-are-sinks") || oc.
getBool(
"discount-sources")) {
123 for (std::string fileOption : {
124 "route-files",
"additional-files"
138 if (oc.
isSet(
"sink-edges")) {
140 for (std::vector<std::string>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
142 if (edge ==
nullptr) {
143 throw ProcessError(
TLF(
"The edge '%' declared as a sink is not known.", *i));
165 oc.
getBool(
"discount-sources"));
182 oc.
setApplicationDescription(
TL(
"Router for the microscopic, multi-modal traffic simulation SUMO based on junction turning ratios."));
185 RONet* net =
nullptr;
213 }
catch (XERCES_CPP_NAMESPACE::SAXParseException& e) {
216 }
catch (XERCES_CPP_NAMESPACE::SAXException& e) {
224 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
230 }
catch (
const std::exception& e) {
231 if (std::string(e.what()) != std::string(
"")) {
244 std::cout <<
"Success." << std::endl;
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static void initOutputOptions()
init output options
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
void setSink(const bool isSink=true)
Sets whether the edge is a sink.
Interface for building instances of jtrrouter-edges.
An edge the jtr-router may route through.
static void fillOptions()
Inserts options used by jtrrouter into the OptionsCont-singleton.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within jtrrouter.
Computes routes using junction turning percentages.
Loader for the of turning percentages and source/sink definitions.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
void openRoutes(RONet &net)
Builds and opens all route loaders.
The router's network representation.
void cleanup()
closes the file output for computed routes and deletes associated threads if necessary
void openOutput(const OptionsCont &options)
Opens the output for computed routes.
static void adaptIntermodalRouter(ROIntermodalRouter &router)
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
int getEdgeNumber() const
Returns the total number of edges the network contains including internal edges.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
static void setUsingJTRR()
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8
static void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
static void init()
Initialises the xml-subsystem.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
void initNet(RONet &net, ROLoader &loader, const std::vector< double > &turnDefs)
int main(int argc, char **argv)
void loadJTRDefinitions(RONet &net, OptionsCont &oc)
std::vector< double > getTurningDefaults(OptionsCont &oc)
void computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc)