Apollo 10.0
自动驾驶开放平台
apollo::hdmap::adapter::OpendriveAdapter类 参考

#include <opendrive_adapter.h>

apollo::hdmap::adapter::OpendriveAdapter 的协作图:

静态 Public 成员函数

static bool LoadData (const std::string &filename, apollo::hdmap::Map *pb_map)
 

详细描述

在文件 opendrive_adapter.h25 行定义.

成员函数说明

◆ LoadData()

bool apollo::hdmap::adapter::OpendriveAdapter::LoadData ( const std::string &  filename,
apollo::hdmap::Map pb_map 
)
static

在文件 opendrive_adapter.cc35 行定义.

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 // root node
46 const tinyxml2::XMLElement* root_node = document.RootElement();
47 ACHECK(root_node != nullptr);
48 // header
49 PbHeader* map_header = pb_map->mutable_header();
50 Status status = HeaderXmlParser::Parse(*root_node, map_header);
51 if (!status.ok()) {
52 AERROR << "fail to parse opendrive header, " << status.error_message();
53 return false;
54 }
55
56 // road
57 std::vector<RoadInternal> roads;
58 status = RoadsXmlParser::Parse(*root_node, &roads);
59 if (!status.ok()) {
60 AERROR << "fail to parse opendrive road, " << status.error_message();
61 return false;
62 }
63
64 // junction
65 std::vector<JunctionInternal> junctions;
66 status = JunctionsXmlParser::Parse(*root_node, &junctions);
67 if (!status.ok()) {
68 AERROR << "fail to parse opendrive junction, " << status.error_message();
69 return false;
70 }
71
72 // objects
73 ObjectInternal objects;
74 status = ObjectsXmlParser::ParseObjects(*root_node, &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, PbHeader *header)
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)
#define ACHECK(cond)
Definition log.h:80
#define AERROR
Definition log.h:44
apollo::hdmap::Header PbHeader

该类的文档由以下文件生成: