line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::GDAL::FFI::Object; |
2
|
5
|
|
|
5
|
|
61
|
use v5.10; |
|
5
|
|
|
|
|
17
|
|
3
|
5
|
|
|
5
|
|
29
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
107
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
137
|
|
5
|
5
|
|
|
5
|
|
48
|
use Carp; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
4117
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.0900; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub GetDescription { |
10
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
11
|
1
|
|
|
|
|
9
|
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
|
26
|
my ($self) = @_; |
24
|
2
|
|
|
|
|
139
|
my $csl = Geo::GDAL::FFI::GDALGetMetadataDomainList($$self); |
25
|
2
|
|
|
|
|
7
|
my @list; |
26
|
2
|
|
|
|
|
17
|
for my $i (0..Geo::GDAL::FFI::CSLCount($csl)-1) { |
27
|
8
|
|
|
|
|
34
|
push @list, Geo::GDAL::FFI::CSLGetField($csl, $i); |
28
|
|
|
|
|
|
|
} |
29
|
2
|
|
|
|
|
10
|
Geo::GDAL::FFI::CSLDestroy($csl); |
30
|
2
|
50
|
|
|
|
17
|
return wantarray ? @list : \@list; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub GetMetadata { |
34
|
7
|
|
|
7
|
1
|
1532
|
my ($self, $domain) = @_; |
35
|
7
|
|
|
|
|
10
|
my %md; |
36
|
7
|
100
|
|
|
|
18
|
unless (defined $domain) { |
37
|
1
|
|
|
|
|
4
|
for $domain ($self->GetMetadataDomainList) { |
38
|
4
|
|
|
|
|
23
|
$md{$domain} = $self->GetMetadata($domain); |
39
|
|
|
|
|
|
|
} |
40
|
1
|
50
|
|
|
|
11
|
return wantarray ? %md : \%md; |
41
|
|
|
|
|
|
|
} |
42
|
6
|
|
|
|
|
108
|
my $csl = Geo::GDAL::FFI::GDALGetMetadata($$self, $domain); |
43
|
6
|
|
|
|
|
28
|
for my $i (0..Geo::GDAL::FFI::CSLCount($csl)-1) { |
44
|
72
|
|
|
|
|
238
|
my ($name, $value) = split /=/, Geo::GDAL::FFI::CSLGetField($csl, $i); |
45
|
72
|
|
|
|
|
196
|
$md{$name} = $value; |
46
|
|
|
|
|
|
|
} |
47
|
6
|
100
|
|
|
|
49
|
return wantarray ? %md : \%md; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub SetMetadata { |
51
|
2
|
|
|
2
|
1
|
352
|
my ($self, $metadata, $domain) = @_; |
52
|
2
|
100
|
|
|
|
8
|
unless (defined $domain) { |
53
|
1
|
|
|
|
|
5
|
for $domain (keys %$metadata) { |
54
|
1
|
|
|
|
|
6
|
$self->SetMetadata($metadata->{$domain}, $domain); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} else { |
57
|
1
|
|
|
|
|
3
|
my $csl = 0; |
58
|
1
|
|
|
|
|
5
|
for my $name (keys %$metadata) { |
59
|
1
|
|
|
|
|
13
|
$csl = Geo::GDAL::FFI::CSLAddString($csl, "$name=$metadata->{$name}"); |
60
|
|
|
|
|
|
|
} |
61
|
1
|
|
|
|
|
14
|
my $err = Geo::GDAL::FFI::GDALSetMetadata($$self, $csl, $domain); |
62
|
1
|
|
|
|
|
6
|
Geo::GDAL::FFI::CSLDestroy($csl); |
63
|
1
|
50
|
|
|
|
6
|
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__; |