[strategies] Add envelope-seg and disjoint-seg-box getters to intersection, side and within strategies.

This commit is contained in:
Adam Wulkiewicz
2017-03-22 20:57:35 +01:00
parent cba7b9b016
commit 3ff1382c61
7 changed files with 103 additions and 4 deletions

View File

@@ -388,6 +388,20 @@ class winding
public:
typedef typename SideStrategy::envelope_strategy_type envelope_strategy_type;
inline envelope_strategy_type get_envelope_strategy() const
{
return m_side_strategy.get_envelope_strategy();
}
typedef typename SideStrategy::disjoint_strategy_type disjoint_strategy_type;
inline disjoint_strategy_type get_disjoint_strategy() const
{
return m_side_strategy.get_disjoint_strategy();
}
winding()
{}

View File

@@ -36,6 +36,7 @@
#include <boost/geometry/strategies/agnostic/point_in_poly_winding.hpp>
#include <boost/geometry/strategies/cartesian/area_surveyor.hpp>
#include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
#include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
#include <boost/geometry/strategies/covered_by.hpp>
#include <boost/geometry/strategies/intersection.hpp>
@@ -133,6 +134,14 @@ struct cartesian_segments
return strategy_type();
}
typedef envelope::cartesian_segment<CalculationType>
envelope_strategy_type;
static inline envelope_strategy_type get_envelope_strategy()
{
return envelope_strategy_type();
}
template <typename CoordinateType, typename SegmentRatio>
struct segment_intersection_info
{

View File

@@ -26,6 +26,9 @@
#include <boost/geometry/arithmetic/determinant.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
#include <boost/geometry/strategies/cartesian/disjoint_segment_box.hpp>
#include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
#include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/algorithms/detail/relate/less.hpp>
@@ -66,6 +69,19 @@ class side_by_triangle
};
public :
typedef strategy::envelope::cartesian_segment<CalculationType> envelope_strategy_type;
static inline envelope_strategy_type get_envelope_strategy()
{
return envelope_strategy_type();
}
typedef strategy::disjoint::segment_box disjoint_strategy_type;
static inline disjoint_strategy_type get_disjoint_strategy()
{
return disjoint_strategy_type();
}
// Template member function, because it is not always trivial
// or convenient to explicitly mention the typenames in the

View File

@@ -34,6 +34,7 @@
#include <boost/geometry/strategies/geographic/area.hpp>
#include <boost/geometry/strategies/geographic/distance.hpp>
#include <boost/geometry/strategies/geographic/envelope_segment.hpp>
#include <boost/geometry/strategies/geographic/parameters.hpp>
#include <boost/geometry/strategies/geographic/side.hpp>
#include <boost/geometry/strategies/intersection.hpp>
@@ -69,7 +70,7 @@ struct geographic_segments
FormulaPolicy, Spheroid, CalculationType
> side_strategy_type;
inline side_strategy_type get_side_strategy()
inline side_strategy_type get_side_strategy() const
{
return side_strategy_type(m_spheroid);
}
@@ -88,7 +89,7 @@ struct geographic_segments
template <typename Geometry1, typename Geometry2>
inline typename point_in_geometry_strategy<Geometry1, Geometry2>::type
get_point_in_geometry_strategy()
get_point_in_geometry_strategy() const
{
typedef typename point_in_geometry_strategy
<
@@ -111,7 +112,7 @@ struct geographic_segments
};
template <typename Geometry>
inline typename area_strategy<Geometry>::type get_area_strategy()
inline typename area_strategy<Geometry>::type get_area_strategy() const
{
typedef typename area_strategy<Geometry>::type strategy_type;
return strategy_type(m_spheroid);
@@ -129,12 +130,20 @@ struct geographic_segments
};
template <typename Geometry>
inline typename distance_strategy<Geometry>::type get_distance_strategy()
inline typename distance_strategy<Geometry>::type get_distance_strategy() const
{
typedef typename distance_strategy<Geometry>::type strategy_type;
return strategy_type(m_spheroid);
}
typedef envelope::geographic_segment<FormulaPolicy, Spheroid, CalculationType>
envelope_strategy_type;
inline envelope_strategy_type get_envelope_strategy() const
{
return envelope_strategy_type(m_spheroid);
}
enum intersection_point_flag { ipi_inters = 0, ipi_at_a1, ipi_at_a2, ipi_at_b1, ipi_at_b2 };
template <typename CoordinateType, typename SegmentRatio>

View File

@@ -26,6 +26,8 @@
#include <boost/geometry/util/promote_floating_point.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/strategies/geographic/disjoint_segment_box.hpp>
#include <boost/geometry/strategies/geographic/envelope_segment.hpp>
#include <boost/geometry/strategies/geographic/parameters.hpp>
#include <boost/geometry/strategies/side.hpp>
//#include <boost/geometry/strategies/concepts/side_concept.hpp>
@@ -56,6 +58,30 @@ template
class geographic
{
public:
typedef strategy::envelope::geographic_segment
<
FormulaPolicy,
Spheroid,
CalculationType
> envelope_strategy_type;
inline envelope_strategy_type get_envelope_strategy() const
{
return envelope_strategy_type(m_model);
}
typedef strategy::disjoint::segment_box_geographic
<
FormulaPolicy,
Spheroid,
CalculationType
> disjoint_strategy_type;
inline disjoint_strategy_type get_disjoint_strategy() const
{
return disjoint_strategy_type(m_model);
}
geographic()
{}

View File

@@ -41,6 +41,7 @@
#include <boost/geometry/strategies/side_info.hpp>
#include <boost/geometry/strategies/spherical/area.hpp>
#include <boost/geometry/strategies/spherical/distance_haversine.hpp>
#include <boost/geometry/strategies/spherical/envelope_segment.hpp>
#include <boost/geometry/strategies/spherical/ssf.hpp>
#include <boost/geometry/strategies/within.hpp>
@@ -147,6 +148,14 @@ struct ecef_segments
return strategy_type();
}
typedef envelope::spherical_segment<CalculationType>
envelope_strategy_type;
static inline envelope_strategy_type get_envelope_strategy()
{
return envelope_strategy_type();
}
enum intersection_point_flag { ipi_inters = 0, ipi_at_a1, ipi_at_a2, ipi_at_b1, ipi_at_b2 };
// segment_intersection_info cannot outlive relate_ecef_segments

View File

@@ -23,6 +23,8 @@
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/strategies/spherical/disjoint_segment_box.hpp>
#include <boost/geometry/strategies/spherical/envelope_segment.hpp>
//#include <boost/geometry/strategies/concepts/side_concept.hpp>
@@ -82,6 +84,20 @@ class spherical_side_formula
{
public :
typedef strategy::envelope::spherical_segment<CalculationType> envelope_strategy_type;
static inline envelope_strategy_type get_envelope_strategy()
{
return envelope_strategy_type();
}
typedef strategy::disjoint::segment_box_spherical disjoint_strategy_type;
static inline disjoint_strategy_type get_disjoint_strategy()
{
return disjoint_strategy_type();
}
template <typename P1, typename P2, typename P>
static inline int apply(P1 const& p1, P2 const& p2, P const& p)
{