Back to home page

EIC code displayed by LXR

 
 

    


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

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 Samuel Debionne, Grenoble, France.
0007 
0008 // This file was modified by Oracle on 2015, 2016, 2017, 2018.
0009 // Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
0010 
0011 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0012 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0013 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0014 
0015 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0016 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0017 
0018 // Distributed under the Boost Software License, Version 1.0.
0019 // (See accompanying file LICENSE_1_0.txt or copy at
0020 // http://www.boost.org/LICENSE_1_0.txt)
0021 
0022 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP
0023 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP
0024 
0025 #include <cstddef>
0026 #include <functional>
0027 
0028 #include <boost/geometry/core/access.hpp>
0029 #include <boost/geometry/core/tags.hpp>
0030 
0031 #include <boost/geometry/util/select_coordinate_type.hpp>
0032 
0033 #include <boost/geometry/algorithms/dispatch/expand.hpp>
0034 
0035 
0036 namespace boost { namespace geometry
0037 {
0038 
0039 #ifndef DOXYGEN_NO_DETAIL
0040 namespace detail { namespace expand
0041 {
0042 
0043 
0044 template
0045 <
0046     std::size_t Index,
0047     std::size_t Dimension, std::size_t DimensionCount
0048 >
0049 struct indexed_loop
0050 {
0051     template <typename Box, typename Geometry>
0052     static inline void apply(Box& box, Geometry const& source)
0053     {
0054         typedef typename select_coordinate_type
0055                 <
0056                     Box,
0057                     Geometry
0058                 >::type coordinate_type;
0059 
0060         coordinate_type const coord = get<Index, Dimension>(source);
0061 
0062         std::less<coordinate_type> less;
0063         std::greater<coordinate_type> greater;
0064 
0065         if (less(coord, get<min_corner, Dimension>(box)))
0066         {
0067             set<min_corner, Dimension>(box, coord);
0068         }
0069 
0070         if (greater(coord, get<max_corner, Dimension>(box)))
0071         {
0072             set<max_corner, Dimension>(box, coord);
0073         }
0074 
0075         indexed_loop
0076             <
0077                 Index, Dimension + 1, DimensionCount
0078             >::apply(box, source);
0079     }
0080 };
0081 
0082 
0083 template <std::size_t Index, std::size_t DimensionCount>
0084 struct indexed_loop
0085     <
0086         Index, DimensionCount, DimensionCount
0087     >
0088 {
0089     template <typename Box, typename Geometry>
0090     static inline void apply(Box&, Geometry const&) {}
0091 };
0092 
0093 
0094 
0095 // Changes a box such that the other box is also contained by the box
0096 template <std::size_t Dimension, std::size_t DimensionCount>
0097 struct expand_indexed
0098 {
0099     template <typename Box, typename Geometry>
0100     static inline void apply(Box& box, Geometry const& geometry)
0101     {
0102         indexed_loop
0103             <
0104                 0, Dimension, DimensionCount
0105             >::apply(box, geometry);
0106 
0107         indexed_loop
0108             <
0109                 1, Dimension, DimensionCount
0110             >::apply(box, geometry);
0111     }
0112 };
0113 
0114 
0115 }} // namespace detail::expand
0116 #endif // DOXYGEN_NO_DETAIL
0117 
0118 
0119 }} // namespace boost::geometry
0120 
0121 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP