64 if (!oc.
isSet(
"visum-files")) {
69 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
71 throw ProcessError(
"Could not open visum-file '" + *file +
"'.");
74 load(*file, oc, toFill, tm);
86 std::map<long long int, Position> punkte;
87 std::map<long long int, PositionVector> kanten;
88 std::map<long long int, PositionVector> teilflaechen;
89 std::map<long long int, long long int> flaechenelemente;
95 if (line.length() == 0 || line[0] ==
'*' || line[0] ==
'$') {
99 if (what ==
"$PUNKT") {
110 }
else if (what ==
"$KANTE") {
116 vec.push_back(punkte[fromID]);
117 vec.push_back(punkte[toID]);
120 }
else if (what ==
"$ZWISCHENPUNKT") {
130 kanten[id].insert(kanten[
id].begin() + index, pos);
132 }
else if (what ==
"$TEILFLAECHENELEMENT") {
139 if (teilflaechen.find(
id) == teilflaechen.end()) {
143 for (
int i = 0; i < (int) kanten[kid].size(); ++i) {
144 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
147 for (
int i = (
int) kanten[kid].size() - 1; i >= 0; --i) {
148 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
152 }
else if (what ==
"$FLAECHENELEMENT") {
156 flaechenelemente[id] = tid;
160 if (line[0] ==
'$') {
162 if (line.find(
"$PUNKT") == 0) {
164 }
else if (line.find(
"$KANTE") == 0) {
166 }
else if (line.find(
"$ZWISCHENPUNKT") == 0) {
167 what =
"$ZWISCHENPUNKT";
168 }
else if (line.find(
"$TEILFLAECHENELEMENT") == 0) {
169 what =
"$TEILFLAECHENELEMENT";
170 }
else if (line.find(
"$FLAECHENELEMENT") == 0) {
171 what =
"$FLAECHENELEMENT";
174 lineParser.
reinit(line.substr(what.length() + 1));
181 std::map<std::string, std::string> typemap;
184 bool parsingCategories =
false;
185 bool parsingPOIs =
false;
186 bool parsingDistrictsDirectly =
false;
188 std::string polyType, lastID;
193 if (line.length() == 0) {
197 if (line[0] ==
'*') {
201 if (line[0] ==
'$') {
203 parsingCategories =
false;
205 parsingDistrictsDirectly =
false;
209 if (parsingCategories) {
212 std::string catid = st.
next();
213 std::string catname = st.
next();
214 typemap[catid] = catname;
222 std::string catid = lineParser.
get(
"CATID");
228 WRITE_WARNING(
"Unable to project coordinates for POI '" +
id +
"'.");
230 std::string type = typemap[catid];
232 bool discard = oc.
getBool(
"discard");
233 double layer = oc.
getFloat(
"layer");
254 if (polyType !=
"") {
256 std::string
id = st.
next();
258 if (!first && lastID !=
id) {
261 double layer = oc.
getFloat(
"layer");
262 bool discard = oc.
getBool(
"discard");
263 if (tm.
has(polyType)) {
284 std::string index = st.
next();
285 std::string xpos = st.
next();
286 std::string ypos = st.
next();
287 Position pos2D((
double) atof(xpos.c_str()), (
double) atof(ypos.c_str()));
289 WRITE_WARNING(
"Unable to project coordinates for polygon '" +
id +
"'.");
291 vec.push_back(pos2D);
295 if (parsingDistrictsDirectly) {
304 std::string type =
"district";
305 bool discard = oc.
getBool(
"discard");
306 double layer = oc.
getFloat(
"layer");
321 if (teilflaechen[flaechenelemente[area]].size() > 0) {
327 WRITE_WARNING(
"Unable to project coordinates for POI '" +
id +
"'.");
336 if (line.find(
"$POIKATEGORIEDEF:") == 0 || line.find(
"$POIKATEGORIE:") == 0) {
338 parsingCategories =
true;
339 lineParser.
reinit(line.substr(line.find(
":") + 1));
341 if (line.find(
"$POI:") == 0) {
344 lineParser.
reinit(line.substr(line.find(
":") + 1));
346 if (line.find(
"$BEZIRK") == 0 && line.find(
"FLAECHEID") != std::string::npos) {
348 parsingDistrictsDirectly =
true;
349 lineParser.
reinit(line.substr(line.find(
":") + 1));
353 if (line.find(
"$BEZIRKPOLY") != std::string::npos) {
354 polyType =
"district";
356 if (line.find(
"$GEBIETPOLY") != std::string::npos) {
std::string id
The new type id to use.
static RGBColor parseColor(std::string coldef)
Parses a color information.
A single definition of values that shall be used for a given type.
static bool isReadable(std::string path)
Checks whether the given file is readable.
bool readLine(LineHandler &lh)
Reads a single (the next) line from the file and reports it to the given LineHandler.
Retrieves a file linewise and reports the lines to a handler.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
bool x2cartesian(Position &from, bool includeInBoundary=true)
static void load(const std::string &file, OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Parses pois/polys stored within the given file.
double layer
The layer to use.
static long long int _2long(const E *const data)
converts a char-type array into the long value described by it
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::string get(const std::string &name, bool prune=false) const
Returns the named information.
#define WRITE_WARNING(msg)
bool discard
Information whether polygons of this type shall be discarded.
A storage for loaded polygons and pois.
RGBColor color
The color to use.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void reinit(const std::string &def, const std::string &defDelim=";", const std::string &lineDelim=";", bool chomp=false, bool ignoreCase=true)
Reinitialises the parser.
A storage for type mappings.
const TypeDef & get(const std::string &id)
Returns a type definition.
static methods for processing the coordinates conversion for the current net
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A point in 2D or 3D with translation and scaling methods.
static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill, PCTypeMap &tm)
Loads pois/polygons assumed to be stored using VISUM-format.
bool has(const std::string &id)
Returns the information whether the named type is known.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
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) ...
#define PROGRESS_BEGIN_MESSAGE(msg)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool add(SUMO::Polygon *poly, bool ignorePruning=false)
Adds a polygon to the storage.
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
std::string prefix
The prefix to use.
bool hasMore() const
Returns whether another line may be read (the file was not read completely)
A storage for options typed value containers)
static double _2double(const E *const data)
converts a char-type array into the double value described by it
void reinit()
Reinitialises the reading (of the previous file)
A parser to retrieve information from a table with known columns.
#define PROGRESS_DONE_MESSAGE()
void parseLine(const std::string &line)
Parses the contents of the line.