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 },
103 if (!oc.
isSet(
"visum-files")) {
106 const std::string languageFile = oc.
getString(
"visum.language-file");
107 if (languageFile !=
"") {
112 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
117 load(*file, oc, toFill, tm);
129 std::map<long long int, Position> punkte;
130 std::map<long long int, PositionVector> kanten;
131 std::map<long long int, PositionVector> teilflaechen;
132 std::map<long long int, long long int> flaechenelemente;
138 if (line.length() == 0 || line[0] ==
'*' || line[0] ==
'$') {
159 vec.push_back(punkte[fromID]);
160 vec.push_back(punkte[toID]);
173 kanten[id].insert(kanten[
id].begin() + index, pos);
182 if (teilflaechen.find(
id) == teilflaechen.end()) {
186 for (
int i = 0; i < (int) kanten[kid].size(); ++i) {
187 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
190 for (
int i = (
int) kanten[kid].size() - 1; i >= 0; --i) {
191 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
199 flaechenelemente[id] = tid;
203 if (line[0] ==
'$') {
217 lineParser.
reinit(line.substr(what.length() + 1));
224 std::map<std::string, std::string> typemap;
227 bool parsingCategories =
false;
228 bool parsingPOIs =
false;
229 bool parsingDistrictsDirectly =
false;
231 std::string polyType, lastID;
236 if (line.length() == 0) {
240 if (line[0] ==
'*') {
244 if (line[0] ==
'$') {
246 parsingCategories =
false;
248 parsingDistrictsDirectly =
false;
252 if (parsingCategories) {
255 std::string catid = st.
next();
256 std::string catname = st.
next();
257 typemap[catid] = catname;
273 std::string type = typemap[catid];
275 bool discard = oc.
getBool(
"discard");
277 double layer = oc.
getFloat(
"layer");
292 const std::string origId = id;
295 id = origId +
"#" +
toString(index++);
297 PointOfInterest* poi =
new PointOfInterest(
id, type, color, pos,
false,
"", 0,
false, 0, icon, layer);
303 if (polyType !=
"") {
305 std::string
id = st.
next();
307 if (!first && lastID !=
id) {
310 double layer = oc.
getFloat(
"layer");
311 bool discard = oc.
getBool(
"discard");
312 if (tm.
has(polyType)) {
325 const std::string origId = id;
328 id = origId +
"#" +
toString(index++);
338 std::string index = st.
next();
339 std::string xpos = st.
next();
340 std::string ypos = st.
next();
341 Position pos2D((
double) atof(xpos.c_str()), (
double) atof(ypos.c_str()));
345 vec.push_back(pos2D);
349 if (parsingDistrictsDirectly) {
358 std::string type =
"district";
359 bool discard = oc.
getBool(
"discard");
361 double layer = oc.
getFloat(
"layer");
377 if (teilflaechen[flaechenelemente[area]].size() > 0) {
378 const std::string origId = id;
381 id = origId +
"#" +
toString(index++);
383 const auto shape = teilflaechen[flaechenelemente[area]];
391 const std::string origId = id;
394 id = origId +
"#" +
toString(index++);
396 PointOfInterest* poi =
new PointOfInterest(
id, type, color, pos,
false,
"", 0,
false, 0, icon, layer);
405 parsingCategories =
true;
406 lineParser.
reinit(line.substr(line.find(
":") + 1));
408 if ((line.find(
"$POI:") == 0) || line.find(
"$POIOFCAT") != std::string::npos) {
411 lineParser.
reinit(line.substr(line.find(
":") + 1));
415 parsingDistrictsDirectly =
true;
416 lineParser.
reinit(line.substr(line.find(
":") + 1));
420 if (line.find(
"$BEZIRKPOLY") != std::string::npos) {
421 polyType =
"district";
423 if (line.find(
"$GEBIETPOLY") != std::string::npos) {
433 std::ifstream strm(file.c_str());
435 throw ProcessError(
TLF(
"Could not load VISUM language map from '%'.", file));
437 while (strm.good()) {
446 }
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
void remove(const std::string str, const T key)
bool hasString(const std::string &str) const
T get(const std::string &str) const
void insert(const std::string str, const T key, bool checkDuplicates=true)
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.