]>
Commit | Line | Data |
---|---|---|
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) | |
2 | ||
3 | // Copyright (c) 2014 Oracle and/or its affiliates. | |
4 | ||
5 | // Use, modification and distribution is subject to the Boost Software License, | |
6 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle | |
10 | ||
11 | #ifndef BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP | |
12 | #define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP | |
13 | ||
14 | #include <boost/geometry/algorithms/detail/equals/point_point.hpp> | |
15 | ||
16 | #include <boost/geometry/strategies/covered_by.hpp> | |
17 | #include <boost/geometry/strategies/within.hpp> | |
18 | ||
19 | ||
20 | namespace boost { namespace geometry | |
21 | { | |
22 | ||
23 | namespace strategy { namespace within | |
24 | { | |
25 | ||
26 | template | |
27 | < | |
28 | typename Point1, typename Point2 | |
29 | > | |
30 | struct point_in_point | |
31 | { | |
32 | static inline bool apply(Point1 const& point1, Point2 const& point2) | |
33 | { | |
34 | return detail::equals::equals_point_point(point1, point2); | |
35 | } | |
36 | }; | |
37 | ||
38 | ||
39 | #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
40 | ||
41 | namespace services | |
42 | { | |
43 | ||
44 | template <typename Point1, typename Point2> | |
45 | struct default_strategy<point_tag, point_tag, point_tag, point_tag, cartesian_tag, cartesian_tag, Point1, Point2> | |
46 | { | |
47 | typedef strategy::within::point_in_point<Point1, Point2> type; | |
48 | }; | |
49 | ||
50 | template <typename Point1, typename Point2> | |
51 | struct default_strategy<point_tag, point_tag, point_tag, point_tag, spherical_tag, spherical_tag, Point1, Point2> | |
52 | { | |
53 | typedef strategy::within::point_in_point<Point1, Point2> type; | |
54 | }; | |
55 | ||
56 | template <typename Point1, typename Point2, typename AnyCS1, typename AnyCS2> | |
57 | struct default_strategy<point_tag, point_tag, point_tag, point_tag, AnyCS1, AnyCS2, Point1, Point2> | |
58 | { | |
59 | typedef strategy::within::point_in_point<Point1, Point2> type; | |
60 | }; | |
61 | ||
62 | template <typename Point, typename MultiPoint> | |
63 | struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, cartesian_tag, cartesian_tag, Point, MultiPoint> | |
64 | { | |
65 | typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type; | |
66 | }; | |
67 | ||
68 | template <typename Point, typename MultiPoint> | |
69 | struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, spherical_tag, spherical_tag, Point, MultiPoint> | |
70 | { | |
71 | typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type; | |
72 | }; | |
73 | ||
74 | template <typename Point, typename MultiPoint, typename AnyCS1, typename AnyCS2> | |
75 | struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, AnyCS1, AnyCS2, Point, MultiPoint> | |
76 | { | |
77 | typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type; | |
78 | }; | |
79 | ||
80 | } // namespace services | |
81 | ||
82 | #endif | |
83 | ||
84 | ||
85 | }} // namespace strategy::within | |
86 | ||
87 | ||
88 | ||
89 | #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
90 | namespace strategy { namespace covered_by { namespace services | |
91 | { | |
92 | ||
93 | template <typename Point1, typename Point2> | |
94 | struct default_strategy<point_tag, point_tag, point_tag, point_tag, cartesian_tag, cartesian_tag, Point1, Point2> | |
95 | { | |
96 | typedef strategy::within::point_in_point<Point1, Point2> type; | |
97 | }; | |
98 | ||
99 | template <typename Point1, typename Point2> | |
100 | struct default_strategy<point_tag, point_tag, point_tag, point_tag, spherical_tag, spherical_tag, Point1, Point2> | |
101 | { | |
102 | typedef strategy::within::point_in_point<Point1, Point2> type; | |
103 | }; | |
104 | ||
105 | template <typename Point1, typename Point2, typename AnyCS1, typename AnyCS2> | |
106 | struct default_strategy<point_tag, point_tag, point_tag, point_tag, AnyCS1, AnyCS2, Point1, Point2> | |
107 | { | |
108 | typedef strategy::within::point_in_point<Point1, Point2> type; | |
109 | }; | |
110 | ||
111 | template <typename Point, typename MultiPoint> | |
112 | struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, cartesian_tag, cartesian_tag, Point, MultiPoint> | |
113 | { | |
114 | typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type; | |
115 | }; | |
116 | ||
117 | template <typename Point, typename MultiPoint> | |
118 | struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, spherical_tag, spherical_tag, Point, MultiPoint> | |
119 | { | |
120 | typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type; | |
121 | }; | |
122 | ||
123 | template <typename Point, typename MultiPoint, typename AnyCS1, typename AnyCS2> | |
124 | struct default_strategy<point_tag, multi_point_tag, point_tag, multi_point_tag, AnyCS1, AnyCS2, Point, MultiPoint> | |
125 | { | |
126 | typedef strategy::within::point_in_point<Point, typename point_type<MultiPoint>::type> type; | |
127 | }; | |
128 | ||
129 | }}} // namespace strategy::covered_by::services | |
130 | #endif | |
131 | ||
132 | ||
133 | }} // namespace boost::geometry | |
134 | ||
135 | ||
136 | #endif // BOOST_GEOMETRY_STRATEGY_AGNOSTIC_POINT_IN_POINT_HPP |