24 const tinyxml2::XMLElement& xml_node,
25 std::vector<TrafficLightInternal>* traffic_lights) {
26 CHECK_NOTNULL(traffic_lights);
27 auto signal_node = xml_node.FirstChildElement(
"signal");
29 std::string object_type;
30 std::string object_id;
35 if (checker != tinyxml2::XML_SUCCESS) {
36 std::string err_msg =
"Error parse signal type.";
40 if (object_type ==
"trafficLight") {
42 traffic_light.mutable_id()->set_id(object_id);
43 std::string layout_type;
45 *signal_node,
"layoutType", &layout_type);
46 if (checker != tinyxml2::XML_SUCCESS) {
47 std::string err_msg =
"Error parse signal layout type.";
51 ToPbSignalType(layout_type, &signal_layout_type);
52 traffic_light.set_type(signal_layout_type);
54 auto sign_infos_node = signal_node->FirstChildElement(
"signInfos");
55 if (sign_infos_node !=
nullptr) {
56 auto sign_info_node = sign_infos_node->FirstChildElement(
"signInfo");
57 while (sign_info_node !=
nullptr) {
58 std::string sign_info_type;
61 if (checker != tinyxml2::XML_SUCCESS) {
62 std::string err_msg =
"Error parse sign info type.";
66 auto sign_info = traffic_light.add_sign_info();
68 to_pb_sign_info_type(sign_info_type, &pb_sign_info_type);
69 sign_info->set_type(pb_sign_info_type);
71 sign_info_node = sign_info_node->NextSiblingElement(
"signInfo");
75 PbPolygon* polygon = traffic_light.mutable_boundary();
76 auto outline_node = signal_node->FirstChildElement(
"outline");
77 if (outline_node ==
nullptr) {
78 std::string err_msg =
"Error parse signal outline";
82 auto sub_node = signal_node->FirstChildElement(
"subSignal");
83 if (sub_node ==
nullptr) {
84 std::string err_msg =
"Error parse sub signal.";
89 std::string sub_signal_id;
90 std::string sub_signal_xml_type;
92 &sub_signal_xml_type);
95 if (checker != tinyxml2::XML_SUCCESS) {
96 std::string err_msg =
"Error parse sub signal layout type.";
100 PbSubSignal* sub_signal = traffic_light.add_subsignal();
102 ToPbSubSignalType(sub_signal_xml_type, &sub_signal_type);
103 sub_signal->mutable_id()->set_id(sub_signal_id);
104 sub_signal->set_type(sub_signal_type);
105 PbPoint3D* pt = sub_signal->mutable_location();
108 sub_node = sub_node->NextSiblingElement(
"subSignal");
112 trafficlight_internal.
id = object_id;
115 sub_node = signal_node->FirstChildElement(
"stopline");
117 sub_node = sub_node->FirstChildElement(
"objectReference");
119 std::string stop_line_id;
122 ACHECK(checker == tinyxml2::XML_SUCCESS);
124 sub_node = sub_node->NextSiblingElement(
"objectReference");
127 traffic_lights->emplace_back(trafficlight_internal);
129 signal_node = signal_node->NextSiblingElement(
"signal");
230 const tinyxml2::XMLElement& xml_node,
231 std::vector<StopSignInternal>* stop_signs) {
232 CHECK_NOTNULL(stop_signs);
234 auto signal_node = xml_node.FirstChildElement(
"signal");
235 while (signal_node) {
236 std::string object_type;
237 std::string object_id;
242 if (checker != tinyxml2::XML_SUCCESS) {
243 std::string err_msg =
"Error parse signal type.";
247 if (object_type ==
"stopSign") {
249 stop_sign.mutable_id()->set_id(object_id);
252 stop_sign_internal.
stop_sign = stop_sign;
254 auto sub_node = signal_node->FirstChildElement(
"stopline");
256 sub_node = sub_node->FirstChildElement(
"objectReference");
258 std::string stop_line_id;
261 ACHECK(checker == tinyxml2::XML_SUCCESS);
264 sub_node = sub_node->NextSiblingElement(
"objectReference");
268 sub_node = signal_node->FirstChildElement(
"attribute");
270 std::string stop_type;
273 if (checker != tinyxml2::XML_SUCCESS) {
274 std::string err_msg =
"Error parse stop type.";
279 ToPbStopSignType(stop_type, &pb_stop_type);
280 stop_sign_internal.
stop_sign.set_type(pb_stop_type);
283 stop_signs->emplace_back(stop_sign_internal);
286 signal_node = signal_node->NextSiblingElement(
"signal");
292 const tinyxml2::XMLElement& xml_node,
293 std::vector<YieldSignInternal>* yield_signs) {
294 CHECK_NOTNULL(yield_signs);
296 auto signal_node = xml_node.FirstChildElement(
"signal");
297 while (signal_node) {
298 std::string object_type;
299 std::string object_id;
304 if (checker != tinyxml2::XML_SUCCESS) {
305 std::string err_msg =
"Error parse signal type.";
309 if (object_type ==
"yieldSign") {
311 yield_sign.mutable_id()->set_id(object_id);
313 yield_sign_internal.
id = object_id;
315 auto sub_node = signal_node->FirstChildElement(
"stopline");
317 sub_node = sub_node->FirstChildElement(
"objectReference");
319 std::string stop_line_id;
322 ACHECK(checker == tinyxml2::XML_SUCCESS);
325 sub_node = sub_node->NextSiblingElement(
"objectReference");
328 yield_signs->emplace_back(yield_sign_internal);
331 signal_node = signal_node->NextSiblingElement(
"signal");