MCPcopy Create free account
hub / github.com/comaps/comaps / LinearLocationReferenceFromXML

Function LinearLocationReferenceFromXML

tools/openlr/openlr_model_xml.cpp:221–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221bool LinearLocationReferenceFromXML(pugi::xml_node const & locRefNode, openlr::LinearLocationReference & locRef)
222{
223 if (!locRefNode)
224 {
225 LOG(LERROR, ("Can't get location reference."));
226 return false;
227 }
228
229 {
230 openlr::LocationReferencePoint point;
231 if (!LocationReferencePointFromXML(locRefNode.child("olr:first"), point))
232 return false;
233 locRef.m_points.push_back(point);
234 }
235
236 for (auto const pointNode : locRefNode.select_nodes("olr:intermediates"))
237 {
238 openlr::LocationReferencePoint point;
239 if (!LocationReferencePointFromXML(pointNode.node(), locRef.m_points.back().m_latLon, point))
240 return false;
241 locRef.m_points.push_back(point);
242 }
243
244 {
245 openlr::LocationReferencePoint point;
246 if (!LocationReferencePointFromXML(locRefNode.child("olr:last"), locRef.m_points.back().m_latLon, point))
247 return false;
248 locRef.m_points.push_back(point);
249 }
250
251 if (!ParseValueIfExists(locRefNode.child("olr:positiveOffset"), locRef.m_positiveOffsetMeters))
252 {
253 LOG(LERROR, ("Can't parse positive offset"));
254 return false;
255 }
256
257 if (!ParseValueIfExists(locRefNode.child("olr:negativeOffset"), locRef.m_negativeOffsetMeters))
258 {
259 LOG(LERROR, ("Can't parse negative offset"));
260 return false;
261 }
262
263 return true;
264}
265
266bool CoordinatesFromXML(pugi::xml_node const & coordsNode, openlr::LinearLocationReference & locRef)
267{

Callers 1

SegmentFromXMLFunction · 0.85

Calls 4

ParseValueIfExistsFunction · 0.85
backMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected