50 {
"VSYS", VISUM_SYS },
51 {
"STRECKENTYP", VISUM_LINKTYPE },
52 {
"KNOTEN", VISUM_NODE },
53 {
"BEZIRK", VISUM_DISTRICT },
54 {
"PUNKT", VISUM_POINT },
55 {
"STRECKE", VISUM_LINK },
57 {
"VSYSSET", VISUM_TYPES },
58 {
"RANG", VISUM_RANK },
59 {
"KAPIV", VISUM_CAPACITY },
60 {
"XKOORD", VISUM_XCOORD },
61 {
"YKOORD", VISUM_YCOORD },
63 {
"CODE", VISUM_CODE },
64 {
"VONKNOTNR", VISUM_FROMNODE },
65 {
"NACHKNOTNR", VISUM_TONODE },
66 {
"TYPNR", VISUM_TYPE },
68 {
"ANBINDUNG", VISUM_DISTRICT_CONNECTION },
69 {
"BEZNR", VISUM_SOURCE_DISTRICT },
70 {
"KNOTNR", VISUM_FROMNODENO },
71 {
"RICHTUNG", VISUM_DIRECTION },
72 {
"FLAECHEID", VISUM_SURFACEID },
73 {
"TFLAECHEID", VISUM_FACEID },
74 {
"VONPUNKTID", VISUM_FROMPOINTID },
75 {
"NACHPUNKTID", VISUM_TOPOINTID },
76 {
"KANTE", VISUM_EDGE },
77 {
"ABBIEGER", VISUM_TURN },
78 {
"UEBERKNOTNR", VISUM_VIANODENO },
79 {
"ANZFAHRSTREIFEN", VISUM_NUMLANES },
80 {
"INDEX", VISUM_INDEX },
81 {
"STRECKENPOLY", VISUM_LINKPOLY },
82 {
"FLAECHENELEMENT", VISUM_SURFACEITEM },
83 {
"TEILFLAECHENELEMENT", VISUM_FACEITEM },
84 {
"KANTEID", VISUM_EDGEID },
85 {
"Q", VISUM_ORIGIN },
86 {
"Z", VISUM_DESTINATION },
87 {
"KATNR", VISUM_CATID },
88 {
"ZWISCHENPUNKT", VISUM_EDGEITEM },
89 {
"POIKATEGORIE", VISUM_POICATEGORY },
90 {
"NETZ", VISUM_NETWORK },
91 {
"DEFKOORD", VISUM_PROJECTIONDEFINITION },
105 if (!oc.
isSet(
"visum-files")) {
108 const std::string languageFile = oc.
getString(
"visum.language-file");
109 if (languageFile !=
"") {
114 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
119 load(*file, oc, toFill, tm);
131 std::map<long long int, Position> punkte;
132 std::map<long long int, PositionVector> kanten;
133 std::map<long long int, PositionVector> teilflaechen;
134 std::map<long long int, long long int> flaechenelemente;
140 if (line.length() == 0 || line[0] ==
'*' || line[0] ==
'$') {
161 vec.push_back(punkte[fromID]);
162 vec.push_back(punkte[toID]);
175 kanten[id].insert(kanten[
id].begin() + index, pos);
184 if (teilflaechen.find(
id) == teilflaechen.end()) {
188 for (
int i = 0; i < (int) kanten[kid].size(); ++i) {
189 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
192 for (
int i = (
int) kanten[kid].size() - 1; i >= 0; --i) {
193 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
201 flaechenelemente[id] = tid;
205 if (line[0] ==
'$') {
219 lineParser.
reinit(line.substr(what.length() + 1));
226 std::map<std::string, std::string> typemap;
229 bool parsingCategories =
false;
230 bool parsingPOIs =
false;
231 bool parsingDistrictsDirectly =
false;
233 std::string polyType, lastID;
238 if (line.length() == 0) {
242 if (line[0] ==
'*') {
246 if (line[0] ==
'$') {
248 parsingCategories =
false;
250 parsingDistrictsDirectly =
false;
254 if (parsingCategories) {
257 std::string catid = st.
next();
258 std::string catname = st.
next();
259 typemap[catid] = catname;
275 std::string type = typemap[catid];
277 bool discard = oc.
getBool(
"discard");
279 double layer = oc.
getFloat(
"layer");
294 const std::string origId = id;
297 id = origId +
"#" +
toString(index++);
299 PointOfInterest* poi =
new PointOfInterest(
id, type, color, pos,
false,
"", 0,
false, 0, icon, layer);
305 if (polyType !=
"") {
307 std::string
id = st.
next();
309 if (!first && lastID !=
id) {
312 double layer = oc.
getFloat(
"layer");
313 bool discard = oc.
getBool(
"discard");
314 if (tm.
has(polyType)) {
327 const std::string origId = id;
330 id = origId +
"#" +
toString(index++);
340 std::string index = st.
next();
341 std::string xpos = st.
next();
342 std::string ypos = st.
next();
343 Position pos2D((
double) atof(xpos.c_str()), (
double) atof(ypos.c_str()));
347 vec.push_back(pos2D);
351 if (parsingDistrictsDirectly) {
360 std::string type =
"district";
361 bool discard = oc.
getBool(
"discard");
363 double layer = oc.
getFloat(
"layer");
379 if (teilflaechen[flaechenelemente[area]].size() > 0) {
380 const std::string origId = id;
383 id = origId +
"#" +
toString(index++);
385 const auto shape = teilflaechen[flaechenelemente[area]];
393 const std::string origId = id;
396 id = origId +
"#" +
toString(index++);
398 PointOfInterest* poi =
new PointOfInterest(
id, type, color, pos,
false,
"", 0,
false, 0, icon, layer);
407 parsingCategories =
true;
408 lineParser.
reinit(line.substr(line.find(
":") + 1));
410 if ((line.find(
"$POI:") == 0) || line.find(
"$POIOFCAT") != std::string::npos) {
413 lineParser.
reinit(line.substr(line.find(
":") + 1));
417 parsingDistrictsDirectly =
true;
418 lineParser.
reinit(line.substr(line.find(
":") + 1));
422 if (line.find(
"$BEZIRKPOLY") != std::string::npos) {
423 polyType =
"district";
425 if (line.find(
"$GEBIETPOLY") != std::string::npos) {
435 std::ifstream strm(file.c_str());
437 throw ProcessError(
TLF(
"Could not load VISUM language map from '%'.", file));
439 while (strm.good()) {
448 }
else if (keyDE !=
"") {
#define WRITE_WARNINGF(...)
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static bool isReadable(std::string path)
Checks whether the given file is readable.
static methods for processing the coordinates conversion for the current net
bool x2cartesian(Position &from, bool includeInBoundary=true)
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
Retrieves a file linewise and reports the lines to a handler.
bool readLine(LineHandler &lh)
Reads a single (the next) line from the file and reports it to the given LineHandler.
void reinit()
Reinitialises the reading (of the previous file)
bool hasMore() const
Returns whether another line may be read (the file was not read completely)
A parser to retrieve information from a table with known columns.
void reinit(const std::string &def, const std::string &defDelim=";", const std::string &lineDelim=";", bool chomp=false, bool ignoreCase=true)
Reinitialises the parser.
void parseLine(const std::string &line)
Parses the contents of the line.
std::string get(const std::string &name, bool prune=false) const
Returns the named information.
T get(const std::string &id) const
Retrieves an item.
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)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
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 StringBijection< VISUM_KEY >::Entry KEYS_DE[]
Strings for the keywords.
static void loadLanguage(const std::string &file)
static void load(const std::string &file, OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Parses pois/polys stored within the given file.
static StringBijection< VISUM_KEY > KEYS
link directions
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored using VISUM-format.
A storage for loaded polygons and pois.
bool add(SUMOPolygon *poly, bool ignorePruning=false)
Adds a polygon to the storage.
A storage for type mappings.
const TypeDef & get(const std::string &id)
Returns a type definition.
bool has(const std::string &id)
Returns the information whether the named type is known.
A point in 2D or 3D with translation and scaling methods.
static RGBColor parseColor(std::string coldef)
Parses a color information.
const Polygons & getPolygons() const
Returns all polygons.
const POIs & getPOIs() const
Returns all pois.
const std::string & getString(const T key) const
get string
void remove(const std::string str, const T key)
remove string
bool hasString(const std::string &str) const
check if the given string exist
T get(const std::string &str) const
get key
void insert(const std::string str, const T key, bool checkDuplicates=true)
insert string and their associated key
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
A single definition of values that shall be used for a given type.
std::string icon
the icon to use
bool discard
Information whether polygons of this type shall be discarded.
std::string prefix
The prefix to use.
double layer
The layer to use.
std::string id
The new type id to use.
RGBColor color
The color to use.