]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/overlay/traverse.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / overlay / traverse.hpp
CommitLineData
7c673cae
FG
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_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
10#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
11
12#include <cstddef>
13
14#include <boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp>
15#include <boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp>
16#include <boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp>
17
18
19namespace boost { namespace geometry
20{
21
22#ifndef DOXYGEN_NO_DETAIL
23namespace detail { namespace overlay
24{
25
26
27/*!
28 \brief Traverses through intersection points / geometries
29 \ingroup overlay
30 */
31template
32<
33 bool Reverse1, bool Reverse2,
34 typename Geometry1,
35 typename Geometry2,
36 overlay_type OverlayType,
37 typename Backtrack = backtrack_check_self_intersections<Geometry1, Geometry2>
38>
39class traverse
40{
41
42 template <typename Turns>
43 static void reset_visits(Turns& turns)
44 {
45 for (typename boost::range_iterator<Turns>::type
46 it = boost::begin(turns);
47 it != boost::end(turns);
48 ++it)
49 {
50 for (int i = 0; i < 2; i++)
51 {
52 it->operations[i].visited.reset();
53 }
54 }
55 }
56
57
58public :
59 template
60 <
61 typename RobustPolicy,
62 typename Turns,
63 typename Rings,
64 typename Visitor,
65 typename Clusters
66 >
67 static inline void apply(Geometry1 const& geometry1,
68 Geometry2 const& geometry2,
69 RobustPolicy const& robust_policy,
70 Turns& turns, Rings& rings,
71 Clusters& clusters,
72 Visitor& visitor)
73 {
74 traversal_switch_detector
75 <
76 Reverse1, Reverse2, OverlayType,
77 Geometry1, Geometry2,
78 Turns, Clusters,
79 RobustPolicy, Visitor
80 > switch_detector(geometry1, geometry2, turns, clusters,
81 robust_policy, visitor);
82
83 switch_detector.iterate();
84 reset_visits(turns);
85
86 traversal_ring_creator
87 <
88 Reverse1, Reverse2, OverlayType,
89 Geometry1, Geometry2,
90 Turns, Clusters,
91 RobustPolicy, Visitor,
92 Backtrack
93 > trav(geometry1, geometry2, turns, clusters,
94 robust_policy, visitor);
95
96 std::size_t finalized_ring_size = boost::size(rings);
97
98 typename Backtrack::state_type state;
99
100 for (int pass = 0; pass < 2; pass++)
101 {
102 trav.iterate(rings, finalized_ring_size, state, pass);
103 }
104 }
105};
106
107}} // namespace detail::overlay
108#endif // DOXYGEN_NO_DETAIL
109
110}} // namespace boost::geometry
111
112#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP