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

#include <junctions_xml_parser.h>

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

静态 Public 成员函数

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

详细描述

在文件 junctions_xml_parser.h28 行定义.

成员函数说明

◆ Parse()

Status apollo::hdmap::adapter::JunctionsXmlParser::Parse ( const tinyxml2::XMLElement &  xml_node,
std::vector< JunctionInternal > *  junctions 
)
static

在文件 junctions_xml_parser.cc25 行定义.

26 {
27 const tinyxml2::XMLElement* junction_node =
28 xml_node.FirstChildElement("junction");
29 while (junction_node) {
30 // id
31 std::string junction_id;
32 int checker =
33 UtilXmlParser::QueryStringAttribute(*junction_node, "id", &junction_id);
34 if (checker != tinyxml2::XML_SUCCESS) {
35 std::string err_msg = "Error parse junction id";
37 }
38
39 // outline
40 const tinyxml2::XMLElement* sub_node =
41 junction_node->FirstChildElement("outline");
42 if (!sub_node) {
43 std::string err_msg = "Error parse junction outline";
45 }
46
47 PbJunction junction;
48 junction.mutable_id()->set_id(junction_id);
49 PbPolygon* polygon = junction.mutable_polygon();
51
52 JunctionInternal junction_internal;
53 junction_internal.junction = junction;
54
55 // overlap
56 sub_node = junction_node->FirstChildElement("objectOverlapGroup");
57 if (sub_node) {
58 sub_node = sub_node->FirstChildElement("objectReference");
59 while (sub_node) {
60 std::string object_id;
61 checker =
62 UtilXmlParser::QueryStringAttribute(*sub_node, "id", &object_id);
63 if (checker != tinyxml2::XML_SUCCESS) {
64 std::string err_msg = "Error parse junction overlap id";
66 }
67
68 OverlapWithJunction overlap_with_juntion;
69 overlap_with_juntion.object_id = object_id;
70 junction_internal.overlap_with_junctions.push_back(
71 overlap_with_juntion);
72
73 sub_node = sub_node->NextSiblingElement("objectReference");
74 }
75 }
76
77 junctions->push_back(junction_internal);
78 junction_node = junction_node->NextSiblingElement("junction");
79 }
80 return Status::OK();
81}
static Status OK()
generate a success status.
Definition status.h:60
static tinyxml2::XMLError QueryStringAttribute(const tinyxml2::XMLElement &xml_node, const std::string &name, std::string *value)
static Status ParseOutline(const tinyxml2::XMLElement &xml_node, PbPolygon *polygon)
#define RETURN_IF_ERROR(expr)
Definition status.h:25
apollo::hdmap::Junction PbJunction
apollo::hdmap::Polygon PbPolygon

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