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

#include <roads_xml_parser.h>

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

静态 Public 成员函数

static Status Parse (const tinyxml2::XMLElement &xml_node, std::vector< RoadInternal > *roads)
 

详细描述

在文件 roads_xml_parser.h29 行定义.

成员函数说明

◆ Parse()

Status apollo::hdmap::adapter::RoadsXmlParser::Parse ( const tinyxml2::XMLElement &  xml_node,
std::vector< RoadInternal > *  roads 
)
static

在文件 roads_xml_parser.cc34 行定义.

35 {
36 CHECK_NOTNULL(roads);
37
38 auto road_node = xml_node.FirstChildElement("road");
39 while (road_node) {
40 // road attributes
41 std::string id;
42 std::string junction_id;
43 int checker = UtilXmlParser::QueryStringAttribute(*road_node, "id", &id);
44 checker += UtilXmlParser::QueryStringAttribute(*road_node, "junction",
45 &junction_id);
46 if (checker != tinyxml2::XML_SUCCESS) {
47 std::string err_msg = "Error parsing road attributes";
49 }
50
51 RoadInternal road_internal;
52 road_internal.id = id;
53 road_internal.road.mutable_id()->set_id(id);
54 if (IsRoadBelongToJunction(junction_id)) {
55 road_internal.road.mutable_junction_id()->set_id(junction_id);
56 }
57
58 std::string type;
59 checker = UtilXmlParser::QueryStringAttribute(*road_node, "type", &type);
60 if (checker != tinyxml2::XML_SUCCESS) {
61 // forward compatibility with old data
62 type = "CITYROAD";
63 }
64 PbRoadType pb_road_type;
65 RETURN_IF_ERROR(to_pb_road_type(type, &pb_road_type));
66 road_internal.road.set_type(pb_road_type);
67
68 // lanes
69 RETURN_IF_ERROR(LanesXmlParser::Parse(*road_node, road_internal.id,
70 &road_internal.sections));
71
72 // objects
73 Parse_road_objects(*road_node, &road_internal);
74 // signals
75 Parse_road_signals(*road_node, &road_internal);
76
77 roads->push_back(road_internal);
78 road_node = road_node->NextSiblingElement("road");
79 }
80
81 return Status::OK();
82}
static Status OK()
generate a success status.
Definition status.h:60
static Status Parse(const tinyxml2::XMLElement &xml_node, const std::string &road_id, std::vector< RoadSectionInternal > *sections)
static tinyxml2::XMLError QueryStringAttribute(const tinyxml2::XMLElement &xml_node, const std::string &name, std::string *value)
#define RETURN_IF_ERROR(expr)
Definition status.h:25
apollo::hdmap::Road_Type PbRoadType

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