| 1 |
|
| MODULE = Geo::Geos PACKAGE = Geo::Geos::Operation |
| 2 |
|
| PROTOTYPES: DISABLE |
| 3 |
|
| |
| 4 |
|
| Sv buffer(Geometry& g, double distance, SV* quadrantSegments = NULL, SV* endCapStyle = NULL) { |
| 5 |
3 |
▶ | int vQuadrantSegments = quadrantSegments ? SvIV(quadrantSegments) : (int)BufferParameters::DEFAULT_QUADRANT_SEGMENTS; |
Branch: 2 branches
| Branch | True | False | Total |
| int vQuadrantSegments = quadrantSegments ? SvIV(quadrantSegments) : (int)BufferParameters::DEFAULT_QUADRANT_SEGMENTS; |
2 |
1 |
3 |
| int vQuadrantSegments = quadrantSegments ? SvIV(quadrantSegments) : (int)BufferParameters::DEFAULT_QUADRANT_SEGMENTS; |
2 |
0 |
2 |
|
| 6 |
3 |
▶ | int vEndCapStyle = endCapStyle? SvIV(endCapStyle) : (int)BufferParameters::CAP_ROUND; |
Branch: 2 branches
| Branch | True | False | Total |
| int vEndCapStyle = endCapStyle? SvIV(endCapStyle) : (int)BufferParameters::CAP_ROUND; |
1 |
2 |
3 |
| int vEndCapStyle = endCapStyle? SvIV(endCapStyle) : (int)BufferParameters::CAP_ROUND; |
1 |
0 |
1 |
|
| 7 |
3 |
▶ | Geometry* r = BufferOp::bufferOp(&g, distance, vQuadrantSegments, vEndCapStyle); |
Branch: 1 branch
| Branch | True | False | Total |
| Geometry* r = BufferOp::bufferOp(&g, distance, vQuadrantSegments, vEndCapStyle); |
3 |
0 |
3 |
|
| 8 |
3 |
▶ | RETVAL = Helper::uplift(r); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = Helper::uplift(r); |
3 |
0 |
3 |
|
| 9 |
|
| } |
| 10 |
|
| |
| 11 |
|
| double distance(Geometry& g0, Geometry& g1) { |
| 12 |
1 |
▶ | RETVAL = DistanceOp::distance(&g0, &g1); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = DistanceOp::distance(&g0, &g1); |
0 |
1 |
1 |
|
| 13 |
|
| } |
| 14 |
|
| |
| 15 |
|
| Array nearestPoints(Geometry& g0, Geometry& g1) { |
| 16 |
1 |
| Array r; |
| 17 |
1 |
▶ | auto seq = DistanceOp::nearestPoints(&g0, &g1); |
Branch: 1 branch
| Branch | True | False | Total |
| auto seq = DistanceOp::nearestPoints(&g0, &g1); |
1 |
0 |
1 |
|
| 18 |
1 |
▶ | if(seq) { |
Branch: 1 branch
| Branch | True | False | Total |
| if(seq) { |
1 |
0 |
1 |
|
| 19 |
1 |
| auto seq_ptr = std::unique_ptr<CoordinateSequence>(seq); |
| 20 |
1 |
▶ | r = Helper::convert_copy(seq); |
Branch: 1 branch
| Branch | True | False | Total |
| r = Helper::convert_copy(seq); |
1 |
0 |
1 |
|
| 21 |
1 |
| } |
| 22 |
1 |
▶ | RETVAL = r; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = r; |
1 |
0 |
1 |
|
| 23 |
|
| } |
| 24 |
|
| |
| 25 |
|
| Array closestPoints(Geometry& g0, Geometry& g1) { |
| 26 |
1 |
| Array r; |
| 27 |
1 |
▶ | auto seq = DistanceOp::closestPoints(&g0, &g1); |
Branch: 1 branch
| Branch | True | False | Total |
| auto seq = DistanceOp::closestPoints(&g0, &g1); |
1 |
0 |
1 |
|
| 28 |
1 |
▶ | if(seq) { |
Branch: 1 branch
| Branch | True | False | Total |
| if(seq) { |
1 |
0 |
1 |
|
| 29 |
1 |
| auto seq_ptr = std::unique_ptr<CoordinateSequence>(seq); |
| 30 |
1 |
▶ | r = Helper::convert_copy(seq); |
Branch: 1 branch
| Branch | True | False | Total |
| r = Helper::convert_copy(seq); |
1 |
0 |
1 |
|
| 31 |
1 |
| } |
| 32 |
1 |
▶ | RETVAL = r; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = r; |
1 |
0 |
1 |
|
| 33 |
|
| } |
| 34 |
|
| |
| 35 |
|
| Sv overlayOp(Geometry& g0, Geometry& g1, int opCode) { |
| 36 |
1 |
▶ | if (opCode > 4) throw "wrong opCode"; |
Branch: 1 branch
| Branch | True | False | Total |
| if (opCode > 4) throw "wrong opCode"; |
0 |
1 |
1 |
|
| 37 |
1 |
| OverlayOp::OpCode code = static_cast<OverlayOp::OpCode>(opCode); |
| 38 |
1 |
▶ | Geometry* g = OverlayOp::overlayOp(&g0, &g1, code); |
Branch: 1 branch
| Branch | True | False | Total |
| Geometry* g = OverlayOp::overlayOp(&g0, &g1, code); |
1 |
0 |
1 |
|
| 39 |
1 |
▶ | RETVAL = Helper::uplift(g); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = Helper::uplift(g); |
1 |
0 |
1 |
|
| 40 |
|
| } |
| 41 |
|
| |
| 42 |
|
| bool isValid(Object obj) { |
| 43 |
2 |
▶ | if (obj.stash().name() == "Geo::Geos::Coordinate") { |
Branch: 4 branches
| Branch | True | False | Total |
| if (obj.stash().name() == "Geo::Geos::Coordinate") { |
2 |
0 |
2 |
| if (obj.stash().name() == "Geo::Geos::Coordinate") { |
2 |
0 |
2 |
| if (obj.stash().name() == "Geo::Geos::Coordinate") { |
2 |
0 |
2 |
| if (obj.stash().name() == "Geo::Geos::Coordinate") { |
1 |
1 |
2 |
|
| 44 |
1 |
▶ | auto& c = xs::in<Coordinate&>(obj); |
Branch: 1 branch
| Branch | True | False | Total |
| auto& c = xs::in<Coordinate&>(obj); |
1 |
0 |
1 |
|
| 45 |
1 |
▶ | RETVAL = IsValidOp::isValid(c); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = IsValidOp::isValid(c); |
1 |
0 |
1 |
|
| 46 |
|
| } |
| 47 |
|
| else { |
| 48 |
1 |
▶ | auto& g = xs::in<Geometry&>(obj); |
Branch: 1 branch
| Branch | True | False | Total |
| auto& g = xs::in<Geometry&>(obj); |
1 |
0 |
1 |
|
| 49 |
1 |
▶ | RETVAL = IsValidOp::isValid(g); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = IsValidOp::isValid(g); |
1 |
0 |
1 |
|
| 50 |
|
| } |
| 51 |
|
| } |
| 52 |
|
| |
| 53 |
|
| IntersectionMatrix* relate(Geometry& g0, Geometry& g1, SV* boundaryNodeRule = NULL) { |
| 54 |
2 |
| if (!boundaryNodeRule) RETVAL = RelateOp::relate(&g0, &g1); |
| 55 |
2 |
▶ | else { |
Branch: 2 branches
| Branch | True | False | Total |
| else { |
1 |
1 |
2 |
| else { |
1 |
0 |
1 |
|
| 56 |
|
| const BoundaryNodeRule* rule; |
| 57 |
|
| auto rule_id = SvIV(boundaryNodeRule); |
| 58 |
1 |
▶ | switch(rule_id) { |
Branch: 1 branch
| Branch | True | False | Total |
| switch(rule_id) { |
1 |
0 |
1 |
|
| 59 |
1 |
| case 0: rule = &BoundaryNodeRule::getBoundaryRuleMod2(); break; |
| 60 |
0 |
▶ | case 1: rule = &BoundaryNodeRule::getBoundaryEndPoint(); break; |
Branch: 1 branch
| Branch | True | False | Total |
| case 1: rule = &BoundaryNodeRule::getBoundaryEndPoint(); break; |
0 |
0 |
0 |
|
| 61 |
0 |
▶ | case 2: rule = &BoundaryNodeRule::getBoundaryMultivalentEndPoint(); break; |
Branch: 1 branch
| Branch | True | False | Total |
| case 2: rule = &BoundaryNodeRule::getBoundaryMultivalentEndPoint(); break; |
0 |
0 |
0 |
|
| 62 |
0 |
▶ | case 3: rule = &BoundaryNodeRule::getBoundaryMonovalentEndPoint(); break; |
Branch: 1 branch
| Branch | True | False | Total |
| case 3: rule = &BoundaryNodeRule::getBoundaryMonovalentEndPoint(); break; |
0 |
0 |
0 |
|
| 63 |
0 |
▶ | case 4: rule = &BoundaryNodeRule::getBoundaryOGCSFS(); break; |
Branch: 1 branch
| Branch | True | False | Total |
| case 4: rule = &BoundaryNodeRule::getBoundaryOGCSFS(); break; |
0 |
0 |
0 |
|
| 64 |
1 |
▶ | default: throw("Wrong boundaryNodeRule"); |
Branch: 1 branch
| Branch | True | False | Total |
| default: throw("Wrong boundaryNodeRule"); |
1 |
0 |
1 |
|
| 65 |
0 |
| } |
| 66 |
|
| RETVAL = RelateOp::relate(&g0, &g1, *rule); |
| 67 |
1 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
1 |
0 |
1 |
|
| 68 |
|
| } |
| 69 |
|
| |
| 70 |
|
| Array mergeLines(Array in) { |
| 71 |
1 |
▶ | LineMerger lm; |
Branch: 1 branch
| Branch | True | False | Total |
| LineMerger lm; |
1 |
0 |
1 |
|
| 72 |
|
| |
| 73 |
3 |
▶ | for(auto it: in) { |
Branch: 4 branches
| Branch | True | False | Total |
| for(auto it: in) { |
1 |
0 |
1 |
| for(auto it: in) { |
1 |
0 |
1 |
| for(auto it: in) { |
2 |
0 |
2 |
| for(auto it: in) { |
2 |
1 |
3 |
|
| 74 |
2 |
▶ | lm.add(&xs::in<Geometry&>(it)); |
Branch: 2 branches
| Branch | True | False | Total |
| lm.add(&xs::in<Geometry&>(it)); |
2 |
0 |
2 |
| lm.add(&xs::in<Geometry&>(it)); |
2 |
0 |
2 |
|
| 75 |
2 |
| } |
| 76 |
|
| |
| 77 |
1 |
▶ | auto v = lm.getMergedLineStrings(); |
Branch: 1 branch
| Branch | True | False | Total |
| auto v = lm.getMergedLineStrings(); |
1 |
0 |
1 |
|
| 78 |
1 |
▶ | Array out = Array::create(v->size()); |
Branch: 1 branch
| Branch | True | False | Total |
| Array out = Array::create(v->size()); |
1 |
0 |
1 |
|
| 79 |
2 |
▶ | for(LineString* it: *v) { |
Branch: 1 branch
| Branch | True | False | Total |
| for(LineString* it: *v) { |
1 |
1 |
2 |
|
| 80 |
1 |
▶ | auto wrapped = xs::out<LineString*>(it); |
Branch: 1 branch
| Branch | True | False | Total |
| auto wrapped = xs::out<LineString*>(it); |
1 |
0 |
1 |
|
| 81 |
1 |
▶ | out.push(wrapped); |
Branch: 1 branch
| Branch | True | False | Total |
| out.push(wrapped); |
1 |
0 |
1 |
|
| 82 |
1 |
| } |
| 83 |
1 |
▶ | RETVAL = out; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = out; |
1 |
0 |
1 |
|
| 84 |
1 |
▶ | delete v; |
Branch: 1 branch
| Branch | True | False | Total |
| delete v; |
1 |
0 |
1 |
|
| 85 |
|
| } |
| 86 |
|
| |
| 87 |
|
| bool isSequenced(Geometry& g) { |
| 88 |
1 |
▶ | RETVAL = LineSequencer::isSequenced(&g); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = LineSequencer::isSequenced(&g); |
1 |
0 |
1 |
|
| 89 |
|
| } |
| 90 |
|
| |
| 91 |
|
| Sv sequence(Geometry& g) { |
| 92 |
1 |
▶ | RETVAL = Helper::uplift(LineSequencer::sequence(g)); |
Branch: 2 branches
| Branch | True | False | Total |
| RETVAL = Helper::uplift(LineSequencer::sequence(g)); |
1 |
0 |
1 |
| RETVAL = Helper::uplift(LineSequencer::sequence(g)); |
1 |
0 |
1 |
|
| 93 |
|
| } |
| 94 |
|
| |
| 95 |
|
| BOOT { |
| 96 |
46 |
▶ | auto this_stash = Stash(__PACKAGE__); |
Branch: 1 branch
| Branch | True | False | Total |
| auto this_stash = Stash(__PACKAGE__); |
46 |
0 |
46 |
|
| 97 |
460 |
▶ | xs::exp::create_constants(this_stash, { |
Branch: 4 branches
| Branch | True | False | Total |
| xs::exp::create_constants(this_stash, { |
46 |
0 |
46 |
| xs::exp::create_constants(this_stash, { |
46 |
0 |
46 |
| xs::exp::create_constants(this_stash, { |
414 |
46 |
460 |
| xs::exp::create_constants(this_stash, { |
0 |
0 |
0 |
|
| 98 |
|
| {"TYPE_OP_INTERSECTION", OverlayOp::OpCode::opINTERSECTION}, |
| 99 |
|
| {"TYPE_OP_UNION", OverlayOp::OpCode::opUNION}, |
| 100 |
|
| {"TYPE_OP_DIFFERENCE", OverlayOp::OpCode::opDIFFERENCE}, |
| 101 |
|
| {"TYPE_OP_SYMDIFFERENCE", OverlayOp::OpCode::opSYMDIFFERENCE}, |
| 102 |
|
| |
| 103 |
|
| {"TYPE_BOUNDARY_NODE_RULE_MOD2", 0}, |
| 104 |
|
| {"TYPE_BOUNDARY_ENDPOINT", 1}, |
| 105 |
|
| {"TYPE_BOUNDARY_MULTIVALENT_ENDPOINT", 2}, |
| 106 |
|
| {"TYPE_BOUNDARY_MONOVALENT_ENDPOINT", 3}, |
| 107 |
|
| {"TYPE_BOUNDARY_OGCSFS", 4} |
| 108 |
|
| }); |
| 109 |
46 |
▶ | xs::exp::autoexport(this_stash); |
Branch: 2 branches
| Branch | True | False | Total |
| xs::exp::autoexport(this_stash); |
46 |
0 |
46 |
| xs::exp::autoexport(this_stash); |
46 |
0 |
46 |
|
| 110 |
46 |
| } |