Branch Coverage

blib/lib/Geo/OGC/Geometry.pm
Criterion Covered Total %
branch 203 572 35.4


line true false branch
75 8 268 if exists $params{'Text'}
86 0 268 exists $params{'SRID'} ? :
87 0 268 if exists $params{'Precision'}
96 0 6 if exists $$self{'Precision'}
105 62 27 if (/^\s*POINT/i) { }
1 26 elsif (/^\s*MULTIPOINT/i) { }
0 26 elsif (/^\s*LINESTRING/i) { }
0 26 elsif (/^\s*MULTILINESTRING/i) { }
11 15 elsif (/^\s*LINEARRING/i) { }
11 4 elsif (/^\s*POLYGON/i) { }
1 3 elsif (/^\s*POLYHEDRALSURFACE/i) { }
2 1 elsif (/^\s*MULTIPOLYGON/i) { }
1 0 elsif (/^\s*GEOMETRYCOLLECTION/i) { }
203 392 216 if $dx1 * $dy2 > $dy1 * $dx2
204 161 55 if $dx1 * $dy2 < $dy1 * $dx2
205 6 49 if $dx1 * $dx2 < 0 or $dy1 * $dy2 < 0
206 7 42 if $dx1 * $dx1 + $dy1 * $dy1 < $dx2 * $dx2 + $dy2 * $dy2
241 11 96 if ($u < 0) { }
11 85 elsif ($u > 1) { }
266 2 0 defined $Precision ? :
293 0 0 defined $SRID ? :
535 95 110 if (@_ == 2 and not $_[0] =~ /^[XYZMpP]/) { }
1 109 elsif (@_ == 3) { }
547 108 196 if (ref $params{$k}) { }
567 67 138 if ($params{'point'}) { }
30 108 elsif ($params{'pointz'}) { }
11 97 elsif ($params{'pointm'}) { }
0 97 elsif ($params{'pointzm'}) { }
570 0 67 if @{$params{'point'};} > 2
571 0 67 if @{$params{'point'};} > 3
576 0 30 if (@{$params{'pointz'};} == 4)
582 11 0 if (@{$params{'pointm'};} == 3) { }
0 0 elsif (@{$params{'pointm'};} == 4) { }
594 97 0 if exists $params{'X'}
595 97 0 if exists $params{'Y'}
596 1 96 if exists $params{'Z'}
597 1 96 if exists $params{'M'}
605 0 0 if exists $$self{$a}
615 0 30 if exists $$self{'Z'}
616 0 30 if exists $$self{'M'}
630 0 30 exists $$self{'M'} ? :
663 0 0 defined $X ? :
669 0 0 defined $Y ? :
680 0 0 exists $$self{'Z'} ? :
0 0 defined $Z ? :
691 0 0 exists $$self{'M'} ? :
0 0 defined $M ? :
698 0 16 exists $$self{'Z'} ? :
699 0 16 if (exists $$self{'Precision'}) { }
701 0 0 unless exists $$self{$a}
707 32 16 if exists $$self{$a}
710 0 16 if (exists $$self{'M'})
716 1 15 if $force_parens
717 1 15 if $include_tag
724 0 158 unless $geom->isa('Geo::OGC::Point')
725 4 154 if (exists $$self{'Precision'})
727 3 7 unless exists $$self{$a} and exists $$geom{$a}
730 1 6 if $s != $g
741 0 15 unless $p1
743 0 15 unless $p2
749 4 8 if $d < $distance
756 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
0 0 elsif ($geom->isa('Geo::OGC::GeometryCollection')) { }
761 0 0 if ($$geom{'ExteriorRing'}->IsPointIn($self)) { }
763 0 0 if $ring->IsPointIn($self)
773 0 0 if $d < $dist
799 0 0 if $self->Within($geom)
805 36 11 if ($geom->isa('Geo::OGC::Point')) { }
11 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
0 0 elsif ($geom->isa('Geo::OGC::GeometryCollection')) { }
806 27 9 $self->Equals($geom) ? :
808 7 4 $self->DistanceToLineStringSqr($geom) < $Geo::OGC::Point::SNAP_DISTANCE_SQR ? :
810 0 0 unless ($$geom{'ExteriorRing'}->IsPointStricktlyOut($self))
812 0 0 if $ring->IsPointStricktlyIn($self)
819 0 0 if $self->Within($g)
836 0 1 if (@_ > 2) { }
889 4 22 if ($params{'points'}) { }
0 22 elsif ($params{'pointsm'}) { }
920 0 3 $self->Is3D ? :
921 0 3 if $self->IsMeasured
922 0 3 if $include_tag
933 0 121 unless $point and $point->isa('Geo::OGC::Point')
936 4 117 if (defined $i) { }
956 25 0 if @$points
962 25 0 if @$points
981 0 9 if defined $point
988 1 44 if $p->Is3D
996 0 40 if $p->IsMeasured
1021 2 0 if $ret and $upgrade
1028 0 0 unless $geom->isa('Geo::OGC::Curve')
1029 0 0 unless $#{$$self{'Points'};} == $#{$$geom{'Points'};}
1031 0 0 unless $$self{'Points'}[$i]->Equals($$geom{'Points'}[$i])
1064 0 0 unless @{$$self{'Points'};}
1069 0 0 if $d < $dmin
1077 0 0 if $i == 0 || $i == $#{$$self{'Points'};} and $self->isa('Geo::OGC::LinearRing')
1086 0 0 if ($t < 0) { }
0 0 elsif ($t > 1) { }
1094 0 0 unless @{$$self{'Points'};}
1100 0 0 if not defined $dmin or $d < $dmin
1140 0 0 if ($y1 > $y2) { }
1168 0 0 if (@{$Q[$k];} == 3)
1191 0 13 if $edges < 2
1196 0 60 if $i < $edges - 1 and $$self{'Points'}[$i + 2]->Equals($$self{'Points'}[$i])
1198 9 111 if $closed and $i == 0 and $j == $edges - 1
1199 2 116 if intersect($$self{'Points'}[$i]{'X'}, $$self{'Points'}[$i]{'Y'}, $$self{'Points'}[$i + 1]{'X'}, $$self{'Points'}[$i + 1]{'Y'}, $$self{'Points'}[$j]{'X'}, $$self{'Points'}[$j]{'Y'}, $$self{'Points'}[$j + 1]{'X'}, $$self{'Points'}[$j + 1]{'Y'})
1215 0 0 if not defined $minx or $minx > $$p{'X'}
1216 0 0 if not defined $miny or $miny > $$p{'Y'}
1217 0 0 if not defined $maxx or $maxx > $$p{'X'}
1218 0 0 if not defined $maxy or $maxy > $$p{'Y'}
1246 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
0 0 elsif ($geom->isa('Geo::OGC::GeometryCollection')) { }
1252 0 0 if not defined $dist or $d < $dist
1259 0 0 if not defined $dist or $d < $dist
1266 0 0 if $d < $dist
1279 0 4 unless $p1
1281 0 4 unless $p1
1282 2 2 if distance_point_line_sqr($x, $y, $$p1{'X'}, $$p1{'Y'}, $$p2{'X'}, $$p2{'Y'}) < $Geo::OGC::LineString::SNAP_DISTANCE_SQR
1287 0 0 if distance_point_line_sqr($x, $y, $$p1{'X'}, $$p1{'Y'}, $$p2{'X'}, $$p2{'Y'}) < $Geo::OGC::LineString::SNAP_DISTANCE_SQR
1295 7 3 if ($geom->isa('Geo::OGC::Point')) { }
3 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
1297 7 3 unless $p->Equals($geom)
1304 2 2 unless @w2
1305 2 0 unless @w1
1309 0 0 if $w1 == $w2
1312 0 0 unless $overlap
1318 0 0 if $$geom{'ExteriorRing'}->IsPointStricktlyOut($p)
1320 0 0 if $ring->IsPointStricktlyIn($p)
1325 0 0 unless $g->isa('Geo::OGC::Line')
1333 0 0 if $s == $e
1336 0 0 unless $overlap
1341 0 0 unless $g->isa('Geo::OGC::Line')
1349 0 0 if $s == $e
1352 0 0 unless $overlap
1365 0 5 if ($geom->isa('Geo::OGC::Point')) { }
5 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
1366 0 0 if $geom->DistanceToLineStringSqr($self) < $Geo::OGC::LineString::SNAP_DISTANCE_SQR
1373 5 17 unless $p1
1376 17 130 unless $q1
1380 19 111 if (intersect(@p, @q))
1386 10 9 if ($p1q < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
9 0 elsif ($p2q < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
0 0 elsif ($q1p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
0 0 elsif ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
1387 5 5 if ($q1p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1388 5 0 if ($p1->Equals($q1)) { }
1394 7 3 if ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1395 5 2 if ($p1->Equals($q2)) { }
1401 1 9 if ($p2q < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
1407 5 4 if ($q1p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1408 5 0 if ($p2->Equals($q1)) { }
1414 4 5 if ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1415 4 0 if ($p2->Equals($q2)) { }
1423 0 0 if ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
1444 35 57 if $g1 == $g2
1445 35 22 if ($i{$g1}->Within($i{$g2}))
1480 0 0 if ($dot <= 0) { }
1486 0 0 if ($dot >= $m12) { }
1502 0 0 if ($last > $first + 1)
1516 0 0 if ($di > $db)
1525 0 0 if ($db >= $tolerance)
1601 32 207 unless $prev
1602 17 86 if $$p{'Y'} <= $y && $y < $$prev{'Y'} || $$prev{'Y'} <= $y && $y < $$p{'Y'} and $x < ($$prev{'X'} - $$p{'X'}) * ($y - $$p{'Y'}) / ($$prev{'Y'} - $$p{'Y'}) + $$p{'X'}
1614 0 0 if $self->IsPointIn($point) and not $point->DistanceToLineStringSqr($self) < $Geo::OGC::LinearRing::SNAP_DISTANCE_SQR
1622 0 0 unless $self->IsPointIn($point) or $point->DistanceToLineStringSqr($self) < $Geo::OGC::LinearRing::SNAP_DISTANCE_SQR
1673 0 0 if $$self{'Points'}[$i]{'Y'} > $$self{'Points'}[$t]{'Y'}
1677 0 0 if $p < 0
1680 0 0 if $n > $N
1767 2 0 if $$self{'ExteriorRing'}
1784 0 3 unless @{$$self{'ExteriorRing'}{'Points'};} > 3
1785 0 3 unless $$self{'ExteriorRing'}->IsClosed
1790 0 3 unless $r->IsClosed
1798 0 14 unless $$self{'ExteriorRing'}->IsPointIn($p)
1800 14 9 if $ring == $r2
1801 0 9 if $r2->IsPointIn($p)
1807 0 3 unless $$self{'ExteriorRing'}->IsSimple
1809 0 3 unless $r->IsSimple
1822 0 3 if @{$$r2{'Geometries'};} and @{$$r2{'Geometries'};} > 1 || !$$r2{'Geometries'}[0]->isa('Geo::OGC::Point')
1828 0 0 if @{$$r2{'Geometries'};} and @{$$r2{'Geometries'};} > 1 || !$$r2{'Geometries'}[0]->isa('Geo::OGC::Point')
1839 0 5 if $$self{'ExteriorRing'}->Is3D
1841 0 0 if $r->Is3D
1848 0 5 if $$self{'ExteriorRing'}->IsMeasured
1850 0 0 if $r->IsMeasured
1857 0 2 unless $ring and $ring->isa('Geo::OGC::LinearRing')
1860 2 0 unless defined $i
1861 1 1 if (@$rings) { }
1871 15 0 if (defined $ring) { }
1872 0 15 unless $ring->isa('Geo::OGC::LinearRing')
1897 0 0 if defined $ring
1898 0 0 if @$rings
1904 0 0 unless $geom->isa('Geo::OGC::Polygon')
1905 0 0 unless @{$$self{'InteriorRings'};} == @{$$geom{'InteriorRings'};}
1906 0 0 unless $$self{'ExteriorRing'}->Equals($$geom{'ExteriorRing'})
1908 0 0 unless $$self{'InteriorRings'}[$i]->Equals($$geom{'InteriorRings'}[$i])
1925 1 8 if ($c)
1927 0 0 if $ring->IsPointIn($point)
1935 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
0 0 elsif ($geom->isa('Geo::OGC::GeometryCollection')) { }
1942 0 0 if ($$geom{'ExteriorRing'}->IsPointIn($p)) { }
1945 0 0 if ($ring->IsPointIn($p))
1947 0 0 if not defined $dist or $d < $dist
1951 0 0 if $c
1954 0 0 if not defined $dist or $d < $dist
1962 0 0 if $d < $dist
1972 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
1974 0 0 unless $p->Equals($geom)
1979 0 0 unless $p->Within($geom)
1987 0 0 unless $p->Within($geom)
1997 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
2014 0 0 if $B->IsPointStricktlyOut($p)
2016 0 0 if $i == @{$$A{'Points'};}
2018 0 0 if (defined $j)
2030 3 0 if $$self{'ExteriorRing'}
2035 0 3 $self->Is3D ? :
2036 0 3 if $self->IsMeasured
2037 2 1 if $include_tag
2050 0 0 unless $$self{'ExteriorRing'}
2056 0 0 if $d < $dmin
2064 0 0 if $iring < 0
2070 0 0 unless $$self{'ExteriorRing'}
2076 0 0 if $d < $dmin
2084 0 0 if $ring < 0
2090 0 0 if $ring < 0
2143 1 1 if ($params{'patches'}) { }
0 1 elsif ($params{'patchesm'}) { }
2168 0 12 unless $patch and $patch->isa('Geo::OGC::Polygon')
2171 12 0 unless defined $i
2172 10 2 if (@$patches) { }
2188 0 0 if defined $patch
2189 0 0 if @$patches
2205 0 0 if $p->IsMeasured
2217 0 0 $self->Is3D ? :
2218 0 0 if $self->IsMeasured
2219 0 0 if $include_tag
2284 0 0 if not defined $dim or $d > $dim
2292 0 3 if $g->Is3D
2300 0 3 if $g->IsMeasured
2308 0 1 $self->Is3D ? :
2309 0 1 if $self->IsMeasured
2310 1 0 if $include_tag
2320 0 26 unless $geometry and $geometry->isa('Geo::OGC::Geometry')
2323 26 0 unless defined $i
2324 13 13 if (@$geometries) { }
2348 0 0 if defined $geometry
2349 0 0 if @$geometries
2359 0 0 if not defined $minx or $minx > $$min{'X'}
2360 0 0 if not defined $miny or $miny > $$min{'Y'}
2361 0 0 if not defined $maxx or $maxx > $$max{'X'}
2362 0 0 if not defined $maxy or $maxy > $$max{'Y'}
2376 0 0 unless $geom->isa('Geo::OGC::GeometryCollection')
2377 0 0 unless @{$$self{'Geometries'};} == @{$$geom{'Geometries'};}
2379 0 0 unless $$self{'Geometries'}[$i]->Equals($$geom{'Geometries'}[$i])
2386 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
0 0 elsif ($geom->isa('Geo::OGC::GeometryCollection')) { }
2396 0 0 if $d < $dist
2406 0 0 unless @{$$self{'Geometries'};}
2411 0 0 if $i == 0
2413 0 0 if ($r[$#r] < $rmin[$#rmin])
2430 0 0 unless @{$$self{'Geometries'};}
2435 0 0 if $i == 0
2437 0 0 if ($r[$#r] < $rmin[$#rmin])
2464 0 0 if $polygon
2553 0 2 if ($params{'points'}) { }
1 1 elsif ($params{'pointsm'}) { }
2571 0 0 $self->Is3D ? :
2572 0 0 if $self->IsMeasured
2573 0 0 if $include_tag
2610 0 1 $self->Is3D ? :
2611 0 1 if $self->IsMeasured
2612 1 0 if $include_tag
2644 0 0 $self->Is3D ? :
2645 0 0 if $self->IsMeasured
2646 0 0 if $include_tag