72be5ddbf46df3bd7b28f63848b88ffffc6fa140
[platform/upstream/boost.git] / boost / geometry / multi / algorithms / detail / overlay / copy_segment_point.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP
10 #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP
11
12
13 #include <boost/range.hpp>
14
15 #include <boost/geometry/multi/core/tags.hpp>
16 #include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
17
18
19 namespace boost { namespace geometry
20 {
21
22
23 #ifndef DOXYGEN_NO_DETAIL
24 namespace detail { namespace copy_segments
25 {
26
27
28 template
29 <
30     typename MultiGeometry,
31     typename SegmentIdentifier,
32     typename PointOut,
33     typename Policy
34 >
35 struct copy_segment_point_multi
36 {
37     static inline bool apply(MultiGeometry const& multi,
38                 SegmentIdentifier const& seg_id, bool second,
39                 PointOut& point)
40     {
41
42         BOOST_ASSERT
43             (
44                 seg_id.multi_index >= 0
45                 && seg_id.multi_index < int(boost::size(multi))
46             );
47
48         // Call the single-version
49         return Policy::apply(multi[seg_id.multi_index], seg_id, second, point);
50     }
51 };
52
53
54 }} // namespace detail::copy_segments
55 #endif // DOXYGEN_NO_DETAIL
56
57
58 #ifndef DOXYGEN_NO_DISPATCH
59 namespace dispatch
60 {
61
62
63 template
64 <
65     typename MultiGeometry,
66     bool Reverse,
67     typename SegmentIdentifier,
68     typename PointOut
69 >
70 struct copy_segment_point
71     <
72         multi_polygon_tag,
73         MultiGeometry,
74         Reverse,
75         SegmentIdentifier,
76         PointOut
77     >
78     : detail::copy_segments::copy_segment_point_multi
79         <
80             MultiGeometry,
81             SegmentIdentifier,
82             PointOut,
83             detail::copy_segments::copy_segment_point_polygon
84                 <
85                     typename boost::range_value<MultiGeometry>::type,
86                     Reverse,
87                     SegmentIdentifier,
88                     PointOut
89                 >
90         >
91 {};
92
93
94 } // namespace dispatch
95 #endif // DOXYGEN_NO_DISPATCH
96
97
98 }} // namespace boost::geometry
99
100
101 #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP