]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/geometries/helper_geometry.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / geometries / helper_geometry.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2015-2017, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
10
11 #ifndef BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
12 #define BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
13
14 #include <boost/mpl/assert.hpp>
15
16 #include <boost/geometry/core/cs.hpp>
17 #include <boost/geometry/core/coordinate_dimension.hpp>
18 #include <boost/geometry/core/coordinate_type.hpp>
19 #include <boost/geometry/core/point_type.hpp>
20 #include <boost/geometry/core/tag.hpp>
21 #include <boost/geometry/core/tags.hpp>
22
23 #include <boost/geometry/geometries/box.hpp>
24 #include <boost/geometry/geometries/point.hpp>
25
26 #include <boost/geometry/algorithms/not_implemented.hpp>
27
28
29 namespace boost { namespace geometry
30 {
31
32 namespace detail { namespace helper_geometries
33 {
34
35 template
36 <
37 typename Point,
38 typename NewCoordinateType,
39 typename NewUnits,
40 typename CS_Tag = typename cs_tag<Point>::type
41 >
42 struct helper_point
43 {
44 typedef model::point
45 <
46 NewCoordinateType,
47 dimension<Point>::value,
48 typename cs_tag_to_coordinate_system<NewUnits, CS_Tag>::type
49 > type;
50 };
51
52
53 }} // detail::helper_geometries
54
55
56 namespace detail_dispatch
57 {
58
59
60 template
61 <
62 typename Geometry,
63 typename NewCoordinateType,
64 typename NewUnits,
65 typename Tag = typename tag<Geometry>::type>
66 struct helper_geometry : not_implemented<Geometry>
67 {};
68
69
70 template <typename Point, typename NewCoordinateType, typename NewUnits>
71 struct helper_geometry<Point, NewCoordinateType, NewUnits, point_tag>
72 {
73 typedef typename detail::helper_geometries::helper_point
74 <
75 Point, NewCoordinateType, NewUnits
76 >::type type;
77 };
78
79
80 template <typename Box, typename NewCoordinateType, typename NewUnits>
81 struct helper_geometry<Box, NewCoordinateType, NewUnits, box_tag>
82 {
83 typedef model::box
84 <
85 typename helper_geometry
86 <
87 typename point_type<Box>::type, NewCoordinateType, NewUnits
88 >::type
89 > type;
90 };
91
92
93 } // detail_dispatch
94
95
96 // Meta-function that provides a new helper geometry of the same kind as
97 // the input geometry and the same coordinate system type,
98 // but with a possibly different coordinate type and coordinate system units
99 template
100 <
101 typename Geometry,
102 typename NewCoordinateType = typename coordinate_type<Geometry>::type,
103 typename NewUnits = typename detail::cs_angular_units<Geometry>::type
104 >
105 struct helper_geometry
106 {
107 typedef typename detail_dispatch::helper_geometry
108 <
109 Geometry, NewCoordinateType, NewUnits
110 >::type type;
111 };
112
113
114 }} // namespace boost::geometry
115
116 #endif // BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP