| 1 | package Geo::GDAL::FFI::Geometry; | ||||||||||||||||||||||||||||||||||||
| 2 | 13 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 13 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||
| 7 | 13 | our $VERSION = '0.15'; | |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||
| 9 | 13 | my %ref; | |||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||
| 11 | sub new { | ||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 13 | 0 | my $g = 0; | |||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | confess "Must give either geometry type or format => data." unless @_; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | if (@_ == 1) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | my $type = shift // ''; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() // ""
MC/DC0%0/1
shift() // ""
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||
| 17 | 0 | my $tmp = $Geo::GDAL::FFI::geometry_types{$type}; | |||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | confess "Empty or unknown geometry type: '$type'." unless defined $tmp; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $m = $type =~ /M$/; | |||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my $z = $type =~ /ZM$/ || $type =~ /25D$/; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type =~ /ZM$/ || $type =~ /25D$/
MC/DC0%0/2
$type =~ /ZM$/ || $type =~ /25D$/
$type =~ /ZM$/
$type =~ /25D$/
Truth table0%0/3
A || B
A= $type =~ /ZM$/B= $type =~ /25D$/
| |||||||||||||||||||||||||||||||||||||
| 21 | 0 | $g = Geo::GDAL::FFI::OGR_G_CreateGeometry($tmp); | |||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | confess "OGR_G_CreateGeometry failed." unless $g; # should not happen | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | Geo::GDAL::FFI::OGR_G_SetMeasured($g, 1) if $m; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | Geo::GDAL::FFI::OGR_G_Set3D($g, 1) if $z; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 25 | 0 | return bless \$g, $class; | |||||||||||||||||||||||||||||||||||
| 26 | } else { | ||||||||||||||||||||||||||||||||||||
| 27 | 0 | my ($format, $string, $sr) = @_; | |||||||||||||||||||||||||||||||||||
| 28 | 0 | my $tmp = $Geo::GDAL::FFI::geometry_formats{$format}; | |||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | confess "Empty or unknown geometry format: '$format'." unless defined $tmp; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | $sr = $$sr if $sr; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ($format eq 'WKT') { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $e = Geo::GDAL::FFI::OGR_G_CreateFromWkt(\$string, $sr, \$g); | |||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | confess(Geo::GDAL::FFI::error_msg({OGRError => $e})) if $e; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||
| 36 | 0 | return bless \$g, $class; | |||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||
| 39 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||
| 41 | 0 | Geo::GDAL::FFI::_deregister_parent_ref ($$self); | |||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ($ref{$$self}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 43 | 0 | delete $ref{$$self}; | |||||||||||||||||||||||||||||||||||
| 44 | 0 | return; | |||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if ($Geo::GDAL::FFI::immutable{$$self}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 47 | #say STDERR "forget $$self $immutable{$$self}"; | ||||||||||||||||||||||||||||||||||||
| 48 | 0 | $Geo::GDAL::FFI::immutable{$$self}--; | |||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | delete $Geo::GDAL::FFI::immutable{$$self} if $Geo::GDAL::FFI::immutable{$$self} == 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 50 | } else { | ||||||||||||||||||||||||||||||||||||
| 51 | #say STDERR "destroy $$self"; | ||||||||||||||||||||||||||||||||||||
| 52 | 0 | Geo::GDAL::FFI::OGR_G_DestroyGeometry($$self); | |||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||
| 56 | sub Clone { | ||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Clone: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $g = Geo::GDAL::FFI::OGR_G_Clone($$self); | |||||||||||||||||||||||||||||||||||
| 59 | 0 | return bless \$g, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||
| 62 | sub GetType { | ||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my ($self, $mode) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetType: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | $mode //= ''; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$mode //= ""
MC/DC0%0/1
$mode //= ""
$mode
Truth table0%0/2
A
A= $mode
| |||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $t = Geo::GDAL::FFI::OGR_G_GetGeometryType($$self); | |||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | Geo::GDAL::FFI::OGR_GT_Flatten($t) if $mode =~ /flatten/i; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 67 | #say STDERR "type is $t"; | ||||||||||||||||||||||||||||||||||||
| 68 | 0 | return $Geo::GDAL::FFI::geometry_types_reverse{$t}; | |||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||
| 71 | sub GetPointCount { | ||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetPointCount: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 73 | 0 | return Geo::GDAL::FFI::OGR_G_GetPointCount($$self); | |||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||
| 76 | sub SetPoint { | ||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||
|
Subroutine
SetPoint: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $i; | |||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if (Geo::GDAL::FFI::OGR_G_GetDimension($$self) == 0) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 81 | 0 | $i = 0; | |||||||||||||||||||||||||||||||||||
| 82 | } else { | ||||||||||||||||||||||||||||||||||||
| 83 | 0 | $i = shift; | |||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||
| 85 | 0 | my ($x, $y, $z, $m, $is3d, $ism); | |||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | confess "SetPoint missing coordinate parameters." unless @_; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if (ref $_[0]) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 88 | 0 | ($x, $y, $z, $m) = @{$_[0]}; | |||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $is3d = $_[1] // Geo::GDAL::FFI::OGR_G_Is3D($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_[1] // Geo::GDAL::FFI::OGR_G_Is3D($$self)
MC/DC0%0/2
$_[1] // Geo::GDAL::FFI::OGR_G_Is3D($$self)
$_[1]
Geo::GDAL::FFI::OGR_G_Is3D($$self)
Truth table0%0/3
A // B
A= $_[1]B= Geo::GDAL::FFI::OGR_G_Is3D($$self)
| |||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $ism = $_[2] // Geo::GDAL::FFI::OGR_G_IsMeasured($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_[2] // Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
MC/DC0%0/2
$_[2] // Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
$_[2]
Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
Truth table0%0/3
A // B
A= $_[2]B= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
| |||||||||||||||||||||||||||||||||||||
| 91 | } else { | ||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | confess "SetPoint missing coordinate parameters." unless @_ > 1; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 93 | 0 | ($x, $y, $z, $m) = @_; | |||||||||||||||||||||||||||||||||||
| 94 | 0 | $is3d = Geo::GDAL::FFI::OGR_G_Is3D($$self); | |||||||||||||||||||||||||||||||||||
| 95 | 0 | $ism = Geo::GDAL::FFI::OGR_G_IsMeasured($$self); | |||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if ($is3d && $ism) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$is3d and $ism
MC/DC0%0/2
$is3d and $ism
$is3d
$ism
Truth table0%0/3
A and B
A= $is3dB= $ism
| |||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $z //= 0; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$z //= 0
MC/DC0%0/1
$z //= 0
$z
Truth table0%0/2
A
A= $z
| |||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $m //= 0; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$m //= 0
MC/DC0%0/1
$m //= 0
$m
Truth table0%0/2
A
A= $m
| |||||||||||||||||||||||||||||||||||||
| 100 | 0 | Geo::GDAL::FFI::OGR_G_SetPointZM($$self, $i, $x, $y, $z, $m); | |||||||||||||||||||||||||||||||||||
| 101 | } elsif ($ism) { | ||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $m //= 0; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$m //= 0
MC/DC0%0/1
$m //= 0
$m
Truth table0%0/2
A
A= $m
| |||||||||||||||||||||||||||||||||||||
| 103 | 0 | Geo::GDAL::FFI::OGR_G_SetPointM($$self, $i, $x, $y, $m); | |||||||||||||||||||||||||||||||||||
| 104 | } elsif ($is3d) { | ||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $z //= 0; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$z //= 0
MC/DC0%0/1
$z //= 0
$z
Truth table0%0/2
A
A= $z
| |||||||||||||||||||||||||||||||||||||
| 106 | 0 | Geo::GDAL::FFI::OGR_G_SetPoint($$self, $i, $x, $y, $z); | |||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||
| 108 | 0 | Geo::GDAL::FFI::OGR_G_SetPoint_2D($$self, $i, $x, $y); | |||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||
| 112 | sub GetPoint { | ||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | my ($self, $i, $is3d, $ism) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetPoint: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | $i //= 0; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$i //= 0
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
| |||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | $is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self)
MC/DC0%0/2
$is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self)
$is3d
Geo::GDAL::FFI::OGR_G_Is3D($$self)
Truth table0%0/3
A //= B
A= $is3dB= Geo::GDAL::FFI::OGR_G_Is3D($$self)
| |||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
MC/DC0%0/2
$ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
$ism
Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
Truth table0%0/3
A //= B
A= $ismB= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
| |||||||||||||||||||||||||||||||||||||
| 117 | 0 | my ($x, $y, $z, $m) = (0, 0, 0, 0); | |||||||||||||||||||||||||||||||||||
| 118 | 0 | Geo::GDAL::FFI::OGR_G_GetPointZM($$self, $i, \$x, \$y, \$z, \$m); | |||||||||||||||||||||||||||||||||||
| 119 | 0 | my @point = ($x, $y); | |||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | push @point, $z if $is3d; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | push @point, $m if $ism; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | return wantarray ? @point : \@point; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||
| 125 | sub GetPoints { | ||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | my ($self, $is3d, $ism) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetPoints: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | $is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self)
MC/DC0%0/2
$is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self)
$is3d
Geo::GDAL::FFI::OGR_G_Is3D($$self)
Truth table0%0/3
A //= B
A= $is3dB= Geo::GDAL::FFI::OGR_G_Is3D($$self)
| |||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
MC/DC0%0/2
$ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
$ism
Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
Truth table0%0/3
A //= B
A= $ismB= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
| |||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $points = []; | |||||||||||||||||||||||||||||||||||
| 130 | 0 | my $n = $self->GetGeometryCount; | |||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if ($n == 0) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 132 | 0 | $n = $self->GetPointCount; | |||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | return scalar $self->GetPoint(0, $is3d, $ism) if $n == 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 134 | 0 | for my $i (0..$n-1) { | |||||||||||||||||||||||||||||||||||
| 135 | 0 | my $p = $self->GetPoint($i, $is3d, $ism); | |||||||||||||||||||||||||||||||||||
| 136 | 0 | push @$points, $p; | |||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||
| 138 | 0 | return $points; | |||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||
| 140 | 0 | for my $i (0..$n-1) { | |||||||||||||||||||||||||||||||||||
| 141 | 0 | push @$points, $self->GetGeometry($i)->GetPoints($is3d, $ism); | |||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||
| 143 | 0 | return $points; | |||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||
| 146 | sub SetPoints { | ||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | my ($self, $points, $is3d, $ism) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
SetPoints: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | confess "SetPoints must be called with an arrayref." unless ref $points; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | $is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self)
MC/DC0%0/2
$is3d //= Geo::GDAL::FFI::OGR_G_Is3D($$self)
$is3d
Geo::GDAL::FFI::OGR_G_Is3D($$self)
Truth table0%0/3
A //= B
A= $is3dB= Geo::GDAL::FFI::OGR_G_Is3D($$self)
| |||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | $ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
MC/DC0%0/2
$ism //= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
$ism
Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
Truth table0%0/3
A //= B
A= $ismB= Geo::GDAL::FFI::OGR_G_IsMeasured($$self)
| |||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $n = $self->GetGeometryCount; | |||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ($n == 0) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | unless (ref $points->[0]) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 154 | 0 | $self->SetPoint($points, $is3d, $ism); | |||||||||||||||||||||||||||||||||||
| 155 | 0 | return; | |||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||
| 157 | 0 | $n = @$points; | |||||||||||||||||||||||||||||||||||
| 158 | 0 | for my $i (0..$n-1) { | |||||||||||||||||||||||||||||||||||
| 159 | 0 | $self->SetPoint($i, $points->[$i], $is3d, $ism); | |||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||
| 161 | 0 | return; | |||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||
| 163 | 0 | for my $i (0..$n-1) { | |||||||||||||||||||||||||||||||||||
| 164 | 0 | $self->GetGeometry($i)->SetPoints($points->[$i], $is3d, $ism); | |||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||
| 168 | sub GetGeometryCount { | ||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetGeometryCount: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 170 | 0 | return Geo::GDAL::FFI::OGR_G_GetGeometryCount($$self); | |||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||
| 173 | sub GetGeometry { | ||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my ($self, $i) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetGeometry: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $g = Geo::GDAL::FFI::OGR_G_GetGeometryRef($$self, $i); | |||||||||||||||||||||||||||||||||||
| 176 | 0 | Geo::GDAL::FFI::_register_parent_ref ($g, $self); | |||||||||||||||||||||||||||||||||||
| 177 | 0 | $ref{$g} = 1; | |||||||||||||||||||||||||||||||||||
| 178 | 0 | return bless \$g, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||
| 181 | sub AddGeometry { | ||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | my ($self, $g) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
AddGeometry: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $e = Geo::GDAL::FFI::OGR_G_AddGeometry($$self, $$g); | |||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | return unless $e; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 186 | 0 | confess(Geo::GDAL::FFI::error_msg()); | |||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||
| 189 | sub RemoveGeometry { | ||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | my ($self, $i) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
RemoveGeometry: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 192 | 0 | my $e = Geo::GDAL::FFI::OGR_G_RemoveGeometry($$self, $i, 1); | |||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | return unless $e; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 194 | 0 | confess(Geo::GDAL::FFI::error_msg()); | |||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||
| 197 | sub ExportToWKT { | ||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | my ($self, $variant) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
ExportToWKT: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $variant //= 'ISO'; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$variant //= "ISO"
MC/DC0%0/1
$variant //= "ISO"
$variant
Truth table0%0/2
A
A= $variant
| |||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $wkt = ''; | |||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ($variant =~ /(?i)iso/) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 202 | 0 | Geo::GDAL::FFI::OGR_G_ExportToIsoWkt($$self, \$wkt); | |||||||||||||||||||||||||||||||||||
| 203 | } else { | ||||||||||||||||||||||||||||||||||||
| 204 | 0 | Geo::GDAL::FFI::OGR_G_ExportToWkt($$self, \$wkt); | |||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||
| 206 | 0 | return $wkt; | |||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||
| 208 | 13 | *AsText = *ExportToWKT; | |||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||
| 210 | sub ExportToGML { | ||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | my ($self, %options) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
ExportToGML: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $o = 0; | |||||||||||||||||||||||||||||||||||
| 213 | 0 | for my $key (keys %options) { | |||||||||||||||||||||||||||||||||||
| 214 | 0 | $o = Geo::GDAL::FFI::CSLAddString($o, "$key=$options{$key}"); | |||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $p; | |||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if ($o) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 218 | 0 | $p = Geo::GDAL::FFI::OGR_G_ExportToGMLEx($$self, $o); | |||||||||||||||||||||||||||||||||||
| 219 | 0 | Geo::GDAL::FFI::CSLDestroy($o); | |||||||||||||||||||||||||||||||||||
| 220 | } else { | ||||||||||||||||||||||||||||||||||||
| 221 | 0 | $p = Geo::GDAL::FFI::OGR_G_ExportToGML($$self); | |||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $ffi = FFI::Platypus->new; | |||||||||||||||||||||||||||||||||||
| 224 | 0 | my $gml = $ffi->cast(opaque => 'string', $p); | |||||||||||||||||||||||||||||||||||
| 225 | 0 | Geo::GDAL::FFI::VSIFree($p); | |||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $gml; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 227 | 0 | return $gml; | |||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||
| 230 | sub ExportToKML { | ||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
ExportToKML: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 232 | 0 | my $p = Geo::GDAL::FFI::OGR_G_ExportToKML($$self); | |||||||||||||||||||||||||||||||||||
| 233 | 0 | my $ffi = FFI::Platypus->new; | |||||||||||||||||||||||||||||||||||
| 234 | 0 | my $kml = $ffi->cast(opaque => 'string', $p); | |||||||||||||||||||||||||||||||||||
| 235 | 0 | Geo::GDAL::FFI::VSIFree($p); | |||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $kml; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 237 | 0 | return $kml; | |||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||
| 240 | sub ExportToJSON { | ||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | my ($self, %options) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
ExportToJSON: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $o = 0; | |||||||||||||||||||||||||||||||||||
| 243 | 0 | for my $key (keys %options) { | |||||||||||||||||||||||||||||||||||
| 244 | 0 | $o = Geo::GDAL::FFI::CSLAddString($o, "$key=$options{$key}"); | |||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $p; | |||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if ($o) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 248 | 0 | $p = Geo::GDAL::FFI::OGR_G_ExportToJsonEx($$self, $o); | |||||||||||||||||||||||||||||||||||
| 249 | 0 | Geo::GDAL::FFI::CSLDestroy($o); | |||||||||||||||||||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||||||||||||||||||
| 251 | 0 | $p = Geo::GDAL::FFI::OGR_G_ExportToJson($$self); | |||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $ffi = FFI::Platypus->new; | |||||||||||||||||||||||||||||||||||
| 254 | 0 | my $json = $ffi->cast(opaque => 'string', $p); | |||||||||||||||||||||||||||||||||||
| 255 | 0 | Geo::GDAL::FFI::VSIFree($p); | |||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $json; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 257 | 0 | return $json; | |||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||
| 260 | sub Intersects { | ||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Intersects: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 262 | 0 | return Geo::GDAL::FFI::OGR_G_Intersects($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||
| 265 | sub Equals { | ||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Equals: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 267 | 0 | return Geo::GDAL::FFI::OGR_G_Equals($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||
| 270 | sub Disjoint { | ||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Disjoint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 272 | 0 | return Geo::GDAL::FFI::OGR_G_Disjoint($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||
| 275 | sub Touches { | ||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Touches: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 277 | 0 | return Geo::GDAL::FFI::OGR_G_Touches($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||
| 280 | sub Crosses { | ||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Crosses: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 282 | 0 | return Geo::GDAL::FFI::OGR_G_Crosses($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||
| 285 | sub Within { | ||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Within: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 287 | 0 | return Geo::GDAL::FFI::OGR_G_Within($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||
| 290 | sub Contains { | ||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Contains: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 292 | 0 | return Geo::GDAL::FFI::OGR_G_Contains($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||
| 295 | sub Overlaps { | ||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Overlaps: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 297 | 0 | return Geo::GDAL::FFI::OGR_G_Overlaps($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||
| 300 | sub Boundary { | ||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Boundary: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 302 | 0 | return bless \Geo::GDAL::FFI::OGR_G_Boundary($$self), 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||
| 305 | sub ConvexHull { | ||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
ConvexHull: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 307 | 0 | return bless \Geo::GDAL::FFI::OGR_G_ConvexHull($$self), 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||
| 310 | sub ConcaveHull { | ||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | my ($self, $ratio, $allow_holes) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
ConcaveHull: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 312 | # A ratio of 0 causes issues similar to | ||||||||||||||||||||||||||||||||||||
| 313 | # https://github.com/libgeos/geos/issues/1212 | ||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | $ratio //= 0.001; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ratio //= "0.001"
MC/DC0%0/1
$ratio //= "0.001"
$ratio
Truth table0%0/2
A
A= $ratio
| |||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | $ratio = 0 if $ratio < 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 316 | 0 | return bless \Geo::GDAL::FFI::OGR_G_ConcaveHull( | |||||||||||||||||||||||||||||||||||
| 317 | $$self, | ||||||||||||||||||||||||||||||||||||
| 318 | $ratio, | ||||||||||||||||||||||||||||||||||||
| 319 | $allow_holes | ||||||||||||||||||||||||||||||||||||
| 320 | ), | ||||||||||||||||||||||||||||||||||||
| 321 | 'Geo::GDAL::FFI::Geometry'; | ||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||
| 324 | sub Segmentize { | ||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | my ($self, $max_len) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Segmentize: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $result = Geo::GDAL::FFI::OGR_G_Segmentize($$self, $max_len); | |||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $result; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 328 | 0 | return $self; | |||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||
| 331 | sub Buffer { | ||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | my ($self, $dist, $quad_segs) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Buffer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 333 | 0 | return bless \Geo::GDAL::FFI::OGR_G_Buffer($$self, $dist, $quad_segs), 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||
| 336 | sub Intersection { | ||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Intersection: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | confess "Undefined geometry." unless $geom; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 339 | 0 | $self = Geo::GDAL::FFI::OGR_G_Intersection($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $self; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 341 | 0 | return bless \$self, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||
| 344 | sub Union { | ||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Union: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | confess "Undefined geometry." unless $geom; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 347 | 0 | $self = Geo::GDAL::FFI::OGR_G_Union($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $self; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 349 | 0 | return bless \$self, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||
| 352 | sub UnaryUnion { | ||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
UnaryUnion: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 354 | 0 | $self = Geo::GDAL::FFI::OGR_G_UnaryUnion($$self); | |||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $self; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 356 | 0 | return bless \$self, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||
| 359 | sub Difference { | ||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Difference: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | confess "Undefined geometry." unless $geom; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 362 | 0 | $self = Geo::GDAL::FFI::OGR_G_Difference($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $self; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 364 | 0 | return bless \$self, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||
| 367 | sub SymDifference { | ||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
SymDifference: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | confess "Undefined geometry." unless $geom; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 370 | 0 | $self = Geo::GDAL::FFI::OGR_G_SymDifference($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $self; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 372 | 0 | return bless \$self, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||
| 375 | sub Distance { | ||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Distance: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | confess "Undefined geometry." unless $geom; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 378 | 0 | return Geo::GDAL::FFI::OGR_G_Distance($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||
| 381 | sub Distance3D { | ||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | my ($self, $geom) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Distance3D: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | confess "Undefined geometry." unless $geom; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 384 | 0 | return Geo::GDAL::FFI::OGR_G_Distance3D($$self, $$geom); | |||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||
| 387 | sub Length { | ||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 389 | 0 | return Geo::GDAL::FFI::OGR_G_Length($$self); | |||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||
| 392 | sub Area { | ||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Area: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 394 | 0 | return Geo::GDAL::FFI::OGR_G_Area($$self); | |||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||
| 397 | sub Centroid { | ||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Centroid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $centroid = Geo::GDAL::FFI::Geometry->new('Point'); | |||||||||||||||||||||||||||||||||||
| 400 | 0 | Geo::GDAL::FFI::OGR_G_Centroid($$self, $$centroid); | |||||||||||||||||||||||||||||||||||
| 401 | 0 | my $msg = Geo::GDAL::FFI::error_msg(); | |||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | confess($msg) if $msg; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 403 | 0 | return $centroid; | |||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||
| 406 | sub Empty { | ||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Empty: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 408 | 0 | Geo::GDAL::FFI::OGR_G_Empty($$self); | |||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||
| 411 | sub IsEmpty { | ||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
IsEmpty: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 413 | 0 | return Geo::GDAL::FFI::OGR_G_IsEmpty($$self); | |||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||
| 416 | sub IsValid { | ||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
IsValid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 418 | 0 | return Geo::GDAL::FFI::OGR_G_IsValid($$self); | |||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||
| 421 | sub IsSimple { | ||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
IsSimple: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 423 | 0 | return Geo::GDAL::FFI::OGR_G_IsSimple($$self); | |||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||
| 426 | sub IsRing { | ||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
IsRing: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 428 | 0 | return Geo::GDAL::FFI::OGR_G_IsRing($$self); | |||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||
| 431 | sub GetEnvelope { | ||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetEnvelope: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $envelope = [0,0,0,0]; | |||||||||||||||||||||||||||||||||||
| 434 | 0 | Geo::GDAL::FFI::OGR_G_GetEnvelope ($$self, $envelope); | |||||||||||||||||||||||||||||||||||
| 435 | 0 | return $envelope; | |||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||
| 438 | sub GetEnvelope3D { | ||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
GetEnvelope3D: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 440 | 0 | my $envelope = [0,0,0,0,0,0]; | |||||||||||||||||||||||||||||||||||
| 441 | 0 | Geo::GDAL::FFI::OGR_G_GetEnvelope3D ($$self, $envelope); | |||||||||||||||||||||||||||||||||||
| 442 | 0 | return $envelope; | |||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||
| 445 | sub MakeValid { | ||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | my ($self, %options) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
MakeValid: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 447 | 0 | my $o = 0; | |||||||||||||||||||||||||||||||||||
| 448 | 0 | for my $key (keys %options) { | |||||||||||||||||||||||||||||||||||
| 449 | 0 | $o = Geo::GDAL::FFI::CSLAddString($o, "$key=$options{$key}"); | |||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||
| 451 | 0 | my $p; | |||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | if ($o) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 453 | 0 | $p = Geo::GDAL::FFI::OGR_G_MakeValidEx($$self, $o); | |||||||||||||||||||||||||||||||||||
| 454 | 0 | Geo::GDAL::FFI::CSLDestroy($o); | |||||||||||||||||||||||||||||||||||
| 455 | } else { | ||||||||||||||||||||||||||||||||||||
| 456 | 0 | $p = Geo::GDAL::FFI::OGR_G_MakeValid($$self); | |||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $p; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 459 | 0 | return bless \$p, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||
| 462 | sub Normalize { | ||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
Normalize: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $g = Geo::GDAL::FFI::OGR_G_Normalize($$self); | |||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | confess Geo::GDAL::FFI::error_msg() unless $g; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 466 | 0 | return bless \$g, 'Geo::GDAL::FFI::Geometry'; | |||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||
| 470 | 13 | 1; | |||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||
| 472 | =pod | ||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||
| 474 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||
| 476 | =head1 NAME | ||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||
| 478 | Geo::GDAL::FFI::Geometry - A GDAL geometry | ||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||
| 480 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||
| 482 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||
| 484 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||
| 486 | =head2 new | ||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||
| 488 | my $geom = Geo::GDAL::FFI::Geometry->new($geometry_type); | ||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||
| 490 | $type must be one of Geo::GDAL::FFI::GeometryTypes(). | ||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||
| 492 | my $geom = Geo::GDAL::FFI::Geometry->new($format, $arg, $sr); | ||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||
| 494 | $format must be one of Geo::GDAL::FFI::GeometryFormats(), e.g., 'WKT'. | ||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||
| 496 | $sr should be a SpatialRef object if given. | ||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||
| 498 | =head2 Clone | ||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||
| 500 | my $geom2 = $geom1->Clone; | ||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||
| 502 | Clones this geometry and returns the clone. | ||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||
| 504 | =head2 GetType | ||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||
| 506 | my $type = $geom->GetType($mode); | ||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||
| 508 | Returns the type of this geometry. If $mode (optional) is 'flatten', | ||||||||||||||||||||||||||||||||||||
| 509 | returns the type without Z, M, or ZM postfix. | ||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||
| 511 | =head2 GetPointCount | ||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||
| 513 | Returns the point count of this geometry. | ||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||
| 515 | =head2 SetPoint | ||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||
| 517 | $point->SetPoint($x, $y, $z, $m); | ||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||
| 519 | Set the coordinates of a point geometry. The usage of $z and $m in the | ||||||||||||||||||||||||||||||||||||
| 520 | method depend on the actual 3D or measured status of the point. | ||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||
| 522 | $point->SetPoint([$x, $y, $z, $m]); | ||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||
| 524 | Set the coordinates of a point geometry. The usage of $z and $m in the | ||||||||||||||||||||||||||||||||||||
| 525 | method depend on the actual 3D or measured status of the geometry. | ||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||
| 527 | $geom->SetPoint($i, $x, $y, $z, $m); | ||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||
| 529 | Set the coordinates of the ith (zero based index) point in a curve | ||||||||||||||||||||||||||||||||||||
| 530 | geometry. The usage of $z and $m in the method depend on the actual 3D | ||||||||||||||||||||||||||||||||||||
| 531 | or measured status of the geometry. | ||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||
| 533 | Note that setting the nth point of a curve creates all points 0..n-2 | ||||||||||||||||||||||||||||||||||||
| 534 | unless they exist. | ||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||
| 536 | $geom->SetPoint($i, $coords); | ||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||
| 538 | Set the coordinates of the ith (zero based index) point in this | ||||||||||||||||||||||||||||||||||||
| 539 | curve. $coords must be a reference to an array of the coordinates. The | ||||||||||||||||||||||||||||||||||||
| 540 | usage of $z and $m in the method depend on the 3D or measured status | ||||||||||||||||||||||||||||||||||||
| 541 | of the geometry. | ||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||
| 543 | Note that setting the nth point of a curve may create all points | ||||||||||||||||||||||||||||||||||||
| 544 | 0..n-2. | ||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||
| 546 | =head2 GetPoint | ||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||
| 548 | my $coords = $geom->GetPoint($i); | ||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||
| 550 | Get the coordinates of the ith (zero based index) point in this | ||||||||||||||||||||||||||||||||||||
| 551 | curve. This method can also be used to set the coordinates of a point | ||||||||||||||||||||||||||||||||||||
| 552 | geometry and then the $i must be zero if it is given. | ||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||
| 554 | Returns the coordinates either as a list or a reference to an | ||||||||||||||||||||||||||||||||||||
| 555 | anonymous array depending on the context. The coordinates contain $z | ||||||||||||||||||||||||||||||||||||
| 556 | and $m depending on the 3D or measured status of the geometry. | ||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||
| 558 | =head2 GetPoints | ||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||
| 560 | my $points = $geom->GetPoints; | ||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||
| 562 | Returns the coordinates of the vertices of this geometry in an obvious | ||||||||||||||||||||||||||||||||||||
| 563 | array based data structure. Note that different geometry types have | ||||||||||||||||||||||||||||||||||||
| 564 | similar data structures. | ||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||
| 566 | =head2 SetPoints | ||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||
| 568 | $geom->SetPoints($points); | ||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||
| 570 | Sets the coordinates of the vertices of this geometry from an obvious | ||||||||||||||||||||||||||||||||||||
| 571 | array based data structure. Note that different geometry types may | ||||||||||||||||||||||||||||||||||||
| 572 | have similar data structures. If the geometry contains subgeometries | ||||||||||||||||||||||||||||||||||||
| 573 | (like polygon contains rings for example), the data structure is | ||||||||||||||||||||||||||||||||||||
| 574 | assumed to adhere to this structure. Uses SetPoint and may thus add | ||||||||||||||||||||||||||||||||||||
| 575 | points to curves. | ||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||
| 577 | =head2 GetGeometryCount | ||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||
| 579 | my $num_geometries = $geom->GetGeometryCount; | ||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||
| 581 | =head2 GetGeometry | ||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||
| 583 | my $outer_ring = $polygon->GetGeometry(0); | ||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||
| 585 | Returns the ith subgeometry (zero based index) in this geometry. The | ||||||||||||||||||||||||||||||||||||
| 586 | returned geometry object is only a wrapper to the underlying C++ | ||||||||||||||||||||||||||||||||||||
| 587 | reference and thus changing that geometry will change the parent. | ||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||
| 589 | =head2 AddGeometry | ||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||
| 591 | $polygon->AddGeometry($ring); | ||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||
| 593 | =head2 RemoveGeometry | ||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||
| 595 | $geom->RemoveGeometry($i); | ||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||
| 597 | =head2 ExportToWKT($variant) | ||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||
| 599 | my $wkt = $geom->ExportToWKT($variant); | ||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||
| 601 | Returns the geometry as WKT. $variant is optional (default is 'ISO'). | ||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||
| 603 | =head2 AsText | ||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||
| 605 | Alias to ExportToWKT. | ||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||
| 607 | =head2 ExportToGML(%options) | ||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||
| 609 | my $gml = $geom->ExportToGML(%options); | ||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||
| 611 | Returns the geometry as GML string. %options may contain options as | ||||||||||||||||||||||||||||||||||||
| 612 | described in GDAL documentation. | ||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||
| 614 | =head2 ExportToJSON(%options) | ||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||
| 616 | my $json = $geom->ExportToJSON(%options); | ||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||
| 618 | Returns the geometry as JSON string. %options may contain options as | ||||||||||||||||||||||||||||||||||||
| 619 | described in GDAL documentation. | ||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||
| 621 | =head2 Intersects | ||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||
| 623 | =head2 Equals | ||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||
| 625 | =head2 Disjoint | ||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||
| 627 | =head2 Touches | ||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||
| 629 | =head2 Crosses | ||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||
| 631 | =head2 Within | ||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||
| 633 | =head2 Contains | ||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||
| 635 | =head2 Overlaps | ||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||
| 637 | =head2 Boundary | ||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||
| 639 | =head2 ConvexHull | ||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||
| 641 | =head2 ConcaveHull($ratio, $allow_holes) | ||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||
| 643 | Generates a concave hull of the input geometry. | ||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||
| 645 | If C<$ratio> is undefined then it defaults to 0.001 as a value of 0 can | ||||||||||||||||||||||||||||||||||||
| 646 | result in unusual segments. | ||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||
| 648 | =head2 Buffer | ||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||
| 650 | =head2 Intersection | ||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||
| 652 | =head2 Union | ||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||
| 654 | =head2 UnaryUnion | ||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||
| 656 | =head2 Difference | ||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||
| 658 | =head2 SymDifference | ||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||
| 660 | =head2 Distance | ||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||
| 662 | =head2 Distance3D | ||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||
| 664 | =head2 Length | ||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||
| 666 | =head2 Area | ||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||
| 668 | =head2 Centroid | ||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||
| 670 | =head2 Empty | ||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||
| 672 | =head2 IsEmpty | ||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||
| 674 | =head2 IsValid | ||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||
| 676 | =head2 IsSimple | ||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||
| 678 | =head2 IsRing | ||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||
| 680 | =head2 Segmentize | ||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||
| 682 | $geom->Segmentize($max_length) | ||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||
| 684 | Requires GEOS 3.10. | ||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||
| 686 | =head2 GetEnvelope | ||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||
| 688 | Returns a four element array reference containing | ||||||||||||||||||||||||||||||||||||
| 689 | [Xmin, Xmax, Ymin, Ymax]. | ||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||
| 691 | =head2 GetEnvelope3D | ||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||
| 693 | Returns a six element array reference containing | ||||||||||||||||||||||||||||||||||||
| 694 | [Xmin, Xmax, Ymin, Ymax, Zmin, Zmax]. | ||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||
| 696 | =head2 MakeValid(%options) | ||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||
| 698 | my $valid_geom = $geom->MakeValid(%options); | ||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||
| 700 | Attempts to make an invalid geometry valid and returns that. %options | ||||||||||||||||||||||||||||||||||||
| 701 | may contain options as described in GDAL documentation. | ||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||
| 703 | Requires GDAL version >= 3.0 | ||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||
| 705 | =head2 Normalize() | ||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||
| 707 | my $normalized_geom = $geom->Normalize(); | ||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||
| 709 | Attempts to bring geometry into normalized/canonical form. | ||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||
| 711 | Requires GDAL version >= 3.3 | ||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||
| 713 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||
| 715 | This software is released under the Artistic License. See | ||||||||||||||||||||||||||||||||||||
| 716 | L<perlartistic>. | ||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||
| 718 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||
| 720 | Ari Jolma - Ari.Jolma at gmail.com | ||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||
| 722 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||
| 724 | L<Geo::GDAL::FFI> | ||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||
| 726 | L<Alien::gdal>, L<FFI::Platypus>, L<http://www.gdal.org> | ||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||
| 728 | =cut | ||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||
| 730 | __END__; | ||||||||||||||||||||||||||||||||||||