72 oc.
addCallExample(
"-c <CONFIGURATION>",
"run with configuration options set in file");
90 oc.
addDescription(
"net-file",
"Input",
"Loads SUMO-network FILE as reference to offset and projection");
94 oc.
addDescription(
"dlr-navteq-poly-files",
"Input",
"Reads polygons from FILE assuming they're coded in DLR-Navteq (Elmar)-format");
96 oc.
addDescription(
"dlr-navteq-poi-files",
"Input",
"Reads pois from FILE+ assuming they're coded in DLR-Navteq (Elmar)-format");
101 oc.
addDescription(
"visum-files",
"Input",
"Reads polygons from FILE assuming it's a Visum-net");
106 oc.
addDescription(
"xml-files",
"Input",
"Reads pois and shapes from FILE assuming they're coded in XML");
111 oc.
addDescription(
"osm-files",
"Input",
"Reads pois from FILE+ assuming they're coded in OSM");
113 oc.
addDescription(
"osm.keep-full-type",
"Input",
"The type will be made of the key-value - pair");
115 oc.
addDescription(
"osm.use-name",
"Input",
"The id will be set from the given 'name' attribute");
119 oc.
addSynonyme(
"shapefile-prefixes",
"shapefile-prefix");
121 oc.
addSynonyme(
"shapefile-prefixes",
"shape-files",
true);
122 oc.
addDescription(
"shapefile-prefixes",
"Input",
"Reads shapes from shapefiles FILE+");
125 oc.
addSynonyme(
"shapefile.guess-projection",
"arcview.guess-projection",
true);
126 oc.
addDescription(
"shapefile.guess-projection",
"Input",
"Guesses the shapefile's projection");
129 oc.
addSynonyme(
"shapefile.id-column",
"shapefile.id-name",
true);
130 oc.
addSynonyme(
"shapefile.id-column",
"shape-files.id-name",
true);
131 oc.
addDescription(
"shapefile.id-column",
"Input",
"Defines in which column the id can be found");
134 oc.
addDescription(
"shapefile.use-running-id",
"Input",
"A running number will be used as id");
137 oc.
addDescription(
"shapefile.add-param",
"Input",
"Extract all additional columns as params");
140 oc.
addDescription(
"shapefile.fill",
"Input",
"[auto|true|false]. Forces the 'fill' status to the given value. Default 'auto' tries to determine it from the data type");
151 oc.
addDescription(
"output-file",
"Output",
"Write generated polygons/pois to FILE");
154 oc.
addDescription(
"dlr-tdp-output",
"Output",
"Write generated polygons/pois to a dlr-tdp file with the given prefix");
159 oc.
addSynonyme(
"prune.in-net",
"prune.on-net",
true);
160 oc.
addDescription(
"prune.in-net",
"Pruning",
"Enables pruning on net boundaries");
163 oc.
addSynonyme(
"prune.in-net.offsets",
"prune.on-net.offsets",
true);
164 oc.
addDescription(
"prune.in-net.offsets",
"Pruning",
"Uses STR as offset definition added to the net boundaries");
167 oc.
addDescription(
"prune.boundary",
"Pruning",
"Uses STR as pruning boundary");
171 oc.
addSynonyme(
"prune.keep-list",
"prune.ignore",
true);
172 oc.
addDescription(
"prune.keep-list",
"Pruning",
"Items in STR will be kept though out of boundary");
176 oc.
addDescription(
"prune.explicit",
"Pruning",
"Items with names in STR will be removed");
180 oc.
addSynonyme(
"offset.x",
"x-offset-to-apply",
true);
181 oc.
addDescription(
"offset.x",
"Processing",
"Adds FLOAT to net x-positions");
184 oc.
addSynonyme(
"offset.y",
"y-offset-to-apply",
true);
185 oc.
addDescription(
"offset.y",
"Processing",
"Adds FLOAT to net y-positions");
188 oc.
addDescription(
"all-attributes",
"Processing",
"Imports all attributes as key/value pairs");
191 oc.
addDescription(
"ignore-errors",
"Processing",
"Continue on broken input");
194 oc.
addDescription(
"poi-layer-offset",
"Processing",
"Adds FLOAT to the layer value for each poi (i.e. to raise it above polygons)");
198 oc.
addDescription(
"color",
"Building Defaults",
"Sets STR as default color");
201 oc.
addDescription(
"prefix",
"Building Defaults",
"Sets STR as default prefix");
204 oc.
addDescription(
"type",
"Building Defaults",
"Sets STR as default type");
207 oc.
addDescription(
"fill",
"Building Defaults",
"Fills polygons by default");
210 oc.
addDescription(
"layer",
"Building Defaults",
"Sets FLOAT as default layer");
213 oc.
addDescription(
"discard",
"Building Defaults",
"Sets default action to discard");
217 oc.
addDescription(
"proj.plain-geo",
"Projection",
"Write geo coordinates in output");
241 if ((oc.
isSet(
"dlr-navteq-poly-files") || oc.
isSet(
"dlr-navteq-poi-files")) && oc.
isDefault(
"proj.scale")) {
244 if (!oc.
isSet(
"net")) {
247 unsigned numProjections = oc.
getBool(
"simple-projection") + oc.
getBool(
"proj.utm") + oc.
getBool(
"proj.dhdn") + (oc.
getString(
"proj").length() > 1);
248 if ((oc.
isSet(
"osm-files") || oc.
isSet(
"dlr-navteq-poly-files") || oc.
isSet(
"dlr-navteq-poi-files")) && numProjections == 0) {
249 oc.
set(
"proj.utm",
"true");
266 if (oc.
getBool(
"prune.in-net")) {
267 if (!oc.
isSet(
"net")) {
268 throw ProcessError(
"In order to prune the input on the net, you have to supply a network.");
274 pruningBoundary.xmin() + offsets.
xmin(),
275 pruningBoundary.ymin() + offsets.
ymin(),
276 pruningBoundary.xmax() + offsets.
xmax(),
277 pruningBoundary.ymax() + offsets.
ymax());
280 if (oc.
isSet(
"prune.boundary")) {
287 oc.
set(
"poi-layer-offset",
"5");
293 if (!oc.
isSet(
"type-file")) {
294 const char* sumoPath = std::getenv(
"SUMO_HOME");
296 WRITE_WARNING(
"Environment variable SUMO_HOME is not set, using built in type maps.");
298 const std::string path = sumoPath + std::string(
"/data/typemap/");
299 if (oc.
isSet(
"dlr-navteq-poly-files")) {
300 oc.
setDefault(
"type-file", path +
"navteqPolyconvert.typ.xml");
302 if (oc.
isSet(
"osm-files")) {
303 oc.
setDefault(
"type-file", path +
"osmPolyconvert.typ.xml");
305 if (oc.
isSet(
"visum-files")) {
306 oc.
setDefault(
"type-file", path +
"visumPolyconvert.typ.xml");
312 if (oc.
isSet(
"type-file")) {
320 if (oc.
isSet(
"dlr-navteq-poly-files")) {
323 if (oc.
isSet(
"osm-files")) {
326 if (oc.
isSet(
"visum-files")) {
344 if (!oc.
isSet(
"output-file") && !oc.
isSet(
"dlr-tdp-output")) {
345 std::string out =
"polygons.xml";
346 if (oc.
isSet(
"configuration-file")) {
351 if (oc.
isSet(
"output-file")) {
354 if (oc.
isSet(
"dlr-tdp-output")) {
355 toFill.saveDlrTDP(oc.
getString(
"dlr-tdp-output"));
359 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
365 }
catch (
const std::exception& e) {
366 if (std::string(e.what()) != std::string(
"")) {
379 std::cout <<
"Success." << std::endl;
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
double ymin() const
Returns minimum y-coordinate.
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored as OSM-XML.
double xmax() const
Returns maximum x-coordinate.
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
int main(int argc, char **argv)
const Boundary & getConvBoundary() const
Returns the converted boundary.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data...
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
static void load(const std::string &file, double scale)
Loads network projection if wished.
const std::string osmTypemap
SAX-reader encapsulation containing binary reader.
static Boundary parseBoundaryReporting(const std::string &def, const std::string &objecttype, const char *objectid, bool &ok, bool report=true)
Builds a boundary from its string representation, reporting occured errors.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void parseString(std::string content)
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.
static void close()
Closes all of an applications subsystems.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
A class that stores a 2D geometrical boundary.
#define WRITE_WARNING(msg)
A storage for loaded polygons and pois.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static OptionsCont & getOptions()
Retrieves the options.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
A storage for type mappings.
void setFileName(const std::string &name)
Sets the current file name.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool setDefault(const std::string &name, const std::string &value)
Sets the given value for the named option as new default value.
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored using VISUM-format.
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored as shape files-files.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
const std::string visumTypemap
static SUMOSAXReader * getSAXReader(SUMOSAXHandler &handler)
Builds a reader and assigns the handler to it.
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
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) ...
double xmin() const
Returns minimum x-coordinate.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static bool checkOptions()
checks shared options and sets StdDefs
static void addProjectionOptions(OptionsCont &oc)
Adds projection options to the given container.
A handler for loading polygon type maps.
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored as according DLR-Navteq (Elmar)-files.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored as XML.
const std::string navteqTypemap
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
double ymax() const
Returns maximum y-coordinate.
static void initOutputOptions()
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.