Chris@16
|
1 /*
|
Chris@16
|
2 Copyright 2008 Intel Corporation
|
Chris@16
|
3
|
Chris@16
|
4 Use, modification and distribution are subject to the Boost Software License,
|
Chris@16
|
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
6 http://www.boost.org/LICENSE_1_0.txt).
|
Chris@16
|
7 */
|
Chris@16
|
8 #ifndef BOOST_POLYGON_POLYGON_90_SET_VIEW_HPP
|
Chris@16
|
9 #define BOOST_POLYGON_POLYGON_90_SET_VIEW_HPP
|
Chris@16
|
10 namespace boost { namespace polygon{
|
Chris@16
|
11 struct operator_provides_storage {};
|
Chris@16
|
12 struct operator_requires_copy {};
|
Chris@16
|
13
|
Chris@16
|
14 template <typename value_type, typename arg_type>
|
Chris@16
|
15 inline void insert_into_view_arg(value_type& dest, const arg_type& arg, orientation_2d orient);
|
Chris@16
|
16
|
Chris@16
|
17 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
18 class polygon_90_set_view;
|
Chris@16
|
19
|
Chris@16
|
20 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
21 struct polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> > {
|
Chris@16
|
22 typedef typename polygon_90_set_view<ltype, rtype, op_type>::coordinate_type coordinate_type;
|
Chris@16
|
23 typedef typename polygon_90_set_view<ltype, rtype, op_type>::iterator_type iterator_type;
|
Chris@16
|
24 typedef typename polygon_90_set_view<ltype, rtype, op_type>::operator_arg_type operator_arg_type;
|
Chris@16
|
25
|
Chris@16
|
26 static inline iterator_type begin(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set);
|
Chris@16
|
27 static inline iterator_type end(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set);
|
Chris@16
|
28
|
Chris@16
|
29 static inline orientation_2d orient(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set);
|
Chris@16
|
30
|
Chris@16
|
31 static inline bool clean(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set);
|
Chris@16
|
32
|
Chris@16
|
33 static inline bool sorted(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set);
|
Chris@16
|
34 };
|
Chris@16
|
35
|
Chris@16
|
36 template <typename value_type, typename ltype, typename rtype, typename op_type>
|
Chris@16
|
37 struct compute_90_set_value {
|
Chris@16
|
38 static
|
Chris@16
|
39 void value(value_type& output_, const ltype& lvalue_, const rtype& rvalue_, orientation_2d orient_) {
|
Chris@16
|
40 value_type linput_(orient_);
|
Chris@16
|
41 value_type rinput_(orient_);
|
Chris@16
|
42 orientation_2d orient_l = polygon_90_set_traits<ltype>::orient(lvalue_);
|
Chris@16
|
43 orientation_2d orient_r = polygon_90_set_traits<rtype>::orient(rvalue_);
|
Chris@16
|
44 //std::cout << "compute_90_set_value-0 orientations (left, right, out):\t" << orient_l.to_int()
|
Chris@16
|
45 // << "," << orient_r.to_int() << "," << orient_.to_int() << std::endl;
|
Chris@16
|
46 insert_into_view_arg(linput_, lvalue_, orient_l);
|
Chris@16
|
47 insert_into_view_arg(rinput_, rvalue_, orient_r);
|
Chris@16
|
48 output_.applyBooleanBinaryOp(linput_.begin(), linput_.end(),
|
Chris@16
|
49 rinput_.begin(), rinput_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
50 }
|
Chris@16
|
51 };
|
Chris@16
|
52
|
Chris@16
|
53 template <typename value_type, typename lcoord, typename rcoord, typename op_type>
|
Chris@16
|
54 struct compute_90_set_value<value_type, polygon_90_set_data<lcoord>, polygon_90_set_data<rcoord>, op_type> {
|
Chris@16
|
55 static
|
Chris@16
|
56 void value(value_type& output_, const polygon_90_set_data<lcoord>& lvalue_,
|
Chris@16
|
57 const polygon_90_set_data<rcoord>& rvalue_, orientation_2d orient_) {
|
Chris@16
|
58 orientation_2d orient_l = lvalue_.orient();
|
Chris@16
|
59 orientation_2d orient_r = rvalue_.orient();
|
Chris@16
|
60 value_type linput_(orient_);
|
Chris@16
|
61 value_type rinput_(orient_);
|
Chris@16
|
62 //std::cout << "compute_90_set_value-1 orientations (left, right, out):\t" << orient_l.to_int()
|
Chris@16
|
63 // << "," << orient_r.to_int() << "," << orient_.to_int() << std::endl;
|
Chris@16
|
64 if((orient_ == orient_l) && (orient_== orient_r)){ // assume that most of the time this condition is met
|
Chris@16
|
65 lvalue_.sort();
|
Chris@16
|
66 rvalue_.sort();
|
Chris@16
|
67 output_.applyBooleanBinaryOp(lvalue_.begin(), lvalue_.end(),
|
Chris@16
|
68 rvalue_.begin(), rvalue_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
69 }else if((orient_ != orient_l) && (orient_!= orient_r)){ // both the orientations are not equal to input
|
Chris@16
|
70 // easier way is to ignore the input orientation and use the input data's orientation, but not done so
|
Chris@16
|
71 insert_into_view_arg(linput_, lvalue_, orient_l);
|
Chris@16
|
72 insert_into_view_arg(rinput_, rvalue_, orient_r);
|
Chris@16
|
73 output_.applyBooleanBinaryOp(linput_.begin(), linput_.end(),
|
Chris@16
|
74 rinput_.begin(), rinput_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
75 }else if(orient_ != orient_l){ // left hand side orientation is different
|
Chris@16
|
76 insert_into_view_arg(linput_, lvalue_, orient_l);
|
Chris@16
|
77 rvalue_.sort();
|
Chris@16
|
78 output_.applyBooleanBinaryOp(linput_.begin(), linput_.end(),
|
Chris@16
|
79 rvalue_.begin(), rvalue_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
80 } else if(orient_ != orient_r){ // right hand side orientation is different
|
Chris@16
|
81 insert_into_view_arg(rinput_, rvalue_, orient_r);
|
Chris@16
|
82 lvalue_.sort();
|
Chris@16
|
83 output_.applyBooleanBinaryOp(lvalue_.begin(), lvalue_.end(),
|
Chris@16
|
84 rinput_.begin(), rinput_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
85 }
|
Chris@16
|
86 }
|
Chris@16
|
87 };
|
Chris@16
|
88
|
Chris@16
|
89 template <typename value_type, typename lcoord, typename rtype, typename op_type>
|
Chris@16
|
90 struct compute_90_set_value<value_type, polygon_90_set_data<lcoord>, rtype, op_type> {
|
Chris@16
|
91 static
|
Chris@16
|
92 void value(value_type& output_, const polygon_90_set_data<lcoord>& lvalue_,
|
Chris@16
|
93 const rtype& rvalue_, orientation_2d orient_) {
|
Chris@16
|
94 value_type rinput_(orient_);
|
Chris@16
|
95 lvalue_.sort();
|
Chris@16
|
96 orientation_2d orient_r = polygon_90_set_traits<rtype>::orient(rvalue_);
|
Chris@16
|
97 //std::cout << "compute_90_set_value-2 orientations (right, out):\t" << orient_r.to_int()
|
Chris@16
|
98 // << "," << orient_.to_int() << std::endl;
|
Chris@16
|
99 insert_into_view_arg(rinput_, rvalue_, orient_r);
|
Chris@16
|
100 output_.applyBooleanBinaryOp(lvalue_.begin(), lvalue_.end(),
|
Chris@16
|
101 rinput_.begin(), rinput_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
102 }
|
Chris@16
|
103 };
|
Chris@16
|
104
|
Chris@16
|
105 template <typename value_type, typename ltype, typename rcoord, typename op_type>
|
Chris@16
|
106 struct compute_90_set_value<value_type, ltype, polygon_90_set_data<rcoord>, op_type> {
|
Chris@16
|
107 static
|
Chris@16
|
108 void value(value_type& output_, const ltype& lvalue_,
|
Chris@16
|
109 const polygon_90_set_data<rcoord>& rvalue_, orientation_2d orient_) {
|
Chris@16
|
110 value_type linput_(orient_);
|
Chris@16
|
111 orientation_2d orient_l = polygon_90_set_traits<ltype>::orient(lvalue_);
|
Chris@16
|
112 insert_into_view_arg(linput_, lvalue_, orient_l);
|
Chris@16
|
113 rvalue_.sort();
|
Chris@16
|
114 //std::cout << "compute_90_set_value-3 orientations (left, out):\t" << orient_l.to_int()
|
Chris@16
|
115 // << "," << orient_.to_int() << std::endl;
|
Chris@16
|
116
|
Chris@16
|
117 output_.applyBooleanBinaryOp(linput_.begin(), linput_.end(),
|
Chris@16
|
118 rvalue_.begin(), rvalue_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
119 }
|
Chris@16
|
120 };
|
Chris@16
|
121
|
Chris@16
|
122 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
123 class polygon_90_set_view {
|
Chris@16
|
124 public:
|
Chris@16
|
125 typedef typename polygon_90_set_traits<ltype>::coordinate_type coordinate_type;
|
Chris@16
|
126 typedef polygon_90_set_data<coordinate_type> value_type;
|
Chris@16
|
127 typedef typename value_type::iterator_type iterator_type;
|
Chris@16
|
128 typedef polygon_90_set_view operator_arg_type;
|
Chris@16
|
129 private:
|
Chris@16
|
130 const ltype& lvalue_;
|
Chris@16
|
131 const rtype& rvalue_;
|
Chris@16
|
132 orientation_2d orient_;
|
Chris@16
|
133 op_type op_;
|
Chris@16
|
134 mutable value_type output_;
|
Chris@16
|
135 mutable bool evaluated_;
|
Chris@16
|
136 polygon_90_set_view& operator=(const polygon_90_set_view&);
|
Chris@16
|
137 public:
|
Chris@16
|
138 polygon_90_set_view(const ltype& lvalue,
|
Chris@16
|
139 const rtype& rvalue,
|
Chris@16
|
140 orientation_2d orient,
|
Chris@16
|
141 op_type op) :
|
Chris@16
|
142 lvalue_(lvalue), rvalue_(rvalue), orient_(orient), op_(op), output_(orient), evaluated_(false) {}
|
Chris@16
|
143
|
Chris@16
|
144 // get iterator to begin vertex data
|
Chris@16
|
145 private:
|
Chris@16
|
146 const value_type& value() const {
|
Chris@16
|
147 if(!evaluated_) {
|
Chris@16
|
148 evaluated_ = true;
|
Chris@16
|
149 compute_90_set_value<value_type, ltype, rtype, op_type>::value(output_, lvalue_, rvalue_, orient_);
|
Chris@16
|
150 }
|
Chris@16
|
151 return output_;
|
Chris@16
|
152 }
|
Chris@16
|
153 public:
|
Chris@16
|
154 iterator_type begin() const { return value().begin(); }
|
Chris@16
|
155 iterator_type end() const { return value().end(); }
|
Chris@16
|
156
|
Chris@16
|
157 orientation_2d orient() const { return orient_; }
|
Chris@16
|
158 bool dirty() const { return false; } //result of a boolean is clean
|
Chris@16
|
159 bool sorted() const { return true; } //result of a boolean is sorted
|
Chris@16
|
160
|
Chris@16
|
161 // template <typename input_iterator_type>
|
Chris@16
|
162 // void set(input_iterator_type input_begin, input_iterator_type input_end,
|
Chris@16
|
163 // orientation_2d orient) const {
|
Chris@16
|
164 // orient_ = orient;
|
Chris@16
|
165 // output_.clear();
|
Chris@16
|
166 // output_.insert(output_.end(), input_begin, input_end);
|
Chris@16
|
167 // polygon_sort(output_.begin(), output_.end());
|
Chris@16
|
168 // }
|
Chris@16
|
169 void sort() const {} //is always sorted
|
Chris@16
|
170 };
|
Chris@16
|
171
|
Chris@16
|
172 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
173 struct geometry_concept<polygon_90_set_view<ltype, rtype, op_type> > {
|
Chris@16
|
174 typedef polygon_90_set_concept type;
|
Chris@16
|
175 };
|
Chris@16
|
176
|
Chris@16
|
177 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
178 typename polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::iterator_type
|
Chris@16
|
179 polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::
|
Chris@16
|
180 begin(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set) {
|
Chris@16
|
181 return polygon_set.begin();
|
Chris@16
|
182 }
|
Chris@16
|
183 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
184 typename polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::iterator_type
|
Chris@16
|
185 polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::
|
Chris@16
|
186 end(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set) {
|
Chris@16
|
187 return polygon_set.end();
|
Chris@16
|
188 }
|
Chris@16
|
189 // template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
190 // template <typename input_iterator_type>
|
Chris@16
|
191 // void polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::
|
Chris@16
|
192 // set(polygon_90_set_view<ltype, rtype, op_type>& polygon_set,
|
Chris@16
|
193 // input_iterator_type input_begin, input_iterator_type input_end,
|
Chris@16
|
194 // orientation_2d orient) {
|
Chris@16
|
195 // polygon_set.set(input_begin, input_end, orient);
|
Chris@16
|
196 // }
|
Chris@16
|
197 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
198 orientation_2d polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::
|
Chris@16
|
199 orient(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set) {
|
Chris@16
|
200 return polygon_set.orient(); }
|
Chris@16
|
201 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
202 bool polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::
|
Chris@16
|
203 clean(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set) {
|
Chris@16
|
204 return true; }
|
Chris@16
|
205 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
206 bool polygon_90_set_traits<polygon_90_set_view<ltype, rtype, op_type> >::
|
Chris@16
|
207 sorted(const polygon_90_set_view<ltype, rtype, op_type>& polygon_set) {
|
Chris@16
|
208 return true; }
|
Chris@16
|
209
|
Chris@16
|
210 template <typename value_type, typename arg_type>
|
Chris@16
|
211 inline void insert_into_view_arg(value_type& dest, const arg_type& arg, orientation_2d orient) {
|
Chris@16
|
212 typedef typename polygon_90_set_traits<arg_type>::iterator_type literator;
|
Chris@16
|
213 literator itr1, itr2;
|
Chris@16
|
214 itr1 = polygon_90_set_traits<arg_type>::begin(arg);
|
Chris@16
|
215 itr2 = polygon_90_set_traits<arg_type>::end(arg);
|
Chris@16
|
216 dest.insert(itr1, itr2, orient);
|
Chris@16
|
217 dest.sort();
|
Chris@16
|
218 }
|
Chris@16
|
219
|
Chris@16
|
220 template <typename T>
|
Chris@16
|
221 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
222 inline polygon_90_set_data<T>& polygon_90_set_data<T>::operator=(const polygon_90_set_view<ltype, rtype, op_type>& that) {
|
Chris@16
|
223 set(that.begin(), that.end(), that.orient());
|
Chris@16
|
224 dirty_ = false;
|
Chris@16
|
225 unsorted_ = false;
|
Chris@16
|
226 return *this;
|
Chris@16
|
227 }
|
Chris@16
|
228
|
Chris@16
|
229 template <typename T>
|
Chris@16
|
230 template <typename ltype, typename rtype, typename op_type>
|
Chris@16
|
231 inline polygon_90_set_data<T>::polygon_90_set_data(const polygon_90_set_view<ltype, rtype, op_type>& that) :
|
Chris@16
|
232 orient_(that.orient()), data_(that.begin(), that.end()), dirty_(false), unsorted_(false) {}
|
Chris@16
|
233
|
Chris@16
|
234 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
235 struct self_assign_operator_lvalue {
|
Chris@16
|
236 typedef geometry_type_1& type;
|
Chris@16
|
237 };
|
Chris@16
|
238
|
Chris@16
|
239 template <typename type_1, typename type_2>
|
Chris@16
|
240 struct by_value_binary_operator {
|
Chris@16
|
241 typedef type_1 type;
|
Chris@16
|
242 };
|
Chris@16
|
243
|
Chris@16
|
244 template <typename geometry_type_1, typename geometry_type_2, typename op_type>
|
Chris@16
|
245 geometry_type_1& self_assignment_boolean_op(geometry_type_1& lvalue_, const geometry_type_2& rvalue_) {
|
Chris@16
|
246 typedef geometry_type_1 ltype;
|
Chris@16
|
247 typedef geometry_type_2 rtype;
|
Chris@16
|
248 typedef typename polygon_90_set_traits<ltype>::coordinate_type coordinate_type;
|
Chris@16
|
249 typedef polygon_90_set_data<coordinate_type> value_type;
|
Chris@16
|
250 orientation_2d orient_ = polygon_90_set_traits<ltype>::orient(lvalue_);
|
Chris@16
|
251 //BM: rvalue_ data set may have its own orientation for scanline
|
Chris@16
|
252 orientation_2d orient_r = polygon_90_set_traits<rtype>::orient(rvalue_);
|
Chris@16
|
253 //std::cout << "self-assignment boolean-op (left, right, out):\t" << orient_.to_int()
|
Chris@16
|
254 // << "," << orient_r.to_int() << "," << orient_.to_int() << std::endl;
|
Chris@16
|
255 value_type linput_(orient_);
|
Chris@16
|
256 // BM: the rinput_ set's (that stores the rvalue_ dataset polygons) scanline orientation is *forced*
|
Chris@16
|
257 // to be same as linput
|
Chris@16
|
258 value_type rinput_(orient_);
|
Chris@16
|
259 //BM: The output dataset's scanline orient is set as equal to first input dataset's (lvalue_) orientation
|
Chris@16
|
260 value_type output_(orient_);
|
Chris@16
|
261 insert_into_view_arg(linput_, lvalue_, orient_);
|
Chris@16
|
262 // BM: The last argument orient_r is the user initialized scanline orientation for rvalue_ data set.
|
Chris@16
|
263 // But since rinput (see above) is initialized to scanline orientation consistent with the lvalue_
|
Chris@16
|
264 // data set, this insertion operation will change the incoming rvalue_ dataset's scanline orientation
|
Chris@16
|
265 insert_into_view_arg(rinput_, rvalue_, orient_r);
|
Chris@16
|
266 // BM: boolean operation and output uses lvalue_ dataset's scanline orientation.
|
Chris@16
|
267 output_.applyBooleanBinaryOp(linput_.begin(), linput_.end(),
|
Chris@16
|
268 rinput_.begin(), rinput_.end(), boolean_op::BinaryCount<op_type>());
|
Chris@16
|
269 polygon_90_set_mutable_traits<geometry_type_1>::set(lvalue_, output_.begin(), output_.end(), orient_);
|
Chris@16
|
270 return lvalue_;
|
Chris@16
|
271 }
|
Chris@16
|
272
|
Chris@16
|
273 namespace operators {
|
Chris@16
|
274 struct y_ps90_b : gtl_yes {};
|
Chris@16
|
275
|
Chris@16
|
276 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
277 typename enable_if< typename gtl_and_3< y_ps90_b,
|
Chris@16
|
278 typename is_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
279 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
280 polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryOr> >::type
|
Chris@16
|
281 operator|(const geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
282 return polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryOr>
|
Chris@16
|
283 (lvalue, rvalue,
|
Chris@16
|
284 polygon_90_set_traits<geometry_type_1>::orient(lvalue),
|
Chris@16
|
285 boolean_op::BinaryOr());
|
Chris@16
|
286 }
|
Chris@16
|
287
|
Chris@16
|
288 struct y_ps90_p : gtl_yes {};
|
Chris@16
|
289
|
Chris@16
|
290 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
291 typename enable_if<
|
Chris@16
|
292 typename gtl_and_3< y_ps90_p,
|
Chris@16
|
293 typename gtl_if<typename is_polygon_90_set_type<geometry_type_1>::type>::type,
|
Chris@16
|
294 typename gtl_if<typename is_polygon_90_set_type<geometry_type_2>::type>::type>::type,
|
Chris@16
|
295 polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryOr> >::type
|
Chris@16
|
296 operator+(const geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
297 return polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryOr>
|
Chris@16
|
298 (lvalue, rvalue,
|
Chris@16
|
299 polygon_90_set_traits<geometry_type_1>::orient(lvalue),
|
Chris@16
|
300 boolean_op::BinaryOr());
|
Chris@16
|
301 }
|
Chris@16
|
302
|
Chris@16
|
303 struct y_ps90_s : gtl_yes {};
|
Chris@16
|
304
|
Chris@16
|
305 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
306 typename enable_if< typename gtl_and_3< y_ps90_s,
|
Chris@16
|
307 typename is_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
308 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
309 polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryAnd> >::type
|
Chris@16
|
310 operator*(const geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
311 return polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryAnd>
|
Chris@16
|
312 (lvalue, rvalue,
|
Chris@16
|
313 polygon_90_set_traits<geometry_type_1>::orient(lvalue),
|
Chris@16
|
314 boolean_op::BinaryAnd());
|
Chris@16
|
315 }
|
Chris@16
|
316
|
Chris@16
|
317 struct y_ps90_a : gtl_yes {};
|
Chris@16
|
318
|
Chris@16
|
319 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
320 typename enable_if< typename gtl_and_3< y_ps90_a,
|
Chris@16
|
321 typename is_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
322 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
323 polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryAnd> >::type
|
Chris@16
|
324 operator&(const geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
325 return polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryAnd>
|
Chris@16
|
326 (lvalue, rvalue,
|
Chris@16
|
327 polygon_90_set_traits<geometry_type_1>::orient(lvalue),
|
Chris@16
|
328 boolean_op::BinaryAnd());
|
Chris@16
|
329 }
|
Chris@16
|
330
|
Chris@16
|
331 struct y_ps90_x : gtl_yes {};
|
Chris@16
|
332
|
Chris@16
|
333 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
334 typename enable_if< typename gtl_and_3< y_ps90_x,
|
Chris@16
|
335 typename is_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
336 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
337 polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryXor> >::type
|
Chris@16
|
338 operator^(const geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
339 return polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryXor>
|
Chris@16
|
340 (lvalue, rvalue,
|
Chris@16
|
341 polygon_90_set_traits<geometry_type_1>::orient(lvalue),
|
Chris@16
|
342 boolean_op::BinaryXor());
|
Chris@16
|
343 }
|
Chris@16
|
344
|
Chris@16
|
345 struct y_ps90_m : gtl_yes {};
|
Chris@16
|
346
|
Chris@16
|
347 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
348 typename enable_if< typename gtl_and_3< y_ps90_m,
|
Chris@16
|
349 typename gtl_if<typename is_polygon_90_set_type<geometry_type_1>::type>::type,
|
Chris@16
|
350 typename gtl_if<typename is_polygon_90_set_type<geometry_type_2>::type>::type>::type,
|
Chris@16
|
351 polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryNot> >::type
|
Chris@16
|
352 operator-(const geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
353 return polygon_90_set_view<geometry_type_1, geometry_type_2, boolean_op::BinaryNot>
|
Chris@16
|
354 (lvalue, rvalue,
|
Chris@16
|
355 polygon_90_set_traits<geometry_type_1>::orient(lvalue),
|
Chris@16
|
356 boolean_op::BinaryNot());
|
Chris@16
|
357 }
|
Chris@16
|
358
|
Chris@16
|
359 struct y_ps90_pe : gtl_yes {};
|
Chris@16
|
360
|
Chris@16
|
361 template <typename coordinate_type_1, typename geometry_type_2>
|
Chris@16
|
362 typename enable_if< typename gtl_and< y_ps90_pe, typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
363 polygon_90_set_data<coordinate_type_1> >::type &
|
Chris@16
|
364 operator+=(polygon_90_set_data<coordinate_type_1>& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
365 lvalue.insert(polygon_90_set_traits<geometry_type_2>::begin(rvalue), polygon_90_set_traits<geometry_type_2>::end(rvalue),
|
Chris@16
|
366 polygon_90_set_traits<geometry_type_2>::orient(rvalue));
|
Chris@16
|
367 return lvalue;
|
Chris@16
|
368 }
|
Chris@16
|
369
|
Chris@16
|
370 struct y_ps90_be : gtl_yes {};
|
Chris@16
|
371 //
|
Chris@16
|
372 template <typename coordinate_type_1, typename geometry_type_2>
|
Chris@16
|
373 typename enable_if< typename gtl_and< y_ps90_be, typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
374 polygon_90_set_data<coordinate_type_1> >::type &
|
Chris@16
|
375 operator|=(polygon_90_set_data<coordinate_type_1>& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
376 return lvalue += rvalue;
|
Chris@16
|
377 }
|
Chris@16
|
378
|
Chris@16
|
379 struct y_ps90_pe2 : gtl_yes {};
|
Chris@16
|
380
|
Chris@16
|
381 //normal self assignment boolean operations
|
Chris@16
|
382 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
383 typename enable_if< typename gtl_and_3< y_ps90_pe2, typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
384 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
385 geometry_type_1>::type &
|
Chris@16
|
386 operator+=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
387 return self_assignment_boolean_op<geometry_type_1, geometry_type_2, boolean_op::BinaryOr>(lvalue, rvalue);
|
Chris@16
|
388 }
|
Chris@16
|
389
|
Chris@16
|
390 struct y_ps90_be2 : gtl_yes {};
|
Chris@16
|
391
|
Chris@16
|
392 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
393 typename enable_if< typename gtl_and_3<y_ps90_be2, typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
394 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
395 geometry_type_1>::type &
|
Chris@16
|
396 operator|=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
397 return self_assignment_boolean_op<geometry_type_1, geometry_type_2, boolean_op::BinaryOr>(lvalue, rvalue);
|
Chris@16
|
398 }
|
Chris@16
|
399
|
Chris@16
|
400 struct y_ps90_se : gtl_yes {};
|
Chris@16
|
401
|
Chris@16
|
402 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
403 typename enable_if< typename gtl_and_3<y_ps90_se, typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
404 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
405 geometry_type_1>::type &
|
Chris@16
|
406 operator*=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
407 return self_assignment_boolean_op<geometry_type_1, geometry_type_2, boolean_op::BinaryAnd>(lvalue, rvalue);
|
Chris@16
|
408 }
|
Chris@16
|
409
|
Chris@16
|
410 struct y_ps90_ae : gtl_yes {};
|
Chris@16
|
411
|
Chris@16
|
412 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
413 typename enable_if< typename gtl_and_3<y_ps90_ae, typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
414 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
415 geometry_type_1>::type &
|
Chris@16
|
416 operator&=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
417 return self_assignment_boolean_op<geometry_type_1, geometry_type_2, boolean_op::BinaryAnd>(lvalue, rvalue);
|
Chris@16
|
418 }
|
Chris@16
|
419
|
Chris@16
|
420 struct y_ps90_xe : gtl_yes {};
|
Chris@16
|
421
|
Chris@16
|
422 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
423 typename enable_if< typename gtl_and_3<y_ps90_xe, typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
424 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
425 geometry_type_1>::type &
|
Chris@16
|
426 operator^=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
427 return self_assignment_boolean_op<geometry_type_1, geometry_type_2, boolean_op::BinaryXor>(lvalue, rvalue);
|
Chris@16
|
428 }
|
Chris@16
|
429
|
Chris@16
|
430 struct y_ps90_me : gtl_yes {};
|
Chris@16
|
431
|
Chris@16
|
432 template <typename geometry_type_1, typename geometry_type_2>
|
Chris@16
|
433 typename enable_if< typename gtl_and_3< y_ps90_me, typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
434 typename is_polygon_90_set_type<geometry_type_2>::type>::type,
|
Chris@16
|
435 geometry_type_1>::type &
|
Chris@16
|
436 operator-=(geometry_type_1& lvalue, const geometry_type_2& rvalue) {
|
Chris@16
|
437 return self_assignment_boolean_op<geometry_type_1, geometry_type_2, boolean_op::BinaryNot>(lvalue, rvalue);
|
Chris@16
|
438 }
|
Chris@16
|
439
|
Chris@16
|
440 struct y_ps90_rpe : gtl_yes {};
|
Chris@16
|
441
|
Chris@16
|
442 template <typename geometry_type_1, typename coordinate_type_1>
|
Chris@16
|
443 typename enable_if< typename gtl_and_3<y_ps90_rpe,
|
Chris@16
|
444 typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
445 typename gtl_same_type<typename geometry_concept<coordinate_type_1>::type, coordinate_concept>::type>::type,
|
Chris@16
|
446 geometry_type_1>::type &
|
Chris@16
|
447 operator+=(geometry_type_1& lvalue, coordinate_type_1 rvalue) {
|
Chris@16
|
448 return resize(lvalue, rvalue);
|
Chris@16
|
449 }
|
Chris@16
|
450
|
Chris@16
|
451 struct y_ps90_rme : gtl_yes {};
|
Chris@16
|
452
|
Chris@16
|
453 template <typename geometry_type_1, typename coordinate_type_1>
|
Chris@16
|
454 typename enable_if< typename gtl_and_3<y_ps90_rme,
|
Chris@16
|
455 typename is_mutable_polygon_90_set_type<geometry_type_1>::type,
|
Chris@16
|
456 typename gtl_same_type<typename geometry_concept<coordinate_type_1>::type, coordinate_concept>::type>::type,
|
Chris@16
|
457 geometry_type_1>::type &
|
Chris@16
|
458 operator-=(geometry_type_1& lvalue, coordinate_type_1 rvalue) {
|
Chris@16
|
459 return resize(lvalue, -rvalue);
|
Chris@16
|
460 }
|
Chris@16
|
461
|
Chris@16
|
462 struct y_ps90_rp : gtl_yes {};
|
Chris@16
|
463
|
Chris@16
|
464 template <typename geometry_type_1, typename coordinate_type_1>
|
Chris@16
|
465 typename enable_if< typename gtl_and_3<y_ps90_rp,
|
Chris@16
|
466 typename gtl_if<typename is_mutable_polygon_90_set_type<geometry_type_1>::type>::type,
|
Chris@16
|
467 typename gtl_if<typename gtl_same_type<typename geometry_concept<coordinate_type_1>::type, coordinate_concept>::type>::type>::type,
|
Chris@16
|
468 geometry_type_1>::type
|
Chris@16
|
469 operator+(const geometry_type_1& lvalue, coordinate_type_1 rvalue) {
|
Chris@16
|
470 geometry_type_1 retval(lvalue);
|
Chris@16
|
471 retval += rvalue;
|
Chris@16
|
472 return retval;
|
Chris@16
|
473 }
|
Chris@16
|
474
|
Chris@16
|
475 struct y_ps90_rm : gtl_yes {};
|
Chris@16
|
476
|
Chris@16
|
477 template <typename geometry_type_1, typename coordinate_type_1>
|
Chris@16
|
478 typename enable_if< typename gtl_and_3<y_ps90_rm,
|
Chris@16
|
479 typename gtl_if<typename is_mutable_polygon_90_set_type<geometry_type_1>::type>::type,
|
Chris@16
|
480 typename gtl_if<typename gtl_same_type<typename geometry_concept<coordinate_type_1>::type, coordinate_concept>::type>::type>::type,
|
Chris@16
|
481 geometry_type_1>::type
|
Chris@16
|
482 operator-(const geometry_type_1& lvalue, coordinate_type_1 rvalue) {
|
Chris@16
|
483 geometry_type_1 retval(lvalue);
|
Chris@16
|
484 retval -= rvalue;
|
Chris@16
|
485 return retval;
|
Chris@16
|
486 }
|
Chris@16
|
487 }
|
Chris@16
|
488 }
|
Chris@16
|
489 }
|
Chris@16
|
490 #endif
|