| 60 | bool LocalSearch::connSuccess() { return dbPtr != NULL; } |
| 61 | |
| 62 | bool 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 | |
| 112 | std::string LocalSearch::getLastOptInfo() { return optInfo; } |
| 113 |
nothing calls this directly
no test coverage detected