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