Branch Coverage

src/panda/Geos/tesselate.cpp
Criterion Covered Total %
branch 45 82 54.8


line true false branch
34 1 0 auto shell = input.getExteriorRing();
35 1 0 auto shell_coords = seq_holder_t{shell->getCoordinates()};
40 1 0 assert(shell_coords->size() > 1);
0 1 assert(shell_coords->size() > 1);
42 5 0 for (size_t i = 0; i < shell_coords->size() - 1; ++i) {
4 1 for (size_t i = 0; i < shell_coords->size() - 1; ++i) {
43 4 0 auto& coord = shell_coords->getAt(i);
44 4 0 shell_seq.push_back(coord);
45 4 0 linearized.push_back(coord);
47 1 0 polygon.push_back(shell_seq);
50 1 0 auto holes_num = input.getNumInteriorRing();
51 1 1 for (size_t i = 0; i < holes_num; ++i) {
52 1 0 auto* hole = input.getInteriorRingN(i);
53 1 0 auto hole_coords = seq_holder_t{hole->getCoordinates()};
54 1 0 assert(hole_coords->size() > 1);
0 1 assert(hole_coords->size() > 1);
56 5 0 for (size_t j = 0; j < hole_coords->size() - 1; ++j) {
4 1 for (size_t j = 0; j < hole_coords->size() - 1; ++j) {
57 4 0 auto& coord = hole_coords->getAt(j);
58 4 0 seq.push_back(coord);
59 4 0 linearized.push_back(coord);
61 1 0 polygon.push_back(seq);
66 1 0 std::vector indices = mapbox::earcut(polygon);
68 0 1 if (!vertices) throw "no tesselation (invalid polygon?)";
69 0 1 assert(vertices % 3 == 0);
73 1 0 auto seq_factory = factory->getCoordinateSequenceFactory();
74 1 0 auto triangles = new result_t();
75 8 1 for(size_t i = 0; i < indices.size(); i += 3) {
79 8 0 auto seq = seq_holder_t{seq_factory->create(4, 2)};
80 8 0 seq->setAt(c_A, 0);
81 8 0 seq->setAt(c_B, 1);
82 8 0 seq->setAt(c_C, 2);
83 8 0 seq->setAt(c_A, 3); /* close the poly */
85 8 0 auto shell = factory->createLinearRing(seq.release());
86 8 0 auto holes = new std::vector();
87 8 0 auto poly = factory->createPolygon(shell, holes);
88 8 0 triangles->push_back(poly);
8 0 triangles->push_back(poly);
91 1 0 return factory->createGeometryCollection(triangles);
95 46 0 }}
46 0 }}