blob: 6be63f42b4a2f38227572032b3db432d227355e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
#ifdef BOOST_GEOMETRY_USE_MSM
# include <boost/geometry/algorithms/detail/overlay/msm_state.hpp>
#endif
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
#if ! defined(BOOST_GEOMETRY_USE_MSM)
class visit_info
{
private :
static const int NONE = 0;
static const int STARTED = 1;
static const int VISITED = 2;
static const int FINISHED = 3;
static const int REJECTED = 4;
int m_visit_code;
bool m_rejected;
public:
inline visit_info()
: m_visit_code(0)
, m_rejected(false)
{}
inline void set_visited() { m_visit_code = VISITED; }
inline void set_started() { m_visit_code = STARTED; }
inline void set_finished() { m_visit_code = FINISHED; }
inline void set_rejected()
{
m_visit_code = REJECTED;
m_rejected = true;
}
inline bool none() const { return m_visit_code == NONE; }
inline bool visited() const { return m_visit_code == VISITED; }
inline bool started() const { return m_visit_code == STARTED; }
inline bool finished() const { return m_visit_code == FINISHED; }
inline bool rejected() const { return m_rejected; }
inline void clear()
{
if (! rejected())
{
m_visit_code = NONE;
}
}
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
friend std::ostream& operator<<(std::ostream &os, visit_info const& v)
{
if (v.m_visit_code != 0)
{
os << " VIS: " << int(v.m_visit_code);
}
return os;
}
#endif
};
#else
class visit_info
{
private :
#ifndef USE_MSM_MINI
mutable
#endif
traverse_state state;
public :
inline visit_info()
{
state.start();
}
inline void set_none() { state.process_event(none()); } // Not Yet Implemented!
inline void set_visited() { state.process_event(visit()); }
inline void set_started() { state.process_event(starting()); }
inline void set_finished() { state.process_event(finish()); }
#ifdef USE_MSM_MINI
inline bool none() const { return state.flag_none(); }
inline bool visited() const { return state.flag_visited(); }
inline bool started() const { return state.flag_started(); }
#else
inline bool none() const { return state.is_flag_active<is_init>(); }
inline bool visited() const { return state.is_flag_active<is_visited>(); }
inline bool started() const { return state.is_flag_active<is_started>(); }
#endif
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
friend std::ostream& operator<<(std::ostream &os, visit_info const& v)
{
return os;
}
#endif
};
#endif
}} // namespace detail::overlay
#endif //DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
|