diff --git a/include/boost/geometry/algorithms/comparable_distance.hpp b/include/boost/geometry/algorithms/comparable_distance.hpp index 55b827bd3..6f009da3e 100644 --- a/include/boost/geometry/algorithms/comparable_distance.hpp +++ b/include/boost/geometry/algorithms/comparable_distance.hpp @@ -19,80 +19,7 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP #define BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP -#include - -#include -#include - - -namespace boost { namespace geometry -{ - - -// MK::need to add qbk documentation -template -inline typename strategy::distance::services::return_type - < - typename strategy::distance::services::comparable_type - < - Strategy - >::type, - typename point_type::type, - typename point_type::type - >::type -comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2, - Strategy const& strategy) -{ - concept::check(); - concept::check(); - - return distance(geometry1, geometry2, - strategy::distance::services::get_comparable - < - Strategy - >::apply(strategy) - ); -} - - - -/*! -\brief \brief_calc2{comparable distance measurement} -\ingroup distance -\details The free function comparable_distance does not necessarily calculate the distance, - but it calculates a distance measure such that two distances are comparable to each other. - For example: for the Cartesian coordinate system, Pythagoras is used but the square root - is not taken, which makes it faster and the results of two point pairs can still be - compared to each other. -\tparam Geometry1 first geometry type -\tparam Geometry2 second geometry type -\param geometry1 \param_geometry -\param geometry2 \param_geometry -\return \return_calc{comparable distance} - -\qbk{[include reference/algorithms/comparable_distance.qbk]} - */ -template -inline typename default_comparable_distance_result::type -comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2) -{ - concept::check(); - concept::check(); - - // Define the default-distance-strategy - typedef typename strategy::distance::services::comparable_type - < - typename detail::distance::default_strategy - < - Geometry1, Geometry2 - >::type - >::type default_comparable_strategy_type; - - return distance(geometry1, geometry2, default_comparable_strategy_type()); -} - - -}} // namespace boost::geometry - +#include +#include #endif // BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP diff --git a/include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp b/include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp new file mode 100644 index 000000000..96fbca63b --- /dev/null +++ b/include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp @@ -0,0 +1,25 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP + +#include +#include + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP diff --git a/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp b/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp new file mode 100644 index 000000000..45f4fcdf1 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp @@ -0,0 +1,96 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_INTERFACE_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_INTERFACE_HPP + +#include + +#include + +namespace boost { namespace geometry +{ + + +// MK::need to add qbk documentation +template +inline typename strategy::distance::services::return_type + < + typename strategy::distance::services::comparable_type + < + Strategy + >::type, + typename point_type::type, + typename point_type::type + >::type +comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2, + Strategy const& strategy) +{ + concept::check(); + concept::check(); + + return distance(geometry1, geometry2, + strategy::distance::services::get_comparable + < + Strategy + >::apply(strategy) + ); +} + + + +/*! +\brief \brief_calc2{comparable distance measurement} +\ingroup distance +\details The free function comparable_distance does not necessarily calculate the distance, + but it calculates a distance measure such that two distances are comparable to each other. + For example: for the Cartesian coordinate system, Pythagoras is used but the square root + is not taken, which makes it faster and the results of two point pairs can still be + compared to each other. +\tparam Geometry1 first geometry type +\tparam Geometry2 second geometry type +\param geometry1 \param_geometry +\param geometry2 \param_geometry +\return \return_calc{comparable distance} + +\qbk{[include reference/algorithms/comparable_distance.qbk]} + */ +template +inline typename default_comparable_distance_result::type +comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2) +{ + concept::check(); + concept::check(); + + // Define the default-distance-strategy + typedef typename strategy::distance::services::comparable_type + < + typename detail::distance::default_strategy + < + Geometry1, Geometry2 + >::type + >::type default_comparable_strategy_type; + + return distance(geometry1, geometry2, default_comparable_strategy_type()); +} + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_INTERFACE_HPP diff --git a/include/boost/geometry/extensions/nsphere/nsphere.hpp b/include/boost/geometry/extensions/nsphere/nsphere.hpp index 81c9a7d08..f9cf82e19 100644 --- a/include/boost/geometry/extensions/nsphere/nsphere.hpp +++ b/include/boost/geometry/extensions/nsphere/nsphere.hpp @@ -14,9 +14,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_NSPHERE_HPP #define BOOST_GEOMETRY_EXTENSIONS_NSPHERE_HPP -// TEMP - remove it after brakeing the comparable_distance code into the interface and implementation -#include - #include #include #include diff --git a/test/algorithms/comparable_distance.cpp b/test/algorithms/comparable_distance.cpp index 5dfb4f4f0..7ae30a028 100644 --- a/test/algorithms/comparable_distance.cpp +++ b/test/algorithms/comparable_distance.cpp @@ -24,17 +24,12 @@ #include #include -#include - -#include -#include - #include -#include - #include - +#include +#include +#include template void test_distance_result()