File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 463
463
PRODUCT_NAME = "$(TARGET_NAME)";
464
464
SDKROOT = macosx;
465
465
SWIFT_OBJC_BRIDGING_HEADER = "src/Azul-Bridging-Header.h";
466
+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
466
467
SWIFT_VERSION = 3.0;
467
468
};
468
469
name = Release;
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ void CityGMLParser::parse(const char *filePath) {
45
45
pugi::xml_document doc;
46
46
doc.load_file (filePath);
47
47
48
+ std::cout << " Loaded XML file" << std::endl;
49
+
48
50
// With single traversal
49
51
ObjectsWalker objectsWalker;
50
52
doc.traverse (objectsWalker);
Original file line number Diff line number Diff line change @@ -75,13 +75,18 @@ struct PointsWalker: pugi::xml_tree_walker {
75
75
iss >> substring;
76
76
if (substring.length () > 0 ) {
77
77
if (currentCoordinate == 0 ) points.push_back (CityGMLPoint ());
78
- points.back ().coordinates [currentCoordinate] = std::stof (substring);
79
- currentCoordinate = (currentCoordinate+1 )%3 ;
78
+ try {
79
+ points.back ().coordinates [currentCoordinate] = std::stof (substring);
80
+ } catch (const std::invalid_argument& ia) {
81
+ std::cout << " Invalid point: " << substring << " . Skipping..." << std::endl;
82
+ points.clear ();
83
+ return true ;
84
+ } currentCoordinate = (currentCoordinate+1 )%3 ;
80
85
}
81
86
} while (iss);
82
87
if (currentCoordinate != 0 ) {
83
88
std::cout << " Wrong number of coordinates: not divisible by 3" << std::endl;
84
- points.pop_back ();
89
+ points.clear ();
85
90
} // std::cout << "Created " << points.size() << " points" << std::endl;
86
91
} return true ;
87
92
}
You can’t perform that action at this time.
0 commit comments