Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0005 
0006 // Distributed under the Boost Software License, Version 1.0.
0007 // (See accompanying file LICENSE_1_0.txt or copy at
0008 // http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_GEOMETRY_COLLECTION_HPP
0011 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_GEOMETRY_COLLECTION_HPP
0012 
0013 
0014 #include <boost/geometry/algorithms/detail/visit.hpp>
0015 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
0016 #include <boost/geometry/algorithms/is_empty.hpp>
0017 
0018 #include <boost/geometry/core/tags.hpp>
0019 
0020 
0021 namespace boost { namespace geometry
0022 {
0023 
0024 
0025 #ifndef DOXYGEN_NO_DISPATCH
0026 namespace dispatch
0027 {
0028 
0029 
0030 template <typename Collection>
0031 struct envelope<Collection, geometry_collection_tag>
0032 {
0033     template <typename Geometry, typename Box, typename Strategies>
0034     static inline void apply(Geometry const& geometry,
0035                              Box& mbr,
0036                              Strategies const& strategies)
0037     {
0038         using strategy_t = decltype(strategies.envelope(geometry, mbr));
0039 
0040         typename strategy_t::template state<Box> state;
0041         detail::visit_breadth_first([&](auto const& g)
0042         {
0043             if (! geometry::is_empty(g))
0044             {
0045                 Box b;
0046                 envelope<util::remove_cref_t<decltype(g)>>::apply(g, b, strategies);
0047                 strategy_t::apply(state, b);
0048             }
0049             return true;
0050         }, geometry);
0051         strategy_t::result(state, mbr);
0052     }
0053 };
0054 
0055 
0056 } // namespace dispatch
0057 #endif // DOXYGEN_NO_DISPATCH
0058 
0059 
0060 }} // namespace boost::geometry
0061 
0062 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_GEOMETRY_COLLECTION_HPP