Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:43:10

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0004 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0008 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 
0015 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP
0016 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP
0017 
0018 #include <cstddef>
0019 
0020 #include <boost/concept_check.hpp>
0021 #include <boost/core/ignore_unused.hpp>
0022 
0023 #include <boost/geometry/core/access.hpp>
0024 #include <boost/geometry/core/coordinate_dimension.hpp>
0025 #include <boost/geometry/core/point_type.hpp>
0026 
0027 #include <boost/geometry/geometries/concepts/concept_type.hpp>
0028 
0029 
0030 namespace boost { namespace geometry { namespace concepts
0031 {
0032 
0033 template <typename Geometry>
0034 class Box
0035 {
0036 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0037     using point_type = point_type_t<Geometry>;
0038 
0039     template
0040     <
0041         std::size_t Index,
0042         std::size_t Dimension,
0043         std::size_t DimensionCount
0044     >
0045     struct dimension_checker
0046     {
0047         static void apply()
0048         {
0049             Geometry* b = 0;
0050             geometry::set<Index, Dimension>(*b, geometry::get<Index, Dimension>(*b));
0051             dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
0052         }
0053     };
0054 
0055     template <std::size_t Index, std::size_t DimensionCount>
0056     struct dimension_checker<Index, DimensionCount, DimensionCount>
0057     {
0058         static void apply() {}
0059     };
0060 
0061 public :
0062     BOOST_CONCEPT_USAGE(Box)
0063     {
0064         static const std::size_t n = dimension<Geometry>::type::value;
0065         dimension_checker<min_corner, 0, n>::apply();
0066         dimension_checker<max_corner, 0, n>::apply();
0067     }
0068 #endif
0069 };
0070 
0071 
0072 /*!
0073 \brief Box concept (const version)
0074 \ingroup const_concepts
0075 \details The ConstBox concept apply the same as the Box concept,
0076 but does not apply write access.
0077 */
0078 template <typename Geometry>
0079 class ConstBox
0080 {
0081 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0082     using point_type = point_type_t<Geometry>;
0083     using coordinate_type = coordinate_type_t<Geometry>;
0084 
0085     template
0086     <
0087         std::size_t Index,
0088         std::size_t Dimension,
0089         std::size_t DimensionCount
0090     >
0091     struct dimension_checker
0092     {
0093         static void apply()
0094         {
0095             const Geometry* b = 0;
0096             coordinate_type coord(geometry::get<Index, Dimension>(*b));
0097             boost::ignore_unused(coord);
0098             dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
0099         }
0100     };
0101 
0102     template <std::size_t Index, std::size_t DimensionCount>
0103     struct dimension_checker<Index, DimensionCount, DimensionCount>
0104     {
0105         static void apply() {}
0106     };
0107 
0108 public :
0109     BOOST_CONCEPT_USAGE(ConstBox)
0110     {
0111         static const std::size_t n = dimension<Geometry>::type::value;
0112         dimension_checker<min_corner, 0, n>::apply();
0113         dimension_checker<max_corner, 0, n>::apply();
0114     }
0115 #endif
0116 };
0117 
0118 
0119 template <typename Geometry>
0120 struct concept_type<Geometry, box_tag>
0121 {
0122     using type = Box<Geometry>;
0123 };
0124 
0125 template <typename Geometry>
0126 struct concept_type<Geometry const, box_tag>
0127 {
0128     using type = ConstBox<Geometry>;
0129 };
0130 
0131 
0132 }}} // namespace boost::geometry::concepts
0133 
0134 
0135 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP