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.
9 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13 // Distributed under the Boost Software License, Version 1.0.
14 // (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_BOX_HPP
18 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_BOX_HPP
23 #include <boost/mpl/assert.hpp>
24 #include <boost/type_traits/is_same.hpp>
26 #include <boost/geometry/core/coordinate_dimension.hpp>
27 #include <boost/geometry/core/tags.hpp>
29 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
30 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
32 #include <boost/geometry/algorithms/detail/expand/indexed.hpp>
34 #include <boost/geometry/algorithms/dispatch/expand.hpp>
37 namespace boost { namespace geometry
40 #ifndef DOXYGEN_NO_DETAIL
41 namespace detail { namespace expand
45 struct box_on_spheroid
47 template <typename BoxOut, typename BoxIn>
48 static inline void apply(BoxOut& box_out, BoxIn const& box_in)
50 // normalize both boxes and convert box-in to be of type of box-out
52 detail::envelope::envelope_box_on_spheroid::apply(box_in, mbrs[0]);
53 detail::envelope::envelope_box_on_spheroid::apply(box_out, mbrs[1]);
55 // compute the envelope of the two boxes
56 detail::envelope::envelope_range_of_boxes::apply(mbrs, box_out);
61 }} // namespace detail::expand
62 #endif // DOXYGEN_NO_DETAIL
64 #ifndef DOXYGEN_NO_DISPATCH
69 // Box + box -> new box containing two input boxes
72 typename BoxOut, typename BoxIn,
73 typename StrategyLess, typename StrategyGreater,
74 typename CSTagOut, typename CSTag
79 StrategyLess, StrategyGreater,
82 > : detail::expand::expand_indexed
84 0, dimension<BoxIn>::value, StrategyLess, StrategyGreater
87 BOOST_MPL_ASSERT_MSG((boost::is_same<CSTagOut, CSTag>::value),
88 COORDINATE_SYSTEMS_MUST_BE_THE_SAME,
89 (types<CSTagOut, CSTag>()));
94 typename BoxOut, typename BoxIn,
95 typename StrategyLess, typename StrategyGreater
100 StrategyLess, StrategyGreater,
102 spherical_equatorial_tag, spherical_equatorial_tag
103 > : detail::expand::box_on_spheroid
108 typename BoxOut, typename BoxIn,
109 typename StrategyLess, typename StrategyGreater
114 StrategyLess, StrategyGreater,
116 geographic_tag, geographic_tag
117 > : detail::expand::box_on_spheroid
121 } // namespace dispatch
122 #endif // DOXYGEN_NO_DISPATCH
124 }} // namespace boost::geometry
126 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP