]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/algorithms/detail/is_simple/multipoint.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / is_simple / multipoint.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
92f5a8d4 3// Copyright (c) 2014-2019, Oracle and/or its affiliates.
7c673cae
FG
4
5// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
b32b8144 6// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7c673cae
FG
7
8// Licensed under the Boost Software License version 1.0.
9// http://www.boost.org/users/license.html
10
11#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP
12#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP
13
14#include <algorithm>
15
16#include <boost/range.hpp>
17
18#include <boost/geometry/core/closure.hpp>
19#include <boost/geometry/core/tags.hpp>
20#include <boost/geometry/core/tags.hpp>
21
22#include <boost/geometry/policies/compare.hpp>
23
24#include <boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp>
25#include <boost/geometry/algorithms/detail/is_simple/failure_policy.hpp>
26
27#include <boost/geometry/algorithms/dispatch/is_simple.hpp>
28
29
30namespace boost { namespace geometry
31{
32
33
34#ifndef DOXYGEN_NO_DETAIL
35namespace detail { namespace is_simple
36{
37
38
39template <typename MultiPoint>
40struct is_simple_multipoint
41{
b32b8144
FG
42 template <typename Strategy>
43 static inline bool apply(MultiPoint const& multipoint, Strategy const&)
7c673cae 44 {
92f5a8d4
TL
45 typedef typename Strategy::cs_tag cs_tag;
46 typedef geometry::less
47 <
48 typename point_type<MultiPoint>::type,
49 -1,
50 cs_tag
51 > less_type;
52
7c673cae
FG
53 if (boost::empty(multipoint))
54 {
55 return true;
56 }
57
58 MultiPoint mp(multipoint);
92f5a8d4 59 std::sort(boost::begin(mp), boost::end(mp), less_type());
7c673cae
FG
60
61 simplicity_failure_policy policy;
62 return !detail::is_valid::has_duplicates
63 <
92f5a8d4 64 MultiPoint, closed, cs_tag
7c673cae
FG
65 >::apply(mp, policy);
66 }
67};
68
69
70}} // namespace detail::is_simple
71#endif // DOXYGEN_NO_DETAIL
72
73
74
75
76#ifndef DOXYGEN_NO_DISPATCH
77namespace dispatch
78{
79
80
81// A MultiPoint is simple if no two Points in the MultiPoint are equal
82// (have identical coordinate values in X and Y)
83//
84// Reference: OGC 06-103r4 (6.1.5)
85template <typename MultiPoint>
86struct is_simple<MultiPoint, multi_point_tag>
87 : detail::is_simple::is_simple_multipoint<MultiPoint>
88{};
89
90
91} // namespace dispatch
92#endif // DOXYGEN_NO_DISPATCH
93
94
95}} // namespace boost::geometry
96
97
98#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_MULTIPOINT_HPP