Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:05

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2015-2021.
0008 // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
0009 
0010 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0011 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0012 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0013 
0014 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0015 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0016 
0017 // Distributed under the Boost Software License, Version 1.0.
0018 // (See accompanying file LICENSE_1_0.txt or copy at
0019 // http://www.boost.org/LICENSE_1_0.txt)
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 // implementation for simple ranges
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 // implementation for multi-ranges
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 }} // namespace detail::envelope
0093 #endif // DOXYGEN_NO_DETAIL
0094 
0095 
0096 }} // namespace boost::geometry
0097 
0098 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_RANGE_HPP