Branch Coverage

blib/lib/Geo/OGC/Geometry.pm
Criterion Covered Total %
branch 220 604 36.4


line true false branch
85 9 269 if exists $params{'Text'}
98 0 269 exists $params{'SRID'} ? :
99 0 269 if exists $params{'Precision'}
107 0 6 if exists $self->{'Precision'}
119 136 90 unless $text =~ /^\s*$t/i
122 1 89 if ($text =~ /^EMPTY/i) { }
131 62 28 if ($type eq 'POINT') { }
1 27 elsif ($type eq 'MULTIPOINT') { }
0 27 elsif ($type eq 'LINESTRING') { }
0 27 elsif ($type eq 'MULTILINESTRING') { }
11 16 elsif ($type eq 'LINEARRING') { }
11 5 elsif ($type eq 'POLYGON') { }
1 4 elsif ($type eq 'POLYHEDRALSURFACE') { }
2 2 elsif ($type eq 'MULTIPOLYGON') { }
2 0 elsif ($type eq 'GEOMETRYCOLLECTION') { }
132 0 62 unless $text
136 0 1 unless $text
145 0 0 unless $text
154 0 0 unless $text
163 0 11 unless $text
172 0 11 unless $text
182 0 1 unless $text
191 0 2 unless $text
200 1 1 unless $text
222 392 216 if $dx1 * $dy2 > $dy1 * $dx2
223 161 55 if $dx1 * $dy2 < $dy1 * $dx2
224 6 49 if $dx1 * $dx2 < 0 or $dy1 * $dy2 < 0
225 7 42 if $dx1 * $dx1 + $dy1 * $dy1 < $dx2 * $dx2 + $dy2 * $dy2
258 11 107 if ($u < 0) { }
20 87 elsif ($u > 1) { }
297 2 0 defined $Precision ? :
339 0 0 defined $SRID ? :
371 1 3 if $self->IsEmpty
789 95 110 if (@_ == 2 and not $_[0] =~ /^[XYZMpP]/) { }
1 109 elsif (@_ == 3) { }
801 108 196 if (ref $params{$k}) { }
821 67 138 if ($params{'point'}) { }
30 108 elsif ($params{'pointz'}) { }
11 97 elsif ($params{'pointm'}) { }
0 97 elsif ($params{'pointzm'}) { }
824 0 67 if @{$params{'point'};} > 2
825 0 67 if @{$params{'point'};} > 3
830 0 30 if (@{$params{'pointz'};} == 4)
836 11 0 if (@{$params{'pointm'};} == 3) { }
0 0 elsif (@{$params{'pointm'};} == 4) { }
848 97 0 if exists $params{'X'}
849 97 0 if exists $params{'Y'}
850 1 96 if exists $params{'Z'}
851 1 96 if exists $params{'M'}
859 0 0 if exists $self->{$a}
868 0 30 if exists $self->{'Z'}
869 0 30 if exists $self->{'M'}
883 0 30 exists $self->{'M'} ? :
916 0 0 defined $X ? :
922 0 0 defined $Y ? :
938 0 0 exists $self->{'Z'} ? :
0 0 defined $Z ? :
954 0 0 exists $self->{'M'} ? :
0 0 defined $M ? :
960 0 16 exists $self->{'Z'} ? :
961 0 16 if (exists $self->{'Precision'}) { }
963 0 0 unless exists $self->{$a}
969 32 16 if exists $self->{$a}
972 0 16 if (exists $self->{'M'})
978 1 15 if $force_parens
979 1 15 if $include_tag
986 0 166 unless $geom->isa('Geo::OGC::Point')
987 4 162 if (exists $self->{'Precision'})
989 3 7 unless exists $self->{$a} and exists $geom->{$a}
992 1 6 if $s != $g
1003 0 24 unless $p1
1005 0 24 unless $p2
1011 4 8 if $d < $distance
1018 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')) { }
1023 0 0 if ($geom->{'ExteriorRing'}->IsPointIn($self)) { }
1025 0 0 if $ring->IsPointIn($self)
1035 0 0 if $d < $dist
1061 0 0 if $self->Within($geom)
1067 23 20 if ($geom->isa('Geo::OGC::Point')) { }
20 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
0 0 elsif ($geom->isa('Geo::OGC::GeometryCollection')) { }
1068 22 1 $self->Equals($geom) ? :
1070 12 8 $self->DistanceToLineStringSqr($geom) < $Geo::OGC::Point::SNAP_DISTANCE_SQR ? :
1072 0 0 unless ($geom->{'ExteriorRing'}->IsPointStricktlyOut($self))
1074 0 0 if $ring->IsPointStricktlyIn($self)
1081 0 0 if $self->Within($g)
1098 0 1 if (@_ > 2) { }
1154 4 22 if ($params{'points'}) { }
0 22 elsif ($params{'pointsm'}) { }
1175 0 0 if not $self->{'Points'} or @{$self->{'Points'};} == 0
1191 0 3 $self->Is3D ? :
1192 0 3 if $self->IsMeasured
1193 0 3 if $include_tag
1214 0 121 unless $point and $point->isa('Geo::OGC::Point')
1217 4 117 if (defined $i) { }
1246 25 0 if @$points
1252 25 0 if @$points
1284 0 9 if defined $point
1291 1 44 if $p->Is3D
1299 0 40 if $p->IsMeasured
1337 2 0 if $ret and $upgrade
1344 0 0 unless $geom->isa('Geo::OGC::Curve')
1345 0 0 unless $#{$$self{'Points'};} == $#{$$geom{'Points'};}
1347 0 0 unless $self->{'Points'}[$i]->Equals($geom->{'Points'}[$i])
1387 0 0 unless @{$self->{'Points'};}
1392 0 0 if $d < $dmin
1400 0 0 if $i == 0 || $i == $#{$$self{'Points'};} and $self->isa('Geo::OGC::LinearRing')
1409 0 0 if ($t < 0) { }
0 0 elsif ($t > 1) { }
1417 0 0 unless @{$self->{'Points'};}
1423 0 0 if not defined $dmin or $d < $dmin
1467 0 0 if ($y1 > $y2) { }
1495 0 0 if (@{$Q[$k];} == 3)
1518 0 13 if $edges < 2
1523 0 60 if $i < $edges - 1 and $self->{'Points'}[$i + 2]->Equals($self->{'Points'}[$i])
1525 9 111 if $closed and $i == 0 and $j == $edges - 1
1532 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'})
1542 0 0 if not defined $minx or $minx > $p->{'X'}
1543 0 0 if not defined $miny or $miny > $p->{'Y'}
1544 0 0 if not defined $maxx or $maxx > $p->{'X'}
1545 0 0 if not defined $maxy or $maxy > $p->{'Y'}
1582 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')) { }
1588 0 0 if not defined $dist or $d < $dist
1595 0 0 if not defined $dist or $d < $dist
1602 0 0 if $d < $dist
1615 0 6 unless $p1
1617 0 6 unless $p1
1619 2 4 if distance_point_line_sqr($x, $y, $p1->{'X'}, $p1->{'Y'}, $p2->{'X'}, $p2->{'Y'}) < $Geo::OGC::LineString::SNAP_DISTANCE_SQR
1624 0 0 if distance_point_line_sqr($x, $y, $p1->{'X'}, $p1->{'Y'}, $p2->{'X'}, $p2->{'Y'}) < $Geo::OGC::LineString::SNAP_DISTANCE_SQR
1631 22 5 if ($geom->isa('Geo::OGC::Point')) { }
5 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
1633 22 9 unless $p->Equals($geom)
1640 4 2 unless @w2
1641 2 0 unless @w1
1645 0 0 if $w1 == $w2
1648 0 0 unless $overlap
1654 0 0 if $geom->{'ExteriorRing'}->IsPointStricktlyOut($p)
1656 0 0 if $ring->IsPointStricktlyIn($p)
1661 0 0 unless $g->isa('Geo::OGC::Line')
1669 0 0 if $s == $e
1672 0 0 unless $overlap
1677 0 0 unless $g->isa('Geo::OGC::Line')
1685 0 0 if $s == $e
1688 0 0 unless $overlap
1701 0 5 if ($geom->isa('Geo::OGC::Point')) { }
5 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
1702 0 0 if $geom->DistanceToLineStringSqr($self) < $Geo::OGC::LineString::SNAP_DISTANCE_SQR
1709 5 17 unless $p1
1712 17 130 unless $q1
1716 19 111 if (intersect(@p, @q))
1722 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) { }
1723 5 5 if ($q1p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1724 5 0 if ($p1->Equals($q1)) { }
1730 7 3 if ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1731 5 2 if ($p1->Equals($q2)) { }
1737 1 9 if ($p2q < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
1743 5 4 if ($q1p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1744 5 0 if ($p2->Equals($q1)) { }
1750 4 5 if ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR)
1751 4 0 if ($p2->Equals($q2)) { }
1759 0 0 if ($q2p < $Geo::OGC::LineString::SNAP_DISTANCE_SQR) { }
1780 31 70 if $g1 == $g2
1781 35 35 if ($i{$g1}->Within($i{$g2}))
1816 0 0 if ($dot <= 0) { }
1822 0 0 if ($dot >= $m12) { }
1838 0 0 if ($last > $first + 1)
1852 0 0 if ($di > $db)
1861 0 0 if ($db >= $tolerance)
1951 32 207 unless $prev
1955 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'}
1964 0 0 if $self->IsPointIn($point) and not $point->DistanceToLineStringSqr($self) < $Geo::OGC::LinearRing::SNAP_DISTANCE_SQR
1972 0 0 unless $self->IsPointIn($point) or $point->DistanceToLineStringSqr($self) < $Geo::OGC::LinearRing::SNAP_DISTANCE_SQR
2028 0 0 if $self->{'Points'}[$i]{'Y'} > $self->{'Points'}[$t]{'Y'}
2032 0 0 if $p < 0
2035 0 0 if $n > $N
2129 2 0 if $self->{'ExteriorRing'}
2137 0 1 unless $self->{'ExteriorRing'}
2150 0 3 unless @{$self->{'ExteriorRing'}{'Points'};} > 3
2151 0 3 unless $self->{'ExteriorRing'}->IsClosed
2156 0 3 unless $r->IsClosed
2164 0 14 unless $self->{'ExteriorRing'}->IsPointIn($p)
2166 14 9 if $ring == $r2
2167 0 9 if $r2->IsPointIn($p)
2173 0 3 unless $self->{'ExteriorRing'}->IsSimple
2175 0 3 unless $r->IsSimple
2189 0 3 if @{$r2->{'Geometries'};} and @{$r2->{'Geometries'};} > 1 || !$r2->{'Geometries'}[0]->isa('Geo::OGC::Point')
2195 0 0 if @{$r2->{'Geometries'};} and @{$r2->{'Geometries'};} > 1 || !$r2->{'Geometries'}[0]->isa('Geo::OGC::Point')
2205 0 5 if $self->{'ExteriorRing'}->Is3D
2207 0 0 if $r->Is3D
2214 0 5 if $self->{'ExteriorRing'}->IsMeasured
2216 0 0 if $r->IsMeasured
2223 0 2 unless $ring and $ring->isa('Geo::OGC::LinearRing')
2226 2 0 unless defined $i
2227 1 1 if (@$rings) { }
2237 15 0 if (defined $ring) { }
2238 0 15 unless $ring->isa('Geo::OGC::LinearRing')
2269 0 0 if defined $ring
2270 0 0 if @$rings
2276 0 0 unless $geom->isa('Geo::OGC::Polygon')
2277 0 0 unless @{$self->{'InteriorRings'};} == @{$geom->{'InteriorRings'};}
2278 0 0 unless $self->{'ExteriorRing'}->Equals($geom->{'ExteriorRing'})
2280 0 0 unless $self->{'InteriorRings'}[$i]->Equals($geom->{'InteriorRings'}[$i])
2297 1 8 if ($c)
2299 0 0 if $ring->IsPointIn($point)
2307 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')) { }
2314 0 0 if ($geom->{'ExteriorRing'}->IsPointIn($p)) { }
2317 0 0 if ($ring->IsPointIn($p))
2319 0 0 if not defined $dist or $d < $dist
2323 0 0 if $c
2326 0 0 if not defined $dist or $d < $dist
2334 0 0 if $d < $dist
2344 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
2346 0 0 unless $p->Equals($geom)
2351 0 0 unless $p->Within($geom)
2359 0 0 unless $p->Within($geom)
2369 0 0 if ($geom->isa('Geo::OGC::Point')) { }
0 0 elsif ($geom->isa('Geo::OGC::LineString')) { }
0 0 elsif ($geom->isa('Geo::OGC::Polygon')) { }
2386 0 0 if $B->IsPointStricktlyOut($p)
2388 0 0 if $i == @{$A->{'Points'};}
2390 0 0 if (defined $j)
2402 3 0 if $self->{'ExteriorRing'}
2407 0 3 $self->Is3D ? :
2408 0 3 if $self->IsMeasured
2409 2 1 if $include_tag
2422 0 0 unless $self->{'ExteriorRing'}
2428 0 0 if $d < $dmin
2436 0 0 if $iring < 0
2442 0 0 unless $self->{'ExteriorRing'}
2448 0 0 if $d < $dmin
2456 0 0 if $ring < 0
2462 0 0 if $ring < 0
2521 1 1 if ($params{'patches'}) { }
0 1 elsif ($params{'patchesm'}) { }
2542 0 0 if not $self->{'Patches'} or @{$self->{'Patches'};} == 0
2552 0 12 unless $patch and $patch->isa('Geo::OGC::Polygon')
2555 12 0 unless defined $i
2556 10 2 if (@$patches) { }
2572 0 0 if defined $patch
2573 0 0 if @$patches
2589 0 0 if $p->IsMeasured
2601 0 0 $self->Is3D ? :
2602 0 0 if $self->IsMeasured
2603 0 0 if $include_tag
2665 1 2 if not $self->{'Geometries'} or @{$self->{'Geometries'};} == 0
2678 0 0 if not defined $dim or $d > $dim
2686 0 3 if $g->Is3D
2694 0 3 if $g->IsMeasured
2702 0 1 $self->Is3D ? :
2703 0 1 if $self->IsMeasured
2704 1 0 if $include_tag
2714 0 26 unless $geometry and $geometry->isa('Geo::OGC::Geometry')
2717 26 0 unless defined $i
2718 13 13 if (@$geometries) { }
2752 0 0 if defined $geometry
2753 0 0 if @$geometries
2763 0 0 if not defined $minx or $minx > $min->{'X'}
2764 0 0 if not defined $miny or $miny > $min->{'Y'}
2765 0 0 if not defined $maxx or $maxx > $max->{'X'}
2766 0 0 if not defined $maxy or $maxy > $max->{'Y'}
2780 0 0 unless $geom->isa('Geo::OGC::GeometryCollection')
2781 0 0 unless @{$self->{'Geometries'};} == @{$geom->{'Geometries'};}
2783 0 0 unless $self->{'Geometries'}[$i]->Equals($geom->{'Geometries'}[$i])
2790 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')) { }
2800 0 0 if $d < $dist
2810 0 0 unless @{$self->{'Geometries'};}
2815 0 0 if $i == 0
2817 0 0 if ($r[$#r] < $rmin[$#rmin])
2834 0 0 unless @{$self->{'Geometries'};}
2839 0 0 if $i == 0
2841 0 0 if ($r[$#r] < $rmin[$#rmin])
2866 0 0 if $polygon
2963 0 2 if ($params{'points'}) { }
1 1 elsif ($params{'pointsm'}) { }
2981 0 0 $self->Is3D ? :
2982 0 0 if $self->IsMeasured
2983 0 0 if $include_tag
3022 0 1 $self->Is3D ? :
3023 0 1 if $self->IsMeasured
3024 1 0 if $include_tag
3074 0 0 $self->Is3D ? :
3075 0 0 if $self->IsMeasured
3076 0 0 if $include_tag