Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:51

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_RANGE_HPP
0011 #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_RANGE_HPP
0012 
0013 #include <boost/range/begin.hpp>
0014 #include <boost/range/end.hpp>
0015 
0016 #include <boost/geometry/algorithms/detail/envelope/initialize.hpp>
0017 #include <boost/geometry/strategy/cartesian/envelope_point.hpp>
0018 #include <boost/geometry/strategy/cartesian/expand_point.hpp>
0019 
0020 namespace boost { namespace geometry
0021 {
0022 
0023 namespace strategy { namespace envelope
0024 {
0025 
0026 class cartesian_range
0027 {
0028 public:
0029     template <typename Range, typename Box>
0030     static inline void apply(Range const& range, Box& mbr)
0031     {
0032         auto it = boost::begin(range);
0033         auto const end = boost::end(range);
0034         if (it == end)
0035         {
0036             // initialize box (assign inverse)
0037             geometry::detail::envelope::initialize<Box>::apply(mbr);
0038             return;
0039         }
0040 
0041         // initialize box with the first point
0042         envelope::cartesian_point::apply(*it, mbr);
0043 
0044         // consider now the remaining points in the range (if any)
0045         for (++it; it != end; ++it)
0046         {
0047             expand::cartesian_point::apply(mbr, *it);
0048         }
0049     }
0050 };
0051 
0052 }} // namespace strategy::envelope
0053 
0054 }} //namepsace boost::geometry
0055 
0056 #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_RANGE_HPP