提交 cf479c34 编写于 作者: U unacao 提交者: Jiangtao Hu

display road boundaries

上级 ff2801d8
......@@ -33,6 +33,7 @@ using apollo::hdmap::Id;
using apollo::hdmap::LaneInfoConstPtr;
using apollo::hdmap::CrosswalkInfoConstPtr;
using apollo::hdmap::JunctionInfoConstPtr;
using apollo::hdmap::RoadInfoConstPtr;
using apollo::hdmap::SignalInfoConstPtr;
using apollo::hdmap::StopSignInfoConstPtr;
using apollo::hdmap::YieldSignInfoConstPtr;
......@@ -200,6 +201,12 @@ void MapService::CollectMapElementIds(const PointENU &point, double radius,
AERROR << "Failed to get yield signs from sim_map.";
}
ExtractIds(yield_signs, ids->mutable_yield());
std::vector<RoadInfoConstPtr> roads;
if (sim_map_->GetRoads(point, radius, &roads) != 0) {
AERROR << "Failed to get roads from sim_map.";
}
ExtractIds(roads, ids->mutable_road());
}
Map MapService::RetrieveMapElements(const MapElementIds &ids) const {
......@@ -259,6 +266,14 @@ Map MapService::RetrieveMapElements(const MapElementIds &ids) const {
}
}
for (const auto &id : ids.road()) {
map_id.set_id(id);
auto element = sim_map_->GetRoadById(map_id);
if (element) {
*result.add_road() = element->road();
}
}
for (const auto &id : ids.overlap()) {
map_id.set_id(id);
auto element = sim_map_->GetOverlapById(map_id);
......
......@@ -2,3 +2,4 @@ node_modules/
yarn-error.log
!*bundle.js
dist_offline/
dist/assets/map_data
......@@ -374,6 +374,11 @@
"rule": "repeated",
"type": "string",
"id": 7
},
"road": {
"rule": "repeated",
"type": "string",
"id": 8
}
}
},
......
......@@ -141,6 +141,23 @@ export default class Map {
return drewObjects;
}
addRoad(road, coordinates, scene) {
const drewObjects = [];
road.section.forEach(section => {
section.boundary.outerPolygon.edge.forEach(edge => {
edge.curve.segment.forEach((segment, index) => {
const points = coordinates.applyOffsetToArray(segment.lineSegment.point);
const boundary = this.addLaneMesh("CURB", points);
scene.add(boundary);
drewObjects.push(boundary);
});
});
});
return drewObjects;
}
addCrossWalk(crosswalk, coordinates, scene) {
const drewObjects = [];
......@@ -404,6 +421,12 @@ export default class Map {
newData[kind][i], coordinates, scene)
}));
break;
case "road":
const road = newData[kind][i];
this.data[kind].push(Object.assign(newData[kind][i], {
drewObjects: this.addRoad(road, coordinates, scene)
}));
break;
default:
this.data[kind].push(newData[kind][i]);
break;
......
......@@ -164,6 +164,7 @@ message MapElementIds {
repeated string stop_sign = 5;
repeated string yield = 6;
repeated string overlap = 7;
repeated string road = 8;
}
// Next-id: 17
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册