Fix for missing elevation profile and lane offset.

This commit is contained in:
Axel 2020-02-17 15:25:58 +01:00 committed by Marc Garcia Puig
parent 692bfeb144
commit 8005f4c32d
2 changed files with 23 additions and 0 deletions

View File

@ -54,6 +54,7 @@ namespace parser {
// parse elevation profile
pugi::xml_node node_profile = node_road.child("elevationProfile");
uint number_profiles = 0;
if (node_profile) {
// all geometry
for (pugi::xml_node node_elevation : node_profile.children("elevation")) {
@ -72,8 +73,25 @@ namespace parser {
// add it
elevation_profile.emplace_back(elev);
number_profiles++;
}
}
// add a default profile if none is found
if(number_profiles == 0){
ElevationProfile elev;
road::RoadId road_id = node_road.attribute("id").as_uint();
elev.road = map_builder.GetRoad(road_id);
// get common properties
elev.s = 0;
elev.a = 0;
elev.b = 0;
elev.c = 0;
elev.d = 0;
// add it
elevation_profile.emplace_back(elev);
}
// parse lateral profile
node_profile = node_road.child("lateralProfile");

View File

@ -164,6 +164,11 @@ namespace parser {
offset.d = node_offset.attribute("d").as_double();
road.section_offsets.emplace_back(offset);
}
// Add default lane offset if none is found
if(road.section_offsets.size() == 0) {
LaneOffset offset { 0.0, 0.0, 0.0, 0.0, 0.0 };
road.section_offsets.emplace_back(offset);
}
// lane sections
for (pugi::xml_node node_section : node_road.child("lanes").children("laneSection")) {