1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014-2017, Oracle and/or its affiliates.
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
11 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP
12 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP
16 #include <boost/range.hpp>
18 #include <boost/geometry/core/closure.hpp>
19 #include <boost/geometry/core/tags.hpp>
20 #include <boost/geometry/core/tags.hpp>
22 #include <boost/geometry/policies/compare.hpp>
24 #include <boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp>
25 #include <boost/geometry/algorithms/detail/is_simple/failure_policy.hpp>
27 #include <boost/geometry/algorithms/dispatch/is_simple.hpp>
30 namespace boost { namespace geometry
34 #ifndef DOXYGEN_NO_DETAIL
35 namespace detail { namespace is_simple
39 template <typename MultiPoint>
40 struct is_simple_multipoint
42 template <typename Strategy>
43 static inline bool apply(MultiPoint const& multipoint, Strategy const&)
45 if (boost::empty(multipoint))
50 MultiPoint mp(multipoint);
51 std::sort(boost::begin(mp), boost::end(mp),
52 geometry::less<typename point_type<MultiPoint>::type>());
54 simplicity_failure_policy policy;
55 return !detail::is_valid::has_duplicates
63 }} // namespace detail::is_simple
64 #endif // DOXYGEN_NO_DETAIL
69 #ifndef DOXYGEN_NO_DISPATCH
74 // A MultiPoint is simple if no two Points in the MultiPoint are equal
75 // (have identical coordinate values in X and Y)
77 // Reference: OGC 06-103r4 (6.1.5)
78 template <typename MultiPoint>
79 struct is_simple<MultiPoint, multi_point_tag>
80 : detail::is_simple::is_simple_multipoint<MultiPoint>
84 } // namespace dispatch
85 #endif // DOXYGEN_NO_DISPATCH
88 }} // namespace boost::geometry
91 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP