MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / insertRoads

Method insertRoads

common/map_sdk/map_engine/src/local_search.cpp:996–1045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

994int LocalSearch::getJunction(junctionpkid jid, hadmap::txJunctionPtr& junction) { return HADMAP_DATA_EMPTY; }
995
996int LocalSearch::insertRoads(const hadmap::txRoads& roads) {
997 tx_task_t task;
998 task.pkid = 1;
999 memcpy(task.name, kTadsimXodr, strlen(kTadsimXodr) + 1);
1000 task.srs = 4326;
1001 task.x = 0.0;
1002 task.y = 0.0;
1003 task.z = 0.0;
1004 task.heading = 0.0;
1005 task.pitch = 0.0;
1006 task.roll = 0.0;
1007 tx_task_vec t_tasks;
1008 t_tasks.push_back(task);
1009 dbPtr->insertTasks(t_tasks);
1010
1011 hadmap::tx_road_vec t_roads;
1012 hadmap::tx_lane_vec t_lanes;
1013 hadmap::tx_laneboundary_vec t_laneboundarys;
1014 std::set<int> laneBoundaryid;
1015 for (auto it = roads.begin(); it != roads.end(); it++) {
1016 tx_road_t roat_t = (*it)->getTxData();
1017 roat_t.srs = 4326;
1018 roat_t.pkid = (*it)->getId();
1019 roat_t.section_num = (*it)->getSections().size();
1020 t_roads.push_back(roat_t);
1021 for (auto itSection : (*it)->getSections()) {
1022 for (auto itlane : (itSection)->getLanes()) {
1023 tx_lane_t tlane = (itlane)->getTxLaneData();
1024 tlane.srs = 4326;
1025 t_lanes.push_back(tlane);
1026 if (laneBoundaryid.find(itlane->getLeftBoundaryId()) == laneBoundaryid.end()) {
1027 tx_laneboundary_t boundary = itlane->getLeftBoundary()->getTxData();
1028 boundary.srs = 4326;
1029 laneBoundaryid.insert(itlane->getLeftBoundaryId());
1030 t_laneboundarys.push_back(boundary);
1031 }
1032 if (laneBoundaryid.find(itlane->getRightBoundaryId()) == laneBoundaryid.end()) {
1033 tx_laneboundary_t boundary = itlane->getRightBoundary()->getTxData();
1034 boundary.srs = 4326;
1035 laneBoundaryid.insert(itlane->getRightBoundaryId());
1036 t_laneboundarys.push_back(boundary);
1037 }
1038 }
1039 }
1040 }
1041 dbPtr->insertRoads(t_roads);
1042 dbPtr->insertLaneBoundaries(t_laneboundarys);
1043 dbPtr->insertLanes(t_lanes);
1044 return 0;
1045}
1046
1047int LocalSearch::updateRoads(const hadmap::txRoads& roads) {
1048 std::set<int> laneBoundaryid;

Callers 1

saveMapMethod · 0.45

Calls 15

insertTasksMethod · 0.80
getLeftBoundaryIdMethod · 0.80
getLeftBoundaryMethod · 0.80
getRightBoundaryIdMethod · 0.80
getRightBoundaryMethod · 0.80
insertLaneBoundariesMethod · 0.80
insertLanesMethod · 0.80
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getTxDataMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected