File indexing completed on 2025-01-18 09:36:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
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
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
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 }
0112
0113 #endif
0114
0115
0116 }}
0117
0118 }}
0119
0120 #endif