| 219 | } |
| 220 | |
| 221 | bool 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 | |
| 266 | bool CoordinatesFromXML(pugi::xml_node const & coordsNode, openlr::LinearLocationReference & locRef) |
| 267 | { |
no test coverage detected