diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2019-02-13 13:48:04 +0300 |
---|---|---|
committer | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2019-02-13 17:12:09 +0300 |
commit | fe54beb840d7355eeeea2ede2eb84a38c4b1da94 (patch) | |
tree | 502b93e919d34606439ebc49e20e49e56c50ce83 /openlr/decoded_path.cpp | |
parent | 64fbbe18780b3e1f7753f6bba0941954d944ab71 (diff) |
Displaying positive and genative offsets for edges in openlr assessment tool.
Diffstat (limited to 'openlr/decoded_path.cpp')
-rw-r--r-- | openlr/decoded_path.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/openlr/decoded_path.cpp b/openlr/decoded_path.cpp index 34bfc8191d..6ed600ce1a 100644 --- a/openlr/decoded_path.cpp +++ b/openlr/decoded_path.cpp @@ -19,16 +19,16 @@ namespace { -bool IsForwardFromXML(pugi::xml_node const & node) +uint32_t UintFromXML(pugi::xml_node const & node) { - THROW_IF_NODE_IS_EMPTY(node, openlr::DecodedPathLoadError, ("Can't parse IsForward")); - return node.text().as_bool(); + THROW_IF_NODE_IS_EMPTY(node, openlr::DecodedPathLoadError, ("Can't parse uint")); + return node.text().as_uint(); } -uint32_t SegmentIdFromXML(pugi::xml_node const & node) +bool IsForwardFromXML(pugi::xml_node const & node) { - THROW_IF_NODE_IS_EMPTY(node, openlr::DecodedPathLoadError, ("Can't parse SegmentId")); - return node.text().as_uint(); + THROW_IF_NODE_IS_EMPTY(node, openlr::DecodedPathLoadError, ("Can't parse IsForward")); + return node.text().as_bool(); } void LatLonToXML(ms::LatLon const & latLon, pugi::xml_node & node) @@ -63,6 +63,15 @@ void FeatureIdToXML(FeatureID const & fid, pugi::xml_node & node) namespace openlr { +uint32_t UintValueFromXML(pugi::xml_node const & node) +{ + auto const value = node.child("olr:value"); + if (!value) + return 0; + + return UintFromXML(value); +} + void WriteAsMappingForSpark(std::string const & fileName, std::vector<DecodedPath> const & paths) { std::ofstream ofs(fileName); @@ -120,7 +129,7 @@ void PathFromXML(pugi::xml_node const & node, DataSource const & dataSource, Pat FeatureIdFromXML(e.child("FeatureID"), dataSource, fid); auto const isForward = IsForwardFromXML(e.child("IsForward")); - auto const segmentId = SegmentIdFromXML(e.child("SegmentId")); + auto const segmentId = UintFromXML(e.child("SegmentId")); ms::LatLon start, end; LatLonFromXML(e.child("StartJunction"), start); |