FFI/Feature.pm

filter: Statementstmt 13.0% 22 / 169 Branchbran 0.0% 0 / 82 Conditioncond 0.0% 0 / 58 MC/DCmcdc 0.0% 0 / 30 Subroutinesub 31.8% 7 / 22 Podpod 71.4% 10 / 14 totaltotal 10.4% 39 / 375 CC 72 SCAR 65.5
CC
72
Cov
7%
SetField
1482.0
GetField
420.0
GetGeomField
20.0
CRAP 699.5
↑ Summary FFI/Driver.pm »
1 package Geo::GDAL::FFI::Feature;
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 Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 13 ▶use Encode qw(decode encode);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 13 ▶use FFI::Platypus::Buffer;
Subroutine BEGIN: called CC=1 SCAR=0.0
9
10 13 our $VERSION = '0.15';
11
12 sub new {
13 0 ▶ my ($class, $defn) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
14 0 my $f = Geo::GDAL::FFI::OGR_F_Create($$defn);
15 0 return bless \$f, $class;
16 }
17
18 sub DESTROY {
19 0 ▶ my $self = shift;
Subroutine DESTROY: not called CC=1 SCAR=6.9
20 0 Geo::GDAL::FFI::OGR_F_Destroy($$self);
21 }
22
23 sub GetFID {
24 0 ▶ my ($self) = @_;
Subroutine GetFID: not called CC=1 SCAR=6.9
Pod documented
25 0 return Geo::GDAL::FFI::OGR_F_GetFID($$self);
26 }
27
28 sub SetFID {
29 0 ▶ my ($self, $fid) = @_;
Subroutine SetFID: not called CC=2 SCAR=17.9
Pod documented
30 0 ▶ $fid //= 0;
Condition0%0/2
$fid //= 0
l!l
00
MC/DC0%0/1
$fid //= 0
$fid
Truth table0%0/2
A
A= $fid
Aresult
11
00
31 0 Geo::GDAL::FFI::OGR_F_GetFID($$self, $fid);
32 }
33
34 sub GetDefn {
35 0 ▶ my ($self) = @_;
Subroutine GetDefn: not called CC=1 SCAR=6.9
Pod documented
36 0 my $d = Geo::GDAL::FFI::OGR_F_GetDefnRef($$self);
37 0 ++$Geo::GDAL::FFI::immutable{$d};
38 #say STDERR "$d immutable";
39 0 return bless \$d, 'Geo::GDAL::FFI::FeatureDefn';
40 }
41
42 sub Clone {
43 0 ▶ my ($self) = @_;
Subroutine Clone: not called CC=1 SCAR=6.9
Pod documented
44 0 my $f = Geo::GDAL::FFI::OGR_F_Clone($$self);
45 0 return bless \$f, 'Geo::GDAL::FFI::Feature';
46 }
47
48 sub Equals {
49 0 ▶ my ($self, $f) = @_;
Subroutine Equals: not called CC=1 SCAR=6.9
Pod documented
50 0 return Geo::GDAL::FFI::OGR_F_Equal($$self, $$f);
51 }
52
53 sub field_index {
54 0 ▶ my ($self, $field_name, $is_geom) = @_;
Subroutine field_index: not called CC=3 SCAR=24.8
Pod undocumented
55 0 ▶ my $index = $is_geom ?
Branch: 1 branch
BranchTrueFalseTotal
$is_geom ? : 0 0 0
56 Geo::GDAL::FFI::OGR_F_GetGeomFieldIndex($$self, $field_name) :
57 Geo::GDAL::FFI::OGR_F_GetFieldIndex($$self, $field_name);
58 0 ▶ confess "Field '$field_name' does not exist." if $index < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $index < 0 0 0 0
59 0 return $index;
60 }
61
62 sub SetField {
63 0 ▶ my $self = shift;
Subroutine SetField: not called CC=38 SCAR=73.0
Pod documented
64 0 my $i = shift;
65 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
66 0 ▶ $i = $self->field_index($i) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
67 0 ▶ unless (@_) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@_) 0 0 0
68 0 Geo::GDAL::FFI::OGR_F_UnsetField($$self, $i) ;
69 0 return;
70 }
71 0 my ($value) = @_;
72 0 ▶ unless (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
73 0 Geo::GDAL::FFI::OGR_F_SetFieldNull($$self, $i);
74 0 return;
75 }
76 0 my $d = Geo::GDAL::FFI::OGR_F_GetFieldDefnRef($$self, $i);
77 0 my $t = $Geo::GDAL::FFI::field_types_reverse{Geo::GDAL::FFI::OGR_Fld_GetType($d)};
78 0 ▶ if ($t =~ /^Integer64/ && $Config{use64bitint} ne 'define') {
Branch: 1 branch
BranchTrueFalseTotal
if ($t =~ /^Integer64/ and $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define") 0 0 0
Condition0%0/3
$t =~ /^Integer64/ and $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
!ll&&!rl&&r
000
MC/DC0%0/2
$t =~ /^Integer64/ and $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
$t =~ /^Integer64/ $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
Truth table0%0/3
A and B
A= $t =~ /^Integer64/B= $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
ABresult
0X0
100
111
79 0 confess "Your Perl does not support 64 bit integers.";
80 }
81 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldInteger($$self, $i, $value) if $t eq 'Integer';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Integer" 0 0 0
82 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldInteger64($$self, $i, $value) if $t eq 'Integer64';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Integer64" 0 0 0
83 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldDouble($$self, $i, $value) if $t eq 'Real';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Real" 0 0 0
84 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldString($$self, $i, $value) if $t eq 'String';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "String" 0 0 0
85
86 0 ▶ confess "Can't yet set binary fields." if $t eq 'Binary';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Binary" 0 0 0
87
88 0 my @s = @_;
89 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldIntegerList($$self, $i, scalar @s, \@s) if $t eq 'IntegerList';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "IntegerList" 0 0 0
90 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldInteger64List($$self, $i, scalar @s, \@s) if $t eq 'Integer64List';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Integer64List" 0 0 0
91 0 ▶ Geo::GDAL::FFI::OGR_F_SetFieldDoubleList($$self, $i, scalar @s, \@s) if $t eq 'RealList';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "RealList" 0 0 0
92 0 ▶ if ($t eq 'StringList') {
Branch: 4 branches
BranchTrueFalseTotal
if ($t eq 'StringList') { } 0 0 0
elsif ($t eq 'Date') { } 0 0 0
elsif ($t eq 'Time') { } 0 0 0
elsif ($t eq 'DateTime') { } 0 0 0
93 0 my $csl = 0;
94 0 for my $s (@s) {
95 0 $csl = Geo::GDAL::FFI::CSLAddString($csl, $s);
96 }
97 0 Geo::GDAL::FFI::OGR_F_SetFieldStringList($$self, $i, $csl);
98 0 Geo::GDAL::FFI::CSLDestroy($csl);
99 } elsif ($t eq 'Date') {
100 0 my @dt = @_;
101 0 ▶ $dt[0] //= 2000; # year
Condition0%0/2
$dt[0] //= 2000
l!l
00
MC/DC0%0/1
$dt[0] //= 2000
$dt[0]
Truth table0%0/2
A
A= $dt[0]
Aresult
11
00
102 0 ▶ $dt[1] //= 1; # month 1-12
Condition0%0/2
$dt[1] //= 1
l!l
00
MC/DC0%0/1
$dt[1] //= 1
$dt[1]
Truth table0%0/2
A
A= $dt[1]
Aresult
11
00
103 0 ▶ $dt[2] //= 1; # day 1-31
Condition0%0/2
$dt[2] //= 1
l!l
00
MC/DC0%0/1
$dt[2] //= 1
$dt[2]
Truth table0%0/2
A
A= $dt[2]
Aresult
11
00
104 0 ▶ $dt[3] //= 0; # hour 0-23
Condition0%0/2
$dt[3] //= 0
l!l
00
MC/DC0%0/1
$dt[3] //= 0
$dt[3]
Truth table0%0/2
A
A= $dt[3]
Aresult
11
00
105 0 ▶ $dt[4] //= 0; # minute 0-59
Condition0%0/2
$dt[4] //= 0
l!l
00
MC/DC0%0/1
$dt[4] //= 0
$dt[4]
Truth table0%0/2
A
A= $dt[4]
Aresult
11
00
106 0 ▶ $dt[5] //= 0.0; # second with millisecond accuracy
Condition0%0/2
$dt[5] //= 0
l!l
00
MC/DC0%0/1
$dt[5] //= 0
$dt[5]
Truth table0%0/2
A
A= $dt[5]
Aresult
11
00
107 0 ▶ $dt[6] //= 100; # TZ
Condition0%0/2
$dt[6] //= 100
l!l
00
MC/DC0%0/1
$dt[6] //= 100
$dt[6]
Truth table0%0/2
A
A= $dt[6]
Aresult
11
00
108 0 Geo::GDAL::FFI::OGR_F_SetFieldDateTimeEx($$self, $i, @dt);
109 } elsif ($t eq 'Time') {
110 0 my @dt = (0, 0, 0, @_);
111 0 ▶ $dt[3] //= 0; # hour 0-23
Condition0%0/2
$dt[3] //= 0
l!l
00
MC/DC0%0/1
$dt[3] //= 0
$dt[3]
Truth table0%0/2
A
A= $dt[3]
Aresult
11
00
112 0 ▶ $dt[4] //= 0; # minute 0-59
Condition0%0/2
$dt[4] //= 0
l!l
00
MC/DC0%0/1
$dt[4] //= 0
$dt[4]
Truth table0%0/2
A
A= $dt[4]
Aresult
11
00
113 0 ▶ $dt[5] //= 0.0; # second with millisecond accuracy
Condition0%0/2
$dt[5] //= 0
l!l
00
MC/DC0%0/1
$dt[5] //= 0
$dt[5]
Truth table0%0/2
A
A= $dt[5]
Aresult
11
00
114 0 ▶ $dt[6] //= 100; # TZ
Condition0%0/2
$dt[6] //= 100
l!l
00
MC/DC0%0/1
$dt[6] //= 100
$dt[6]
Truth table0%0/2
A
A= $dt[6]
Aresult
11
00
115 0 Geo::GDAL::FFI::OGR_F_SetFieldDateTimeEx($$self, $i, @dt);
116 } elsif ($t eq 'DateTime') {
117 0 my @dt = @_;
118 0 ▶ $dt[0] //= 2000; # year
Condition0%0/2
$dt[0] //= 2000
l!l
00
MC/DC0%0/1
$dt[0] //= 2000
$dt[0]
Truth table0%0/2
A
A= $dt[0]
Aresult
11
00
119 0 ▶ $dt[1] //= 1; # month 1-12
Condition0%0/2
$dt[1] //= 1
l!l
00
MC/DC0%0/1
$dt[1] //= 1
$dt[1]
Truth table0%0/2
A
A= $dt[1]
Aresult
11
00
120 0 ▶ $dt[2] //= 1; # day 1-31
Condition0%0/2
$dt[2] //= 1
l!l
00
MC/DC0%0/1
$dt[2] //= 1
$dt[2]
Truth table0%0/2
A
A= $dt[2]
Aresult
11
00
121 0 ▶ $dt[3] //= 0; # hour 0-23
Condition0%0/2
$dt[3] //= 0
l!l
00
MC/DC0%0/1
$dt[3] //= 0
$dt[3]
Truth table0%0/2
A
A= $dt[3]
Aresult
11
00
122 0 ▶ $dt[4] //= 0; # minute 0-59
Condition0%0/2
$dt[4] //= 0
l!l
00
MC/DC0%0/1
$dt[4] //= 0
$dt[4]
Truth table0%0/2
A
A= $dt[4]
Aresult
11
00
123 0 ▶ $dt[5] //= 0.0; # second with millisecond accuracy
Condition0%0/2
$dt[5] //= 0
l!l
00
MC/DC0%0/1
$dt[5] //= 0
$dt[5]
Truth table0%0/2
A
A= $dt[5]
Aresult
11
00
124 0 ▶ $dt[6] //= 100; # TZ
Condition0%0/2
$dt[6] //= 100
l!l
00
MC/DC0%0/1
$dt[6] //= 100
$dt[6]
Truth table0%0/2
A
A= $dt[6]
Aresult
11
00
125 0 Geo::GDAL::FFI::OGR_F_SetFieldDateTimeEx($$self, $i, @dt);
126 }
127 }
128
129 sub GetField {
130 0 ▶ my ($self, $i, $encoding) = @_;
Subroutine GetField: not called CC=20 SCAR=60.4
Pod documented
131 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
132 0 ▶ $i = $self->field_index($i) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
133 0 ▶ return unless $self->IsFieldSetAndNotNull($i);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->IsFieldSetAndNotNull($i) 0 0 0
134 0 my $d = Geo::GDAL::FFI::OGR_F_GetFieldDefnRef($$self, $i);
135 0 my $t = $Geo::GDAL::FFI::field_types_reverse{Geo::GDAL::FFI::OGR_Fld_GetType($d)};
136 0 ▶ if ($t =~ /^Integer64/ && $Config{use64bitint} ne 'define') {
Branch: 1 branch
BranchTrueFalseTotal
if ($t =~ /^Integer64/ and $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define") 0 0 0
Condition0%0/3
$t =~ /^Integer64/ and $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
!ll&&!rl&&r
000
MC/DC0%0/2
$t =~ /^Integer64/ and $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
$t =~ /^Integer64/ $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
Truth table0%0/3
A and B
A= $t =~ /^Integer64/B= $Geo::GDAL::FFI::Feature::Config{"use64bitint"} ne "define"
ABresult
0X0
100
111
137 0 confess "Your Perl does not support 64 bit integers.";
138 }
139 0 ▶ return Geo::GDAL::FFI::OGR_F_GetFieldAsInteger($$self, $i) if $t eq 'Integer';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Integer" 0 0 0
140 0 ▶ return Geo::GDAL::FFI::OGR_F_GetFieldAsInteger64($$self, $i) if $t eq 'Integer64';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Integer64" 0 0 0
141 0 ▶ return Geo::GDAL::FFI::OGR_F_GetFieldAsDouble($$self, $i) if $t eq 'Real';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Real" 0 0 0
142 0 ▶ if ($t eq 'String') {
Branch: 1 branch
BranchTrueFalseTotal
if ($t eq "String") 0 0 0
143 0 my $retval = Geo::GDAL::FFI::OGR_F_GetFieldAsString($$self, $i);
144 0 ▶ $retval = decode $encoding => $retval if defined $encoding;
Branch: 1 branch
BranchTrueFalseTotal
if defined $encoding 0 0 0
145 0 return $retval;
146 }
147 0 ▶ return Geo::GDAL::FFI::OGR_F_GetFieldAsBinary($$self, $i) if $t eq 'Binary';
Branch: 1 branch
BranchTrueFalseTotal
if $t eq "Binary" 0 0 0
148 0 my @list;
149 0 ▶ if ($t eq 'IntegerList') {
Branch: 7 branches
BranchTrueFalseTotal
if ($t eq 'IntegerList') { } 0 0 0
elsif ($t eq 'Integer64List') { } 0 0 0
elsif ($t eq 'RealList') { } 0 0 0
elsif ($t eq 'StringList') { } 0 0 0
elsif ($t eq 'Date') { } 0 0 0
elsif ($t eq 'Time') { } 0 0 0
elsif ($t eq 'DateTime') { } 0 0 0
150 0 my $len;
151 0 my $p = Geo::GDAL::FFI::OGR_F_GetFieldAsIntegerList($$self, $i, \$len);
152 0 @list = unpack("l[$len]", buffer_to_scalar($p, $len*4));
153 } elsif ($t eq 'Integer64List') {
154 0 my $len;
155 0 my $p = Geo::GDAL::FFI::OGR_F_GetFieldAsInteger64List($$self, $i, \$len);
156 0 @list = unpack("q[$len]", buffer_to_scalar($p, $len*8));
157 } elsif ($t eq 'RealList') {
158 0 my $len;
159 0 my $p = Geo::GDAL::FFI::OGR_F_GetFieldAsDoubleList($$self, $i, \$len);
160 0 @list = unpack("d[$len]", buffer_to_scalar($p, $len*8));
161 } elsif ($t eq 'StringList') {
162 0 my $p = Geo::GDAL::FFI::OGR_F_GetFieldAsStringList($$self, $i);
163 0 for my $i (0..Geo::GDAL::FFI::CSLCount($p)-1) {
164 0 push @list, Geo::GDAL::FFI::CSLGetField($p, $i);
165 }
166 } elsif ($t eq 'Date') {
167 0 my ($y, $m, $d, $h, $min, $s, $tz) = (0, 0, 0, 0, 0, 0.0, 0);
168 0 Geo::GDAL::FFI::OGR_F_GetFieldAsDateTimeEx($$self, $i, \$y, \$m, \$d, \$h, \$min, \$s, \$tz);
169 0 @list = ($y, $m, $d);
170 } elsif ($t eq 'Time') {
171 0 my ($y, $m, $d, $h, $min, $s, $tz) = (0, 0, 0, 0, 0, 0.0, 0);
172 0 Geo::GDAL::FFI::OGR_F_GetFieldAsDateTimeEx($$self, $i, \$y, \$m, \$d, \$h, \$min, \$s, \$tz);
173 0 $s = sprintf("%.3f", $s) + 0;
174 0 @list = ($h, $min, $s, $tz);
175 } elsif ($t eq 'DateTime') {
176 0 my ($y, $m, $d, $h, $min, $s, $tz) = (0, 0, 0, 0, 0, 0.0, 0);
177 0 Geo::GDAL::FFI::OGR_F_GetFieldAsDateTimeEx($$self, $i, \$y, \$m, \$d, \$h, \$min, \$s, \$tz);
178 0 $s = sprintf("%.3f", $s) + 0;
179 0 @list = ($y, $m, $d, $h, $min, $s, $tz);
180 }
181 0 return @list;
182 }
183
184 sub IsFieldSet {
185 0 ▶ my ($self, $i) = @_;
Subroutine IsFieldSet: not called CC=3 SCAR=24.8
Pod undocumented
186 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
187 0 ▶ $i = $self->field_index($i) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
188 0 return Geo::GDAL::FFI::OGR_F_IsFieldSet($$self, $i);
189 }
190
191 sub IsFieldNull {
192 0 ▶ my ($self, $i) = @_;
Subroutine IsFieldNull: not called CC=3 SCAR=24.8
Pod undocumented
193 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
194 0 ▶ $i = $self->field_index($i) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
195 0 return Geo::GDAL::FFI::OGR_F_IsFieldNull($$self, $i);
196 }
197
198 sub IsFieldSetAndNotNull {
199 0 ▶ my ($self, $i) = @_;
Subroutine IsFieldSetAndNotNull: not called CC=3 SCAR=24.8
Pod undocumented
200 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
201 0 ▶ $i = $self->field_index($i) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
202 0 return Geo::GDAL::FFI::OGR_F_IsFieldSetAndNotNull($$self, $i);
203 }
204
205 sub GetGeomField {
206 0 ▶ my ($self, $i) = @_;
Subroutine GetGeomField: not called CC=4 SCAR=30.0
Pod documented
207 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
208 0 ▶ $i = $self->field_index($i, 1) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
209 0 my $g = Geo::GDAL::FFI::OGR_F_GetGeomFieldRef($$self, $i);
210 0 ▶ confess "No such field: $i" unless $g;
Branch: 1 branch
BranchTrueFalseTotal
unless $g 0 0 0
211 0 ++$Geo::GDAL::FFI::immutable{$g};
212 #say STDERR "$g immutable";
213 0 return bless \$g, 'Geo::GDAL::FFI::Geometry';
214 }
215
216 sub SetGeomField {
217 0 ▶ my $self = shift;
Subroutine SetGeomField: not called CC=4 SCAR=30.0
Pod documented
218 0 my $g = pop;
219 0 my $i = shift;
220 0 ▶ $i //= 0;
Condition0%0/2
$i //= 0
l!l
00
MC/DC0%0/1
$i //= 0
$i
Truth table0%0/2
A
A= $i
Aresult
11
00
221 0 ▶ $i = $self->field_index($i, 1) unless Geo::GDAL::FFI::isint($i);
Branch: 1 branch
BranchTrueFalseTotal
unless Geo::GDAL::FFI::isint($i) 0 0 0
222 0 ▶ if (ref $g eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $g eq "ARRAY") 0 0 0
223 0 $g = Geo::GDAL::FFI::Geometry->new(@$g);
224 }
225 0 ++$Geo::GDAL::FFI::immutable{$$g};
226 #say STDERR "$$g immutable";
227 0 Geo::GDAL::FFI::OGR_F_SetGeomFieldDirectly($$self, $i, $$g);
228 }
229
230 13 1;
231
232 =pod
233
234 =encoding UTF-8
235
236 =head1 NAME
237
238 Geo::GDAL::FFI::Feature - A GDAL vector feature
239
240 =head1 SYNOPSIS
241
242 =head1 DESCRIPTION
243
244 =head1 METHODS
245
246 =head2 new
247
248 my $feature = Geo::GDAL::FFI::Feature->new($defn);
249
250 Create a new Feature object. The argument is a FeatureDefn object,
251 which you can get from a Layer object (Defn method), another Feature
252 object (Defn method), or by explicitly creating a new FeatureDefn
253 object.
254
255 =head2 GetDefn
256
257 Returns the FeatureDefn object for this Feature.
258
259 =head2 GetFID
260
261 =head2 SetFID
262
263 =head2 Clone
264
265 =head2 Equals
266
267 my $equals = $feature1->Equals($feature2);
268
269 =head2 SetField
270
271 $feature->SetField($fname, ...);
272
273 Set the value of field $fname. If no arguments after the name is
274 given, the field is unset. If the arguments after the name is
275 undefined, sets the field to NULL. Otherwise sets the field according
276 to the field type.
277
278 =head2 GetField
279
280 my $value = $feature->GetField($fname);
281
282 =head2 SetGeomField
283
284 $feature->SetField($fname, $geom);
285
286 $fname is optional and by default the first geometry field.
287
288 =head2 GetGeomField
289
290 my $geom = $feature->GetGeomField($fname);
291
292 $fname is optional and by default the first geometry field.
293
294 =head1 LICENSE
295
296 This software is released under the Artistic License. See
297 L<perlartistic>.
298
299 =head1 AUTHOR
300
301 Ari Jolma - Ari.Jolma at gmail.com
302
303 =head1 SEE ALSO
304
305 L<Geo::GDAL::FFI>
306
307 L<Alien::gdal>, L<FFI::Platypus>, L<http://www.gdal.org>
308
309 =cut
310
311 __END__;
↑ Summary FFI/Driver.pm »