line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
MODULE = Geo::Geos PACKAGE = Geo::Geos::LineSegment |
2
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
LineSegment* new(SV*, SV* arg1 = NULL, SV* arg2 = NULL, SV* arg3 = NULL, SV* arg4 = NULL) { |
5
|
34
|
|
|
|
|
|
if (!arg1) RETVAL = new LineSegment(); |
6
|
17
|
100
|
|
|
|
|
else if (!arg3) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
7
|
16
|
100
|
|
|
|
|
auto& c1 = xs::in(arg1); |
8
|
15
|
50
|
|
|
|
|
auto& c2 = xs::in(arg2); |
9
|
15
|
50
|
|
|
|
|
RETVAL = new LineSegment(c1, c2); |
10
|
15
|
50
|
|
|
|
|
} |
|
|
50
|
|
|
|
|
|
11
|
|
|
|
|
|
|
else { |
12
|
|
|
|
|
|
|
if(!arg2) throw("undef not allowed"); |
13
|
1
|
50
|
|
|
|
|
if(!arg3) throw("undef not allowed"); |
14
|
1
|
50
|
|
|
|
|
if(!arg4) throw("undef not allowed"); |
15
|
1
|
50
|
|
|
|
|
double x0 = SvNV(arg1); |
16
|
1
|
50
|
|
|
|
|
double y0 = SvNV(arg2); |
|
|
50
|
|
|
|
|
|
17
|
1
|
50
|
|
|
|
|
double x1 = SvNV(arg3); |
|
|
50
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
|
double y1 = SvNV(arg4); |
|
|
50
|
|
|
|
|
|
19
|
1
|
50
|
|
|
|
|
RETVAL = new LineSegment(x0, y0, x1, y1); |
|
|
50
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
|
} |
|
|
50
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
|
double LineSegment::getLength() |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
|
|
|
|
bool LineSegment::isHorizontal() |
26
|
|
|
|
|
|
|
|
27
|
1
|
50
|
|
|
|
|
bool LineSegment::isVertical() |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
void LineSegment::setCoordinates(SV* arg1, SV* arg2 = NULL) { |
30
|
2
|
100
|
|
|
|
|
if (!arg2) { |
31
|
1
|
|
|
|
|
|
auto& ls = xs::in(arg1); |
32
|
1
|
|
|
|
|
|
THIS->setCoordinates(ls); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
1
|
|
|
|
|
|
auto& c1 = xs::in(arg1); |
36
|
1
|
|
|
|
|
|
auto& c2 = xs::in(arg2); |
37
|
1
|
|
|
|
|
|
THIS->setCoordinates(c1, c2); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
int LineSegment::orientationIndex(Object arg) { |
42
|
2
|
50
|
|
|
|
|
if (arg.stash().name() == "Geo::Geos::Coordinate") { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
43
|
1
|
50
|
|
|
|
|
auto c = xs::in(arg); |
44
|
1
|
50
|
|
|
|
|
RETVAL = THIS->orientationIndex(*c); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
1
|
50
|
|
|
|
|
auto& ls = xs::in(arg); |
48
|
1
|
50
|
|
|
|
|
RETVAL = THIS->orientationIndex(ls); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
|
void LineSegment::reverse () |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
|
void LineSegment::normalize () |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
|
double LineSegment::angle () |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Coordinate* LineSegment::midPoint() { |
59
|
2
|
|
|
|
|
|
Coordinate c; |
60
|
1
|
50
|
|
|
|
|
THIS->midPoint(c); |
61
|
1
|
50
|
|
|
|
|
RETVAL = new Coordinate(c); |
62
|
1
|
50
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
double LineSegment::distance(Object arg){ |
65
|
2
|
50
|
|
|
|
|
if (arg.stash().name() == "Geo::Geos::Coordinate") { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
66
|
1
|
50
|
|
|
|
|
auto c = xs::in(arg); |
67
|
1
|
50
|
|
|
|
|
RETVAL = THIS->distance(*c); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
1
|
50
|
|
|
|
|
auto& ls = xs::in(arg); |
71
|
1
|
50
|
|
|
|
|
RETVAL = THIS->distance(ls); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
1
|
50
|
|
|
|
|
double LineSegment::distancePerpendicular(Coordinate& p) |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Coordinate* LineSegment::pointAlong(double segmentLengthFraction) { |
78
|
2
|
|
|
|
|
|
Coordinate c; |
79
|
1
|
50
|
|
|
|
|
THIS->pointAlong(segmentLengthFraction, c); |
80
|
1
|
50
|
|
|
|
|
RETVAL = new Coordinate(c); |
81
|
1
|
50
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Coordinate* LineSegment::pointAlongOffset (double segmentLengthFraction, double offsetDistance){ |
84
|
2
|
|
|
|
|
|
Coordinate c; |
85
|
1
|
50
|
|
|
|
|
THIS->pointAlongOffset(segmentLengthFraction, offsetDistance, c); |
86
|
1
|
50
|
|
|
|
|
RETVAL = new Coordinate(c); |
87
|
1
|
50
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
1
|
50
|
|
|
|
|
double LineSegment::projectionFactor(Coordinate& p) |
90
|
|
|
|
|
|
|
|
91
|
1
|
50
|
|
|
|
|
double LineSegment::segmentFraction (Coordinate& p) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
void LineSegment::project(Object arg) { |
94
|
4
|
50
|
|
|
|
|
if (arg.stash().name() == "Geo::Geos::Coordinate") { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
95
|
2
|
50
|
|
|
|
|
auto& c = xs::in(arg); |
96
|
2
|
50
|
|
|
|
|
Coordinate c_out; |
97
|
2
|
50
|
|
|
|
|
THIS->project(c, c_out); |
98
|
4
|
50
|
|
|
|
|
auto wrapped = xs::out<>(new Coordinate(c_out)); |
|
|
50
|
|
|
|
|
|
99
|
2
|
50
|
|
|
|
|
mXPUSHs(wrapped.detach()); |
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
2
|
50
|
|
|
|
|
auto& ls = xs::in(arg); |
103
|
4
|
50
|
|
|
|
|
LineSegment ls_out; |
104
|
2
|
50
|
|
|
|
|
bool overlap = THIS->project(ls, ls_out); |
105
|
4
|
50
|
|
|
|
|
auto wrapped = xs::out<>(new LineSegment(ls_out)); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
106
|
2
|
50
|
|
|
|
|
mXPUSHs(wrapped.detach()); |
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
107
|
2
|
50
|
|
|
|
|
if (GIMME_V == G_ARRAY) mXPUSHi(overlap); |
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Coordinate* LineSegment::closestPoint (Coordinate& p) { |
112
|
2
|
|
|
|
|
|
Coordinate c; |
113
|
1
|
50
|
|
|
|
|
THIS->closestPoint(p, c); |
114
|
1
|
50
|
|
|
|
|
RETVAL = new Coordinate(c); |
115
|
1
|
50
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
1
|
50
|
|
|
|
|
int LineSegment::compareTo(LineSegment& other) |
118
|
|
|
|
|
|
|
|
119
|
1
|
50
|
|
|
|
|
bool LineSegment::equalsTopo(LineSegment& other) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Array LineSegment::closestPoints(LineSegment& line) { |
122
|
2
|
50
|
|
|
|
|
auto seq = std::unique_ptr(THIS->closestPoints(line)); |
|
|
50
|
|
|
|
|
|
123
|
1
|
50
|
|
|
|
|
RETVAL = Helper::convert_copy(seq.get()); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Coordinate* LineSegment::intersection(LineSegment& line){ |
127
|
3
|
|
|
|
|
|
Coordinate c; |
128
|
2
|
50
|
|
|
|
|
if(THIS->intersection(line, c)) RETVAL = new Coordinate(c); |
129
|
2
|
50
|
|
|
|
|
else XSRETURN_UNDEF; |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
130
|
1
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Coordinate* LineSegment::lineIntersection(LineSegment& line){ |
133
|
3
|
|
|
|
|
|
Coordinate c; |
134
|
2
|
50
|
|
|
|
|
if(THIS->lineIntersection(line, c)) RETVAL = new Coordinate(c); |
135
|
2
|
50
|
|
|
|
|
else XSRETURN_UNDEF; |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
136
|
1
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
LineString* LineSegment::toGeometry(GeometryFactory& gf) { |
139
|
2
|
|
|
|
|
|
auto ptr = THIS->toGeometry(gf); |
140
|
2
|
50
|
|
|
|
|
RETVAL = ptr.release(); |
141
|
1
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
std::string LineSegment::toString(...) { |
144
|
28
|
50
|
|
|
|
|
std::ostringstream out; |
145
|
14
|
50
|
|
|
|
|
out << *THIS; |
146
|
14
|
50
|
|
|
|
|
RETVAL = out.str(); |
|
|
50
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Coordinate* LineSegment::p0(SV* newval = NULL) : ALIAS(p1=1) { |
150
|
16
|
|
|
|
|
|
Coordinate* val; |
151
|
|
|
|
|
|
|
switch (ix) { |
152
|
8
|
100
|
|
|
|
|
case 0: val = &THIS->p0; break; |
153
|
4
|
|
|
|
|
|
default: val = &THIS->p1; break; |
154
|
4
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
if (newval) { |
156
|
8
|
50
|
|
|
|
|
auto& c = xs::in(newval); |
157
|
0
|
0
|
|
|
|
|
*val = c; |
158
|
0
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
RETVAL = new Coordinate(*val); |
160
|
8
|
50
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
int CLONE_SKIP (...) { PERL_UNUSED_VAR(items); RETVAL = 1; } |