| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geo::GDAL::FFI::GeomFieldDefn; |
|
2
|
5
|
|
|
5
|
|
65
|
use v5.10; |
|
|
5
|
|
|
|
|
18
|
|
|
3
|
5
|
|
|
5
|
|
32
|
use strict; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
104
|
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
160
|
|
|
5
|
5
|
|
|
5
|
|
28
|
use Carp; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
4557
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.0800; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
4
|
|
|
4
|
0
|
23
|
my ($class, $args) = @_; |
|
11
|
4
|
|
50
|
|
|
13
|
$args //= {}; |
|
12
|
4
|
|
50
|
|
|
14
|
my $name = $args->{Name} // 'Unnamed'; |
|
13
|
4
|
|
100
|
|
|
24
|
my $type = $args->{Type} // 'Point'; |
|
14
|
4
|
|
|
|
|
13
|
my $tmp = $Geo::GDAL::FFI::geometry_types{$type}; |
|
15
|
4
|
50
|
|
|
|
13
|
confess "Unknown geometry type: $type." unless defined $tmp; |
|
16
|
4
|
|
|
|
|
37
|
my $self = bless \Geo::GDAL::FFI::OGR_GFld_Create($name, $tmp), $class; |
|
17
|
4
|
50
|
|
|
|
15
|
$self->SetSpatialRef($args->{SpatialReference}) if $args->{SpatialReference}; |
|
18
|
4
|
50
|
|
|
|
12
|
$self->SetNullable(0) if $args->{NotNullable}; |
|
19
|
4
|
|
|
|
|
31
|
return $self; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub DESTROY { |
|
23
|
11
|
|
|
11
|
|
302
|
my $self = shift; |
|
24
|
11
|
100
|
|
|
|
32
|
if ($Geo::GDAL::FFI::immutable{$$self}) { |
|
25
|
7
|
|
|
|
|
12
|
$Geo::GDAL::FFI::immutable{$$self}--; |
|
26
|
7
|
50
|
|
|
|
51
|
delete $Geo::GDAL::FFI::immutable{$$self} if $Geo::GDAL::FFI::immutable{$$self} == 0; |
|
27
|
|
|
|
|
|
|
} else { |
|
28
|
4
|
|
|
|
|
34
|
Geo::GDAL::FFI::OGR_GFld_Destroy($$self); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub GetSchema { |
|
33
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
34
|
0
|
|
|
|
|
0
|
my $schema = { |
|
35
|
|
|
|
|
|
|
Name => $self->GetName, |
|
36
|
|
|
|
|
|
|
Type => $self->GetType |
|
37
|
|
|
|
|
|
|
}; |
|
38
|
0
|
0
|
|
|
|
0
|
if (my $sr = $self->GetSpatialRef) { |
|
39
|
0
|
|
|
|
|
0
|
$schema->{SpatialReference} = $sr->Export('Wkt'); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
0
|
0
|
|
|
|
0
|
$schema->{NotNullable} = 1 unless $self->IsNullable; |
|
42
|
0
|
|
|
|
|
0
|
return $schema; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub SetName { |
|
46
|
1
|
|
|
1
|
0
|
4
|
my ($self, $name) = @_; |
|
47
|
1
|
50
|
|
|
|
5
|
confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; |
|
48
|
1
|
|
50
|
|
|
4
|
$name //= ''; |
|
49
|
1
|
|
|
|
|
16
|
Geo::GDAL::FFI::OGR_GFld_SetName($$self, $name); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub GetName { |
|
53
|
2
|
|
|
2
|
0
|
12
|
my ($self) = @_; |
|
54
|
2
|
|
|
|
|
27
|
return Geo::GDAL::FFI::OGR_GFld_GetNameRef($$self); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub SetType { |
|
58
|
1
|
|
|
1
|
0
|
4
|
my ($self, $type) = @_; |
|
59
|
1
|
50
|
|
|
|
5
|
confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; |
|
60
|
1
|
|
50
|
|
|
5
|
$type //= 'Point'; |
|
61
|
1
|
|
|
|
|
3
|
my $tmp = $Geo::GDAL::FFI::geometry_types{$type}; |
|
62
|
1
|
50
|
|
|
|
5
|
confess "Unknown geometry type: $type." unless defined $tmp; |
|
63
|
1
|
|
|
|
|
2
|
$type = $tmp; |
|
64
|
1
|
|
|
|
|
7
|
Geo::GDAL::FFI::OGR_GFld_SetType($$self, $type); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub GetType { |
|
68
|
2
|
|
|
2
|
0
|
5
|
my ($self) = @_; |
|
69
|
2
|
|
|
|
|
22
|
return $Geo::GDAL::FFI::geometry_types_reverse{Geo::GDAL::FFI::OGR_GFld_GetType($$self)}; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub SetSpatialRef { |
|
73
|
0
|
|
|
0
|
0
|
0
|
my ($self, $sr) = @_; |
|
74
|
0
|
0
|
|
|
|
0
|
confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; |
|
75
|
0
|
0
|
|
|
|
0
|
$sr = Geo::GDAL::FFI::SpatialReference->new($sr) unless ref $sr; |
|
76
|
0
|
|
|
|
|
0
|
Geo::GDAL::FFI::OGR_GFld_SetSpatialRef($$self, $$sr); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub GetSpatialRef { |
|
80
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
81
|
0
|
|
|
|
|
0
|
my $sr = Geo::GDAL::FFI::OGR_GFld_GetSpatialRef($$self); |
|
82
|
0
|
0
|
|
|
|
0
|
return bless \$sr, 'Geo::GDAL::FFI::SpatialReference' if $sr; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub SetIgnored { |
|
86
|
2
|
|
|
2
|
1
|
6
|
my ($self, $ignored) = @_; |
|
87
|
|
|
|
|
|
|
#confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; |
|
88
|
2
|
|
100
|
|
|
11
|
$ignored //= 1; |
|
89
|
2
|
|
|
|
|
16
|
Geo::GDAL::FFI::OGR_GFld_SetIgnored($$self, $ignored); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub IsIgnored { |
|
93
|
2
|
|
|
2
|
1
|
6
|
my ($self) = @_; |
|
94
|
2
|
|
|
|
|
14
|
return Geo::GDAL::FFI::OGR_GFld_IsIgnored($$self); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub SetNullable { |
|
98
|
2
|
|
|
2
|
0
|
9
|
my ($self, $nullable) = @_; |
|
99
|
2
|
50
|
|
|
|
7
|
confess "Can't modify an immutable object." if $Geo::GDAL::FFI::immutable{$$self}; |
|
100
|
2
|
|
100
|
|
|
11
|
$nullable //= 0; |
|
101
|
2
|
|
|
|
|
20
|
Geo::GDAL::FFI::OGR_GFld_SetNullable($$self, $nullable); |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub IsNullable { |
|
105
|
2
|
|
|
2
|
0
|
6
|
my ($self) = @_; |
|
106
|
2
|
|
|
|
|
15
|
return Geo::GDAL::FFI::OGR_GFld_IsNullable($$self); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=pod |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=encoding UTF-8 |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 NAME |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Geo::GDAL::FFI::GeomFieldDefn - A spatial field in a GDAL feature schema |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
There should not usually be any reason to directly access this method |
|
124
|
|
|
|
|
|
|
except for the ignore methods. This object is created/read from/to the |
|
125
|
|
|
|
|
|
|
Perl data structure in the CreateLayer method of a dataset, or in the |
|
126
|
|
|
|
|
|
|
constructor or schema method of FeatureDefn. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The schema of a GeomFieldDefn is (Name, Type, SpatialReference, |
|
129
|
|
|
|
|
|
|
NotNullable). |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 METHODS |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 SetIgnored |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$defn->SetIgnored($arg); |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Ignore this field when reading features from a layer. To not ignore |
|
138
|
|
|
|
|
|
|
this field call this method with defined but false (0) argument. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 IsIgnored |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Is this field ignored when reading features from a layer. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 LICENSE |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This software is released under the Artistic License. See |
|
147
|
|
|
|
|
|
|
L. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 AUTHOR |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Ari Jolma - Ari.Jolma at gmail.com |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
L, L, L |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
__END__; |