]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/views/detail/indexed_point_view.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / views / detail / indexed_point_view.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6 // Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland
7
8 // This file was modified by Oracle on 2015.
9 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12
13 // Use, modification and distribution is subject to the Boost Software License,
14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
16
17 #ifndef BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
18 #define BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
19
20 #include <cstddef>
21
22 #include <boost/geometry/core/access.hpp>
23 #include <boost/geometry/core/coordinate_type.hpp>
24 #include <boost/geometry/core/coordinate_system.hpp>
25 #include <boost/geometry/core/coordinate_dimension.hpp>
26 #include <boost/geometry/util/math.hpp>
27
28 namespace boost { namespace geometry
29 {
30
31 namespace detail
32 {
33
34 template <typename Geometry, std::size_t Index>
35 class indexed_point_view
36 {
37 indexed_point_view & operator=(indexed_point_view const&);
38
39 public:
40 typedef typename geometry::point_type<Geometry>::type point_type;
41 typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
42
43 indexed_point_view(Geometry & geometry)
44 : m_geometry(geometry)
45 {}
46
47 template <std::size_t Dimension>
48 inline coordinate_type get() const
49 {
50 return geometry::get<Index, Dimension>(m_geometry);
51 }
52
53 template <std::size_t Dimension>
54 inline void set(coordinate_type const& value)
55 {
56 geometry::set<Index, Dimension>(m_geometry, value);
57 }
58
59 private:
60 Geometry & m_geometry;
61 };
62
63 }
64
65 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
66 namespace traits
67 {
68
69 template <typename Geometry, std::size_t Index>
70 struct tag< geometry::detail::indexed_point_view<Geometry, Index> >
71 {
72 typedef point_tag type;
73 };
74
75 template <typename Geometry, std::size_t Index>
76 struct coordinate_type< geometry::detail::indexed_point_view<Geometry, Index> >
77 {
78 typedef typename geometry::coordinate_type<Geometry>::type type;
79 };
80
81 template <typename Geometry, std::size_t Index>
82 struct coordinate_system
83 <
84 geometry::detail::indexed_point_view<Geometry, Index>
85 >
86 {
87 typedef typename geometry::coordinate_system<Geometry>::type type;
88 };
89
90 template <typename Geometry, std::size_t Index>
91 struct dimension< geometry::detail::indexed_point_view<Geometry, Index> >
92 : geometry::dimension<Geometry>
93 {};
94
95 template<typename Geometry, std::size_t Index, std::size_t Dimension>
96 struct access
97 <
98 geometry::detail::indexed_point_view<Geometry, Index>, Dimension
99 >
100 {
101 typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
102
103 static inline coordinate_type get(
104 geometry::detail::indexed_point_view<Geometry, Index> const& p)
105 {
106 return p.template get<Dimension>();
107 }
108
109 static inline void set(
110 geometry::detail::indexed_point_view<Geometry, Index> & p,
111 coordinate_type const& value)
112 {
113 p.template set<Dimension>(value);
114 }
115 };
116
117 } // namespace traits
118 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
119
120 }} // namespace boost::geometry
121
122
123 #endif // BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP