]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | ||
3 | // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. | |
4 | // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. | |
5 | // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. | |
6 | ||
7 | // This file was modified by Oracle on 2015-2020. | |
8 | // Modifications copyright (c) 2015-2020, Oracle and/or its affiliates. | |
9 | ||
10 | // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle | |
11 | // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle | |
12 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle | |
13 | ||
14 | // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library | |
15 | // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. | |
16 | ||
17 | // Distributed under the Boost Software License, Version 1.0. | |
18 | // (See accompanying file LICENSE_1_0.txt or copy at | |
19 | // http://www.boost.org/LICENSE_1_0.txt) | |
20 | ||
21 | #ifndef BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_HPP | |
22 | #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_HPP | |
23 | ||
24 | #include <boost/range/begin.hpp> | |
25 | #include <boost/range/end.hpp> | |
26 | ||
27 | #include <boost/geometry/algorithms/detail/envelope/initialize.hpp> | |
28 | ||
29 | #include <boost/geometry/strategy/cartesian/envelope_box.hpp> | |
30 | #include <boost/geometry/strategy/cartesian/envelope_segment.hpp> | |
31 | #include <boost/geometry/strategy/cartesian/expand_box.hpp> | |
32 | #include <boost/geometry/strategy/cartesian/expand_segment.hpp> | |
33 | ||
34 | namespace boost { namespace geometry | |
35 | { | |
36 | ||
37 | namespace strategy { namespace envelope | |
38 | { | |
39 | ||
40 | template <typename CalculationType = void> | |
41 | class cartesian | |
42 | { | |
43 | public: | |
44 | typedef cartesian_tag cs_tag; | |
45 | ||
46 | // Linestring, Ring, Polygon | |
47 | ||
48 | template <typename Range> | |
49 | static inline typename boost::range_iterator<Range const>::type begin(Range const& range) | |
50 | { | |
51 | return boost::begin(range); | |
52 | } | |
53 | ||
54 | template <typename Range> | |
55 | static inline typename boost::range_iterator<Range const>::type end(Range const& range) | |
56 | { | |
57 | return boost::end(range); | |
58 | } | |
59 | ||
60 | // MultiLinestring, MultiPolygon | |
61 | ||
62 | template <typename Box> | |
63 | struct multi_state | |
64 | { | |
65 | multi_state() | |
66 | : m_initialized(false) | |
67 | {} | |
68 | ||
69 | void apply(Box const& single_box) | |
70 | { | |
71 | if (! m_initialized) | |
72 | { | |
73 | m_box = single_box; | |
74 | m_initialized = true; | |
75 | } | |
76 | else | |
77 | { | |
78 | strategy::expand::cartesian_box::apply(m_box, single_box); | |
79 | } | |
80 | } | |
81 | ||
82 | void result(Box & box) | |
83 | { | |
84 | if (m_initialized) | |
85 | { | |
86 | box = m_box; | |
87 | } | |
88 | else | |
89 | { | |
90 | geometry::detail::envelope::initialize<Box, 0, dimension<Box>::value>::apply(box); | |
91 | } | |
92 | } | |
93 | ||
94 | private: | |
95 | bool m_initialized; | |
96 | Box m_box; | |
97 | }; | |
98 | }; | |
99 | ||
100 | #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
101 | ||
102 | namespace services | |
103 | { | |
104 | ||
105 | template <typename Tag, typename CalculationType> | |
106 | struct default_strategy<Tag, cartesian_tag, CalculationType> | |
107 | { | |
108 | typedef strategy::envelope::cartesian<CalculationType> type; | |
109 | }; | |
110 | ||
111 | } // namespace services | |
112 | ||
113 | #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS | |
114 | ||
115 | ||
116 | }} // namespace strategy::envelope | |
117 | ||
118 | }} //namepsace boost::geometry | |
119 | ||
120 | #endif // BOOST_GEOMETRY_STRATEGY_CARTESIAN_ENVELOPE_HPP |