template
<
typename Geometry,
- typename EqPPStrategy,
typename Tag = typename tag<Geometry>::type
>
struct multi_point_geometry_eb
{
- template <typename MultiPoint>
+ template <typename MultiPoint, typename Strategy>
static inline bool apply(MultiPoint const& ,
- detail::relate::topology_check<Geometry, EqPPStrategy> const& )
+ detail::relate::topology_check<Geometry, Strategy> const& )
{
return true;
}
};
-template <typename Geometry, typename EqPPStrategy>
-struct multi_point_geometry_eb<Geometry, EqPPStrategy, linestring_tag>
+template <typename Geometry>
+struct multi_point_geometry_eb<Geometry, linestring_tag>
{
template <typename Points>
struct boundary_visitor
, m_boundary_found(false)
{}
- template <typename Point>
+ template <typename Point, typename Strategy>
struct find_pred
{
- find_pred(Point const& point)
+ find_pred(Point const& point, Strategy const& strategy)
: m_point(point)
+ , m_strategy(strategy)
{}
template <typename Pt>
bool operator()(Pt const& pt) const
{
- return detail::equals::equals_point_point(pt, m_point, EqPPStrategy());
+ return detail::equals::equals_point_point(pt, m_point, m_strategy);
}
Point const& m_point;
+ Strategy const& m_strategy;
};
- template <typename Point>
- bool apply(Point const& boundary_point)
+ template <typename Point, typename Strategy>
+ bool apply(Point const& boundary_point, Strategy const& strategy)
{
- if (std::find_if(m_points.begin(), m_points.end(), find_pred<Point>(boundary_point)) == m_points.end())
+ if ( std::none_of(m_points.begin(), m_points.end(),
+ find_pred<Point, Strategy>(boundary_point, strategy)))
{
m_boundary_found = true;
return false;
bool m_boundary_found;
};
- template <typename MultiPoint>
+ template <typename MultiPoint, typename Strategy>
static inline bool apply(MultiPoint const& multi_point,
- detail::relate::topology_check<Geometry, EqPPStrategy> const& tc)
+ detail::relate::topology_check<Geometry, Strategy> const& tc)
{
boundary_visitor<MultiPoint> visitor(multi_point);
tc.for_each_boundary_point(visitor);
}
};
-template <typename Geometry, typename EqPPStrategy>
-struct multi_point_geometry_eb<Geometry, EqPPStrategy, multi_linestring_tag>
+template <typename Geometry>
+struct multi_point_geometry_eb<Geometry, multi_linestring_tag>
{
- // TODO: CS-specific less compare strategy derived from EqPPStrategy
- typedef geometry::less<void, -1, typename EqPPStrategy::cs_tag> less_type;
-
template <typename Points>
struct boundary_visitor
{
, m_boundary_found(false)
{}
- template <typename Point>
- bool apply(Point const& boundary_point)
+ template <typename Point, typename Strategy>
+ bool apply(Point const& boundary_point, Strategy const&)
{
- if (! std::binary_search(m_points.begin(), m_points.end(), boundary_point, less_type()))
+ typedef geometry::less<void, -1, typename Strategy::cs_tag> less_type;
+
+ if (! std::binary_search(m_points.begin(), m_points.end(),
+ boundary_point, less_type()) )
{
m_boundary_found = true;
return false;
bool m_boundary_found;
};
- template <typename MultiPoint>
+ template <typename MultiPoint, typename Strategy>
static inline bool apply(MultiPoint const& multi_point,
- detail::relate::topology_check<Geometry, EqPPStrategy> const& tc)
+ detail::relate::topology_check<Geometry, Strategy> const& tc)
{
typedef typename boost::range_value<MultiPoint>::type point_type;
typedef std::vector<point_type> points_type;
- points_type points(boost::begin(multi_point), boost::end(multi_point));
+ typedef geometry::less<void, -1, typename Strategy::cs_tag> less_type;
+
+ points_type points(boost::begin(multi_point), boost::end(multi_point));
std::sort(points.begin(), points.end(), less_type());
boundary_visitor<points_type> visitor(points);
{
typedef typename point_type<SingleGeometry>::type point2_type;
typedef model::box<point2_type> box2_type;
- typedef typename Strategy::equals_point_point_strategy_type eq_pp_strategy_type;
- typedef typename Strategy::disjoint_point_box_strategy_type d_pb_strategy_type;
box2_type box2;
- geometry::envelope(single_geometry, box2, strategy.get_envelope_strategy());
+ geometry::envelope(single_geometry, box2, strategy);
geometry::detail::expand_by_epsilon(box2);
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
}
// The default strategy is enough for Point/Box
- if (detail::disjoint::disjoint_point_box(*it, box2, d_pb_strategy_type()))
+ if (detail::disjoint::disjoint_point_box(*it, box2, strategy))
{
relate::set<interior, exterior, '0', Transpose>(result);
}
}
}
- typedef detail::relate::topology_check
- <
- SingleGeometry, eq_pp_strategy_type
- > tc_t;
+ typedef detail::relate::topology_check<SingleGeometry, Strategy> tc_t;
+
if ( relate::may_update<exterior, interior, tc_t::interior, Transpose>(result)
|| relate::may_update<exterior, boundary, tc_t::boundary, Transpose>(result) )
{
- tc_t tc(single_geometry);
+ tc_t tc(single_geometry, strategy);
if ( relate::may_update<exterior, interior, tc_t::interior, Transpose>(result)
&& tc.has_interior() )
if ( relate::may_update<exterior, boundary, tc_t::boundary, Transpose>(result)
&& tc.has_boundary() )
{
- if (multi_point_geometry_eb
- <
- SingleGeometry, eq_pp_strategy_type
- >::apply(multi_point, tc))
+ if (multi_point_geometry_eb<SingleGeometry>::apply(multi_point, tc))
{
relate::set<exterior, boundary, tc_t::boundary, Transpose>(result);
}
template <typename MultiPoint, typename MultiGeometry, bool Transpose>
class multi_point_multi_geometry_ii_ib
{
- template <typename ExpandPointStrategy>
+ template <typename Strategy>
struct expand_box_point
{
+ expand_box_point(Strategy const& strategy)
+ : m_strategy(strategy)
+ {}
+
template <typename Box, typename Point>
- static inline void apply(Box& total, Point const& point)
+ inline void apply(Box& total, Point const& point) const
{
- geometry::expand(total, point, ExpandPointStrategy());
+ geometry::expand(total, point, m_strategy);
}
+
+ private:
+ Strategy const& m_strategy;
};
- template <typename ExpandBoxStrategy>
+ template <typename Strategy>
struct expand_box_box_pair
{
+ expand_box_box_pair(Strategy const& strategy)
+ : m_strategy(strategy)
+ {}
+
template <typename Box, typename BoxPair>
- static inline void apply(Box& total, BoxPair const& box_pair)
+ inline void apply(Box& total, BoxPair const& box_pair) const
{
- geometry::expand(total, box_pair.first, ExpandBoxStrategy());
+ geometry::expand(total, box_pair.first, m_strategy);
}
+
+ private:
+ Strategy const& m_strategy;
};
- template <typename DisjointPointBoxStrategy>
+ template <typename Strategy>
struct overlaps_box_point
{
+ overlaps_box_point(Strategy const& strategy)
+ : m_strategy(strategy)
+ {}
+
template <typename Box, typename Point>
- static inline bool apply(Box const& box, Point const& point)
+ inline bool apply(Box const& box, Point const& point) const
{
// The default strategy is enough for Point/Box
return ! detail::disjoint::disjoint_point_box(point, box,
- DisjointPointBoxStrategy());
+ m_strategy);
}
+
+ private:
+ Strategy const& m_strategy;
};
- template <typename DisjointBoxBoxStrategy>
+ template <typename Strategy>
struct overlaps_box_box_pair
{
+ overlaps_box_box_pair(Strategy const& strategy)
+ : m_strategy(strategy)
+ {}
+
template <typename Box, typename BoxPair>
- static inline bool apply(Box const& box, BoxPair const& box_pair)
+ inline bool apply(Box const& box, BoxPair const& box_pair) const
{
// The default strategy is enough for Box/Box
return ! detail::disjoint::disjoint_box_box(box_pair.first, box,
- DisjointBoxBoxStrategy());
+ m_strategy);
}
+
+ private:
+ Strategy const& m_strategy;
};
- template <typename Result, typename PtSegStrategy>
+ template <typename Result, typename Strategy>
class item_visitor_type
{
- typedef typename PtSegStrategy::equals_point_point_strategy_type pp_strategy_type;
- typedef typename PtSegStrategy::disjoint_point_box_strategy_type d_pp_strategy_type;
- typedef detail::relate::topology_check<MultiGeometry, pp_strategy_type> topology_check_type;
+ typedef detail::relate::topology_check<MultiGeometry, Strategy> topology_check_type;
public:
item_visitor_type(MultiGeometry const& multi_geometry,
topology_check_type const& tc,
Result & result,
- PtSegStrategy const& strategy)
+ Strategy const& strategy)
: m_multi_geometry(multi_geometry)
, m_tc(tc)
, m_result(result)
inline bool apply(Point const& point, BoxPair const& box_pair)
{
// The default strategy is enough for Point/Box
- if (! detail::disjoint::disjoint_point_box(point, box_pair.first, d_pp_strategy_type()))
+ if (! detail::disjoint::disjoint_point_box(point, box_pair.first, m_strategy) )
{
typename boost::range_value<MultiGeometry>::type const&
single = range::at(m_multi_geometry, box_pair.second);
MultiGeometry const& m_multi_geometry;
topology_check_type const& m_tc;
Result & m_result;
- PtSegStrategy const& m_strategy;
+ Strategy const& m_strategy;
};
public:
std::vector<box_pair_type> const& boxes,
detail::relate::topology_check
<
- MultiGeometry,
- typename Strategy::equals_point_point_strategy_type
+ MultiGeometry, Strategy
> const& tc,
Result & result,
Strategy const& 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
- <
- typename Strategy::disjoint_point_box_strategy_type
- > overlaps_box_point_type;
- typedef expand_box_box_pair
- <
- // TEMP - envelope umbrella strategy also contains
- // expand strategies
- decltype(strategies::envelope::services::strategy_converter
- <
- typename Strategy::envelope_strategy_type
- >::get(strategy.get_envelope_strategy())
- .expand(std::declval<box1_type>(),
- std::declval<box2_type>()))
- > expand_box_box_pair_type;
- typedef overlaps_box_box_pair
- <
- typename Strategy::disjoint_box_box_strategy_type
- > overlaps_box_box_pair_type;
-
geometry::partition
<
box1_type
>::apply(multi_point, boxes, visitor,
- expand_box_point_type(),
- overlaps_box_point_type(),
- expand_box_box_pair_type(),
- overlaps_box_box_pair_type());
+ expand_box_point<Strategy>(strategy),
+ overlaps_box_point<Strategy>(strategy),
+ expand_box_box_pair<Strategy>(strategy),
+ overlaps_box_box_pair<Strategy>(strategy));
}
};
std::vector<box_pair_type> const& boxes,
detail::relate::topology_check
<
- MultiGeometry,
- typename Strategy::equals_point_point_strategy_type
+ MultiGeometry, Strategy
> const& tc,
Result & result,
Strategy const& strategy)
{
- typedef strategy::index::services::from_strategy
- <
- Strategy
- > index_strategy_from;
typedef index::parameters
<
- index::rstar<4>, typename index_strategy_from::type
+ index::rstar<4>, Strategy
> 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)));
+ index_parameters_type(index::rstar<4>(), strategy));
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
typedef model::box<point2_type> box2_type;
typedef std::pair<box2_type, std::size_t> box_pair_type;
- typedef typename Strategy::equals_point_point_strategy_type eq_pp_strategy_type;
-
- typename Strategy::envelope_strategy_type const
- envelope_strategy = strategy.get_envelope_strategy();
-
std::size_t count2 = boost::size(multi_geometry);
std::vector<box_pair_type> boxes(count2);
for (std::size_t i = 0 ; i < count2 ; ++i)
{
- geometry::envelope(range::at(multi_geometry, i), boxes[i].first, envelope_strategy);
+ geometry::envelope(range::at(multi_geometry, i), boxes[i].first, strategy);
geometry::detail::expand_by_epsilon(boxes[i].first);
boxes[i].second = i;
}
- typedef detail::relate::topology_check<MultiGeometry, eq_pp_strategy_type> tc_t;
- tc_t tc(multi_geometry);
+ typedef detail::relate::topology_check<MultiGeometry, Strategy> tc_t;
+ tc_t tc(multi_geometry, strategy);
if ( relate::may_update<interior, interior, '0', Transpose>(result)
|| relate::may_update<interior, boundary, '0', Transpose>(result)
if ( relate::may_update<exterior, boundary, tc_t::boundary, Transpose>(result)
&& tc.has_boundary() )
{
- if (multi_point_geometry_eb
- <
- MultiGeometry, eq_pp_strategy_type
- >::apply(multi_point, tc))
+ if (multi_point_geometry_eb<MultiGeometry>::apply(multi_point, tc))
{
relate::set<exterior, boundary, tc_t::boundary, Transpose>(result);
}