]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_SIMPLE_ALWAYS_SIMPLE_HPP | |
11 | #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_ALWAYS_SIMPLE_HPP | |
12 | ||
13 | #include <boost/geometry/core/tags.hpp> | |
14 | ||
15 | #include <boost/geometry/algorithms/dispatch/is_simple.hpp> | |
16 | ||
17 | ||
18 | namespace boost { namespace geometry | |
19 | { | |
20 | ||
21 | ||
22 | #ifndef DOXYGEN_NO_DETAIL | |
23 | namespace detail { namespace is_simple | |
24 | { | |
25 | ||
26 | ||
27 | template <typename Geometry> | |
28 | struct always_simple | |
29 | { | |
30 | static inline bool apply(Geometry const&) | |
31 | { | |
32 | return true; | |
33 | } | |
34 | }; | |
35 | ||
36 | ||
37 | }} // namespace detail::is_simple | |
38 | #endif // DOXYGEN_NO_DETAIL | |
39 | ||
40 | ||
41 | ||
42 | ||
43 | #ifndef DOXYGEN_NO_DISPATCH | |
44 | namespace dispatch | |
45 | { | |
46 | ||
47 | ||
48 | // A point is always simple | |
49 | template <typename Point> | |
50 | struct is_simple<Point, point_tag> | |
51 | : detail::is_simple::always_simple<Point> | |
52 | {}; | |
53 | ||
54 | ||
55 | // A valid segment is always simple. | |
56 | // A segment is a curve. | |
57 | // A curve is simple if it does not pass through the same point twice, | |
58 | // with the possible exception of its two endpoints | |
59 | // | |
60 | // Reference: OGC 06-103r4 (6.1.6.1) | |
61 | template <typename Segment> | |
62 | struct is_simple<Segment, segment_tag> | |
63 | : detail::is_simple::always_simple<Segment> | |
64 | {}; | |
65 | ||
66 | ||
67 | // A valid box is always simple | |
68 | // A box is a Polygon, and it satisfies the conditions for Polygon validity. | |
69 | // | |
70 | // Reference (for polygon validity): OGC 06-103r4 (6.1.11.1) | |
71 | template <typename Box> | |
72 | struct is_simple<Box, box_tag> | |
73 | : detail::is_simple::always_simple<Box> | |
74 | {}; | |
75 | ||
76 | ||
77 | } // namespace dispatch | |
78 | #endif // DOXYGEN_NO_DISPATCH | |
79 | ||
80 | ||
81 | }} // namespace boost::geometry | |
82 | ||
83 | #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_ALWAYS_SIMPLE_HPP |