diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2017-11-23 16:47:24 +0300 |
---|---|---|
committer | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-11-23 16:55:21 +0300 |
commit | e02505aa5418859d0b7bbbefcd1221995f1a12eb (patch) | |
tree | a0f3d21e89c21dae7100b2e77e57afe0af6cc7a5 /openlr | |
parent | fc7367b77c9df55d6ed4acf4f08c37558617802d (diff) |
[OpenLR] Skip segments with no <locationReference>.
Diffstat (limited to 'openlr')
-rw-r--r-- | openlr/openlr_model_xml.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/openlr/openlr_model_xml.cpp b/openlr/openlr_model_xml.cpp index bc5b285a8f..9570becffb 100644 --- a/openlr/openlr_model_xml.cpp +++ b/openlr/openlr_model_xml.cpp @@ -53,6 +53,13 @@ pugi::xml_node GetLinearLocationReference(pugi::xml_node const & node) return node.select_node(".//olr:locationReference/olr:optionLinearLocationReference").node(); } +bool NoLocationReferenceButCoordinates(pugi::xml_node const & node) +{ + if (node.select_node(".//olr:locationReference").node()) + return false; + return node.select_node("coordinates").node(); +} + // This helper is used do deal with xml nodes of the form // <node> // <value>integer<value> @@ -253,8 +260,16 @@ bool ParseOpenlr(pugi::xml_document const & document, vector<LinearSegment> & se for (auto const segmentXpathNode : document.select_nodes("//reportSegments")) { LinearSegment segment; + if (NoLocationReferenceButCoordinates(segmentXpathNode.node())) + { + LOG(LWARNING, ("A segment with <coordinates> instead of <optionLinearLocationReference> " + "encounted, skipping...")); + continue; + } + if (!SegmentFromXML(segmentXpathNode.node(), segment)) return false; + segments.push_back(segment); } return true; |