36 {
37 CHECK_NOTNULL(pb_map);
38
39 tinyxml2::XMLDocument document;
40 if (document.LoadFile(filename.c_str()) != tinyxml2::XML_SUCCESS) {
41 AERROR <<
"fail to load file " << filename;
42 return false;
43 }
44
45
46 const tinyxml2::XMLElement* root_node = document.RootElement();
47 ACHECK(root_node !=
nullptr);
48
49 PbHeader* map_header = pb_map->mutable_header();
51 if (!status.ok()) {
52 AERROR <<
"fail to parse opendrive header, " << status.error_message();
53 return false;
54 }
55
56
57 std::vector<RoadInternal> roads;
59 if (!status.ok()) {
60 AERROR <<
"fail to parse opendrive road, " << status.error_message();
61 return false;
62 }
63
64
65 std::vector<JunctionInternal> junctions;
67 if (!status.ok()) {
68 AERROR <<
"fail to parse opendrive junction, " << status.error_message();
69 return false;
70 }
71
72
73 ObjectInternal objects;
75 if (!status.ok()) {
76 AERROR <<
"fail to parse opendrive objects, " << status.error_message();
77 return false;
78 }
79
80 ProtoOrganizer proto_organizer;
81 proto_organizer.GetRoadElements(&roads);
82 proto_organizer.GetJunctionElements(junctions);
83 proto_organizer.GetObjectElements(objects);
84 proto_organizer.GetOverlapElements(roads, junctions);
85 proto_organizer.OutputData(pb_map);
86
87 return true;
88}
static Status Parse(const tinyxml2::XMLElement &xml_node, std::vector< JunctionInternal > *junctions)
static Status ParseObjects(const tinyxml2::XMLElement &xml_node, ObjectInternal *objects)
static Status Parse(const tinyxml2::XMLElement &xml_node, std::vector< RoadInternal > *roads)
apollo::hdmap::Header PbHeader