[algorithms] Propagate CS-specific strategies in algorithms.

This commit is contained in:
Adam Wulkiewicz 2019-06-24 12:20:04 +02:00
parent 7bf8c0dca8
commit d772e36632
31 changed files with 372 additions and 196 deletions

View File

@ -4,8 +4,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017. // This file was modified by Oracle on 2017, 2019.
// Modifications copyright (c) 2017 Oracle and/or its affiliates. // Modifications copyright (c) 2017, 2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -224,7 +224,11 @@ inline void buffer(GeometryIn const& geometry_in,
concepts::check<polygon_type>(); concepts::check<polygon_type>();
typedef typename point_type<GeometryIn>::type point_type; typedef typename point_type<GeometryIn>::type point_type;
typedef typename rescale_policy_type<point_type>::type rescale_policy_type; typedef typename rescale_policy_type
<
point_type,
typename geometry::cs_tag<point_type>::type
>::type rescale_policy_type;
geometry_out.clear(); geometry_out.clear();

View File

@ -175,7 +175,8 @@ struct buffered_piece_collection
typedef typename geometry::rescale_policy_type typedef typename geometry::rescale_policy_type
< <
typename geometry::point_type<Ring>::type typename geometry::point_type<Ring>::type,
typename IntersectionStrategy::cs_tag
>::type rescale_policy_type; >::type rescale_policy_type;
typedef typename geometry::segment_ratio_type typedef typename geometry::segment_ratio_type

View File

@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -53,7 +54,15 @@ private:
QueryRangeIterator& qit_min, QueryRangeIterator& qit_min,
Distance& dist_min) Distance& dist_min)
{ {
typedef index::rtree<RTreeValueType, index::linear<8> > rtree_type; typedef strategy::index::services::from_strategy
<
Strategy
> index_strategy_from;
typedef index::parameters
<
index::linear<8>, typename index_strategy_from::type
> index_parameters_type;
typedef index::rtree<RTreeValueType, index_parameters_type> rtree_type;
BOOST_GEOMETRY_ASSERT( rtree_first != rtree_last ); BOOST_GEOMETRY_ASSERT( rtree_first != rtree_last );
BOOST_GEOMETRY_ASSERT( queries_first != queries_last ); BOOST_GEOMETRY_ASSERT( queries_first != queries_last );
@ -62,7 +71,9 @@ private:
dist_min = zero; dist_min = zero;
// create -- packing algorithm // create -- packing algorithm
rtree_type rt(rtree_first, rtree_last); rtree_type rt(rtree_first, rtree_last,
index_parameters_type(index::linear<8>(),
index_strategy_from::get(strategy)));
RTreeValueType t_v; RTreeValueType t_v;
bool first = true; bool first = true;

View File

@ -4,10 +4,11 @@
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014. // This file was modified by Oracle on 2014, 2019.
// Modifications copyright (c) 2014, Oracle and/or its affiliates. // Modifications copyright (c) 2014, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -35,9 +36,10 @@ namespace boost { namespace geometry
namespace resolve_strategy namespace resolve_strategy
{ {
template <typename Strategy>
struct comparable_distance struct comparable_distance
{ {
template <typename Geometry1, typename Geometry2, typename Strategy> template <typename Geometry1, typename Geometry2>
static inline static inline
typename comparable_distance_result<Geometry1, Geometry2, Strategy>::type typename comparable_distance_result<Geometry1, Geometry2, Strategy>::type
apply(Geometry1 const& geometry1, apply(Geometry1 const& geometry1,
@ -59,7 +61,11 @@ struct comparable_distance
Strategy Strategy
>::apply(strategy)); >::apply(strategy));
} }
};
template <>
struct comparable_distance<default_strategy>
{
template <typename Geometry1, typename Geometry2> template <typename Geometry1, typename Geometry2>
static inline typename comparable_distance_result static inline typename comparable_distance_result
< <
@ -101,9 +107,10 @@ struct comparable_distance
Geometry2 const& geometry2, Geometry2 const& geometry2,
Strategy const& strategy) Strategy const& strategy)
{ {
return resolve_strategy::comparable_distance::apply(geometry1, return resolve_strategy::comparable_distance
geometry2, <
strategy); Strategy
>::apply(geometry1, geometry2, strategy);
} }
}; };

View File

@ -223,7 +223,7 @@ struct direction_code_impl<spherical_polar_tag>
return direction_code_impl return direction_code_impl
< <
Point, spherical_equatorial_tag spherical_equatorial_tag
>::apply(segment_a, segment_b, p); >::apply(segment_a, segment_b, p);
} }
}; };

View File

