diff --git a/include/boost/geometry/algorithms/detail/distance/default_strategies.hpp b/include/boost/geometry/algorithms/detail/distance/default_strategies.hpp index 890924984..3b79f82a3 100644 --- a/include/boost/geometry/algorithms/detail/distance/default_strategies.hpp +++ b/include/boost/geometry/algorithms/detail/distance/default_strategies.hpp @@ -43,7 +43,7 @@ namespace detail { namespace distance template < typename Geometry1, - typename Geometry2, + typename Geometry2 = Geometry1, typename Tag1 = typename tag_cast < typename tag::type, pointlike_tag @@ -57,7 +57,7 @@ template struct default_strategy : strategy::distance::services::default_strategy < - segment_tag, + point_tag, segment_tag, typename point_type::type, typename point_type::type > @@ -82,7 +82,7 @@ struct default_strategy pointlike_tag, pointlike_tag, false > : strategy::distance::services::default_strategy < - point_tag, + point_tag, point_tag, typename point_type::type, typename point_type::type > @@ -93,13 +93,12 @@ template struct default_strategy : strategy::distance::services::default_strategy < - point_tag, + point_tag, box_tag, typename point_type::type, typename point_type::type, cartesian_tag, cartesian_tag, - void, - box_tag + void > {}; @@ -108,13 +107,12 @@ template struct default_strategy : strategy::distance::services::default_strategy < - box_tag, + box_tag, box_tag, typename point_type::type, typename point_type::type, cartesian_tag, cartesian_tag, - void, - box_tag + void > {}; @@ -125,7 +123,7 @@ template struct default_ps_strategy : strategy::distance::services::default_strategy < - segment_tag, + point_tag, segment_tag, typename point_type::type, typename point_type::type, typename cs_tag::type>::type, diff --git a/include/boost/geometry/algorithms/length.hpp b/include/boost/geometry/algorithms/length.hpp index 6420bbb40..dddc86e85 100644 --- a/include/boost/geometry/algorithms/length.hpp +++ b/include/boost/geometry/algorithms/length.hpp @@ -241,7 +241,7 @@ length(Geometry const& geometry) // TODO put this into a resolve_strategy stage typedef typename strategy::distance::services::default_strategy < - point_tag, typename point_type::type + point_tag, point_tag, typename point_type::type >::type strategy_type; return resolve_variant::length::apply(geometry, strategy_type()); diff --git a/include/boost/geometry/algorithms/perimeter.hpp b/include/boost/geometry/algorithms/perimeter.hpp index 25870b9de..937b5baff 100644 --- a/include/boost/geometry/algorithms/perimeter.hpp +++ b/include/boost/geometry/algorithms/perimeter.hpp @@ -101,8 +101,7 @@ struct perimeter { typedef typename strategy::distance::services::default_strategy < - point_tag, - typename point_type::type + point_tag, point_tag, typename point_type::type >::type strategy_type; return dispatch::perimeter::apply(geometry, strategy_type()); diff --git a/include/boost/geometry/algorithms/simplify.hpp b/include/boost/geometry/algorithms/simplify.hpp index 0c1b94e0b..6dae3c98c 100644 --- a/include/boost/geometry/algorithms/simplify.hpp +++ b/include/boost/geometry/algorithms/simplify.hpp @@ -34,6 +34,8 @@ #include #include +#include + #include #include #include @@ -280,7 +282,7 @@ struct simplify typedef typename strategy::distance::services::default_strategy < - segment_tag, point_type + point_tag, segment_tag, point_type >::type ds_strategy_type; typedef strategy::simplify::douglas_peucker @@ -323,7 +325,7 @@ struct simplify_insert typedef typename strategy::distance::services::default_strategy < - segment_tag, point_type + point_tag, segment_tag, point_type >::type ds_strategy_type; typedef strategy::simplify::douglas_peucker diff --git a/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp b/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp index 329b7d4e4..25179ba21 100644 --- a/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp @@ -229,7 +229,11 @@ public : // of point-to-segment or point-to-linestring. // Convenient for geographic coordinate systems especially. template -struct default_strategy +struct default_strategy + < + point_tag, segment_tag, Point, PointOfSegment, + cartesian_tag, cartesian_tag, Strategy + > { typedef strategy::distance::projected_point < @@ -239,7 +243,7 @@ struct default_strategy, typename default_strategy < - point_tag, Point, PointOfSegment, + point_tag, point_tag, Point, PointOfSegment, cartesian_tag, cartesian_tag >::type, Strategy diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp index c3806c046..f1e00384c 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp @@ -271,7 +271,10 @@ public : template -struct default_strategy +struct default_strategy + < + point_tag, point_tag, Point1, Point2, cartesian_tag, cartesian_tag + > { typedef pythagoras<> type; }; diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp index d4c94b5c0..7adfb5ced 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp @@ -318,7 +318,7 @@ public : template struct default_strategy < - box_tag, Box1, Box2, cartesian_tag, cartesian_tag, void, box_tag + box_tag, box_tag, Box1, Box2, cartesian_tag, cartesian_tag > { typedef pythagoras_box_box<> type; diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp index 304250167..6b05ff014 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp @@ -314,7 +314,10 @@ public : template -struct default_strategy +struct default_strategy + < + point_tag, box_tag, Point, Box, cartesian_tag, cartesian_tag + > { typedef pythagoras_point_box<> type; }; diff --git a/include/boost/geometry/strategies/distance.hpp b/include/boost/geometry/strategies/distance.hpp index 2071e86cc..98ccb8202 100644 --- a/include/boost/geometry/strategies/distance.hpp +++ b/include/boost/geometry/strategies/distance.hpp @@ -1,8 +1,13 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// 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. @@ -70,7 +75,8 @@ struct result_from_distance {}; \brief Traits class binding a default strategy for distance to one (or possibly two) coordinate system(s) \ingroup distance - \tparam GeometryTag tag (point/segment) for which this strategy is the default + \tparam GeometryTag1 tag (point/segment/box) for which this strategy is the default + \tparam GeometryTag2 tag (point/segment/box) for which this strategy is the default \tparam Point1 first point-type \tparam Point2 second point-type \tparam CsTag1 tag of coordinate system of first point type @@ -78,13 +84,13 @@ struct result_from_distance {}; */ template < - typename GeometryTag, + typename GeometryTag1, + typename GeometryTag2, typename Point1, typename Point2 = Point1, typename CsTag1 = typename cs_tag::type, typename CsTag2 = typename cs_tag::type, - typename UnderlyingStrategy = void, - typename GeometryTag2 = GeometryTag + typename UnderlyingStrategy = void > struct default_strategy { diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track.hpp index 3180fcf5f..87fac4811 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track.hpp @@ -284,7 +284,7 @@ struct default_strategy template struct default_strategy < - segment_tag, Point, PointOfSegment, + point_tag, segment_tag, Point, PointOfSegment, spherical_equatorial_tag, spherical_equatorial_tag, Strategy > @@ -297,7 +297,7 @@ struct default_strategy boost::is_void, typename default_strategy < - point_tag, Point, PointOfSegment, + point_tag, point_tag, Point, PointOfSegment, spherical_equatorial_tag, spherical_equatorial_tag >::type, Strategy diff --git a/include/boost/geometry/strategies/spherical/distance_haversine.hpp b/include/boost/geometry/strategies/spherical/distance_haversine.hpp index 2f8d2622a..d66213380 100644 --- a/include/boost/geometry/strategies/spherical/distance_haversine.hpp +++ b/include/boost/geometry/strategies/spherical/distance_haversine.hpp @@ -279,7 +279,11 @@ public : // Register it as the default for point-types // in a spherical equatorial coordinate system template -struct default_strategy +struct default_strategy + < + point_tag, point_tag, Point1, Point2, + spherical_equatorial_tag, spherical_equatorial_tag + > { typedef strategy::distance::haversine::type> type; }; diff --git a/test/algorithms/distance.cpp b/test/algorithms/distance.cpp index 39f1285d6..e8384670e 100644 --- a/test/algorithms/distance.cpp +++ b/test/algorithms/distance.cpp @@ -72,7 +72,10 @@ void test_distance_point() BOOST_CHECK_CLOSE(d, return_type(1.4142135), 0.001); // Test specifying strategy manually - typename services::default_strategy::type strategy; + typename services::default_strategy + < + bg::point_tag, bg::point_tag, P + >::type strategy; d = bg::distance(p1, p2, strategy); BOOST_CHECK_CLOSE(d, return_type(1.4142135), 0.001); @@ -93,7 +96,10 @@ void test_distance_point() { // test comparability - typedef typename services::default_strategy::type strategy_type; + typedef typename services::default_strategy + < + bg::point_tag, bg::point_tag, P + >::type strategy_type; typedef typename services::comparable_type::type comparable_strategy_type; strategy_type strategy; @@ -143,12 +149,18 @@ void test_distance_segment() // Test specifying strategy manually: // 1) point-point-distance - typename bg::strategy::distance::services::default_strategy::type pp_strategy; + typename bg::strategy::distance::services::default_strategy + < + bg::point_tag, bg::point_tag, P + >::type pp_strategy; d1 = bg::distance(p1, seg, pp_strategy); BOOST_CHECK_CLOSE(d1, return_type(1), 0.001); // 2) point-segment-distance - typename bg::strategy::distance::services::default_strategy::type ps_strategy; + typename bg::strategy::distance::services::default_strategy + < + bg::point_tag, bg::segment_tag, P + >::type ps_strategy; d1 = bg::distance(p1, seg, ps_strategy); BOOST_CHECK_CLOSE(d1, return_type(1), 0.001);