From 83d7a57b733d25f68178d9cd12485f7d884b00ea Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 2 Feb 2018 12:34:53 +0000 Subject: [PATCH] Remove OSM link debug printing from public class --- include/util/assert.hpp | 5 ++-- include/util/coordinate.hpp | 17 ------------ include/util/to_osm_link.hpp | 32 ++++++++++++++++++++++ src/extractor/edge_based_graph_factory.cpp | 4 +-- 4 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 include/util/to_osm_link.hpp diff --git a/include/util/assert.hpp b/include/util/assert.hpp index ac4b80797..31127f29c 100644 --- a/include/util/assert.hpp +++ b/include/util/assert.hpp @@ -4,7 +4,7 @@ #include #include -#include "util/coordinate.hpp" +#include "util/to_osm_link.hpp" #include @@ -19,8 +19,7 @@ { \ if (!static_cast(cond)) \ { \ - ::osrm::util::FloatCoordinate c_(loc); \ - std::cerr << "[Location] " << c_.toOSMLink() << '\n'; \ + std::cerr << "[Location] " << ::osrm::util::toOSMLink(loc) << '\n'; \ } \ BOOST_ASSERT_MSG(cond, msg); \ } while (0) diff --git a/include/util/coordinate.hpp b/include/util/coordinate.hpp index 21ba703f8..a708383ba 100644 --- a/include/util/coordinate.hpp +++ b/include/util/coordinate.hpp @@ -217,15 +217,6 @@ struct Coordinate friend bool operator==(const Coordinate lhs, const Coordinate rhs); friend bool operator!=(const Coordinate lhs, const Coordinate rhs); friend std::ostream &operator<<(std::ostream &out, const Coordinate coordinate); - - std::string toOSMLink() const - { - std::stringstream link; - link << "http://www.openstreetmap.org/?mlat=" << toFloating(lat) - << "&mlon=" << toFloating(lon) << "#map=19/" << toFloating(lat) << "/" - << toFloating(lon); - return link.str(); - } }; /** @@ -267,14 +258,6 @@ struct FloatCoordinate friend bool operator==(const FloatCoordinate lhs, const FloatCoordinate rhs); friend bool operator!=(const FloatCoordinate lhs, const FloatCoordinate rhs); friend std::ostream &operator<<(std::ostream &out, const FloatCoordinate coordinate); - - std::string toOSMLink() const - { - std::stringstream link; - link << "http://www.openstreetmap.org/?mlat=" << lat << "&mlon=" << lon << "#map=19/" << lat - << "/" << lon; - return link.str(); - } }; bool operator==(const Coordinate lhs, const Coordinate rhs); diff --git a/include/util/to_osm_link.hpp b/include/util/to_osm_link.hpp new file mode 100644 index 000000000..1acfb11ba --- /dev/null +++ b/include/util/to_osm_link.hpp @@ -0,0 +1,32 @@ +#ifndef OSRM_UTIL_TO_OSM_LINK_HPP +#define OSRM_UTIL_TO_OSM_LINK_HPP + +#include "util/coordinate.hpp" + +#include + +namespace osrm +{ +namespace util +{ +inline std::string toOSMLink(const util::FloatCoordinate &c) +{ + std::stringstream link; + link << "http://www.openstreetmap.org/?mlat=" << c.lat << "&mlon=" << c.lon << "#map=19/" + << c.lat << "/" << c.lon; + return link.str(); +} + +inline std::string toOSMLink(const util::Coordinate &c) +{ + std::stringstream link; + link << "http://www.openstreetmap.org/?mlat=" << toFloating(c.lat) + << "&mlon=" << toFloating(c.lon) << "#map=19/" << toFloating(c.lat) << "/" + << toFloating(c.lon); + return link.str(); +} +} +} + + +#endif diff --git a/src/extractor/edge_based_graph_factory.cpp b/src/extractor/edge_based_graph_factory.cpp index 9a5ac6570..ddefd1b31 100644 --- a/src/extractor/edge_based_graph_factory.cpp +++ b/src/extractor/edge_based_graph_factory.cpp @@ -807,14 +807,14 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges( << "Turn is a u turn but not turning to the first connected " "edge of the intersection. Node ID: " << intersection_node << ", OSM link: " - << m_coordinates[intersection_node].toOSMLink(); + << toOSMLink(m_coordinates[intersection_node]); } else if (turn == intersection_view.begin() && !is_uturn) { util::Log(logWARNING) << "Turn is a u turn but not classified as a u turn. Node ID: " << intersection_node << ", OSM link: " - << m_coordinates[intersection_node].toOSMLink(); + << toOSMLink(m_coordinates[intersection_node]); } // In case a way restriction starts at a given location, add a turn onto