annotate DEPENDENCIES/generic/include/boost/geometry/views/detail/indexed_point_view.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@102 2
Chris@102 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@102 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@102 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@102 6 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland
Chris@102 7
Chris@102 8 // Use, modification and distribution is subject to the Boost Software License,
Chris@102 9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@102 10 // http://www.boost.org/LICENSE_1_0.txt)
Chris@102 11
Chris@102 12 #ifndef BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
Chris@102 13 #define BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP
Chris@102 14
Chris@102 15 #include <cstddef>
Chris@102 16
Chris@102 17 #include <boost/geometry/core/access.hpp>
Chris@102 18 #include <boost/geometry/core/coordinate_type.hpp>
Chris@102 19 #include <boost/geometry/core/coordinate_system.hpp>
Chris@102 20 #include <boost/geometry/core/coordinate_dimension.hpp>
Chris@102 21 #include <boost/geometry/util/math.hpp>
Chris@102 22
Chris@102 23 namespace boost { namespace geometry
Chris@102 24 {
Chris@102 25
Chris@102 26 namespace detail
Chris@102 27 {
Chris@102 28
Chris@102 29 template <typename Geometry, std::size_t Index>
Chris@102 30 class indexed_point_view
Chris@102 31 {
Chris@102 32 indexed_point_view & operator=(indexed_point_view const&);
Chris@102 33
Chris@102 34 public:
Chris@102 35 typedef typename geometry::point_type<Geometry>::type point_type;
Chris@102 36 typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
Chris@102 37
Chris@102 38 indexed_point_view(Geometry & geometry)
Chris@102 39 : m_geometry(geometry)
Chris@102 40 {}
Chris@102 41
Chris@102 42 template <std::size_t Dimension>
Chris@102 43 inline coordinate_type get() const
Chris@102 44 {
Chris@102 45 return geometry::get<Index, Dimension>(m_geometry);
Chris@102 46 }
Chris@102 47
Chris@102 48 template <std::size_t Dimension>
Chris@102 49 inline void set(coordinate_type const& value)
Chris@102 50 {
Chris@102 51 geometry::set<Index, Dimension>(m_geometry, value);
Chris@102 52 }
Chris@102 53
Chris@102 54 private:
Chris@102 55 Geometry & m_geometry;
Chris@102 56 };
Chris@102 57
Chris@102 58 }
Chris@102 59
Chris@102 60 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@102 61 namespace traits
Chris@102 62 {
Chris@102 63
Chris@102 64 template <typename Geometry, std::size_t Index>
Chris@102 65 struct tag< detail::indexed_point_view<Geometry, Index> >
Chris@102 66 {
Chris@102 67 typedef point_tag type;
Chris@102 68 };
Chris@102 69
Chris@102 70 template <typename Geometry, std::size_t Index>
Chris@102 71 struct coordinate_type< detail::indexed_point_view<Geometry, Index> >
Chris@102 72 {
Chris@102 73 typedef typename geometry::coordinate_type<Geometry>::type type;
Chris@102 74 };
Chris@102 75
Chris@102 76 template <typename Geometry, std::size_t Index>
Chris@102 77 struct coordinate_system< detail::indexed_point_view<Geometry, Index> >
Chris@102 78 {
Chris@102 79 typedef typename geometry::coordinate_system<Geometry>::type type;
Chris@102 80 };
Chris@102 81
Chris@102 82 template <typename Geometry, std::size_t Index>
Chris@102 83 struct dimension< detail::indexed_point_view<Geometry, Index> >
Chris@102 84 : geometry::dimension<Geometry>
Chris@102 85 {};
Chris@102 86
Chris@102 87 template<typename Geometry, std::size_t Index, std::size_t Dimension>
Chris@102 88 struct access< detail::indexed_point_view<Geometry, Index>, Dimension >
Chris@102 89 {
Chris@102 90 typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
Chris@102 91
Chris@102 92 static inline coordinate_type get(
Chris@102 93 detail::indexed_point_view<Geometry, Index> const& p)
Chris@102 94 {
Chris@102 95 return p.template get<Dimension>();
Chris@102 96 }
Chris@102 97
Chris@102 98 static inline void set(
Chris@102 99 detail::indexed_point_view<Geometry, Index> & p,
Chris@102 100 coordinate_type const& value)
Chris@102 101 {
Chris@102 102 p.template set<Dimension>(value);
Chris@102 103 }
Chris@102 104 };
Chris@102 105
Chris@102 106 } // namespace traits
Chris@102 107 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@102 108
Chris@102 109 }} // namespace boost::geometry
Chris@102 110
Chris@102 111
Chris@102 112 #endif // BOOST_GEOMETRY_VIEWS_DETAIL_INDEXED_POINT_VIEW_HPP