line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::OSM::MapFeatures::Feature; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2573
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
872
|
use Geo::OSM::MapFeatures::Feature::Key; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
1
|
|
|
1
|
|
1609
|
use Geo::OSM::MapFeatures::Feature::Value; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
8
|
1
|
|
|
1
|
|
661
|
use Geo::OSM::MapFeatures::Feature::Type; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
38
|
use overload '""' => \&stringify; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
52
|
use base qw(Class::Accessor); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
416
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(key values types description)); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Geo::OSM::MapFeatures::Feature - Represents a feature on map features |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Version 0.01 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
A feature corresponds to one row on map features. It has a key, one or |
31
|
|
|
|
|
|
|
more values, one or more feature types and a description. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 FUNCTIONS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 key |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 values |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 types |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Feature type: area, way or node |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 description |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub new { |
48
|
0
|
|
|
0
|
1
|
|
my $pkg = shift; |
49
|
0
|
|
0
|
|
|
|
my $class = ref $pkg || $pkg; |
50
|
0
|
|
|
|
|
|
my $self = bless( {}, $class); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $key = shift; |
53
|
0
|
|
|
|
|
|
my $values = shift; |
54
|
0
|
|
|
|
|
|
my @types = @{shift()}; |
|
0
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $description = shift; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# |
58
|
|
|
|
|
|
|
# Key |
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$self->key( new Geo::OSM::MapFeatures::Feature::Key($key) ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# |
64
|
|
|
|
|
|
|
# Value |
65
|
|
|
|
|
|
|
# |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Hack for empty value list |
68
|
0
|
0
|
|
|
|
|
if( @$values < 1 ){ |
69
|
0
|
|
|
|
|
|
push( @$values, '' ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
foreach my $value ( @$values ){ |
73
|
0
|
|
|
|
|
|
push( @{$self->{values}}, new Geo::OSM::MapFeatures::Feature::Value($value) ); |
|
0
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# |
77
|
|
|
|
|
|
|
# Types |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
unless( @types ){ |
81
|
0
|
|
|
|
|
|
Carp::croak(sprintf("Trying to construct feature without element types. key=%s value(s)=%s", $self->key, join(' / ', @{$self->values}))); |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
0
|
|
|
|
|
|
foreach my $type ( @types ){ |
84
|
|
|
|
|
|
|
#FIXME: use accessor instead |
85
|
0
|
|
|
|
|
|
push( @{$self->{types}}, new Geo::OSM::MapFeatures::Feature::Type($type) ); |
|
0
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# Description |
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->description($description); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return $self; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub stringify { |
98
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return sprintf("%s = %s", $self->{key}, join(' / ', @{ $self->{values} })); |
|
0
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Knut Arne Bjørndal, C<< >> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 BUGS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
110
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
111
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SUPPORT |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
perldoc Geo::OSM::MapFeatures |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
You can also look for information at: |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over 4 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
L |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * CPAN Ratings |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
L |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * Search CPAN |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
L |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Copyright 2008-2009 Knut Arne Bjørndal, all rights reserved. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
154
|
|
|
|
|
|
|
under the same terms as Perl itself. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
1; # End of Geo::OSM::MapFeatures::Feature |