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-2018.
9 // Modifications copyright (c) 2015-2018, 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_STRATEGIES_CARTESIAN_EXPAND_POINT_HPP
23 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_EXPAND_POINT_HPP
28 #include <boost/geometry/core/access.hpp>
29 #include <boost/geometry/core/coordinate_dimension.hpp>
30 #include <boost/geometry/core/coordinate_system.hpp>
31 #include <boost/geometry/core/coordinate_type.hpp>
32 #include <boost/geometry/core/tags.hpp>
34 #include <boost/geometry/util/select_coordinate_type.hpp>
36 #include <boost/geometry/strategies/expand.hpp>
38 namespace boost { namespace geometry
41 namespace strategy { namespace expand
44 #ifndef DOXYGEN_NO_DETAIL
48 template <std::size_t Dimension, std::size_t DimensionCount>
51 template <typename Box, typename Point>
52 static inline void apply(Box& box, Point const& source)
54 typedef typename select_coordinate_type
57 >::type coordinate_type;
59 std::less<coordinate_type> less;
60 std::greater<coordinate_type> greater;
62 coordinate_type const coord = get<Dimension>(source);
64 if (less(coord, get<min_corner, Dimension>(box)))
66 set<min_corner, Dimension>(box, coord);
69 if (greater(coord, get<max_corner, Dimension>(box)))
71 set<max_corner, Dimension>(box, coord);
74 point_loop<Dimension + 1, DimensionCount>::apply(box, source);
79 template <std::size_t DimensionCount>
80 struct point_loop<DimensionCount, DimensionCount>
82 template <typename Box, typename Point>
83 static inline void apply(Box&, Point const&) {}
88 #endif // DOXYGEN_NO_DETAIL
91 struct cartesian_point
93 template <typename Box, typename Point>
94 static void apply(Box & box, Point const& point)
96 expand::detail::point_loop
98 0, dimension<Point>::value
104 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
109 template <typename CalculationType>
110 struct default_strategy<point_tag, cartesian_tag, CalculationType>
112 typedef cartesian_point type;
116 } // namespace services
118 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
121 }} // namespace strategy::expand
123 }} // namespace boost::geometry
125 #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_EXPAND_POINT_HPP