src/myinit.h

filter: Statementstmt 93.3% 14 / 15 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 90.4% 19 / 21 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« buildtmp/Clipper.c ↑ Summary src/clipper.hpp »
1 #ifndef __clipper_myinit_h_
2 #define __clipper_myinit_h_
3  
4 // fix build error under clang for pre-5.18 Perls
5 #undef dNOOP
6 #define dNOOP struct Perl___notused_struct
7  
8 #include "clipper.hpp"
9  
10 using namespace ClipperLib;
11  
12 //-----------------------------------------------------------
13 // legacy code from Clipper documentation
14 struct ExPolygon {
15 ClipperLib::Polygon outer;
16 ClipperLib::Polygons holes;
17 };
18
19 typedef std::vector< ExPolygon > ExPolygons;
20
21 4 void AddOuterPolyNodeToExPolygons(ClipperLib::PolyNode& polynode, ExPolygons& expolygons)
22 {
23 4 size_t cnt = expolygons.size();
24 4 expolygons.resize(cnt + 1);
25 4 expolygons[cnt].outer = polynode.Contour;
26 4 expolygons[cnt].holes.resize(polynode.ChildCount());
27 7 ▶ for (int i = 0; i < polynode.ChildCount(); ++i)
Branch: 1 branch
BranchTrueFalseTotal
for (int i = 0; i < polynode.ChildCount(); ++i) 3 4 7
28 {
29 3 expolygons[cnt].holes[i] = polynode.Childs[i]->Contour;
30 //Add outer polygons contained by (nested within) holes ...
31 3 ▶ for (int j = 0; j < polynode.Childs[i]->ChildCount(); ++j)
Branch: 1 branch
BranchTrueFalseTotal
for (int j = 0; j < polynode.Childs[i]->ChildCount(); ++j) 0 3 3
32 0 AddOuterPolyNodeToExPolygons(*polynode.Childs[i]->Childs[j], expolygons);
33 }
34 4 }
35
36 4 void PolyTreeToExPolygons(ClipperLib::PolyTree& polytree, ExPolygons& expolygons)
37 {
38 4 expolygons.clear();
39 8 ▶ for (int i = 0; i < polytree.ChildCount(); ++i)
Branch: 1 branch
BranchTrueFalseTotal
for (int i = 0; i < polytree.ChildCount(); ++i) 4 4 8
40 4 AddOuterPolyNodeToExPolygons(*polytree.Childs[i], expolygons);
41 4 }
42 //-----------------------------------------------------------
43  
44 #include "poly2av.h"
45 #include "offset.h"
46  
47 #endif
« buildtmp/Clipper.c ↑ Summary src/clipper.hpp »