1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
8 // This file was modified by Oracle on 2015, 2016, 2017.
9 // Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
11 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
12 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
15 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
16 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
18 // Distributed under the Boost Software License, Version 1.0.
19 // (See accompanying file LICENSE_1_0.txt or copy at
20 // http://www.boost.org/LICENSE_1_0.txt)
22 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP
23 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP
28 #include <boost/geometry/core/access.hpp>
29 #include <boost/geometry/core/tags.hpp>
31 #include <boost/geometry/util/select_coordinate_type.hpp>
33 #include <boost/geometry/algorithms/dispatch/expand.hpp>
36 namespace boost { namespace geometry
39 #ifndef DOXYGEN_NO_DETAIL
40 namespace detail { namespace expand
47 std::size_t Dimension, std::size_t DimensionCount
51 template <typename Box, typename Geometry, typename Strategy>
52 static inline void apply(Box& box, Geometry const& source, Strategy const& strategy)
54 typedef typename select_coordinate_type
58 >::type coordinate_type;
60 coordinate_type const coord = get<Index, Dimension>(source);
62 std::less<coordinate_type> less;
63 std::greater<coordinate_type> greater;
65 if (less(coord, get<min_corner, Dimension>(box)))
67 set<min_corner, Dimension>(box, coord);
70 if (greater(coord, get<max_corner, Dimension>(box)))
72 set<max_corner, Dimension>(box, coord);
77 Index, Dimension + 1, DimensionCount
78 >::apply(box, source, strategy);
83 template <std::size_t Index, std::size_t DimensionCount>
86 Index, DimensionCount, DimensionCount
89 template <typename Box, typename Geometry, typename Strategy>
90 static inline void apply(Box&, Geometry const&, Strategy const&) {}
95 // Changes a box such that the other box is also contained by the box
96 template <std::size_t Dimension, std::size_t DimensionCount>
99 template <typename Box, typename Geometry, typename Strategy>
100 static inline void apply(Box& box,
101 Geometry const& geometry,
102 Strategy const& strategy)
106 0, Dimension, DimensionCount
107 >::apply(box, geometry, strategy);
111 1, Dimension, DimensionCount
112 >::apply(box, geometry, strategy);
117 }} // namespace detail::expand
118 #endif // DOXYGEN_NO_DETAIL
121 }} // namespace boost::geometry
123 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP