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.
7 // This file was modified by Oracle on 2015, 2016.
8 // Modifications copyright (c) 2015-2016, Oracle and/or its affiliates.
10 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
16 // Distributed under the Boost Software License, Version 1.0.
17 // (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_IMPLEMENTATION_HPP
21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_IMPLEMENTATION_HPP
23 #include <boost/geometry/core/exterior_ring.hpp>
24 #include <boost/geometry/core/interior_rings.hpp>
25 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/algorithms/is_empty.hpp>
29 #include <boost/geometry/algorithms/detail/envelope/box.hpp>
30 #include <boost/geometry/algorithms/detail/envelope/linear.hpp>
31 #include <boost/geometry/algorithms/detail/envelope/multipoint.hpp>
32 #include <boost/geometry/algorithms/detail/envelope/point.hpp>
33 #include <boost/geometry/algorithms/detail/envelope/range.hpp>
34 #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
36 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
39 namespace boost { namespace geometry
42 #ifndef DOXYGEN_NO_DETAIL
43 namespace detail { namespace envelope
47 struct envelope_polygon
49 template <typename Polygon, typename Box, typename Strategy>
50 static inline void apply(Polygon const& polygon, Box& mbr, Strategy const& strategy)
52 typename ring_return_type<Polygon const>::type ext_ring
53 = exterior_ring(polygon);
55 if (geometry::is_empty(ext_ring))
57 // if the exterior ring is empty, consider the interior rings
61 >::apply(interior_rings(polygon), mbr, strategy);
65 // otherwise, consider only the exterior ring
66 envelope_range::apply(ext_ring, mbr, strategy);
72 }} // namespace detail::envelope
73 #endif // DOXYGEN_NO_DETAIL
75 #ifndef DOXYGEN_NO_DISPATCH
80 template <typename Ring>
81 struct envelope<Ring, ring_tag>
82 : detail::envelope::envelope_range
86 template <typename Polygon>
87 struct envelope<Polygon, polygon_tag>
88 : detail::envelope::envelope_polygon
92 template <typename MultiPolygon>
93 struct envelope<MultiPolygon, multi_polygon_tag>
94 : detail::envelope::envelope_multi_range
96 detail::envelope::envelope_polygon
101 } // namespace dispatch
102 #endif // DOXYGEN_NO_DISPATCH
105 }} // namespace boost::geometry
107 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_IMPLEMENTATION_HPP