314
314
if (!f->is_unbounded()) // f is not the unbounded face
316
typedef typename CGAL::Arr_polyline_traits_2<Kernel_> Arr_poly_traits;
317
typedef typename Arr_poly_traits::Compare_endpoints_xy_2 Comp_end_pts_2;
318
typedef typename Arr_poly_traits::Construct_min_vertex_2 Poly_const_min_v;
319
typedef typename Arr_poly_traits::Construct_max_vertex_2 Poly_const_max_v;
321
// Obtain a polyline traits class and construct the needed functors
322
Arr_poly_traits poly_tr;
323
Comp_end_pts_2 comp_end_pts = poly_tr.compare_endpoints_xy_2_object();
324
Poly_const_min_v poly_const_min_v=poly_tr.construct_min_vertex_2_object();
325
Poly_const_max_v poly_const_max_v=poly_tr.construct_max_vertex_2_object();
327
// Construct needed functors from the segment traits
328
typedef typename Arr_poly_traits::Segment_traits_2 Segment_traits;
329
typedef typename Segment_traits::Construct_min_vertex_2 Seg_const_min_v;
330
typedef typename Segment_traits::Construct_max_vertex_2 Seg_const_max_v;
331
Seg_const_min_v construct_min_v = poly_tr.segment_traits_2()->
332
construct_min_vertex_2_object();
333
Seg_const_max_v construct_max_v = poly_tr.segment_traits_2()->
334
construct_max_vertex_2_object();
336
// Iterator of the segments of an x-monotone polyline
337
typename X_monotone_curve_2::Segment_const_iterator seg_it;
316
339
QVector< QPointF > pts; // holds the points of the polygon
317
typename X_monotone_curve_2::const_iterator pt_itr;
318
typename X_monotone_curve_2::const_reverse_iterator pt_rev_itr;
319
340
X_monotone_curve_2 cv;
321
342
/* running with around the outer of the face and generate from it
324
345
Ccb_halfedge_circulator cc = f->outer_ccb();
326
347
cv = cc->curve();
327
bool curve_has_same_direction =
328
( *(cc->curve().begin()) == cc->source()->point() );
329
if ( curve_has_same_direction )
331
for( pt_itr = cv.begin() , ++pt_itr ; pt_itr != cv.end(); ++pt_itr)
333
double x = CGAL::to_double((*pt_itr).x());
334
double y = CGAL::to_double((*pt_itr).y());
349
// Determine the direction of cv (left-to-right or right-to-left)
350
Comparison_result dir = comp_end_pts(cv);
352
for (seg_it = cv.begin_segments();
353
seg_it != cv.end_segments() ; ++seg_it)
357
// cv is directed from left-to-right
358
// Adding the left-min vertex of the current segment
359
double x = CGAL::to_double((construct_min_v(*seg_it)).x());
360
double y = CGAL::to_double((construct_min_v(*seg_it)).y());
361
QPointF coord_source(x , y);
362
pts.push_back(coord_source );
366
// cv is directed from right-to-left
367
// Adding the right-max vertex of the current segment
368
double x = CGAL::to_double((construct_max_v(*seg_it)).x());
369
double y = CGAL::to_double((construct_max_v(*seg_it)).y());
370
QPointF coord_source(x , y);
371
pts.push_back(coord_source );
377
// Add the right-most point of cv
378
double x = CGAL::to_double((poly_const_max_v(cv)).x());
379
double y = CGAL::to_double((poly_const_max_v(cv)).y());
335
380
QPointF coord_source(x , y);
336
381
pts.push_back(coord_source );
341
for (pt_rev_itr = cv.rbegin() , ++pt_rev_itr; pt_rev_itr != cv.rend();
344
double x = CGAL::to_double((*pt_rev_itr).x());
345
double y = CGAL::to_double((*pt_rev_itr).y());
385
// Add the left-most point of cv
386
double x = CGAL::to_double((poly_const_min_v(cv)).x());
387
double y = CGAL::to_double((poly_const_min_v(cv)).y());
346
388
QPointF coord_source(x , y);
347
389
pts.push_back(coord_source );
350
391
//created from the outer boundary of the face
351
392
} while (++cc != f->outer_ccb());