@ -5,8 +5,8 @@
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2014. // This file was modified by Oracle on 2013-2019.
// Modifications copyright (c) 2013-2014, Oracle and/or its affiliates. // Modifications copyright (c) 2013-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -21,19 +21,14 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP
#include <boost/range.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/views/closeable_view.hpp>
#include <boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp> #include <boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp>
#include <boost/geometry/algorithms/dispatch/disjoint.hpp> #include <boost/geometry/algorithms/dispatch/disjoint.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/util/range.hpp>
#include <boost/geometry/views/closeable_view.hpp>
namespace boost { namespace geometry namespace boost { namespace geometry
@ -45,6 +40,44 @@ namespace detail { namespace disjoint
{ {
template
<
typename SegmentOrBox,
typename Tag = typename tag<SegmentOrBox>::type
>
struct disjoint_point_segment_or_box
: not_implemented<Tag>
{};
template <typename Segment>
struct disjoint_point_segment_or_box<Segment, segment_tag>
{
template <typename Point, typename Strategy>
static inline bool apply(Point const& point, Segment const& segment, Strategy const& strategy)
{
return dispatch::disjoint
<
Point, Segment
>::apply(point, segment,
strategy.template get_point_in_geometry_strategy<Point, Segment>());
}
};
template <typename Box>
struct disjoint_point_segment_or_box<Box, box_tag>
{
template <typename Point, typename Strategy>
static inline bool apply(Point const& point, Box const& box, Strategy const& strategy)
{
return dispatch::disjoint
<
Point, Box
>::apply(point, box,
strategy.get_disjoint_point_box_strategy());
}
};
template template
< <
typename Range, typename Range,
@ -83,12 +116,12 @@ struct disjoint_range_segment_or_box
} }
else if ( count == 1 ) else if ( count == 1 )
{ {
return dispatch::disjoint return disjoint_point_segment_or_box
< <
point_type, SegmentOrBox SegmentOrBox
>::apply(geometry::range::front<view_type const>(view), >::apply(geometry::range::front<view_type const>(view),
segment_or_box, segment_or_box,
strategy.template get_point_in_geometry_strategy<Range, SegmentOrBox>()); strategy);
} }
else else
{ {

View File

@ -307,21 +307,23 @@ template <typename MultiPoint, typename MultiGeometry>
class multi_point_multi_geometry class multi_point_multi_geometry
{ {
private: private:
template <typename ExpandPointStrategy>
struct expand_box_point struct expand_box_point
{ {
template <typename Box, typename Point> template <typename Box, typename Point>
static inline void apply(Box& total, Point const& point) static inline void apply(Box& total, Point const& point)
{ {
geometry::expand(total, point); geometry::expand(total, point, ExpandPointStrategy());
} }
}; };
template <typename ExpandBoxStrategy>
struct expand_box_box_pair struct expand_box_box_pair
{ {
template <typename Box, typename BoxPair> template <typename Box, typename BoxPair>
inline void apply(Box& total, BoxPair const& box_pair) const inline void apply(Box& total, BoxPair const& box_pair) const
{ {
geometry::expand(total, box_pair.first); geometry::expand(total, box_pair.first, ExpandBoxStrategy());
} }
}; };
@ -411,10 +413,18 @@ public:
item_visitor_type<Strategy> visitor(multi_geometry, strategy); item_visitor_type<Strategy> visitor(multi_geometry, strategy);
typedef expand_box_point
<
typename Strategy::expand_point_strategy_type
> expand_box_point_type;
typedef overlaps_box_point typedef overlaps_box_point
< <
typename Strategy::disjoint_point_box_strategy_type typename Strategy::disjoint_point_box_strategy_type
> overlaps_box_point_type; > overlaps_box_point_type;
typedef expand_box_box_pair
<
typename Strategy::envelope_strategy_type::box_expand_strategy_type
> expand_box_box_pair_type;
typedef overlaps_box_box_pair typedef overlaps_box_box_pair
< <
typename Strategy::disjoint_box_box_strategy_type typename Strategy::disjoint_box_box_strategy_type
@ -424,9 +434,9 @@ public:
< <
box1_type box1_type
>::apply(multi_point, boxes, visitor, >::apply(multi_point, boxes, visitor,
expand_box_point(), expand_box_point_type(),
overlaps_box_point_type(), overlaps_box_point_type(),
expand_box_box_pair(), expand_box_box_pair_type(),
overlaps_box_box_pair_type()); overlaps_box_box_pair_type());
return ! visitor.intersection_found(); return ! visitor.intersection_found();

View File

@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -165,6 +166,27 @@ private:
} }
}; };
template
<
typename SegOrBox,
typename SegOrBoxTag = typename tag<SegOrBox>::type
>
struct intersects
{
static inline bool apply(Geometry const& g1, SegOrBox const& g2, Strategy const&)
{
return geometry::intersects(g1, g2);
}
};
template <typename SegOrBox>
struct intersects<SegOrBox, segment_tag>
{
static inline bool apply(Geometry const& g1, SegOrBox const& g2, Strategy const& s)
{
return geometry::intersects(g1, g2, s.get_relate_segment_segment_strategy());
}
};
public: public:
typedef typename strategy::distance::services::return_type typedef typename strategy::distance::services::return_type
@ -194,7 +216,7 @@ public:
if (check_intersection if (check_intersection
&& geometry::intersects(geometry, segment_or_box)) && intersects<SegmentOrBox>::apply(geometry, segment_or_box, strategy))
{ {
return 0; return 0;
} }

View File

@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -40,7 +41,8 @@ struct linear_to_areal
Areal const& areal, Areal const& areal,
Strategy const& strategy) Strategy const& strategy)
{ {
if ( geometry::intersects(linear, areal) ) if ( geometry::intersects(linear, areal,
strategy.get_relate_segment_segment_strategy()) )
{ {
return 0; return 0;
} }
@ -74,7 +76,8 @@ struct areal_to_areal
Areal2 const& areal2, Areal2 const& areal2,
Strategy const& strategy) Strategy const& strategy)
{ {
if ( geometry::intersects(areal1, areal2) ) if ( geometry::intersects(areal1, areal2,
strategy.get_relate_segment_segment_strategy()) )
{ {
return 0; return 0;
} }

View File

@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -113,19 +114,21 @@ template <typename MultiPoint, typename Areal, typename Strategy>
class multipoint_to_areal class multipoint_to_areal
{ {
private: private:
template <typename CoveredByStrategy>
struct not_covered_by_areal struct not_covered_by_areal
{ {
not_covered_by_areal(Areal const& areal) not_covered_by_areal(Areal const& areal, CoveredByStrategy const& strategy)
: m_areal(areal) : m_areal(areal), m_strategy(strategy)
{} {}
template <typename Point> template <typename Point>
inline bool apply(Point const& point) const inline bool apply(Point const& point) const
{ {
return !geometry::covered_by(point, m_areal); return !geometry::covered_by(point, m_areal, m_strategy);
} }
Areal const& m_areal; Areal const& m_areal;
CoveredByStrategy const& m_strategy;
}; };
public: public:
@ -140,11 +143,16 @@ public:
Areal const& areal, Areal const& areal,
Strategy const& strategy) Strategy const& strategy)
{ {
not_covered_by_areal predicate(areal); typedef not_covered_by_areal
<
typename Strategy::point_in_geometry_strategy_type
> predicate_type;
predicate_type predicate(areal, strategy.get_point_in_geometry_strategy());
if (check_iterator_range if (check_iterator_range
< <
not_covered_by_areal, false predicate_type, false
>::apply(boost::begin(multipoint), >::apply(boost::begin(multipoint),
boost::end(multipoint), boost::end(multipoint),
predicate)) predicate))

View File

@ -161,7 +161,8 @@ struct point_to_ring
Strategy const& strategy) Strategy const& strategy)
{ {
// TODO: pass strategy // TODO: pass strategy
if (within::within_point_geometry(point, ring)) if (within::within_point_geometry(point, ring,
strategy.get_point_in_geometry_strategy()))
{ {
return return_type(0); return return_type(0);
} }
@ -206,7 +207,8 @@ private:
for (InteriorRingIterator it = first; it != last; ++it) for (InteriorRingIterator it = first; it != last; ++it)
{ {
// TODO: pass strategy // TODO: pass strategy
if (within::within_point_geometry(point, *it)) if (within::within_point_geometry(point, *it,
strategy.get_point_in_geometry_strategy()))
{ {
// the point is inside a polygon hole, so its distance // the point is inside a polygon hole, so its distance
// to the polygon its distance to the polygon's // to the polygon its distance to the polygon's
@ -236,7 +238,8 @@ public:
Strategy const& strategy) Strategy const& strategy)
{ {
// TODO: pass strategy // TODO: pass strategy
if (! within::covered_by_point_geometry(point, exterior_ring(polygon))) if (! within::covered_by_point_geometry(point, exterior_ring(polygon),
strategy.get_point_in_geometry_strategy()))
{ {
// the point is outside the exterior ring, so its distance // the point is outside the exterior ring, so its distance
// to the polygon is its distance to the polygon's exterior ring // to the polygon is its distance to the polygon's exterior ring
@ -334,7 +337,8 @@ struct point_to_multigeometry<Point, MultiPolygon, Strategy, true>
Strategy const& strategy) Strategy const& strategy)
{ {
// TODO: pass strategy // TODO: pass strategy
if (within::covered_by_point_geometry(point, multipolygon)) if (within::covered_by_point_geometry(point, multipolygon,
strategy.get_point_in_geometry_strategy()))
{ {
return 0; return 0;
} }

View File

@ -542,10 +542,8 @@ private:
SBStrategy const& sb_strategy, SBStrategy const& sb_strategy,
ReturnType& result) ReturnType& result)
{ {
typedef typename geometry::strategy::side::services::default_strategy typename SBStrategy::side_strategy_type
< side_strategy = sb_strategy.get_side_strategy();
typename geometry::cs_tag<SegmentPoint>::type
>::type side;
typedef cast_to_result<ReturnType> cast; typedef cast_to_result<ReturnType> cast;
ReturnType diff1 = cast::apply(geometry::get<1>(p1)) ReturnType diff1 = cast::apply(geometry::get<1>(p1))
@ -555,12 +553,12 @@ private:
sb_strategy.get_distance_ps_strategy(); sb_strategy.get_distance_ps_strategy();
int sign = diff1 < 0 ? -1 : 1; int sign = diff1 < 0 ? -1 : 1;
if (side::apply(p0, p1, corner1) * sign < 0) if (side_strategy.apply(p0, p1, corner1) * sign < 0)
{ {
result = cast::apply(ps_strategy.apply(corner1, p0, p1)); result = cast::apply(ps_strategy.apply(corner1, p0, p1));
return true; return true;
} }
if (side::apply(p0, p1, corner2) * sign > 0) if (side_strategy.apply(p0, p1, corner2) * sign > 0)
{ {
result = cast::apply(ps_strategy.apply(corner2, p0, p1)); result = cast::apply(ps_strategy.apply(corner2, p0, p1));
return true; return true;
@ -682,7 +680,7 @@ public:
BoxPoint const& bottom_right, BoxPoint const& bottom_right,
SBStrategy const& sb_strategy) SBStrategy const& sb_strategy)
{ {
BOOST_GEOMETRY_ASSERT( geometry::less<SegmentPoint>()(p0, p1) BOOST_GEOMETRY_ASSERT( (geometry::less<SegmentPoint, -1, typename SBStrategy::cs_tag>()(p0, p1))
|| geometry::has_nan_coordinate(p0) || geometry::has_nan_coordinate(p0)
|| geometry::has_nan_coordinate(p1) ); || geometry::has_nan_coordinate(p1) );
@ -782,15 +780,9 @@ public:
>, >,
typename strategy::distance::services::comparable_type typename strategy::distance::services::comparable_type
< <
typename detail::distance::default_strategy typename SBStrategy::distance_pb_strategy::type
<
segment_point, Box
>::type
>::type, >::type,
typename detail::distance::default_strategy typename SBStrategy::distance_pb_strategy::type
<
segment_point, Box
>::type
>::type point_box_strategy_type; >::type point_box_strategy_type;
return dispatch::distance return dispatch::distance
@ -809,7 +801,8 @@ public:
bottom_left, bottom_right, bottom_left, bottom_right,
top_left, top_right); top_left, top_right);
if (geometry::less<segment_point>()(p[0], p[1])) typedef geometry::less<segment_point, -1, typename SBStrategy::cs_tag> less_type;
if (less_type()(p[0], p[1]))
{ {
return segment_to_box_2D return segment_to_box_2D
< <

View File

@ -1,8 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -70,7 +71,7 @@ public:
apply(Segment1 const& segment1, Segment2 const& segment2, apply(Segment1 const& segment1, Segment2 const& segment2,
Strategy const& strategy) Strategy const& strategy)
{ {
if (geometry::intersects(segment1, segment2)) if (geometry::intersects(segment1, segment2, strategy.get_relate_segment_segment_strategy()))
{ {
return 0; return 0;
} }

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014, 2017. // This file was modified by Oracle on 2014, 2017, 2019.
// Modifications copyright (c) 2014-2017, Oracle and/or its affiliates. // Modifications copyright (c) 2014-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -109,16 +109,25 @@ struct intersection
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename GeometryOut, typename GeometryOut,
typename Strategy typename Strategy
> >
static inline bool apply(Geometry1 const& geometry1, static inline bool apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut & geometry_out, GeometryOut & geometry_out,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
return dispatch::intersection return dispatch::intersection
< <
Geometry1, Geometry1,
@ -131,15 +140,24 @@ struct intersection
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename GeometryOut typename GeometryOut
> >
static inline bool apply(Geometry1 const& geometry1, static inline bool apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut & geometry_out, GeometryOut & geometry_out,
default_strategy) default_strategy)
{ {
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename geometry::cs_tag<Geometry1>::type
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
typedef typename strategy::relate::services::default_strategy typedef typename strategy::relate::services::default_strategy
< <
Geometry1, Geometry2 Geometry1, Geometry2
@ -172,19 +190,8 @@ struct intersection
concepts::check<Geometry1 const>(); concepts::check<Geometry1 const>();
concepts::check<Geometry2 const>(); concepts::check<Geometry2 const>();
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
return resolve_strategy::intersection::apply(geometry1, return resolve_strategy::intersection::apply(geometry1,
geometry2, geometry2,
robust_policy,
geometry_out, geometry_out,
strategy); strategy);
} }

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2018, Oracle and/or its affiliates. // Copyright (c) 2014-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -41,7 +41,7 @@ namespace detail { namespace is_valid
template template
< <
typename Geometry, typename Geometry,
typename IsAcceptableTurn = is_acceptable_turn<Geometry> typename CSTag
> >
class has_valid_self_turns class has_valid_self_turns
{ {
@ -50,7 +50,8 @@ private:
typedef typename geometry::rescale_policy_type typedef typename geometry::rescale_policy_type
< <
point_type point_type,
CSTag
>::type rescale_policy_type; >::type rescale_policy_type;
typedef detail::overlay::get_turn_info typedef detail::overlay::get_turn_info
@ -83,7 +84,7 @@ public:
detail::overlay::stateless_predicate_based_interrupt_policy detail::overlay::stateless_predicate_based_interrupt_policy
< <
IsAcceptableTurn is_acceptable_turn<Geometry>
> interrupt_policy; > interrupt_policy;
detail::self_get_turn_points::self_turns<false, turn_policy>(geometry, detail::self_get_turn_points::self_turns<false, turn_policy>(geometry,

View File

@ -317,7 +317,7 @@ public:
// compute turns and check if all are acceptable // compute turns and check if all are acceptable
debug_phase::apply(2); debug_phase::apply(2);
typedef has_valid_self_turns<MultiPolygon> has_valid_turns; typedef has_valid_self_turns<MultiPolygon, typename Strategy::cs_tag> has_valid_turns;
std::deque<typename has_valid_turns::turn_type> turns; std::deque<typename has_valid_turns::turn_type> turns;
bool has_invalid_turns = bool has_invalid_turns =

View File

@ -476,7 +476,7 @@ public:
// compute turns and check if all are acceptable // compute turns and check if all are acceptable
debug_phase::apply(3); debug_phase::apply(3);
typedef has_valid_self_turns<Polygon> has_valid_turns; typedef has_valid_self_turns<Polygon, typename Strategy::cs_tag> has_valid_turns;
std::deque<typename has_valid_turns::turn_type> turns; std::deque<typename has_valid_turns::turn_type> turns;
bool has_invalid_turns bool has_invalid_turns

View File

@ -209,7 +209,7 @@ struct is_valid_ring
&& ! has_duplicates<Ring, closure, cs_tag>::apply(ring, visitor) && ! has_duplicates<Ring, closure, cs_tag>::apply(ring, visitor)
&& ! has_spikes<Ring, closure>::apply(ring, visitor, strategy.get_side_strategy()) && ! has_spikes<Ring, closure>::apply(ring, visitor, strategy.get_side_strategy())
&& (! CheckSelfIntersections && (! CheckSelfIntersections
|| has_valid_self_turns<Ring>::apply(ring, visitor, strategy)) || has_valid_self_turns<Ring, typename Strategy::cs_tag>::apply(ring, visitor, strategy))
&& is_properly_oriented<Ring, IsInteriorRing>::apply(ring, visitor, strategy); && is_properly_oriented<Ring, IsInteriorRing>::apply(ring, visitor, strategy);
} }
}; };

View File

@ -193,7 +193,7 @@ struct assign_visitor
ring_info_type& inner_in_map = m_ring_map[inner.id]; ring_info_type& inner_in_map = m_ring_map[inner.id];
if (geometry::covered_by(inner_in_map.point, outer.envelope, if (geometry::covered_by(inner_in_map.point, outer.envelope,
Strategy::disjoint_point_box_strategy_type()) typename Strategy::disjoint_point_box_strategy_type())
&& within_selected_input(inner_in_map, inner.id, outer.id, && within_selected_input(inner_in_map, inner.id, outer.id,
m_geometry1, m_geometry2, m_collection, m_geometry1, m_geometry2, m_collection,
m_strategy) m_strategy)

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014, 2015, 2017. // This file was modified by Oracle on 2014, 2015, 2017, 2019.
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -1290,7 +1290,8 @@ inline OutputIterator intersection_insert(Geometry1 const& geometry1,
typedef typename geometry::rescale_policy_type typedef typename geometry::rescale_policy_type
< <
typename geometry::point_type<Geometry1>::type // TODO from both typename geometry::point_type<Geometry1>::type, // TODO from both
typename Strategy::cs_tag
>::type rescale_policy_type; >::type rescale_policy_type;
rescale_policy_type robust_policy rescale_policy_type robust_policy

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2017, Oracle and/or its affiliates. // Copyright (c) 2014-2019, Oracle and/or its affiliates.
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -169,8 +169,7 @@ protected:
LinearGeometry1, LinearGeometry1,
LinearGeometry2, LinearGeometry2,
assign_policy assign_policy
>, >
RobustPolicy
>::apply(turns, linear1, linear2, interrupt_policy, strategy, robust_policy); >::apply(turns, linear1, linear2, interrupt_policy, strategy, robust_policy);
} }
@ -237,13 +236,12 @@ public:
Linear1, Linear1,
Linear2, Linear2,
detail::get_turns::get_turn_info_type detail::get_turns::get_turn_info_type
< <
Linear1, Linear1,
Linear2, Linear2,
assign_policy assign_policy
>, >
RobustPolicy >::template turn_info_type<Strategy, RobustPolicy>::type turn_info;
>::turn_info turn_info;
typedef std::vector<turn_info> turns_container; typedef std::vector<turn_info> turns_container;

View File

@ -5,8 +5,8 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015, 2017. // This file was modified by Oracle on 2015, 2017, 2019.
// Modifications copyright (c) 2015-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -75,7 +75,7 @@ inline bool point_is_spike_or_equal(Point1 const& last_point, // prev | back
Point3 const& segment_b, // curr | back - 1 | spike's vertex Point3 const& segment_b, // curr | back - 1 | spike's vertex
SideStrategy const& strategy) SideStrategy const& strategy)
{ {
typedef SideStrategy::cs_tag cs_tag; typedef typename SideStrategy::cs_tag cs_tag;
int const side = strategy.apply(segment_a, segment_b, last_point); int const side = strategy.apply(segment_a, segment_b, last_point);
if (side == 0) if (side == 0)

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018. // This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018, 2019.
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -223,7 +223,10 @@ struct areal_areal
return; return;
// get and analyse turns // get and analyse turns
typedef typename turns::get_turns<Geometry1, Geometry2>::turn_info turn_type; typedef typename turns::get_turns
<
Geometry1, Geometry2
>::template turn_info_type<IntersectionStrategy>::type turn_type;
std::vector<turn_type> turns; std::vector<turn_type> turns;
interrupt_policy_areal_areal<Result> interrupt_policy(geometry1, geometry2, result); interrupt_policy_areal_areal<Result> interrupt_policy(geometry1, geometry2, result);

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018. // This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018, 2019.
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -219,21 +219,21 @@ struct linear_areal
> >
{}; {};
template <typename Geom1, typename Geom2> template <typename Geom1, typename Geom2, typename Strategy>
struct multi_turn_info struct multi_turn_info
: turns::get_turns<Geom1, Geom2>::turn_info : turns::get_turns<Geom1, Geom2>::template turn_info_type<Strategy>::type
{ {
multi_turn_info() : priority(0) {} multi_turn_info() : priority(0) {}
int priority; // single-geometry sorting priority int priority; // single-geometry sorting priority
}; };
template <typename Geom1, typename Geom2> template <typename Geom1, typename Geom2, typename Strategy>
struct turn_info_type struct turn_info_type
: boost::mpl::if_c : boost::mpl::if_c
< <
is_multi<Geometry2>::value, is_multi<Geometry2>::value,
multi_turn_info<Geom1, Geom2>, multi_turn_info<Geom1, Geom2, Strategy>,
typename turns::get_turns<Geom1, Geom2>::turn_info typename turns::get_turns<Geom1, Geom2>::template turn_info_type<Strategy>::type
> >
{}; {};
@ -251,7 +251,7 @@ struct linear_areal
return; return;
// get and analyse turns // get and analyse turns
typedef typename turn_info_type<Geometry1, Geometry2>::type turn_type; typedef typename turn_info_type<Geometry1, Geometry2, IntersectionStrategy>::type turn_type;
std::vector<turn_type> turns; std::vector<turn_type> turns;
interrupt_policy_linear_areal<Geometry2, Result> interrupt_policy(geometry2, result); interrupt_policy_linear_areal<Geometry2, Result> interrupt_policy(geometry2, result);

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018. // This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018, 2019.
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -133,7 +133,10 @@ struct linear_linear
return; return;
// get and analyse turns // get and analyse turns
typedef typename turns::get_turns<Geometry1, Geometry2>::turn_info turn_type; typedef typename turns::get_turns
<
Geometry1, Geometry2
>::template turn_info_type<IntersectionStrategy>::type turn_type;
std::vector<turn_type> turns; std::vector<turn_type> turns;
interrupt_policy_linear_linear<Result> interrupt_policy(result); interrupt_policy_linear_linear<Result> interrupt_policy(result);

View File

@ -1,6 +1,6 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2017-2018 Oracle and/or its affiliates. // Copyright (c) 2017-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -113,7 +113,7 @@ template <typename Geometry, typename EqPPStrategy>
struct multi_point_geometry_eb<Geometry, EqPPStrategy, multi_linestring_tag> struct multi_point_geometry_eb<Geometry, EqPPStrategy, multi_linestring_tag>
{ {
// TODO: CS-specific less compare strategy derived from EqPPStrategy // TODO: CS-specific less compare strategy derived from EqPPStrategy
typedef geometry::less<> less_type; typedef geometry::less<void, -1, typename EqPPStrategy::cs_tag> less_type;
template <typename Points> template <typename Points>
struct boundary_visitor struct boundary_visitor
@ -257,21 +257,23 @@ struct multi_point_single_geometry
template <typename MultiPoint, typename MultiGeometry, bool Transpose> template <typename MultiPoint, typename MultiGeometry, bool Transpose>
class multi_point_multi_geometry_ii_ib class multi_point_multi_geometry_ii_ib
{ {
template <typename ExpandPointStrategy>
struct expand_box_point struct expand_box_point
{ {
template <typename Box, typename Point> template <typename Box, typename Point>
static inline void apply(Box& total, Point const& point) static inline void apply(Box& total, Point const& point)
{ {
geometry::expand(total, point); geometry::expand(total, point, ExpandPointStrategy());
} }
}; };
template <typename ExpandBoxStrategy>
struct expand_box_box_pair struct expand_box_box_pair
{ {
template <typename Box, typename BoxPair> template <typename Box, typename BoxPair>
static inline void apply(Box& total, BoxPair const& box_pair) static inline void apply(Box& total, BoxPair const& box_pair)
{ {
geometry::expand(total, box_pair.first); geometry::expand(total, box_pair.first, ExpandBoxStrategy());
} }
}; };
@ -384,10 +386,18 @@ public:
{ {
item_visitor_type<Result, Strategy> visitor(multi_geometry, tc, result, strategy); item_visitor_type<Result, Strategy> visitor(multi_geometry, tc, result, strategy);
typedef expand_box_point
<
typename Strategy::expand_point_strategy_type
> expand_box_point_type;
typedef overlaps_box_point typedef overlaps_box_point
< <
typename Strategy::disjoint_point_box_strategy_type typename Strategy::disjoint_point_box_strategy_type
> overlaps_box_point_type; > overlaps_box_point_type;
typedef expand_box_box_pair
<
typename Strategy::envelope_strategy_type::box_expand_strategy_type
> expand_box_box_pair_type;
typedef overlaps_box_box_pair typedef overlaps_box_box_pair
< <
typename Strategy::disjoint_box_box_strategy_type typename Strategy::disjoint_box_box_strategy_type
@ -397,9 +407,9 @@ public:
< <
box1_type box1_type
>::apply(multi_point, boxes, visitor, >::apply(multi_point, boxes, visitor,
expand_box_point(), expand_box_point_type(),
overlaps_box_point_type(), overlaps_box_point_type(),
expand_box_box_pair(), expand_box_box_pair_type(),
overlaps_box_box_pair_type()); overlaps_box_box_pair_type());
} }
@ -431,7 +441,17 @@ struct multi_point_multi_geometry_ii_ib_ie
Result & result, Result & result,
Strategy const& strategy) Strategy const& strategy)
{ {
index::rtree<box_pair_type, index::rstar<4> > rt(boxes.begin(), boxes.end()); typedef strategy::index::services::from_strategy
<
Strategy
> index_strategy_from;
typedef index::parameters
<
index::rstar<4>, typename index_strategy_from::type
> index_parameters_type;
index::rtree<box_pair_type, index_parameters_type>
rtree(boxes.begin(), boxes.end(),
index_parameters_type(index::rstar<4>(), index_strategy_from::get(strategy)));
typedef typename boost::range_const_iterator<MultiPoint>::type iterator; typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it ) for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
@ -446,7 +466,7 @@ struct multi_point_multi_geometry_ii_ib_ie
typename boost::range_value<MultiPoint>::type const& point = *it; typename boost::range_value<MultiPoint>::type const& point = *it;
boxes_type boxes_found; boxes_type boxes_found;
rt.query(index::intersects(point), std::back_inserter(boxes_found)); rtree.query(index::intersects(point), std::back_inserter(boxes_found));
bool found_ii_or_ib = false; bool found_ii_or_ib = false;
for (boxes_iterator bi = boxes_found.begin() ; bi != boxes_found.end() ; ++bi) for (boxes_iterator bi = boxes_found.begin() ; bi != boxes_found.end() ; ++bi)

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017. // This file was modified by Oracle on 2013, 2014, 2015, 2017, 2019.
// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -47,18 +47,30 @@ template
typename GetTurnPolicy = detail::get_turns::get_turn_info_type typename GetTurnPolicy = detail::get_turns::get_turn_info_type
< <
Geometry1, Geometry2, assign_policy<> Geometry1, Geometry2, assign_policy<>
>, >
typename RobustPolicy = typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2
>::type
> >
struct get_turns struct get_turns
{ {
typedef typename geometry::point_type<Geometry1>::type point1_type; typedef typename geometry::point_type<Geometry1>::type point1_type;
typedef overlay::turn_info template <typename Strategy>
struct robust_policy_type
: geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>
{};
template
<
typename Strategy,
typename RobustPolicy = typename robust_policy_type<Strategy>::type
>
struct turn_info_type
{
typedef overlay::turn_info
< <
point1_type, point1_type,
typename segment_ratio_type<point1_type, RobustPolicy>::type, typename segment_ratio_type<point1_type, RobustPolicy>::type,
@ -70,7 +82,8 @@ struct get_turns
point1_type, RobustPolicy point1_type, RobustPolicy
>::type >::type
>::type >::type
> turn_info; > type;
};
template <typename Turns> template <typename Turns>
static inline void apply(Turns & turns, static inline void apply(Turns & turns,
@ -94,15 +107,17 @@ struct get_turns
InterruptPolicy & interrupt_policy, InterruptPolicy & interrupt_policy,
IntersectionStrategy const& intersection_strategy) IntersectionStrategy const& intersection_strategy)
{ {
RobustPolicy robust_policy = geometry::get_rescale_policy typedef typename robust_policy_type<IntersectionStrategy>::type robust_policy_t;
robust_policy_t robust_policy = geometry::get_rescale_policy
< <
RobustPolicy robust_policy_t
>(geometry1, geometry2); >(geometry1, geometry2);
apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy, robust_policy); apply(turns, geometry1, geometry2, interrupt_policy, intersection_strategy, robust_policy);
} }
template <typename Turns, typename InterruptPolicy, typename IntersectionStrategy> template <typename Turns, typename InterruptPolicy, typename IntersectionStrategy, typename RobustPolicy>
static inline void apply(Turns & turns, static inline void apply(Turns & turns,
Geometry1 const& geometry1, Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,

View File

@ -1,6 +1,6 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2017 Oracle and/or its affiliates. // Copyright (c) 2017, 2019 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -116,7 +116,7 @@ struct multi_point_single_geometry
LinearOrAreal const& linear_or_areal, LinearOrAreal const& linear_or_areal,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename boost::range_value<MultiPoint>::type point1_type; //typedef typename boost::range_value<MultiPoint>::type point1_type;
typedef typename point_type<LinearOrAreal>::type point2_type; typedef typename point_type<LinearOrAreal>::type point2_type;
typedef model::box<point2_type> box2_type; typedef model::box<point2_type> box2_type;
@ -195,7 +195,17 @@ struct multi_point_multi_geometry
} }
// Create R-tree // Create R-tree
index::rtree<box_pair_type, index::rstar<4> > rtree(boxes.begin(), boxes.end()); typedef strategy::index::services::from_strategy
<
Strategy
> index_strategy_from;
typedef index::parameters
<
index::rstar<4>, typename index_strategy_from::type
> index_parameters_type;
index::rtree<box_pair_type, index_parameters_type>
rtree(boxes.begin(), boxes.end(),
index_parameters_type(index::rstar<4>(), index_strategy_from::get(strategy)));
// For each point find overlapping envelopes and test corresponding single geometries // For each point find overlapping envelopes and test corresponding single geometries
// If a point is in the exterior break // If a point is in the exterior break

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017. // This file was modified by Oracle on 2017, 2019.
// Modifications copyright (c) 2017, Oracle and/or its affiliates. // Modifications copyright (c) 2017, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -131,18 +131,27 @@ struct difference
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Collection, typename Collection,
typename Strategy typename Strategy
> >
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Collection & output_collection, Collection & output_collection,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename boost::range_value<Collection>::type geometry_out; typedef typename boost::range_value<Collection>::type geometry_out;
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
detail::difference::difference_insert<geometry_out>( detail::difference::difference_insert<geometry_out>(
geometry1, geometry2, robust_policy, geometry1, geometry2, robust_policy,
range::back_inserter(output_collection), range::back_inserter(output_collection),
@ -153,17 +162,26 @@ struct difference
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Collection typename Collection
> >
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Collection & output_collection, Collection & output_collection,
default_strategy) default_strategy)
{ {
typedef typename boost::range_value<Collection>::type geometry_out; typedef typename boost::range_value<Collection>::type geometry_out;
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename geometry::cs_tag<Geometry1>::type
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
detail::difference::difference_insert<geometry_out>( detail::difference::difference_insert<geometry_out>(
geometry1, geometry2, robust_policy, geometry1, geometry2, robust_policy,
range::back_inserter(output_collection)); range::back_inserter(output_collection));
@ -185,18 +203,7 @@ struct difference
Collection& output_collection, Collection& output_collection,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
resolve_strategy::difference::apply(geometry1, geometry2, resolve_strategy::difference::apply(geometry1, geometry2,
robust_policy,
output_collection, output_collection,
strategy); strategy);
} }

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015, 2017. // This file was modified by Oracle on 2015, 2017, 2019.
// Modifications copyright (c) 2015-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -305,18 +305,27 @@ struct sym_difference
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Collection, typename Collection,
typename Strategy typename Strategy
> >
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Collection & output_collection, Collection & output_collection,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename boost::range_value<Collection>::type geometry_out; typedef typename boost::range_value<Collection>::type geometry_out;
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
detail::sym_difference::sym_difference_insert<geometry_out>( detail::sym_difference::sym_difference_insert<geometry_out>(
geometry1, geometry2, robust_policy, geometry1, geometry2, robust_policy,
range::back_inserter(output_collection), range::back_inserter(output_collection),
@ -327,17 +336,26 @@ struct sym_difference
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Collection typename Collection
> >
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Collection & output_collection, Collection & output_collection,
default_strategy) default_strategy)
{ {
typedef typename boost::range_value<Collection>::type geometry_out; typedef typename boost::range_value<Collection>::type geometry_out;
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename geometry::cs_tag<Geometry1>::type
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
detail::sym_difference::sym_difference_insert<geometry_out>( detail::sym_difference::sym_difference_insert<geometry_out>(
geometry1, geometry2, robust_policy, geometry1, geometry2, robust_policy,
range::back_inserter(output_collection)); range::back_inserter(output_collection));
@ -359,18 +377,7 @@ struct sym_difference
Collection& output_collection, Collection& output_collection,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
resolve_strategy::sym_difference::apply(geometry1, geometry2, resolve_strategy::sym_difference::apply(geometry1, geometry2,
robust_policy,
output_collection, output_collection,
strategy); strategy);
} }

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014, 2017, 2018. // This file was modified by Oracle on 2014, 2017, 2018, 2019.
// Modifications copyright (c) 2014-2018 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2019 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -244,18 +244,27 @@ struct union_
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Collection, typename Collection,
typename Strategy typename Strategy
> >
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Collection & output_collection, Collection & output_collection,
Strategy const& strategy) Strategy const& strategy)
{ {
typedef typename boost::range_value<Collection>::type geometry_out; typedef typename boost::range_value<Collection>::type geometry_out;
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename Strategy::cs_tag
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
dispatch::union_insert dispatch::union_insert
< <
Geometry1, Geometry2, geometry_out Geometry1, Geometry2, geometry_out
@ -268,12 +277,10 @@ struct union_
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
typename RobustPolicy,
typename Collection typename Collection
> >
static inline void apply(Geometry1 const& geometry1, static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Collection & output_collection, Collection & output_collection,
default_strategy) default_strategy)
{ {
@ -285,6 +292,17 @@ struct union_
Geometry2 Geometry2
>::type strategy_type; >::type strategy_type;
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2,
typename geometry::cs_tag<Geometry1>::type
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
dispatch::union_insert dispatch::union_insert
< <
Geometry1, Geometry2, geometry_out Geometry1, Geometry2, geometry_out
@ -313,18 +331,7 @@ struct union_
concepts::check<Geometry2 const>(); concepts::check<Geometry2 const>();
concepts::check<typename boost::range_value<Collection>::type>(); concepts::check<typename boost::range_value<Collection>::type>();
typedef typename geometry::rescale_overlay_policy_type
<
Geometry1,
Geometry2
>::type rescale_policy_type;
rescale_policy_type robust_policy
= geometry::get_rescale_policy<rescale_policy_type>(geometry1,
geometry2);
resolve_strategy::union_::apply(geometry1, geometry2, resolve_strategy::union_::apply(geometry1, geometry2,
robust_policy,
output_collection, output_collection,
strategy); strategy);
} }