35#include <xercesc/sax/SAXException.hpp>
36#include <xercesc/sax/SAXParseException.hpp>
69 if (!oc.
isSet(
"detector-files")) {
70 throw ProcessError(
"No detector file given (use --detector-files <FILE>).");
74 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
76 throw ProcessError(
"Could not open detector file '" + *fileIt +
"'");
95 if (!oc.
isSet(
"measure-files")) {
101 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
103 throw ProcessError(
"The measure-file '" + *fileIt +
"' can not be opened.");
117 if (oc.
getBool(
"print-absolute-flows")) {
122 if (optNet !=
nullptr) {
123 if (oc.
getBool(
"remove-empty-detectors")) {
127 }
else if (oc.
getBool(
"report-empty-detectors")) {
136 std::vector<RODFDetector*>::const_iterator i = detectors.
getDetectors().begin();
149 oc.
getBool(
"keep-unfinished-routes"), oc.
getBool(
"routes-for-all"),
150 !oc.
getBool(
"keep-longer-routes"), oc.
getInt(
"max-search-depth"));
158 throw ProcessError(
"The detector types are not defined; use in combination with a network");
162 throw ProcessError(
"The emitters have no routes; use in combination with a network");
166 if (oc.
isSet(
"detector-output")) {
170 if (oc.
isSet(
"detectors-poi-output")) {
180 if (oc.
getBool(
"guess-empty-flows")) {
190 if (oc.
isSet(
"emitters-output") || oc.
isSet(
"emitters-poi-output")) {
192 if (oc.
getBool(
"revalidate-flows")) {
197 if (oc.
isSet(
"emitters-output")) {
202 oc.
getBool(
"calibrator-output"),
203 oc.
getBool(
"include-unused-routes"),
209 if (oc.
isSet(
"emitters-poi-output")) {
216 if (oc.
isSet(
"variable-speed-sign-output")) {
223 if (oc.
isSet(
"validation-output")) {
226 oc.
getBool(
"validation-output.add-sources"),
true,
true);
230 if (oc.
isSet(
"end-reroute-output")) {
292 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
298 }
catch (
const std::exception& e) {
299 if (std::string(e.what()) != std::string(
"")) {
314 std::cout <<
"Success." << std::endl;
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_FAILED_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
@ SOURCE_DETECTOR
A source detector.
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
static bool isReadable(std::string path)
Checks whether the given file is readable.
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 setupI18n(const std::string &locale="")
set up gettext stuff
static void initOutputOptions()
init output options
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)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
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)
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.
A loader for detector flows.
void read(const std::string &file)
Reads the given file assuming it contains detector values.
A container for RODFDetectors.
bool detectorsHaveRoutes() const
void save(const std::string &file) const
void writeEmitterPOIs(const std::string &file, const RODFDetectorFlows &flows)
void writeValidationDetectors(const std::string &file, bool includeSources, bool singleFile, bool friendly)
void guessEmptyFlows(RODFDetectorFlows &flows)
bool detectorsHaveCompleteTypes() const
void saveRoutes(const std::string &file) const
void writeSpeedTrigger(const RODFNet *const net, const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void writeEmitters(const std::string &file, const RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, const RODFNet &net, bool writeCalibrators, bool includeUnusedRoutes, double scale, bool insertionsOnly)
void saveAsPOIs(const std::string &file) const
const std::vector< RODFDetector * > & getDetectors() const
void writeEndRerouterDetectors(const std::string &file)
void printAbsolute() const
SAX2-Handler for loading DFROUTER-detector definitions.
Interface for building instances of dfrouter-edges.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter.
static void fillOptions()
Inserts options used by dfrouter into the OptionsCont-singleton.
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
void buildDetectorDependencies(RODFDetectorCon &detectors)
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
static void close()
Closes all of an applications subsystems.
static bool checkOptions()
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)
Runs the given handler on the given file; returns if everything's ok.
int main(int argc, char **argv)
void readDetectors(RODFDetectorCon &detectors, OptionsCont &oc, RODFNet *optNet)
void startComputation(RODFNet *optNet, RODFDetectorFlows &flows, RODFDetectorCon &detectors, OptionsCont &oc)
void readDetectorFlows(RODFDetectorFlows &flows, OptionsCont &oc, RODFDetectorCon &dc)