Skip to content
Snippets Groups Projects
Commit 0033ac33 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Solved some bugs when generating the junction roads: all optional records are...

Solved some bugs when generating the junction roads: all optional records are checked before being used.
parent ac5899f8
No related branches found
No related tags found
1 merge request!2Param poly3
......@@ -112,7 +112,13 @@ unsigned int create_junction_road(RoadTree *road_tree, OpenDrive *open_drive,uns
if(abs(lane->GetId())==abs(lane_link->GetFrom()))
{
lane_start_width=lane->GetWidthValue(s);
max_speed=lane->GetLaneSpeed(0)->GetMax();
if(lane->GetLaneSpeedCount()>0)
max_speed=lane->GetLaneSpeed(0)->GetMax();
else
{
std::cout << "Warning: Speed record missing. Using 60.0 Km/h" << std::endl;
max_speed=60.0;
}
}
}
}
......@@ -253,7 +259,13 @@ unsigned int create_junction_road(RoadTree *road_tree, OpenDrive *open_drive,uns
road->SetSuccessor("road",connection->GetConnectingRoad(), "start");
else
road->SetSuccessor("road",connection->GetConnectingRoad(), "end");
road->AddRoadType(0,predecessor->GetRoadType(0)->GetType());
if(predecessor->GetRoadTypeCount()>0)
road->AddRoadType(0,predecessor->GetRoadType(0)->GetType());
else
{
std::cout << "Warning: Road type record missing: Using town" << std::endl;
road->AddRoadType(0,"town");
}
road_tree->AddRoadType(road_index,0,false);
road_id++;
}
......@@ -367,7 +379,13 @@ unsigned int create_junction_road(RoadTree *road_tree, OpenDrive *open_drive,uns
road->SetSuccessor("road",connection->GetConnectingRoad(), "start");
else
road->SetSuccessor("road",connection->GetConnectingRoad(), "end");
road->AddRoadType(0,predecessor->GetRoadType(0)->GetType());
if(predecessor->GetRoadTypeCount()>0)
road->AddRoadType(0,predecessor->GetRoadType(0)->GetType());
else
{
std::cout << "Warning: Road type record missing: Using town" << std::endl;
road->AddRoadType(0,"town");
}
road_tree->AddRoadType(road_index,0,false);
road_id++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment