Back to home page

EIC code displayed by LXR

 
 

    


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

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_BOXES_HPP
0011 #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_BOXES_HPP
0012 
0013 #include <boost/geometry/algorithms/detail/envelope/initialize.hpp>
0014 #include <boost/geometry/strategy/cartesian/expand_box.hpp>
0015 
0016 namespace boost { namespace geometry
0017 {
0018 
0019 namespace strategy { namespace envelope
0020 {
0021 
0022 class cartesian_boxes
0023 {
0024 public:
0025     template <typename Box>
0026     class state
0027     {
0028         friend cartesian_boxes;
0029 
0030         Box m_box;
0031         bool m_initialized = false;
0032     };
0033 
0034     template <typename Box>
0035     static void apply(state<Box> & st, Box const& box)
0036     {
0037         if (! st.m_initialized)
0038         {
0039             st.m_box = box;
0040             st.m_initialized = true;
0041         }
0042         else
0043         {
0044             strategy::expand::cartesian_box::apply(st.m_box, box);
0045         }
0046     }
0047 
0048     template <typename Box>
0049     static void result(state<Box> const& st, Box & box)
0050     {
0051         if (st.m_initialized)
0052         {
0053             box = st.m_box;
0054         }
0055         else
0056         {
0057             geometry::detail::envelope::initialize<Box, 0, dimension<Box>::value>::apply(box);
0058         }
0059     }
0060 };
0061 
0062 }} // namespace strategy::envelope
0063 
0064 }} //namepsace boost::geometry
0065 
0066 #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_BOXES_HPP