summaryrefslogtreecommitdiff
path: root/boost/geometry/strategies/agnostic
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/strategies/agnostic')
-rw-r--r--boost/geometry/strategies/agnostic/point_in_point.hpp77
-rw-r--r--boost/geometry/strategies/agnostic/point_in_poly_winding.hpp69
-rw-r--r--boost/geometry/strategies/agnostic/relate.hpp122
3 files changed, 43 insertions, 225 deletions
diff --git a/boost/geometry/strategies/agnostic/point_in_point.hpp b/boost/geometry/strategies/agnostic/point_in_point.hpp
index e4f9bec4c6..c6e2b63623 100644
--- a/boost/geometry/strategies/agnostic/point_in_point.hpp
+++ b/boost/geometry/strategies/agnostic/point_in_point.hpp
@@ -1,12 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 2014 Oracle and/or its affiliates.
+// Copyright (c) 2014-2017 Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#ifndef BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP
#define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP
@@ -41,41 +42,12 @@ struct point_in_point
namespace services
{
-template <typename Point1, typename Point2>
-struct default_strategy<point_tag, point_tag, point_tag, point_tag, cartesian_tag, cartesian_tag, Point1, Point2>
-{
- typedef strategy::within::point_in_point<Point1, Point2> type;
-};
-
-template <typename Point1, typename Point2>
-struct default_strategy<point_tag, point_tag, point_tag, point_tag, spherical_tag, spherical_tag, Point1, Point2>
-{
- typedef strategy::within::point_in_point<Point1, Point2> type;
-};
-
-template <typename Point1, typename Point2, typename AnyCS1, typename AnyCS2>
-struct default_strategy<point_tag, point_tag, point_tag, point_tag, AnyCS1, AnyCS2, Point1, Point2>
+template <typename Point, typename PointLike, typename Tag2, typename AnyCS1, typename AnyCS2>
+struct default_strategy<Point, PointLike, point_tag, Tag2, pointlike_tag, pointlike_tag, AnyCS1, AnyCS2>
{
- typedef strategy::within::point_in_point<Point1, Point2> type;
+ typedef strategy::within::point_in_point<Point, typename point_type<PointLike>::type> type;
};
-template <typename Point, typename MultiPoint>
-struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, cartesian_tag, cartesian_tag, Point, MultiPoint>
-{
- typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type;
-};
-
-template <typename Point, typename MultiPoint>
-struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, spherical_tag, spherical_tag, Point, MultiPoint>
-{
- typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type;
-};
-
-template <typename Point, typename MultiPoint, typename AnyCS1, typename AnyCS2>
-struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, AnyCS1, AnyCS2, Point, MultiPoint>
-{
- typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type;
-};
} // namespace services
@@ -85,45 +57,14 @@ struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag,
}} // namespace strategy::within
-
#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
namespace strategy { namespace covered_by { namespace services
{
-template <typename Point1, typename Point2>
-struct default_strategy<point_tag, point_tag, point_tag, point_tag, cartesian_tag, cartesian_tag, Point1, Point2>
-{
- typedef strategy::within::point_in_point<Point1, Point2> type;
-};
-
-template <typename Point1, typename Point2>
-struct default_strategy<point_tag, point_tag, point_tag, point_tag, spherical_tag, spherical_tag, Point1, Point2>
-{
- typedef strategy::within::point_in_point<Point1, Point2> type;
-};
-
-template <typename Point1, typename Point2, typename AnyCS1, typename AnyCS2>
-struct default_strategy<point_tag, point_tag, point_tag, point_tag, AnyCS1, AnyCS2, Point1, Point2>
-{
- typedef strategy::within::point_in_point<Point1, Point2> type;
-};
-
-template <typename Point, typename MultiPoint>
-struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, cartesian_tag, cartesian_tag, Point, MultiPoint>
-{
- typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type;
-};
-
-template <typename Point, typename MultiPoint>
-struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, spherical_tag, spherical_tag, Point, MultiPoint>
-{
- typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type;
-};
-
-template <typename Point, typename MultiPoint, typename AnyCS1, typename AnyCS2>
-struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, AnyCS1, AnyCS2, Point, MultiPoint>
+template <typename Point, typename PointLike, typename Tag2, typename AnyCS1, typename AnyCS2>
+struct default_strategy<Point, PointLike, point_tag, Tag2, pointlike_tag, pointlike_tag, AnyCS1, AnyCS2>
{
- typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type;
+ typedef strategy::within::point_in_point<Point, typename point_type<PointLike>::type> type;
};
}}} // namespace strategy::covered_by::services
diff --git a/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp b/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
index 9e2ec2c4ff..3e7e258788 100644
--- a/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
+++ b/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
@@ -3,8 +3,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2013, 2014, 2016.
-// Modifications copyright (c) 2013-2016 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013, 2014, 2016, 2017.
+// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@@ -314,6 +314,7 @@ struct winding_calculate_count<Point, CalculationType, cartesian_tag>
\ingroup strategies
\tparam Point \tparam_point
\tparam PointOfSegment \tparam_segment_point
+\tparam SideStrategy Side strategy
\tparam CalculationType \tparam_calculation
\author Barend Gehrels
\note The implementation is inspired by terralib http://www.terralib.org (LGPL)
@@ -329,6 +330,10 @@ template
<
typename Point,
typename PointOfSegment = Point,
+ typename SideStrategy = typename strategy::side::services::default_strategy
+ <
+ typename cs_tag<Point>::type
+ >::type,
typename CalculationType = void
>
class winding
@@ -339,14 +344,7 @@ class winding
PointOfSegment,
CalculationType
>::type calculation_type;
-
-
- typedef typename strategy::side::services::default_strategy
- <
- typename cs_tag<Point>::type
- >::type strategy_side_type;
-
-
+
/*! subclass to keep state */
class counter
{
@@ -371,7 +369,6 @@ class winding
};
-
static inline int check_segment(Point const& point,
PointOfSegment const& seg1, PointOfSegment const& seg2,
counter& state, bool& eq1, bool& eq2)
@@ -390,16 +387,22 @@ class winding
}
-public :
+public:
+ winding()
+ {}
+
+ explicit winding(SideStrategy const& side_strategy)
+ : m_side_strategy(side_strategy)
+ {}
// Typedefs and static methods to fulfill the concept
typedef Point point_type;
typedef PointOfSegment segment_point_type;
typedef counter state_type;
- static inline bool apply(Point const& point,
- PointOfSegment const& s1, PointOfSegment const& s2,
- counter& state)
+ inline bool apply(Point const& point,
+ PointOfSegment const& s1, PointOfSegment const& s2,
+ counter& state) const
{
typedef typename cs_tag<Point>::type cs_t;
@@ -418,7 +421,7 @@ public :
else // count == 2 || count == -2
{
// 1 left, -1 right
- side = strategy_side_type::apply(s1, s2, point);
+ side = m_side_strategy.apply(s1, s2, point);
}
if (side == 0)
@@ -445,6 +448,9 @@ public :
{
return state.code();
}
+
+private:
+ SideStrategy m_side_strategy;
};
@@ -453,29 +459,26 @@ public :
namespace services
{
-// Register using "areal_tag" for ring, polygon, multi-polygon
-template <typename AnyTag, typename Point, typename Geometry>
-struct default_strategy<point_tag, AnyTag, point_tag, areal_tag, cartesian_tag, cartesian_tag, Point, Geometry>
+template <typename Point, typename Geometry, typename AnyTag>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, polygonal_tag, cartesian_tag, cartesian_tag>
{
typedef winding<Point, typename geometry::point_type<Geometry>::type> type;
};
-template <typename AnyTag, typename Point, typename Geometry>
-struct default_strategy<point_tag, AnyTag, point_tag, areal_tag, spherical_tag, spherical_tag, Point, Geometry>
+template <typename Point, typename Geometry, typename AnyTag>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, polygonal_tag, spherical_tag, spherical_tag>
{
typedef winding<Point, typename geometry::point_type<Geometry>::type> type;
};
-// TODO: use linear_tag and pointlike_tag the same way how areal_tag is used
-
template <typename Point, typename Geometry, typename AnyTag>
-struct default_strategy<point_tag, AnyTag, point_tag, AnyTag, cartesian_tag, cartesian_tag, Point, Geometry>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, linear_tag, cartesian_tag, cartesian_tag>
{
typedef winding<Point, typename geometry::point_type<Geometry>::type> type;
};
template <typename Point, typename Geometry, typename AnyTag>
-struct default_strategy<point_tag, AnyTag, point_tag, AnyTag, spherical_tag, spherical_tag, Point, Geometry>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, linear_tag, spherical_tag, spherical_tag>
{
typedef winding<Point, typename geometry::point_type<Geometry>::type> type;
};
@@ -488,34 +491,30 @@ struct default_strategy<point_tag, AnyTag, point_tag, AnyTag, spherical_tag, sph
}} // namespace strategy::within
-
#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
namespace strategy { namespace covered_by { namespace services
{
-// Register using "areal_tag" for ring, polygon, multi-polygon
-template <typename AnyTag, typename Point, typename Geometry>
-struct default_strategy<point_tag, AnyTag, point_tag, areal_tag, cartesian_tag, cartesian_tag, Point, Geometry>
+template <typename Point, typename Geometry, typename AnyTag>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, polygonal_tag, cartesian_tag, cartesian_tag>
{
typedef strategy::within::winding<Point, typename geometry::point_type<Geometry>::type> type;
};
-template <typename AnyTag, typename Point, typename Geometry>
-struct default_strategy<point_tag, AnyTag, point_tag, areal_tag, spherical_tag, spherical_tag, Point, Geometry>
+template <typename Point, typename Geometry, typename AnyTag>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, polygonal_tag, spherical_tag, spherical_tag>
{
typedef strategy::within::winding<Point, typename geometry::point_type<Geometry>::type> type;
};
-// TODO: use linear_tag and pointlike_tag the same way how areal_tag is used
-
template <typename Point, typename Geometry, typename AnyTag>
-struct default_strategy<point_tag, AnyTag, point_tag, AnyTag, cartesian_tag, cartesian_tag, Point, Geometry>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, linear_tag, cartesian_tag, cartesian_tag>
{
typedef strategy::within::winding<Point, typename geometry::point_type<Geometry>::type> type;
};
template <typename Point, typename Geometry, typename AnyTag>
-struct default_strategy<point_tag, AnyTag, point_tag, AnyTag, spherical_tag, spherical_tag, Point, Geometry>
+struct default_strategy<Point, Geometry, point_tag, AnyTag, pointlike_tag, linear_tag, spherical_tag, spherical_tag>
{
typedef strategy::within::winding<Point, typename geometry::point_type<Geometry>::type> type;
};
diff --git a/boost/geometry/strategies/agnostic/relate.hpp b/boost/geometry/strategies/agnostic/relate.hpp
deleted file mode 100644
index 676207694f..0000000000
--- a/boost/geometry/strategies/agnostic/relate.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2014-2015 Oracle and/or its affiliates.
-
-// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
-
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_STRATEGY_AGNOSTIC_RELATE_HPP
-#define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_RELATE_HPP
-
-#include <boost/geometry/algorithms/relate.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-namespace strategy { namespace relate
-{
-
-template <typename Geometry1, typename Geometry2, typename StaticMask>
-struct relate
-{
- static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
- {
- return geometry::relate(geometry1, geometry2, StaticMask());
- }
-};
-
-} // namespace relate
-
-namespace within
-{
-
-#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
-
-namespace services
-{
-
-
-template <typename Geometry1, typename Geometry2, typename AnyTag1, typename AnyTag2, typename AnyCS>
-struct default_strategy<AnyTag1, AnyTag2, AnyTag1, AnyTag2, AnyCS, AnyCS, Geometry1, Geometry2>
-{
- typedef strategy::relate::relate
- <
- Geometry1,
- Geometry2,
- typename detail::de9im::static_mask_within_type
- <
- Geometry1, Geometry2
- >::type
- > type;
-};
-
-template <typename Geometry1, typename Geometry2, typename AnyTag1, typename AnyTag2, typename AnyCS>
-struct default_strategy<AnyTag1, AnyTag2, AnyTag1, areal_tag, AnyCS, AnyCS, Geometry1, Geometry2>
-{
- typedef strategy::relate::relate
- <
- Geometry1,
- Geometry2,
- typename detail::de9im::static_mask_within_type
- <
- Geometry1, Geometry2
- >::type
- > type;
-};
-
-
-} // namespace services
-
-#endif
-
-
-}} // namespace strategy::within
-
-
-
-#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
-namespace strategy { namespace covered_by { namespace services
-{
-
-
-template <typename Geometry1, typename Geometry2, typename AnyTag1, typename AnyTag2, typename AnyCS>
-struct default_strategy<AnyTag1, AnyTag2, AnyTag1, AnyTag2, AnyCS, AnyCS, Geometry1, Geometry2>
-{
- typedef strategy::relate::relate
- <
- Geometry1,
- Geometry2,
- typename detail::de9im::static_mask_covered_by_type
- <
- Geometry1, Geometry2
- >::type
- > type;
-};
-
-template <typename Geometry1, typename Geometry2, typename AnyTag1, typename AnyTag2, typename AnyCS>
-struct default_strategy<AnyTag1, AnyTag2, AnyTag1, areal_tag, AnyCS, AnyCS, Geometry1, Geometry2>
-{
- typedef strategy::relate::relate
- <
- Geometry1,
- Geometry2,
- typename detail::de9im::static_mask_covered_by_type
- <
- Geometry1, Geometry2
- >::type
- > type;
-};
-
-
-}}} // namespace strategy::covered_by::services
-#endif
-
-
-}} // namespace boost::geometry
-
-
-#endif // BOOST_GEOMETRY_STRATEGY_AGNOSTIC_RELATE_HPP