Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:54

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland
0007 
0008 // This file was modified by Oracle on 2015.
0009 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
0010 
0011 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0012 
0013 // Use, modification and distribution is subject to the Boost Software License,
0014 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 #ifndef BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
0018 #define BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
0019 
0020 #include <cstddef>
0021 
0022 #include <boost/geometry/core/access.hpp>
0023 #include <boost/geometry/core/coordinate_type.hpp>
0024 #include <boost/geometry/core/coordinate_system.hpp>
0025 #include <boost/geometry/core/coordinate_dimension.hpp>
0026 #include <boost/geometry/util/math.hpp>
0027 
0028 namespace boost { namespace geometry
0029 {
0030 
0031 namespace detail
0032 {
0033 
0034 template <typename Geometry, std::size_t Index>
0035 class indexed_point_view
0036 {
0037     indexed_point_view & operator=(indexed_point_view const&);
0038 
0039 public:
0040     typedef typename geometry::point_type<Geometry>::type point_type;
0041     typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
0042 
0043     indexed_point_view(Geometry & geometry)
0044         : m_geometry(geometry)
0045     {}
0046 
0047     template <std::size_t Dimension>
0048     inline coordinate_type get() const
0049     {
0050         return geometry::get<Index, Dimension>(m_geometry);
0051     }
0052 
0053     template <std::size_t Dimension>
0054     inline void set(coordinate_type const& value)
0055     {
0056         geometry::set<Index, Dimension>(m_geometry, value);
0057     }
0058 
0059 private:
0060     Geometry & m_geometry;
0061 };
0062 
0063 }
0064 
0065 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0066 namespace traits
0067 {
0068 
0069 template <typename Geometry, std::size_t Index>
0070 struct tag< geometry::detail::indexed_point_view<Geometry, Index> >
0071 {
0072     typedef point_tag type;
0073 };
0074 
0075 template <typename Geometry, std::size_t Index>
0076 struct coordinate_type< geometry::detail::indexed_point_view<Geometry, Index> >
0077 {
0078     typedef typename geometry::coordinate_type<Geometry>::type type;
0079 };
0080 
0081 template <typename Geometry, std::size_t Index>
0082 struct coordinate_system
0083     <
0084         geometry::detail::indexed_point_view<Geometry, Index>
0085     >
0086 {
0087     typedef typename geometry::coordinate_system<Geometry>::type type;
0088 };
0089 
0090 template <typename Geometry, std::size_t Index>
0091 struct dimension< geometry::detail::indexed_point_view<Geometry, Index> >
0092     : geometry::dimension<Geometry>
0093 {};
0094 
0095 template<typename Geometry, std::size_t Index, std::size_t Dimension>
0096 struct access
0097     <
0098        geometry::detail::indexed_point_view<Geometry, Index>, Dimension
0099     >
0100 {
0101     typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
0102 
0103     static inline coordinate_type get(
0104         geometry::detail::indexed_point_view<Geometry, Index> const& p)
0105     {
0106         return p.template get<Dimension>();
0107     }
0108 
0109     static inline void set(
0110         geometry::detail::indexed_point_view<Geometry, Index> & p,
0111         coordinate_type const& value)
0112     {
0113         p.template set<Dimension>(value);
0114     }
0115 };
0116 
0117 } // namespace traits
0118 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0119 
0120 }} // namespace boost::geometry
0121 
0122 
0123 #endif // BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP