line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Encoding and name #_{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf8 |
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Geo::OSM::Primitive::Node - Abstract base class for the Open Street Map data primitive I. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=cut |
9
|
|
|
|
|
|
|
package Geo::OSM::Primitive::Node; |
10
|
|
|
|
|
|
|
our @ISA = qw(Geo::OSM::Primitive); |
11
|
|
|
|
|
|
|
#_} |
12
|
|
|
|
|
|
|
#_{ use … |
13
|
1
|
|
|
1
|
|
446
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
14
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
17
|
1
|
|
|
1
|
|
38
|
use Carp; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
69
|
|
18
|
1
|
|
|
1
|
|
8
|
use Geo::OSM::Primitive; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
297
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#_} |
21
|
|
|
|
|
|
|
our $VERSION = 0.01; |
22
|
|
|
|
|
|
|
#_{ Synopsis |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
… |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
#_} |
30
|
|
|
|
|
|
|
#_{ Overview |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 OVERVIEW |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The idea is to encapsulte methods that use OpenStreetMap data (that is possibly stored in L. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#_} |
39
|
|
|
|
|
|
|
#_{ Methods |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 METHODS |
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { #_{ |
45
|
|
|
|
|
|
|
#_{ POD |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $osm_node = Geo::OSM::Primitive::Node->new($osm_node_id, $lat, $lon); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#_} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
56
|
0
|
|
|
|
|
|
my $id = shift; |
57
|
0
|
|
|
|
|
|
my $lat = shift; |
58
|
0
|
|
|
|
|
|
my $lon = shift; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new($id, 'nod'); |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
croak "Wrong class $class" unless $self->isa('Geo::OSM::Primitive::Node'); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# TODO: use _set_cache_lat_lon ? |
65
|
0
|
|
|
|
|
|
$self->{lat} = $lat; |
66
|
0
|
|
|
|
|
|
$self->{lon} = $lon; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $self; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} #_} |
71
|
|
|
|
|
|
|
sub lat { #_{ |
72
|
|
|
|
|
|
|
#_{ POD |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 lat |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $lat = $node->lat(); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Return the lattitude of the node. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
#_} |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
85
|
0
|
|
|
|
|
|
return $self->{lat}; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} #_} |
88
|
|
|
|
|
|
|
sub lon { #_{ |
89
|
|
|
|
|
|
|
#_{ POD |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 lon |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $lon = $node->lon(); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Return the longitude of the node. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
#_} |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
102
|
0
|
|
|
|
|
|
return $self->{lon}; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} #_} |
105
|
|
|
|
|
|
|
# todo sub _set_cache_lat_lon { #_{ |
106
|
|
|
|
|
|
|
# todo #_{ POD |
107
|
|
|
|
|
|
|
# todo |
108
|
|
|
|
|
|
|
# todo =head2 _set_cache_lat_lon |
109
|
|
|
|
|
|
|
# todo |
110
|
|
|
|
|
|
|
# todo my $lat = …; |
111
|
|
|
|
|
|
|
# todo my $lon = …; |
112
|
|
|
|
|
|
|
# todo $node->_set_cache_lat_lon($lat, $lon); |
113
|
|
|
|
|
|
|
# todo |
114
|
|
|
|
|
|
|
# todo Set the node's lattitude and longitude in its cache. |
115
|
|
|
|
|
|
|
# todo |
116
|
|
|
|
|
|
|
# todo This method is internal and should not be called from a user of C. |
117
|
|
|
|
|
|
|
# todo |
118
|
|
|
|
|
|
|
# todo =cut |
119
|
|
|
|
|
|
|
# todo |
120
|
|
|
|
|
|
|
# todo #_} |
121
|
|
|
|
|
|
|
# todo |
122
|
|
|
|
|
|
|
# todo my $self = shift; |
123
|
|
|
|
|
|
|
# todo my $lat = shift; |
124
|
|
|
|
|
|
|
# todo my $lon = shift; |
125
|
|
|
|
|
|
|
# todo |
126
|
|
|
|
|
|
|
# todo |
127
|
|
|
|
|
|
|
# todo $self->{cache}->{lat} = $lat; |
128
|
|
|
|
|
|
|
# todo $self->{cache}->{lon} = $lon; |
129
|
|
|
|
|
|
|
# todo |
130
|
|
|
|
|
|
|
# todo } #_} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#_} |
133
|
|
|
|
|
|
|
#_{ POD: Copyright |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 Copyright |
136
|
|
|
|
|
|
|
Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved. |
137
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
138
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
139
|
|
|
|
|
|
|
copy of the full license at: L |
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
#_} |
143
|
|
|
|
|
|
|
#_{ POD: Source Code |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 Source Code |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The source code is on L<< github|https://github.com/ReneNyffenegger/perl-Geo-OSM-Primitive >>. Meaningful pull requests are welcome. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#_} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
'tq84'; |