Fixed bug filling the MapBuilder
This commit is contained in:
parent
7236bfc2fe
commit
a018135b0f
|
@ -80,68 +80,72 @@ namespace opendrive {
|
||||||
} else {
|
} else {
|
||||||
roadSegment.AddSuccessorID(it->second->road_link.successor->id);
|
roadSegment.AddSuccessorID(it->second->road_link.successor->id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (it->second->road_link.predecessor != nullptr) {
|
if (it->second->road_link.predecessor != nullptr) {
|
||||||
|
if (it->second->road_link.predecessor->element_type == "junction") {
|
||||||
std::vector<lane_junction_t> &options =
|
std::vector<lane_junction_t> &options =
|
||||||
junctionsData[it->second->road_link.predecessor->id][it->first];
|
junctionsData[it->second->road_link.predecessor->id][it->first];
|
||||||
for (size_t i = 0; i < options.size(); ++i) {
|
for (size_t i = 0; i < options.size(); ++i) {
|
||||||
roadSegment.AddPredecessorID(options[i].connection_road);
|
roadSegment.AddPredecessorID(options[i].connection_road);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
roadSegment.AddPredecessorID(it->second->road_link.predecessor->id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < it->second->geometry_attributes.size(); ++i) {
|
for (size_t i = 0; i < it->second->geometry_attributes.size(); ++i) {
|
||||||
geom::Location loc;
|
geom::Location loc;
|
||||||
loc.x = it->second->geometry_attributes[i]->start_position_x;
|
loc.x = it->second->geometry_attributes[i]->start_position_x;
|
||||||
loc.y = it->second->geometry_attributes[i]->start_position_y;
|
loc.y = it->second->geometry_attributes[i]->start_position_y;
|
||||||
|
|
||||||
switch (it->second->geometry_attributes[i]->type) {
|
switch (it->second->geometry_attributes[i]->type) {
|
||||||
case carla::opendrive::types::GeometryType::ARC: {
|
case carla::opendrive::types::GeometryType::ARC: {
|
||||||
carla::opendrive::types::GeometryAttributesArc *arc =
|
carla::opendrive::types::GeometryAttributesArc *arc =
|
||||||
(carla::opendrive::types::GeometryAttributesArc *) it->second->geometry_attributes[i].get();
|
(carla::opendrive::types::GeometryAttributesArc *) it->second->geometry_attributes[i].get();
|
||||||
|
|
||||||
roadSegment.MakeGeometry<carla::road::GeometryArc>(arc->start_position,
|
roadSegment.MakeGeometry<carla::road::GeometryArc>(arc->start_position,
|
||||||
arc->length,
|
arc->length,
|
||||||
arc->heading,
|
arc->heading,
|
||||||
loc,
|
loc,
|
||||||
arc->curvature);
|
arc->curvature);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case carla::opendrive::types::GeometryType::LINE: {
|
case carla::opendrive::types::GeometryType::LINE: {
|
||||||
carla::opendrive::types::GeometryAttributesLine *line =
|
carla::opendrive::types::GeometryAttributesLine *line =
|
||||||
(carla::opendrive::types::GeometryAttributesLine *) it->second->geometry_attributes[i].get();
|
(carla::opendrive::types::GeometryAttributesLine *) it->second->geometry_attributes[i].get();
|
||||||
|
|
||||||
roadSegment.MakeGeometry<carla::road::GeometryLine>(line->start_position,
|
roadSegment.MakeGeometry<carla::road::GeometryLine>(line->start_position,
|
||||||
line->length,
|
line->length,
|
||||||
line->heading,
|
line->heading,
|
||||||
loc);
|
loc);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case carla::opendrive::types::GeometryType::SPIRAL: {
|
case carla::opendrive::types::GeometryType::SPIRAL: {
|
||||||
carla::opendrive::types::GeometryAttributesSpiral *spiral =
|
carla::opendrive::types::GeometryAttributesSpiral *spiral =
|
||||||
(carla::opendrive::types::GeometryAttributesSpiral *) it->second->geometry_attributes[i].get();
|
(carla::opendrive::types::GeometryAttributesSpiral *) it->second->geometry_attributes[i].get();
|
||||||
|
|
||||||
roadSegment.MakeGeometry<carla::road::GeometrySpiral>(spiral->start_position,
|
roadSegment.MakeGeometry<carla::road::GeometrySpiral>(spiral->start_position,
|
||||||
spiral->length,
|
spiral->length,
|
||||||
spiral->heading,
|
spiral->heading,
|
||||||
loc,
|
loc,
|
||||||
spiral->curve_start,
|
spiral->curve_start,
|
||||||
spiral->curve_end);
|
spiral->curve_end);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapBuilder.AddRoadSegmentDefinition(roadSegment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mapBuilder.AddRoadSegmentDefinition(roadSegment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapBuilder.Build();
|
return mapBuilder.Build();
|
||||||
|
|
Loading…
Reference in New Issue