Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:51

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-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_STRATEGY_CARTESIAN_EXPAND_POINT_HPP
0023 #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_EXPAND_POINT_HPP
0024 
0025 #include <cstddef>
0026 #include <functional>
0027 
0028 #include <boost/geometry/core/access.hpp>
0029 #include <boost/geometry/core/coordinate_dimension.hpp>
0030 #include <boost/geometry/core/coordinate_system.hpp>
0031 #include <boost/geometry/core/coordinate_type.hpp>
0032 #include <boost/geometry/core/tags.hpp>
0033 
0034 #include <boost/geometry/util/select_coordinate_type.hpp>
0035 
0036 #include <boost/geometry/strategy/expand.hpp>
0037 
0038 namespace boost { namespace geometry
0039 {
0040 
0041 namespace strategy { namespace expand
0042 {
0043 
0044 #ifndef DOXYGEN_NO_DETAIL
0045 namespace detail
0046 {
0047 
0048 template <std::size_t Dimension, std::size_t DimensionCount>
0049 struct point_loop
0050 {
0051     template <typename Box, typename Point>
0052     static inline void apply(Box& box, Point const& source)
0053     {
0054         typedef typename select_coordinate_type
0055             <
0056                 Point, Box
0057             >::type coordinate_type;
0058 
0059         std::less<coordinate_type> less;
0060         std::greater<coordinate_type> greater;
0061 
0062         coordinate_type const coord = get<Dimension>(source);
0063 
0064         if (less(coord, get<min_corner, Dimension>(box)))
0065         {
0066             set<min_corner, Dimension>(box, coord);
0067         }
0068 
0069         if (greater(coord, get<max_corner, Dimension>(box)))
0070         {
0071             set<max_corner, Dimension>(box, coord);
0072         }
0073 
0074         point_loop<Dimension + 1, DimensionCount>::apply(box, source);
0075     }
0076 };
0077 
0078 
0079 template <std::size_t DimensionCount>
0080 struct point_loop<DimensionCount, DimensionCount>
0081 {
0082     template <typename Box, typename Point>
0083     static inline void apply(Box&, Point const&) {}
0084 };
0085 
0086 
0087 } // namespace detail
0088 #endif // DOXYGEN_NO_DETAIL
0089 
0090 
0091 struct cartesian_point
0092 {
0093     template <typename Box, typename Point>
0094     static void apply(Box & box, Point const& point)
0095     {
0096         expand::detail::point_loop
0097             <
0098                 0, dimension<Point>::value
0099             >::apply(box, point);
0100     }
0101 };
0102 
0103 
0104 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0105 
0106 namespace services
0107 {
0108 
0109 template <typename CalculationType>
0110 struct default_strategy<point_tag, cartesian_tag, CalculationType>
0111 {
0112     typedef cartesian_point type;
0113 };
0114 
0115 
0116 } // namespace services
0117 
0118 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0119 
0120 
0121 }} // namespace strategy::expand
0122 
0123 }} // namespace boost::geometry
0124 
0125 #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_EXPAND_POINT_HPP