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/buffer_distance_asymmetric.hpp4
-rw-r--r--boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp5
-rw-r--r--boost/geometry/strategies/agnostic/hull_graham_andrew.hpp2
-rw-r--r--boost/geometry/strategies/agnostic/point_in_poly_winding.hpp12
-rw-r--r--boost/geometry/strategies/agnostic/relate.hpp31
-rw-r--r--boost/geometry/strategies/agnostic/side_by_azimuth.hpp87
-rw-r--r--boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp51
7 files changed, 162 insertions, 30 deletions
diff --git a/boost/geometry/strategies/agnostic/buffer_distance_asymmetric.hpp b/boost/geometry/strategies/agnostic/buffer_distance_asymmetric.hpp
index 7b7cd1890f..446d2f02cd 100644
--- a/boost/geometry/strategies/agnostic/buffer_distance_asymmetric.hpp
+++ b/boost/geometry/strategies/agnostic/buffer_distance_asymmetric.hpp
@@ -9,6 +9,8 @@
#ifndef BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_ASYMMETRIC_HPP
#define BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_ASYMMETRIC_HPP
+#include <boost/core/ignore_unused.hpp>
+
#include <boost/geometry/strategies/buffer.hpp>
#include <boost/geometry/util/math.hpp>
@@ -79,6 +81,8 @@ public :
inline NumericType max_distance(JoinStrategy const& join_strategy,
EndStrategy const& end_strategy) const
{
+ boost::ignore_unused(join_strategy, end_strategy);
+
NumericType const left = geometry::math::abs(m_left);
NumericType const right = geometry::math::abs(m_right);
NumericType const dist = (std::max)(left, right);
diff --git a/boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp b/boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp
index bc0c46f644..73bd21ac73 100644
--- a/boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp
+++ b/boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp
@@ -9,6 +9,9 @@
#ifndef BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_SYMMETRIC_HPP
#define BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_BUFFER_DISTANCE_SYMMETRIC_HPP
+
+#include <boost/core/ignore_unused.hpp>
+
#include <boost/geometry/strategies/buffer.hpp>
#include <boost/geometry/util/math.hpp>
@@ -76,6 +79,8 @@ public :
inline NumericType max_distance(JoinStrategy const& join_strategy,
EndStrategy const& end_strategy) const
{
+ boost::ignore_unused(join_strategy, end_strategy);
+
NumericType const dist = geometry::math::abs(m_distance);
return (std::max)(join_strategy.max_distance(dist),
end_strategy.max_distance(dist));
diff --git a/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp b/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp
index a960a6f1f9..1d59e13cf6 100644
--- a/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp
+++ b/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp
@@ -364,7 +364,7 @@ private:
// count describes a closed case but comparison with min size of closed
// gives the result compatible also with open
// here core_detail::closure::minimum_ring_size<closed> could be used
- if ( count < 4 )
+ if (count < 4)
{
// there should be only one missing
*out++ = *boost::begin(first);
diff --git a/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp b/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
index f4ed7a634f..641533fc6a 100644
--- a/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
+++ b/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
@@ -73,7 +73,7 @@ struct winding_side_equal
PointOfSegment ss1, ss2;
set<1-D>(ss1, get<1-D>(se));
set<1-D>(ss2, get<1-D>(se));
- if ( count > 0 ) // UP
+ if (count > 0) // UP
{
set<D>(ss1, 0);
set<D>(ss2, 1);
@@ -127,7 +127,7 @@ struct winding_side_between
set<1-D>(ss1, get<1-D>(s1));
set<1-D>(ss2, get<1-D>(s1));
- if ( count > 0 ) // UP
+ if (count > 0) // UP
{
set<D>(ss1, 0);
set<D>(ss2, 1);
@@ -140,9 +140,9 @@ struct winding_side_between
int const seg_side = strategy_side_type::apply(ss1, ss2, s2);
- if ( seg_side != 0 ) // segment not vertical
+ if (seg_side != 0) // segment not vertical
{
- if ( strategy_side_type::apply(ss1, ss2, point) == -seg_side ) // point on the opposite side than s2
+ if (strategy_side_type::apply(ss1, ss2, point) == -seg_side) // point on the opposite side than s2
{
return -seg_side;
}
@@ -151,7 +151,7 @@ struct winding_side_between
set<1-D>(ss1, get<1-D>(s2));
set<1-D>(ss2, get<1-D>(s2));
- if ( strategy_side_type::apply(ss1, ss2, point) == seg_side ) // point behind s2
+ if (strategy_side_type::apply(ss1, ss2, point) == seg_side) // point behind s2
{
return seg_side;
}
@@ -308,7 +308,7 @@ public :
if (count != 0)
{
int side = 0;
- if ( count == 1 || count == -1 )
+ if (count == 1 || count == -1)
{
side = winding_side_equal<cs_t>
::template apply<1>(point, eq1 ? s1 : s2, count);
diff --git a/boost/geometry/strategies/agnostic/relate.hpp b/boost/geometry/strategies/agnostic/relate.hpp
index 318047fadb..9e8753251d 100644
--- a/boost/geometry/strategies/agnostic/relate.hpp
+++ b/boost/geometry/strategies/agnostic/relate.hpp
@@ -20,10 +20,9 @@ namespace boost { namespace geometry
namespace strategy { namespace relate
{
-template <typename StaticMask>
+template <typename Geometry1, typename Geometry2, typename StaticMask>
struct relate
{
- template <typename Geometry1, typename Geometry2>
static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
return detail::relate::relate<StaticMask>(geometry1, geometry2);
@@ -44,13 +43,23 @@ 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<detail::relate::static_mask_within> type;
+ typedef strategy::relate::relate
+ <
+ Geometry1,
+ Geometry2,
+ detail::relate::static_mask_within
+ > 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<detail::relate::static_mask_within> type;
+ typedef strategy::relate::relate
+ <
+ Geometry1,
+ Geometry2,
+ detail::relate::static_mask_within
+ > type;
};
@@ -71,13 +80,23 @@ 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<detail::relate::static_mask_covered_by> type;
+ typedef strategy::relate::relate
+ <
+ Geometry1,
+ Geometry2,
+ detail::relate::static_mask_covered_by
+ > 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<detail::relate::static_mask_covered_by> type;
+ typedef strategy::relate::relate
+ <
+ Geometry1,
+ Geometry2,
+ detail::relate::static_mask_covered_by
+ > type;
};
diff --git a/boost/geometry/strategies/agnostic/side_by_azimuth.hpp b/boost/geometry/strategies/agnostic/side_by_azimuth.hpp
new file mode 100644
index 0000000000..14c69a0597
--- /dev/null
+++ b/boost/geometry/strategies/agnostic/side_by_azimuth.hpp
@@ -0,0 +1,87 @@
+// Boost.Geometry
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// This file was modified by Oracle on 2014.
+// Modifications copyright (c) 2014 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_STRATEGIES_AGNOSTIC_SIDE_BY_AZIMUTH_HPP
+#define BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_SIDE_BY_AZIMUTH_HPP
+
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/core/ignore_unused.hpp>
+
+#include <boost/geometry/core/cs.hpp>
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/radian_access.hpp>
+
+#include <boost/geometry/algorithms/detail/azimuth.hpp>
+
+#include <boost/geometry/util/math.hpp>
+#include <boost/geometry/util/promote_floating_point.hpp>
+#include <boost/geometry/util/select_calculation_type.hpp>
+
+#include <boost/geometry/strategies/side.hpp>
+//#include <boost/geometry/strategies/concepts/side_concept.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+namespace strategy { namespace side
+{
+
+/*!
+\brief Check at which side of a segment a point lies
+ left of segment (> 0), right of segment (< 0), on segment (0)
+\ingroup strategies
+\tparam Model Reference model of coordinate system.
+\tparam CalculationType \tparam_calculation
+ */
+template <typename Model, typename CalculationType = void>
+class side_by_azimuth
+{
+public:
+ side_by_azimuth(Model const& model = Model())
+ : m_model(model)
+ {}
+
+ template <typename P1, typename P2, typename P>
+ inline int apply(P1 const& p1, P2 const& p2, P const& p)
+ {
+ typedef typename promote_floating_point
+ <
+ typename select_calculation_type_alt
+ <
+ CalculationType,
+ P1, P2, P
+ >::type
+ >::type calc_t;
+
+ calc_t d1 = 0.001;
+ calc_t crs_AD = geometry::detail::azimuth<calc_t>(p1, p, m_model);
+ calc_t crs_AB = geometry::detail::azimuth<calc_t>(p1, p2, m_model);
+ calc_t XTD = asin(sin(d1) * sin(crs_AD - crs_AB));
+
+ return math::equals(XTD, 0) ? 0 : XTD < 0 ? 1 : -1;
+ }
+
+private:
+ Model m_model;
+};
+
+}} // namespace strategy::side
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_STRATEGIES_AGNOSTIC_SIDE_BY_AZIMUTH_HPP
diff --git a/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp b/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp
index 8ad3bbc50d..99e7d9b50f 100644
--- a/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp
+++ b/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp
@@ -1,8 +1,13 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Copyright (c) 1995, 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 1995, 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 1995 Maarten Hilferink, Amsterdam, the Netherlands
+// This file was modified by Oracle on 2015.
+// Modifications copyright (c) 2015, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -15,6 +20,9 @@
#include <cstddef>
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
+#include <iostream>
+#endif
#include <vector>
#include <boost/range.hpp>
@@ -23,10 +31,7 @@
#include <boost/geometry/strategies/distance.hpp>
-
-//#define GL_DEBUG_DOUGLAS_PEUCKER
-
-#ifdef GL_DEBUG_DOUGLAS_PEUCKER
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
#include <boost/geometry/io/dsv/write.hpp>
#endif
@@ -126,7 +131,7 @@ namespace detail
// because we want to consider a candidate point in between
if (size <= 2)
{
-#ifdef GL_DEBUG_DOUGLAS_PEUCKER
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
if (begin != end)
{
std::cout << "ignore between " << dsv(begin->p)
@@ -140,7 +145,7 @@ namespace detail
iterator_type last = end - 1;
-#ifdef GL_DEBUG_DOUGLAS_PEUCKER
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
std::cout << "find between " << dsv(begin->p)
<< " and " << dsv(last->p)
<< " size=" << size << std::endl;
@@ -155,7 +160,7 @@ namespace detail
{
distance_type dist = ps_distance_strategy.apply(it->p, begin->p, last->p);
-#ifdef GL_DEBUG_DOUGLAS_PEUCKER
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
std::cout << "consider " << dsv(it->p)
<< " at " << double(dist)
<< ((dist > max_dist) ? " maybe" : " no")
@@ -173,7 +178,7 @@ namespace detail
// and handle segments in between recursively
if ( less()(max_dist, md) )
{
-#ifdef GL_DEBUG_DOUGLAS_PEUCKER
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
std::cout << "use " << dsv(candidate->p) << std::endl;
#endif
@@ -193,6 +198,10 @@ namespace detail
OutputIterator out,
distance_type max_distance) const
{
+#ifdef BOOST_GEOMETRY_DEBUG_DOUGLAS_PEUCKER
+ std::cout << "max distance: " << max_distance
+ << std::endl << std::endl;
+#endif
distance_strategy_type strategy;
// Copy coordinates, a vector of references to all points
@@ -228,8 +237,6 @@ namespace detail
}
};
-
-
}
#endif // DOXYGEN_NO_DETAIL
@@ -269,18 +276,28 @@ public :
PointDistanceStrategy
>::distance_type distance_type;
- typedef distance_type return_type;
-
template <typename Range, typename OutputIterator>
static inline OutputIterator apply(Range const& range,
OutputIterator out,
- distance_type max_distance)
+ distance_type const& max_distance)
{
- return detail::douglas_peucker
+ namespace services = strategy::distance::services;
+
+ typedef typename services::comparable_type
<
- Point,
PointDistanceStrategy
- >().apply(range, out, max_distance);
+ >::type comparable_distance_strategy_type;
+
+ return detail::douglas_peucker
+ <
+ Point, comparable_distance_strategy_type
+ >().apply(range, out,
+ services::result_from_distance
+ <
+ comparable_distance_strategy_type, Point, Point
+ >::apply(comparable_distance_strategy_type(),
+ max_distance)
+ );
}
};