1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 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 7 // This file was modified by Oracle on 2015-2019. 8 // Modifications copyright (c) 2015-2019, Oracle and/or its affiliates. 9 10 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle 11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle 12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 13 14 // Distributed under the Boost Software License, Version 1.0. 15 // (See accompanying file LICENSE_1_0.txt or copy at 16 // http://www.boost.org/LICENSE_1_0.txt) 17 18 #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_BOX_HPP 19 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_BOX_HPP 20 21 #include <cstddef> 22 23 #include <boost/geometry/core/access.hpp> 24 #include <boost/geometry/core/coordinate_dimension.hpp> 25 #include <boost/geometry/core/tags.hpp> 26 27 #include <boost/geometry/views/detail/indexed_point_view.hpp> 28 29 #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp> 30 #include <boost/geometry/algorithms/detail/normalize.hpp> 31 #include <boost/geometry/algorithms/detail/envelope/transform_units.hpp> 32 33 #include <boost/geometry/algorithms/dispatch/envelope.hpp> 34 35 #include <boost/geometry/strategies/cartesian/expand_box.hpp> 36 37 #include <boost/geometry/strategies/envelope.hpp> 38 39 40 namespace boost { namespace geometry 41 { 42 43 #ifndef DOXYGEN_NO_DETAIL 44 namespace detail { namespace envelope 45 { 46 47 48 template 49 < 50 std::size_t Index, 51 std::size_t Dimension, 52 std::size_t DimensionCount 53 > 54 struct envelope_indexed_box 55 { 56 template <typename BoxIn, typename BoxOut> applyboost::geometry::detail::envelope::envelope_indexed_box57 static inline void apply(BoxIn const& box_in, BoxOut& mbr) 58 { 59 detail::indexed_point_view<BoxIn const, Index> box_in_corner(box_in); 60 detail::indexed_point_view<BoxOut, Index> mbr_corner(mbr); 61 62 detail::conversion::point_to_point 63 < 64 detail::indexed_point_view<BoxIn const, Index>, 65 detail::indexed_point_view<BoxOut, Index>, 66 Dimension, 67 DimensionCount 68 >::apply(box_in_corner, mbr_corner); 69 } 70 }; 71 72 73 }} // namespace detail::envelope 74 #endif // DOXYGEN_NO_DETAIL 75 76 77 namespace strategy { namespace envelope 78 { 79 80 81 struct cartesian_box 82 { 83 typedef cartesian_tag cs_tag; 84 85 typedef strategy::expand::cartesian_box box_expand_strategy_type; 86 get_box_expand_strategyboost::geometry::strategy::envelope::cartesian_box87 static inline box_expand_strategy_type get_box_expand_strategy() 88 { 89 return box_expand_strategy_type(); 90 } 91 92 template<typename BoxIn, typename BoxOut> applyboost::geometry::strategy::envelope::cartesian_box93 static inline void apply(BoxIn const& box_in, BoxOut& mbr) 94 { 95 geometry::detail::envelope::envelope_indexed_box 96 < 97 min_corner, 0, dimension<BoxIn>::value 98 >::apply(box_in, mbr); 99 100 geometry::detail::envelope::envelope_indexed_box 101 < 102 max_corner, 0, dimension<BoxIn>::value 103 >::apply(box_in, mbr); 104 } 105 }; 106 107 108 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 109 110 namespace services 111 { 112 113 template <typename CalculationType> 114 struct default_strategy<box_tag, cartesian_tag, CalculationType> 115 { 116 typedef strategy::envelope::cartesian_box type; 117 }; 118 119 } 120 121 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 122 123 124 }} // namespace strategy::envelope 125 126 127 }} // namespace boost::geometry 128 129 130 #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_ENVELOPE_BOX_HPP 131