diff --git a/include/boost/geometry/algorithms/difference.hpp b/include/boost/geometry/algorithms/difference.hpp index bd919f5af..780436f01 100644 --- a/include/boost/geometry/algorithms/difference.hpp +++ b/include/boost/geometry/algorithms/difference.hpp @@ -148,11 +148,11 @@ inline void difference(Geometry1 const& geometry1, typedef typename boost::range_value::type geometry_out; concept::check(); - typedef typename geometry::rescale_policy_type + typedef typename geometry::rescale_overlay_policy_type < - typename geometry::point_type::type // TODO from both - >::type - rescale_policy_type; + Geometry1, + Geometry2 + >::type rescale_policy_type; rescale_policy_type robust_policy = geometry::get_rescale_policy(geometry1, geometry2); diff --git a/include/boost/geometry/algorithms/intersection.hpp b/include/boost/geometry/algorithms/intersection.hpp index 484b399ca..500cacc9f 100644 --- a/include/boost/geometry/algorithms/intersection.hpp +++ b/include/boost/geometry/algorithms/intersection.hpp @@ -196,9 +196,10 @@ inline bool intersection(Geometry1 const& geometry1, concept::check(); concept::check(); - typedef typename geometry::rescale_policy_type + typedef typename geometry::rescale_overlay_policy_type < - typename geometry::point_type::type // TODO from both + Geometry1, + Geometry2 >::type rescale_policy_type; rescale_policy_type robust_policy diff --git a/include/boost/geometry/algorithms/sym_difference.hpp b/include/boost/geometry/algorithms/sym_difference.hpp index d151b624d..de34c9c7b 100644 --- a/include/boost/geometry/algorithms/sym_difference.hpp +++ b/include/boost/geometry/algorithms/sym_difference.hpp @@ -156,9 +156,10 @@ inline void sym_difference(Geometry1 const& geometry1, typedef typename boost::range_value::type geometry_out; concept::check(); - typedef typename geometry::rescale_policy_type + typedef typename geometry::rescale_overlay_policy_type < - typename geometry::point_type::type // TODO from both + Geometry1, + Geometry2 >::type rescale_policy_type; rescale_policy_type robust_policy diff --git a/include/boost/geometry/algorithms/union.hpp b/include/boost/geometry/algorithms/union.hpp index a0d7db01b..ca9b8ff11 100644 --- a/include/boost/geometry/algorithms/union.hpp +++ b/include/boost/geometry/algorithms/union.hpp @@ -270,9 +270,10 @@ inline OutputIterator union_insert(Geometry1 const& geometry1, concept::check(); concept::check(); - typedef typename geometry::rescale_policy_type + typedef typename geometry::rescale_overlay_policy_type < - typename geometry::point_type::type // TODO from both + Geometry1, + Geometry2 >::type rescale_policy_type; typedef strategy_intersection diff --git a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp index 6c0d8bd32..4c3e4c73f 100644 --- a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp +++ b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp @@ -17,6 +17,8 @@ #include +#include + #include #include #include @@ -221,6 +223,49 @@ struct rescale_policy_type #endif }; + +template +< + typename Geometry1, + typename Geometry2, + typename Tag1 = typename tag_cast + < + typename tag::type, + pointlike_tag, + linear_tag, + areal_tag + >::type, + typename Tag2 = typename tag_cast + < + typename tag::type, + pointlike_tag, + linear_tag, + areal_tag + >::type +> +struct rescale_overlay_policy_type + // Default: no rescaling + : public detail::get_rescale_policy::rescale_policy_type + < + typename geometry::point_type::type, + false + > +{}; + +// Areal/areal: get rescale policy based on coordinate type +template +< + typename Geometry1, + typename Geometry2 +> +struct rescale_overlay_policy_type + : public rescale_policy_type + < + typename geometry::point_type::type + > +{}; + + template inline Policy get_rescale_policy(Geometry const& geometry) {