File indexing completed on 2025-01-18 09:35:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_AREAL_HPP
0013 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_AREAL_HPP
0014
0015 #include <boost/geometry/core/cs.hpp>
0016 #include <boost/geometry/core/tags.hpp>
0017
0018 #include <boost/geometry/iterators/segment_iterator.hpp>
0019
0020 #include <boost/geometry/algorithms/detail/envelope/range.hpp>
0021 #include <boost/geometry/algorithms/detail/envelope/linear.hpp>
0022
0023 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
0024
0025 #include <boost/geometry/views/reversible_view.hpp>
0026
0027 namespace boost { namespace geometry
0028 {
0029
0030 #ifndef DOXYGEN_NO_DETAIL
0031 namespace detail { namespace envelope
0032 {
0033
0034
0035 struct envelope_hole
0036 {
0037 template <typename Range, typename Box, typename Strategies>
0038 static inline void apply(Range const& range, Box& mbr, Strategies const& strategies)
0039 {
0040
0041
0042 detail::clockwise_view
0043 <
0044 Range const,
0045 geometry::point_order<Range>::value == counterclockwise
0046 ? clockwise : counterclockwise
0047 > view(range);
0048 strategies.envelope(range, mbr).apply(view, mbr);
0049 }
0050 };
0051
0052 struct envelope_polygon
0053 {
0054 template <typename Polygon, typename Box, typename Strategy>
0055 static inline void apply(Polygon const& polygon, Box& mbr, Strategy const& strategy)
0056 {
0057 typename ring_return_type<Polygon const>::type ext_ring
0058 = exterior_ring(polygon);
0059
0060 if (geometry::is_empty(ext_ring))
0061 {
0062
0063 using strategy_t = decltype(strategy.envelope(detail::dummy_multi_polygon(),
0064 detail::dummy_box()));
0065
0066 envelope_multi_range
0067 <
0068 envelope_hole
0069 >::template apply<strategy_t>(interior_rings(polygon), mbr, strategy);
0070 }
0071 else
0072 {
0073
0074 envelope_range::apply(ext_ring, mbr, strategy);
0075 }
0076 }
0077 };
0078
0079
0080 }}
0081 #endif
0082
0083 #ifndef DOXYGEN_NO_DISPATCH
0084 namespace dispatch
0085 {
0086
0087
0088 template <typename Ring>
0089 struct envelope<Ring, ring_tag>
0090 : detail::envelope::envelope_range
0091 {};
0092
0093 template <typename Polygon>
0094 struct envelope<Polygon, polygon_tag>
0095 : detail::envelope::envelope_polygon
0096 {};
0097
0098 template <typename MultiPolygon>
0099 struct envelope<MultiPolygon, multi_polygon_tag>
0100 : detail::envelope::envelope_multi_range
0101 <
0102 detail::envelope::envelope_polygon
0103 >
0104 {};
0105
0106
0107 }
0108 #endif
0109
0110
0111 }}
0112
0113 #endif