1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014-2015, Oracle and/or its affiliates.
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP
15 #include <boost/range.hpp>
17 #include <boost/geometry/core/closure.hpp>
18 #include <boost/geometry/core/tags.hpp>
19 #include <boost/geometry/core/tags.hpp>
21 #include <boost/geometry/policies/compare.hpp>
23 #include <boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp>
24 #include <boost/geometry/algorithms/detail/is_simple/failure_policy.hpp>
26 #include <boost/geometry/algorithms/dispatch/is_simple.hpp>
29 namespace boost { namespace geometry
33 #ifndef DOXYGEN_NO_DETAIL
34 namespace detail { namespace is_simple
38 template <typename MultiPoint>
39 struct is_simple_multipoint
41 static inline bool apply(MultiPoint const& multipoint)
43 if (boost::empty(multipoint))
48 MultiPoint mp(multipoint);
49 std::sort(boost::begin(mp), boost::end(mp),
50 geometry::less<typename point_type<MultiPoint>::type>());
52 simplicity_failure_policy policy;
53 return !detail::is_valid::has_duplicates
61 }} // namespace detail::is_simple
62 #endif // DOXYGEN_NO_DETAIL
67 #ifndef DOXYGEN_NO_DISPATCH
72 // A MultiPoint is simple if no two Points in the MultiPoint are equal
73 // (have identical coordinate values in X and Y)
75 // Reference: OGC 06-103r4 (6.1.5)
76 template <typename MultiPoint>
77 struct is_simple<MultiPoint, multi_point_tag>
78 : detail::is_simple::is_simple_multipoint<MultiPoint>
82 } // namespace dispatch
83 #endif // DOXYGEN_NO_DISPATCH
86 }} // namespace boost::geometry
89 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP