Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / geometry / algorithms / detail / is_valid / pointlike.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
6
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
9
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_POINTLIKE_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_POINTLIKE_HPP
12
13 #include <boost/range.hpp>
14
15 #include <boost/geometry/core/tags.hpp>
16
17 #include <boost/geometry/algorithms/dispatch/is_valid.hpp>
18
19
20 namespace boost { namespace geometry
21 {
22
23
24
25 #ifndef DOXYGEN_NO_DISPATCH
26 namespace dispatch
27 {
28
29 // A point is always simple
30 template <typename Point>
31 struct is_valid<Point, point_tag>
32 {
33     static inline bool apply(Point const&)
34     {
35         return true;
36     }
37 };
38
39
40
41 // A MultiPoint is simple if no two Points in the MultiPoint are equal
42 // (have identical coordinate values in X and Y)
43 //
44 // Reference: OGC 06-103r4 (6.1.5)
45 template <typename MultiPoint>
46 struct is_valid<MultiPoint, multi_point_tag>
47 {
48     static inline bool apply(MultiPoint const& multipoint)
49     {
50         return boost::size(multipoint) > 0;
51     }
52 };
53
54
55 } // namespace dispatch
56 #endif // DOXYGEN_NO_DISPATCH
57
58
59 }} // namespace boost::geometry
60
61
62 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_POINTLIKE_HPP