Back to home page

EIC code displayed by LXR

 
 

    


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

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-2020.
0008 // Modifications copyright (c) 2015-2020, 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_STRATEGY_CARTESIAN_ENVELOPE_HPP
0022 #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_HPP
0023 
0024 #include <boost/range/begin.hpp>
0025 #include <boost/range/end.hpp>
0026 
0027 #include <boost/geometry/algorithms/detail/envelope/initialize.hpp>
0028 
0029 #include <boost/geometry/strategy/cartesian/envelope_box.hpp>
0030 #include <boost/geometry/strategy/cartesian/envelope_segment.hpp>
0031 #include <boost/geometry/strategy/cartesian/expand_box.hpp>
0032 #include <boost/geometry/strategy/cartesian/expand_segment.hpp>
0033 
0034 namespace boost { namespace geometry
0035 {
0036 
0037 namespace strategy { namespace envelope
0038 {
0039 
0040 template <typename CalculationType = void>
0041 class cartesian
0042 {
0043 public:
0044     typedef cartesian_tag cs_tag;
0045 
0046     // Linestring, Ring, Polygon
0047 
0048     template <typename Range>
0049     static inline typename boost::range_iterator<Range const>::type begin(Range const& range)
0050     {
0051         return boost::begin(range);
0052     }
0053 
0054     template <typename Range>
0055     static inline typename boost::range_iterator<Range const>::type end(Range const& range)
0056     {
0057         return boost::end(range);
0058     }
0059 
0060     // MultiLinestring, MultiPolygon
0061 
0062     template <typename Box>
0063     struct multi_state
0064     {
0065         multi_state()
0066             : m_initialized(false)
0067         {}
0068 
0069         void apply(Box const& single_box)
0070         {
0071             if (! m_initialized)
0072             {
0073                 m_box = single_box;
0074                 m_initialized = true;
0075             }
0076             else
0077             {
0078                 strategy::expand::cartesian_box::apply(m_box, single_box);
0079             }
0080         }
0081 
0082         void result(Box & box)
0083         {
0084             if (m_initialized)
0085             {
0086                 box = m_box;
0087             }
0088             else
0089             {
0090                 geometry::detail::envelope::initialize<Box, 0, dimension<Box>::value>::apply(box);
0091             }
0092         }
0093 
0094     private:
0095         bool m_initialized;
0096         Box m_box;
0097     };
0098 };
0099 
0100 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0101 
0102 namespace services
0103 {
0104 
0105 template <typename Tag, typename CalculationType>
0106 struct default_strategy<Tag, cartesian_tag, CalculationType>
0107 {
0108     typedef strategy::envelope::cartesian<CalculationType> type;
0109 };
0110 
0111 } // namespace services
0112 
0113 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0114 
0115 
0116 }} // namespace strategy::envelope
0117 
0118 }} //namepsace boost::geometry
0119 
0120 #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_HPP