| 94 | void end_contour(clipper::Polygons &p); |
| 95 | |
| 96 | template<class VS> void add(VS &src, clipper::Polygons &p){ |
| 97 | unsigned cmd; |
| 98 | double x; double y; double start_x; double start_y; |
| 99 | bool starting_first_line; |
| 100 | |
| 101 | start_x = 0.0; |
| 102 | start_y = 0.0; |
| 103 | starting_first_line = true; |
| 104 | p.resize(0); |
| 105 | |
| 106 | cmd = src->vertex( &x , &y ); |
| 107 | while(!is_stop(cmd)) |
| 108 | { |
| 109 | if(is_vertex(cmd)) |
| 110 | { |
| 111 | if(is_move_to(cmd)) |
| 112 | { |
| 113 | if(!starting_first_line ) end_contour(p); |
| 114 | start_x = x; |
| 115 | start_y = y; |
| 116 | } |
| 117 | add_vertex_( x, y ); |
| 118 | starting_first_line = false; |
| 119 | } |
| 120 | else if(is_end_poly(cmd)) |
| 121 | { |
| 122 | if(!starting_first_line && is_closed(cmd)) |
| 123 | add_vertex_( start_x, start_y ); |
| 124 | } |
| 125 | cmd = src->vertex( &x, &y ); |
| 126 | } |
| 127 | end_contour(p); |
| 128 | } |
| 129 | }; |
| 130 | |
| 131 | //------------------------------------------------------------------------ |
no test coverage detected