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