Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:27

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     typedef typename point_type<Geometry>::type point_type;
0038 
0039 
0040     template
0041     <
0042         std::size_t Index,
0043         std::size_t Dimension,
0044         std::size_t DimensionCount
0045     >
0046     struct dimension_checker
0047     {
0048         static void apply()
0049         {
0050             Geometry* b = 0;
0051             geometry::set<Index, Dimension>(*b, geometry::get<Index, Dimension>(*b));
0052             dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
0053         }
0054     };
0055 
0056     template <std::size_t Index, std::size_t DimensionCount>
0057     struct dimension_checker<Index, DimensionCount, DimensionCount>
0058     {
0059         static void apply() {}
0060     };
0061 
0062 public :
0063     BOOST_CONCEPT_USAGE(Box)
0064     {
0065         static const std::size_t n = dimension<Geometry>::type::value;
0066         dimension_checker<min_corner, 0, n>::apply();
0067         dimension_checker<max_corner, 0, n>::apply();
0068     }
0069 #endif
0070 };
0071 
0072 
0073 /*!
0074 \brief Box concept (const version)
0075 \ingroup const_concepts
0076 \details The ConstBox concept apply the same as the Box concept,
0077 but does not apply write access.
0078 */
0079 template <typename Geometry>
0080 class ConstBox
0081 {
0082 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0083     typedef typename point_type<Geometry>::type point_type;
0084     typedef typename coordinate_type<Geometry>::type coordinate_type;
0085 
0086     template
0087     <
0088         std::size_t Index,
0089         std::size_t Dimension,
0090         std::size_t DimensionCount
0091     >
0092     struct dimension_checker
0093     {
0094         static void apply()
0095         {
0096             const Geometry* b = 0;
0097             coordinate_type coord(geometry::get<Index, Dimension>(*b));
0098             boost::ignore_unused(coord);
0099             dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
0100         }
0101     };
0102 
0103     template <std::size_t Index, std::size_t DimensionCount>
0104     struct dimension_checker<Index, DimensionCount, DimensionCount>
0105     {
0106         static void apply() {}
0107     };
0108 
0109 public :
0110     BOOST_CONCEPT_USAGE(ConstBox)
0111     {
0112         static const std::size_t n = dimension<Geometry>::type::value;
0113         dimension_checker<min_corner, 0, n>::apply();
0114         dimension_checker<max_corner, 0, n>::apply();
0115     }
0116 #endif
0117 };
0118 
0119 
0120 template <typename Geometry>
0121 struct concept_type<Geometry, box_tag>
0122 {
0123     using type = Box<Geometry>;
0124 };
0125 
0126 template <typename Geometry>
0127 struct concept_type<Geometry const, box_tag>
0128 {
0129     using type = ConstBox<Geometry>;
0130 };
0131 
0132 
0133 }}} // namespace boost::geometry::concepts
0134 
0135 
0136 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP