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

Method saveMap

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

Source from the content-addressed store, hash-verified

60bool LocalSearch::connSuccess() { return dbPtr != NULL; }
61
62bool LocalSearch::saveMap(const int type, std::string filePath) {
63 if (MAP_DATA_TYPE(type) == OPENDRIVE) {
64 OpenDriveOutput outPut;
65 hadmap::txRoads _roads;
66 getRoads(true, _roads);
67 if (_roads.size() > 0) {
68 outPut.initFilePath(filePath.c_str());
69 outPut.insertHeader(hadmap::txPoint());
70 for (auto it : _roads) {
71 // get fromroads and to roads
72 hadmap::txLaneLinks links;
73 getLaneLinks(it->getId(), ROAD_PKID_INVALID, links);
74 if (links.size() > 0) {
75 hadmap::txLaneLinkPtr lanelink = links.at(0);
76 int junctionId = lanelink->getJunctionId();
77 hadmap::txRoadLink _suclink;
78 _suclink.Id = std::to_string(junctionId);
79 _suclink.Type = "junction";
80 it->setToLink(_suclink);
81 }
82 links.clear();
83 getLaneLinks(ROAD_PKID_INVALID, it->getId(), links);
84 if (links.size() > 0) {
85 hadmap::txLaneLinkPtr lanelink = links.at(0);
86 int junctionId = lanelink->getJunctionId();
87 hadmap::txRoadLink _suclink;
88 _suclink.Id = std::to_string(junctionId);
89 _suclink.Type = "junction";
90 it->setPreLink(_suclink);
91 }
92 }
93 outPut.insertRoads(_roads);
94 }
95 // lanelinks
96 hadmap::txLaneLinks links;
97 roadpkid from_id = ROAD_PKID_INVALID;
98 roadpkid to_id = ROAD_PKID_INVALID;
99 getLaneLinks(from_id, to_id, links);
100 outPut.insertLaneLinks(links);
101 // objects
102 hadmap::txObjects _objects;
103 std::vector<txLaneId> laneids;
104 std::vector<OBJECT_TYPE> types;
105 hadmap::txObjects objects;
106 getObjects(laneids, types, objects);
107 outPut.insertObjects(objects, _roads);
108 }
109 return true;
110}
111
112std::string LocalSearch::getLastOptInfo() { return optInfo; }
113

Callers

nothing calls this directly

Calls 15

MAP_DATA_TYPEEnum · 0.85
getRoadsFunction · 0.85
txPointFunction · 0.85
getLaneLinksFunction · 0.85
to_stringFunction · 0.85
getObjectsFunction · 0.85
initFilePathMethod · 0.80
insertHeaderMethod · 0.80
getJunctionIdMethod · 0.80
sizeMethod · 0.45
getIdMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected