File indexing completed on 2025-01-18 09:35:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_RANGE_HPP
0022 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_RANGE_HPP
0023
0024 #include <iterator>
0025 #include <vector>
0026
0027 #include <boost/range/begin.hpp>
0028 #include <boost/range/end.hpp>
0029
0030 #include <boost/geometry/algorithms/is_empty.hpp>
0031 #include <boost/geometry/algorithms/detail/dummy_geometries.hpp>
0032 #include <boost/geometry/algorithms/detail/envelope/initialize.hpp>
0033 #include <boost/geometry/algorithms/detail/expand/box.hpp>
0034 #include <boost/geometry/algorithms/detail/expand/point.hpp>
0035 #include <boost/geometry/algorithms/detail/expand/segment.hpp>
0036
0037 #include <boost/geometry/core/coordinate_dimension.hpp>
0038
0039 namespace boost { namespace geometry
0040 {
0041
0042 #ifndef DOXYGEN_NO_DETAIL
0043 namespace detail { namespace envelope
0044 {
0045
0046
0047
0048 struct envelope_range
0049 {
0050 template <typename Range, typename Box, typename Strategies>
0051 static inline void apply(Range const& range, Box& mbr, Strategies const& strategies)
0052 {
0053 strategies.envelope(range, mbr).apply(range, mbr);
0054 }
0055 };
0056
0057
0058
0059 template <typename EnvelopePolicy>
0060 struct envelope_multi_range
0061 {
0062 template <typename MultiRange, typename Box, typename Strategies>
0063 static inline void apply(MultiRange const& multirange,
0064 Box& mbr,
0065 Strategies const& strategies)
0066 {
0067 using strategy_t = decltype(strategies.envelope(multirange, mbr));
0068 apply<strategy_t>(multirange, mbr, strategies);
0069 }
0070
0071 template <typename Strategy, typename MultiRange, typename Box, typename Strategies>
0072 static inline void apply(MultiRange const& multirange,
0073 Box& mbr,
0074 Strategies const& strategies)
0075 {
0076 typename Strategy::template state<Box> state;
0077 auto const end = boost::end(multirange);
0078 for (auto it = boost::begin(multirange); it != end; ++it)
0079 {
0080 if (! geometry::is_empty(*it))
0081 {
0082 Box helper_mbr;
0083 EnvelopePolicy::apply(*it, helper_mbr, strategies);
0084 Strategy::apply(state, helper_mbr);
0085 }
0086 }
0087 Strategy::result(state, mbr);
0088 }
0089 };
0090
0091
0092 }}
0093 #endif
0094
0095
0096 }}
0097
0098 #endif