annotate DEPENDENCIES/generic/include/boost/geometry/geometries/box.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 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14 #ifndef BOOST_GEOMETRY_GEOMETRIES_BOX_HPP
Chris@16 15 #define BOOST_GEOMETRY_GEOMETRIES_BOX_HPP
Chris@16 16
Chris@16 17 #include <cstddef>
Chris@16 18
Chris@16 19 #include <boost/concept/assert.hpp>
Chris@16 20
Chris@16 21 #include <boost/geometry/algorithms/convert.hpp>
Chris@16 22 #include <boost/geometry/geometries/concepts/point_concept.hpp>
Chris@16 23
Chris@16 24
Chris@16 25
Chris@16 26 namespace boost { namespace geometry
Chris@16 27 {
Chris@16 28
Chris@16 29 namespace model
Chris@16 30 {
Chris@16 31
Chris@16 32
Chris@16 33 /*!
Chris@16 34 \brief Class box: defines a box made of two describing points
Chris@16 35 \ingroup geometries
Chris@16 36 \details Box is always described by a min_corner() and a max_corner() point. If another
Chris@16 37 rectangle is used, use linear_ring or polygon.
Chris@16 38 \note Boxes are for selections and for calculating the envelope of geometries. Not all algorithms
Chris@16 39 are implemented for box. Boxes are also used in Spatial Indexes.
Chris@16 40 \tparam Point point type. The box takes a point type as template parameter.
Chris@16 41 The point type can be any point type.
Chris@16 42 It can be 2D but can also be 3D or more dimensional.
Chris@16 43 The box can also take a latlong point type as template parameter.
Chris@16 44 */
Chris@16 45
Chris@16 46 template<typename Point>
Chris@16 47 class box
Chris@16 48 {
Chris@16 49 BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
Chris@16 50
Chris@16 51 public:
Chris@16 52
Chris@16 53 inline box() {}
Chris@16 54
Chris@16 55 /*!
Chris@16 56 \brief Constructor taking the minimum corner point and the maximum corner point
Chris@16 57 */
Chris@16 58 inline box(Point const& min_corner, Point const& max_corner)
Chris@16 59 {
Chris@16 60 geometry::convert(min_corner, m_min_corner);
Chris@16 61 geometry::convert(max_corner, m_max_corner);
Chris@16 62 }
Chris@16 63
Chris@16 64 inline Point const& min_corner() const { return m_min_corner; }
Chris@16 65 inline Point const& max_corner() const { return m_max_corner; }
Chris@16 66
Chris@16 67 inline Point& min_corner() { return m_min_corner; }
Chris@16 68 inline Point& max_corner() { return m_max_corner; }
Chris@16 69
Chris@16 70 private:
Chris@16 71
Chris@16 72 Point m_min_corner;
Chris@16 73 Point m_max_corner;
Chris@16 74 };
Chris@16 75
Chris@16 76
Chris@16 77 } // namespace model
Chris@16 78
Chris@16 79
Chris@16 80 // Traits specializations for box above
Chris@16 81 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 82 namespace traits
Chris@16 83 {
Chris@16 84
Chris@16 85 template <typename Point>
Chris@16 86 struct tag<model::box<Point> >
Chris@16 87 {
Chris@16 88 typedef box_tag type;
Chris@16 89 };
Chris@16 90
Chris@16 91 template <typename Point>
Chris@16 92 struct point_type<model::box<Point> >
Chris@16 93 {
Chris@16 94 typedef Point type;
Chris@16 95 };
Chris@16 96
Chris@16 97 template <typename Point, std::size_t Dimension>
Chris@16 98 struct indexed_access<model::box<Point>, min_corner, Dimension>
Chris@16 99 {
Chris@16 100 typedef typename geometry::coordinate_type<Point>::type coordinate_type;
Chris@16 101
Chris@16 102 static inline coordinate_type get(model::box<Point> const& b)
Chris@16 103 {
Chris@16 104 return geometry::get<Dimension>(b.min_corner());
Chris@16 105 }
Chris@16 106
Chris@16 107 static inline void set(model::box<Point>& b, coordinate_type const& value)
Chris@16 108 {
Chris@16 109 geometry::set<Dimension>(b.min_corner(), value);
Chris@16 110 }
Chris@16 111 };
Chris@16 112
Chris@16 113 template <typename Point, std::size_t Dimension>
Chris@16 114 struct indexed_access<model::box<Point>, max_corner, Dimension>
Chris@16 115 {
Chris@16 116 typedef typename geometry::coordinate_type<Point>::type coordinate_type;
Chris@16 117
Chris@16 118 static inline coordinate_type get(model::box<Point> const& b)
Chris@16 119 {
Chris@16 120 return geometry::get<Dimension>(b.max_corner());
Chris@16 121 }
Chris@16 122
Chris@16 123 static inline void set(model::box<Point>& b, coordinate_type const& value)
Chris@16 124 {
Chris@16 125 geometry::set<Dimension>(b.max_corner(), value);
Chris@16 126 }
Chris@16 127 };
Chris@16 128
Chris@16 129 } // namespace traits
Chris@16 130 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 131
Chris@16 132 }} // namespace boost::geometry
Chris@16 133
Chris@16 134 #endif // BOOST_GEOMETRY_GEOMETRIES_BOX_HPP