[disjoint] Rename PiGStrategy to Strategy.

This commit is contained in:
Adam Wulkiewicz
2017-02-07 20:11:45 +01:00
parent 448d0daa88
commit fe2bdfd169
3 changed files with 48 additions and 48 deletions

View File

@@ -42,8 +42,11 @@ namespace detail { namespace disjoint
template <typename Geometry, typename Tag = typename tag<Geometry>::type>
struct check_each_ring_for_within_call_covered_by
{
template <typename Point, typename PiGStrategy>
static inline bool apply(Point const& p, Geometry const& g, PiGStrategy const& strategy)
/*!
\tparam Strategy point_in_geometry strategy
*/
template <typename Point, typename Strategy>
static inline bool apply(Point const& p, Geometry const& g, Strategy const& strategy)
{
return geometry::covered_by(p, g, strategy);
}
@@ -52,26 +55,29 @@ struct check_each_ring_for_within_call_covered_by
template <typename Geometry>
struct check_each_ring_for_within_call_covered_by<Geometry, box_tag>
{
template <typename Point, typename PiGStrategy>
static inline bool apply(Point const& p, Geometry const& g, PiGStrategy const& )
template <typename Point, typename Strategy>
static inline bool apply(Point const& p, Geometry const& g, Strategy const& )
{
return geometry::covered_by(p, g);
}
};
template<typename Geometry, typename PiGStrategy>
/*!
\tparam Strategy point_in_geometry strategy
*/
template<typename Geometry, typename Strategy>
struct check_each_ring_for_within
{
bool not_disjoint;
Geometry const& m_geometry;
PiGStrategy const& m_pig_strategy;
Strategy const& m_strategy;
inline check_each_ring_for_within(Geometry const& g,
PiGStrategy const& pig_strategy)
Strategy const& strategy)
: not_disjoint(false)
, m_geometry(g)
, m_pig_strategy(pig_strategy)
, m_strategy(strategy)
{}
template <typename Range>
@@ -83,21 +89,23 @@ struct check_each_ring_for_within
&& check_each_ring_for_within_call_covered_by
<
Geometry
>::apply(pt, m_geometry, m_pig_strategy) );
>::apply(pt, m_geometry, m_strategy) );
}
};
template <typename FirstGeometry, typename SecondGeometry, typename PiGStrategy>
/*!
\tparam Strategy point_in_geometry strategy
*/
template <typename FirstGeometry, typename SecondGeometry, typename Strategy>
inline bool rings_containing(FirstGeometry const& geometry1,
SecondGeometry const& geometry2,
PiGStrategy const& pig_strategy)
Strategy const& strategy)
{
check_each_ring_for_within
<
FirstGeometry, PiGStrategy
> checker(geometry1, pig_strategy);
FirstGeometry, Strategy
> checker(geometry1, strategy);
geometry::detail::for_each_range(geometry2, checker);
return checker.not_disjoint;
}
@@ -107,6 +115,9 @@ inline bool rings_containing(FirstGeometry const& geometry1,
template <typename Geometry1, typename Geometry2>
struct general_areal
{
/*!
\tparam Strategy relate (segments intersection) strategy
*/
template <typename Strategy>
static inline bool apply(Geometry1 const& geometry1,
Geometry2 const& geometry2,

View File

@@ -61,22 +61,28 @@ template <typename Geometry1, typename Geometry2,
typename Tag1OrMulti = typename tag_cast<Tag1, multi_tag>::type>
struct disjoint_no_intersections_policy
{
template <typename PiGStrategy>
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, PiGStrategy const& pig_strategy)
/*!
\tparam Strategy point_in_geometry strategy
*/
template <typename Strategy>
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
{
typedef typename point_type<Geometry1>::type point1_type;
point1_type p;
geometry::point_on_border(p, g1);
return !geometry::covered_by(p, g2, pig_strategy);
return !geometry::covered_by(p, g2, strategy);
}
};
template <typename Geometry1, typename Geometry2, typename Tag1>
struct disjoint_no_intersections_policy<Geometry1, Geometry2, Tag1, multi_tag>
{
template <typename PiGStrategy>
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, PiGStrategy const& pig_strategy)
/*!
\tparam Strategy point_in_geometry strategy
*/
template <typename Strategy>
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
{
// TODO: use partition or rtree on g2
typedef typename boost::range_iterator<Geometry1 const>::type iterator;
@@ -84,7 +90,7 @@ struct disjoint_no_intersections_policy<Geometry1, Geometry2, Tag1, multi_tag>
{
typedef typename boost::range_value<Geometry1 const>::type value_type;
if ( ! disjoint_no_intersections_policy<value_type const, Geometry2>
::apply(*it, g2, pig_strategy) )
::apply(*it, g2, strategy) )
{
return false;
}
@@ -99,6 +105,9 @@ template<typename Geometry1, typename Geometry2,
= disjoint_no_intersections_policy<Geometry1, Geometry2> >
struct disjoint_linear_areal
{
/*!
\tparam Strategy relate (segments intersection) strategy
*/
template <typename Strategy>
static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
{
@@ -108,13 +117,9 @@ struct disjoint_linear_areal
return false;
}
typename Strategy::template point_in_geometry_strategy
<
Geometry1, Geometry2
>::type
pig_strategy = strategy.template get_point_in_geometry_strategy<Geometry1, Geometry2>();
return NoIntersectionsPolicy::apply(g1, g2, pig_strategy);
return NoIntersectionsPolicy
::apply(g1, g2,
strategy.template get_point_in_geometry_strategy<Geometry1, Geometry2>());
}
};
@@ -184,16 +189,11 @@ public:
return false;
}
typename IntersectionStrategy::template point_in_geometry_strategy
<
Segment, Polygon
>::type
pig_strategy = strategy.template get_point_in_geometry_strategy<Segment, Polygon>();
typename point_type<Segment>::type p;
detail::assign_point_from_index<0>(segment, p);
return !geometry::covered_by(p, polygon, pig_strategy);
return !geometry::covered_by(p, polygon,
strategy.template get_point_in_geometry_strategy<Segment, Polygon>());
}
};
@@ -229,16 +229,11 @@ struct disjoint_segment_areal<Segment, Ring, ring_tag>
return false;
}
typename IntersectionStrategy::template point_in_geometry_strategy
<
Segment, Ring
>::type
pig_strategy = strategy.template get_point_in_geometry_strategy<Segment, Ring>();
typename point_type<Segment>::type p;
detail::assign_point_from_index<0>(segment, p);
return !geometry::covered_by(p, ring, pig_strategy);
return !geometry::covered_by(p, ring,
strategy.template get_point_in_geometry_strategy<Segment, Ring>());
}
};

View File

@@ -83,18 +83,12 @@ struct disjoint_range_segment_or_box
}
else if ( count == 1 )
{
typename Strategy::template point_in_geometry_strategy
<
Range, SegmentOrBox
>::type
pig_strategy = strategy.template get_point_in_geometry_strategy<Range, SegmentOrBox>();
return dispatch::disjoint
<
point_type, SegmentOrBox
>::apply(geometry::range::front<view_type const>(view),
segment_or_box,
pig_strategy);
strategy.template get_point_in_geometry_strategy<Range, SegmentOrBox>());
}
else
{