57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
68 if (!oc.
isSet(
"visum-files")) {
73 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
75 throw ProcessError(
"Could not open visum-file '" + *file +
"'.");
78 load(*file, oc, toFill, tm);
90 std::map<SUMOLong, Position> punkte;
91 std::map<SUMOLong, PositionVector> kanten;
92 std::map<SUMOLong, PositionVector> teilflaechen;
93 std::map<SUMOLong, SUMOLong> flaechenelemente;
99 if (line.length() == 0 || line[0] ==
'*' || line[0] ==
'$') {
103 if (what ==
"$PUNKT") {
114 }
else if (what ==
"$KANTE") {
121 vec.push_back(punkte[toID]);
124 }
else if (what ==
"$ZWISCHENPUNKT") {
134 kanten[id].insertAt(index, pos);
136 }
else if (what ==
"$TEILFLAECHENELEMENT") {
143 if (teilflaechen.find(
id) == teilflaechen.end()) {
147 for (
int i = 0; i < (
int) kanten[kid].size(); ++i) {
148 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
151 for (
int i = (
int) kanten[kid].size() - 1; i >= 0; --i) {
152 teilflaechen[id].push_back_noDoublePos(kanten[kid][i]);
156 }
else if (what ==
"$FLAECHENELEMENT") {
162 flaechenelemente[id] = tid;
166 if (line[0] ==
'$') {
168 if (line.find(
"$PUNKT") == 0) {
170 }
else if (line.find(
"$KANTE") == 0) {
172 }
else if (line.find(
"$ZWISCHENPUNKT") == 0) {
173 what =
"$ZWISCHENPUNKT";
174 }
else if (line.find(
"$TEILFLAECHENELEMENT") == 0) {
175 what =
"$TEILFLAECHENELEMENT";
176 }
else if (line.find(
"$FLAECHENELEMENT") == 0) {
177 what =
"$FLAECHENELEMENT";
180 lineParser.
reinit(line.substr(what.length() + 1));
187 std::map<std::string, std::string> typemap;
190 bool parsingCategories =
false;
191 bool parsingPOIs =
false;
192 bool parsingDistrictsDirectly =
false;
194 std::string polyType, lastID;
199 if (line.length() == 0) {
203 if (line[0] ==
'*') {
207 if (line[0] ==
'$') {
209 parsingCategories =
false;
211 parsingDistrictsDirectly =
false;
215 if (parsingCategories) {
218 std::string catid = st.
next();
219 std::string catname = st.
next();
220 typemap[catid] = catname;
228 std::string catid = lineParser.
get(
"CATID");
234 WRITE_WARNING(
"Unable to project coordinates for POI '" +
id +
"'.");
236 std::string type = typemap[catid];
238 bool discard = oc.
getBool(
"discard");
239 int layer = oc.
getInt(
"layer");
255 if (!toFill.
insert(
id, poi, layer)) {
256 WRITE_ERROR(
"POI '" +
id +
"' could not be added.");
263 if (polyType !=
"") {
265 std::string
id = st.
next();
267 if (!first && lastID !=
id) {
270 int layer = oc.
getInt(
"layer");
271 bool discard = oc.
getBool(
"discard");
272 if (tm.
has(polyType)) {
286 if (!toFill.
insert(
id, poly, 1)) {
287 WRITE_ERROR(
"Polygon '" +
id +
"' could not be added.");
296 std::string index = st.
next();
297 std::string xpos = st.
next();
298 std::string ypos = st.
next();
301 WRITE_WARNING(
"Unable to project coordinates for polygon '" +
id +
"'.");
307 if (parsingDistrictsDirectly) {
316 std::string type =
"district";
317 bool discard = oc.
getBool(
"discard");
318 int layer = oc.
getInt(
"layer");
333 if (teilflaechen[flaechenelemente[area]].size() > 0) {
334 Polygon* poly =
new Polygon(
id, type, color, teilflaechen[flaechenelemente[area]],
false, (
SUMOReal)layer);
335 if (!toFill.
insert(
id, poly, layer)) {
336 WRITE_ERROR(
"Polygon '" +
id +
"' could not be added.");
342 WRITE_WARNING(
"Unable to project coordinates for POI '" +
id +
"'.");
345 if (!toFill.
insert(
id, poi, layer)) {
346 WRITE_ERROR(
"POI '" +
id +
"' could not be added.");
354 if (line.find(
"$POIKATEGORIEDEF:") == 0 || line.find(
"$POIKATEGORIE:") == 0) {
356 parsingCategories =
true;
357 lineParser.
reinit(line.substr(line.find(
":") + 1));
359 if (line.find(
"$POI:") == 0) {
362 lineParser.
reinit(line.substr(line.find(
":") + 1));
364 if (line.find(
"$BEZIRK") == 0 && line.find(
"FLAECHEID") != std::string::npos) {
366 parsingDistrictsDirectly =
true;
367 lineParser.
reinit(line.substr(line.find(
":") + 1));
371 if (line.find(
"$BEZIRKPOLY") != std::string::npos) {
372 polyType =
"district";
374 if (line.find(
"$GEBIETPOLY") != std::string::npos) {