Chris@102
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@102
|
2
|
Chris@102
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@102
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@102
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@102
|
6
|
Chris@102
|
7 // This file was modified by Oracle on 2014.
|
Chris@102
|
8 // Modifications copyright (c) 2014 Oracle and/or its affiliates.
|
Chris@102
|
9
|
Chris@102
|
10 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@102
|
11 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@102
|
12
|
Chris@102
|
13 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@102
|
14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
15 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
16
|
Chris@102
|
17 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
Chris@102
|
18
|
Chris@102
|
19 #ifndef BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
Chris@102
|
20 #define BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|
Chris@102
|
21
|
Chris@102
|
22
|
Chris@102
|
23 #include <boost/range/begin.hpp>
|
Chris@102
|
24 #include <boost/range/end.hpp>
|
Chris@102
|
25 #include <boost/range/iterator.hpp>
|
Chris@102
|
26 #include <boost/mpl/if.hpp>
|
Chris@102
|
27 #include <boost/type_traits/is_const.hpp>
|
Chris@102
|
28 #include <boost/geometry/views/detail/range_type.hpp>
|
Chris@102
|
29 #include <boost/geometry/views/reversible_view.hpp>
|
Chris@102
|
30 #include <boost/geometry/views/closeable_view.hpp>
|
Chris@102
|
31 #include <boost/geometry/util/order_as_direction.hpp>
|
Chris@102
|
32
|
Chris@102
|
33 namespace boost { namespace geometry {
|
Chris@102
|
34
|
Chris@102
|
35
|
Chris@102
|
36 #ifndef DOXYGEN_NO_DETAIL
|
Chris@102
|
37
|
Chris@102
|
38 namespace detail {
|
Chris@102
|
39
|
Chris@102
|
40 template <typename Geometry>
|
Chris@102
|
41 struct normalized_view
|
Chris@102
|
42 {
|
Chris@102
|
43 static const bool is_const = boost::is_const<Geometry>::value;
|
Chris@102
|
44
|
Chris@102
|
45 //typedef typename ring_type<Geometry>::type ring_type;
|
Chris@102
|
46
|
Chris@102
|
47 typedef typename detail::range_type<Geometry>::type range_type;
|
Chris@102
|
48
|
Chris@102
|
49 typedef typename
|
Chris@102
|
50 boost::mpl::if_c
|
Chris@102
|
51 <
|
Chris@102
|
52 is_const,
|
Chris@102
|
53 range_type const,
|
Chris@102
|
54 range_type
|
Chris@102
|
55 >::type range;
|
Chris@102
|
56
|
Chris@102
|
57 typedef typename
|
Chris@102
|
58 reversible_view
|
Chris@102
|
59 <
|
Chris@102
|
60 range,
|
Chris@102
|
61 order_as_direction
|
Chris@102
|
62 <
|
Chris@102
|
63 geometry::point_order<Geometry>::value
|
Chris@102
|
64 >::value
|
Chris@102
|
65 >::type reversible_type;
|
Chris@102
|
66
|
Chris@102
|
67 typedef typename
|
Chris@102
|
68 boost::mpl::if_c
|
Chris@102
|
69 <
|
Chris@102
|
70 is_const,
|
Chris@102
|
71 reversible_type const,
|
Chris@102
|
72 reversible_type
|
Chris@102
|
73 >::type reversible;
|
Chris@102
|
74
|
Chris@102
|
75 typedef typename
|
Chris@102
|
76 closeable_view
|
Chris@102
|
77 <
|
Chris@102
|
78 reversible,
|
Chris@102
|
79 geometry::closure<Geometry>::value
|
Chris@102
|
80 >::type closeable_type;
|
Chris@102
|
81
|
Chris@102
|
82 typedef typename
|
Chris@102
|
83 boost::mpl::if_c
|
Chris@102
|
84 <
|
Chris@102
|
85 is_const,
|
Chris@102
|
86 closeable_type const,
|
Chris@102
|
87 closeable_type
|
Chris@102
|
88 >::type closeable;
|
Chris@102
|
89
|
Chris@102
|
90 explicit inline normalized_view(range & r)
|
Chris@102
|
91 : m_reversible(r)
|
Chris@102
|
92 , m_closeable(m_reversible)
|
Chris@102
|
93 {}
|
Chris@102
|
94
|
Chris@102
|
95 typedef typename boost::range_iterator<closeable>::type iterator;
|
Chris@102
|
96 typedef typename boost::range_const_iterator<closeable>::type const_iterator;
|
Chris@102
|
97
|
Chris@102
|
98 inline const_iterator begin() const { return boost::begin(m_closeable); }
|
Chris@102
|
99 inline const_iterator end() const { return boost::end(m_closeable); }
|
Chris@102
|
100
|
Chris@102
|
101 inline iterator begin() { return boost::begin(m_closeable); }
|
Chris@102
|
102 inline iterator end() { return boost::end(m_closeable); }
|
Chris@102
|
103
|
Chris@102
|
104 private:
|
Chris@102
|
105 reversible_type m_reversible;
|
Chris@102
|
106 closeable_type m_closeable;
|
Chris@102
|
107 };
|
Chris@102
|
108
|
Chris@102
|
109 } // namespace detail
|
Chris@102
|
110
|
Chris@102
|
111 #endif // DOXYGEN_NO_DETAIL
|
Chris@102
|
112
|
Chris@102
|
113
|
Chris@102
|
114 }} // namespace boost::geometry
|
Chris@102
|
115
|
Chris@102
|
116
|
Chris@102
|
117 #endif // BOOST_GEOMETRY_VIEWS_DETAIL_NORMALIZED_VIEW_HPP
|