File Coverage

xsi/algorithm/LineIntersector.xsi
Criterion Covered Total %
statement 33 36 91.6
branch 49 94 52.1
condition n/a
subroutine n/a
pod n/a
total 82 130 63.0


line stmt bran cond sub pod time code
1             MODULE = Geo::Geos PACKAGE = Geo::Geos::Algorithm::LineIntersector
2             PROTOTYPES: DISABLE
3              
4             Sv new(SV*, SV* precisionModel = NULL) {
5 12 100         PrecisionModel* pm = precisionModel ? xs::in(precisionModel) : NULL;
    50          
6 24 50         Object wrapped = xs::out(new LineIntersector(pm));
    50          
    50          
    50          
    50          
7 12 100         if (pm) wrapped.payload_attach(precisionModel, &payload_marker);
    50          
8 12 50         RETVAL = wrapped.ref();
    50          
9             }
10              
11 1 50         double interpolateZ(Coordinate *p, Coordinate *p0, Coordinate *p1) { RETVAL = LineIntersector::interpolateZ(*p, *p0, *p1); }
12              
13 1 50         double computeEdgeDistance(Coordinate *p, Coordinate *p0, Coordinate *p1) { RETVAL = LineIntersector::computeEdgeDistance(*p, *p0, *p1); }
14              
15 1 50         bool isSameSignAndNonZero(double a, double b) { RETVAL = LineIntersector::isSameSignAndNonZero(a, b); }
16              
17             bool hasIntersection(Object arg0, Coordinate *p1 = NULL, Coordinate *p2 = NULL) {
18 6 100         if (p1 == NULL) RETVAL = xs::in(arg0).hasIntersection();
    50          
19             else {
20 1 50         auto& p0 = xs::in(arg0);
21 1 50         if(!p1) throw("undef not allowed");
22 1 50         if(!p2) throw("undef not allowed");
23 1 50         RETVAL = LineIntersector::hasIntersection(p0, *p1, *p2);
24             }
25             }
26              
27              
28             bool LineIntersector::isInteriorIntersection (SV* arg = NULL) {
29 1 50         if(!arg) RETVAL = THIS->isInteriorIntersection();
    50          
30             else {
31 0 0         int inputLineIndex = SvIV(arg);
    0          
32 0 0         RETVAL = THIS->isInteriorIntersection(inputLineIndex);
33             }
34             }
35              
36             void LineIntersector::setPrecisionModel (SV* pm) {
37 3 50         PrecisionModel& newPM = xs::in(pm);
38 3           THIS->setPrecisionModel(&newPM);
39 6 50         Object me {ST(0)};
40 3 100         if (me.payload_exists(&payload_marker)) {
41 1 50         me.payload_detach(&payload_marker);
42             }
43 3 50         me.payload_attach(SvRV(pm), &payload_marker);
44             }
45              
46             void LineIntersector::computeIntersection (Coordinate& p1, Coordinate& p2, Coordinate& p3, SV* p4arg = NULL) {
47 5 100         if (!p4arg) THIS->computeIntersection(p1, p2, p3);
48             else {
49 4           auto& p4 = xs::in(p4arg);
50 4           THIS->computeIntersection(p1, p2, p3, p4);
51             }
52             }
53              
54 1 50         std::string LineIntersector::toString(...)
    50          
55              
56 1           int LineIntersector::getIntersectionNum ()
57              
58 1           bool LineIntersector::isProper ()
59              
60 1 50         int LineIntersector::getIndexAlongSegment (int segmentIndex, int intIndex)
61              
62 4 50         double LineIntersector::getEdgeDistance (int geomIndex, int intIndex)
63              
64             Coordinate* LineIntersector::getIntersectionAlongSegment (int segmentIndex, int intIndex) {
65 2           RETVAL = new Coordinate(THIS->getIntersectionAlongSegment(segmentIndex, intIndex));
66 1 50         }
    50          
67              
68 0           int CLONE_SKIP (...) { PERL_UNUSED_VAR(items); RETVAL = 1; }
69              
70             BOOT {
71 92 50         auto this_stash = Stash(__PACKAGE__);
72 230 50         xs::exp::create_constants(this_stash, {
    50          
    50          
    50          
    100          
    0          
73             {"TYPE_NO_INTERSECTION", LineIntersector::NO_INTERSECTION},
74             {"TYPE_POINT_INTERSECTION", LineIntersector::POINT_INTERSECTION},
75             {"TYPE_COLLINEAR_INTERSECTION", LineIntersector::COLLINEAR_INTERSECTION}
76 184 50         });
77 46 50         xs::exp::autoexport(this_stash);
    50          
78             }