line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::GDAL::FFI::Object; |
2
|
5
|
|
|
5
|
|
60
|
use v5.10; |
|
5
|
|
|
|
|
17
|
|
3
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
120
|
|
4
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
134
|
|
5
|
5
|
|
|
5
|
|
29
|
use Carp; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
4031
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.0700; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub GetDescription { |
10
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
11
|
1
|
|
|
|
|
7
|
return Geo::GDAL::FFI::GDALGetDescription($$self); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub HasCapability { |
15
|
0
|
|
|
0
|
1
|
0
|
my ($self, $cap) = @_; |
16
|
0
|
|
|
|
|
0
|
my $tmp = $Geo::GDAL::FFI::capabilities{$cap}; |
17
|
0
|
0
|
|
|
|
0
|
confess "Unknown capability: $cap." unless defined $tmp; |
18
|
0
|
|
|
|
|
0
|
my $md = $self->GetMetadata(''); |
19
|
0
|
|
|
|
|
0
|
return $md->{'DCAP_'.$cap}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub GetMetadataDomainList { |
23
|
2
|
|
|
2
|
1
|
16
|
my ($self) = @_; |
24
|
2
|
|
|
|
|
99
|
my $csl = Geo::GDAL::FFI::GDALGetMetadataDomainList($$self); |
25
|
2
|
|
|
|
|
6
|
my @list; |
26
|
2
|
|
|
|
|
13
|
for my $i (0..Geo::GDAL::FFI::CSLCount($csl)-1) { |
27
|
8
|
|
|
|
|
28
|
push @list, Geo::GDAL::FFI::CSLGetField($csl, $i); |
28
|
|
|
|
|
|
|
} |
29
|
2
|
|
|
|
|
19
|
Geo::GDAL::FFI::CSLDestroy($csl); |
30
|
2
|
50
|
|
|
|
19
|
return wantarray ? @list : \@list; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub GetMetadata { |
34
|
7
|
|
|
7
|
1
|
1277
|
my ($self, $domain) = @_; |
35
|
7
|
|
|
|
|
12
|
my %md; |
36
|
7
|
100
|
|
|
|
18
|
unless (defined $domain) { |
37
|
1
|
|
|
|
|
4
|
for $domain ($self->GetMetadataDomainList) { |
38
|
4
|
|
|
|
|
14
|
$md{$domain} = $self->GetMetadata($domain); |
39
|
|
|
|
|
|
|
} |
40
|
1
|
50
|
|
|
|
10
|
return wantarray ? %md : \%md; |
41
|
|
|
|
|
|
|
} |
42
|
6
|
|
|
|
|
42
|
my $csl = Geo::GDAL::FFI::GDALGetMetadata($$self, $domain); |
43
|
6
|
|
|
|
|
22
|
for my $i (0..Geo::GDAL::FFI::CSLCount($csl)-1) { |
44
|
72
|
|
|
|
|
216
|
my ($name, $value) = split /=/, Geo::GDAL::FFI::CSLGetField($csl, $i); |
45
|
72
|
|
|
|
|
230
|
$md{$name} = $value; |
46
|
|
|
|
|
|
|
} |
47
|
6
|
100
|
|
|
|
42
|
return wantarray ? %md : \%md; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub SetMetadata { |
51
|
2
|
|
|
2
|
1
|
336
|
my ($self, $metadata, $domain) = @_; |
52
|
2
|
100
|
|
|
|
7
|
unless (defined $domain) { |
53
|
1
|
|
|
|
|
5
|
for $domain (keys %$metadata) { |
54
|
1
|
|
|
|
|
5
|
$self->SetMetadata($metadata->{$domain}, $domain); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} else { |
57
|
1
|
|
|
|
|
2
|
my $csl = 0; |
58
|
1
|
|
|
|
|
3
|
for my $name (keys %$metadata) { |
59
|
1
|
|
|
|
|
11
|
$csl = Geo::GDAL::FFI::CSLAddString($csl, "$name=$metadata->{$name}"); |
60
|
|
|
|
|
|
|
} |
61
|
1
|
|
|
|
|
9
|
my $err = Geo::GDAL::FFI::GDALSetMetadata($$self, $csl, $domain); |
62
|
1
|
|
|
|
|
5
|
Geo::GDAL::FFI::CSLDestroy($csl); |
63
|
1
|
50
|
|
|
|
4
|
confess Geo::GDAL::FFI::error_msg() if $err == $Geo::GDAL::FFI::Failure; |
64
|
1
|
50
|
|
|
|
6
|
warn Geo::GDAL::FFI::error_msg() if $err == $Geo::GDAL::FFI::Warning; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub GetMetadataItem { |
69
|
0
|
|
|
0
|
1
|
|
my ($self, $name, $domain) = @_; |
70
|
0
|
|
0
|
|
|
|
$domain //= ""; |
71
|
0
|
|
|
|
|
|
return Geo::GDAL::FFI::GDALGetMetadataItem($$self, $name, $domain); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub SetMetadataItem { |
75
|
0
|
|
|
0
|
1
|
|
my ($self, $name, $value, $domain) = @_; |
76
|
0
|
|
0
|
|
|
|
$domain //= ""; |
77
|
0
|
|
|
|
|
|
my $err = Geo::GDAL::FFI::GDALSetMetadataItem($$self, $name, $value, $domain); |
78
|
0
|
0
|
|
|
|
|
confess Geo::GDAL::FFI::error_msg() if $err == $Geo::GDAL::FFI::Failure; |
79
|
0
|
0
|
|
|
|
|
warn Geo::GDAL::FFI::error_msg() if $err == $Geo::GDAL::FFI::Warning; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=encoding UTF-8 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Geo::GDAL::FFI::Object - A GDAL major object |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SYNOPSIS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 DESCRIPTION |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The base class for classes Driver, Dataset, Band, and Layer. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 METHODS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 GetDescription |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my $desc = $object->GetDescription; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 HasCapability |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $has_cap = $object->HasCapability($capability); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 GetMetadataDomainList |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my @domains = $object->GetMetadataDomainList; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 GetMetadata |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my %metadata = $object->GetMetadata($domain); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns the object metadata of a given domain. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $metadata = $object->GetMetadata($domain); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns the object metadata of a given domain in an anonymous hash. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my %metadata = $object->GetMetadata; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns the object metadata. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
my $metadata = $object->GetMetadata; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns the object metadata in an anonymous hash. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 SetMetadata |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$object->SetMetadata($metadata, $domain); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Sets the object metadata in a given domain. The metadata is in an |
135
|
|
|
|
|
|
|
anonymous hash. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
$object->SetMetadata($metadata); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Sets the object metadata in the domains that are the keys of the hash |
140
|
|
|
|
|
|
|
$metadata references. The values of the hash are the metadata in |
141
|
|
|
|
|
|
|
anonymous hashes. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 GetMetadataItem |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
my $value = $object->GetMetadataItem($item, $domain) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Gets the value of the metadata item in a domain (by default an empty |
148
|
|
|
|
|
|
|
string). |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 SetMetadataItem |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
$object->GetMetadataItem($item, $value, $domain) |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Sets the value of the metadata item in a domain (by default an empty |
155
|
|
|
|
|
|
|
string). |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 LICENSE |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This software is released under the Artistic License. See |
160
|
|
|
|
|
|
|
L. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 AUTHOR |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Ari Jolma - Ari.Jolma at gmail.com |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 SEE ALSO |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
L |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L, L, L |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
__END__; |