| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Encoding and name #_{ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf8 |
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Geo::OSM::Render::Projection - Project OSM latitudes and longitudes into x, y coordinate pairs to be rendered by L. |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=cut |
|
9
|
|
|
|
|
|
|
package Geo::OSM::Render::Projection; |
|
10
|
|
|
|
|
|
|
#_} |
|
11
|
|
|
|
|
|
|
#_{ use … |
|
12
|
5
|
|
|
5
|
|
464
|
use warnings; |
|
|
5
|
|
|
|
|
16
|
|
|
|
5
|
|
|
|
|
199
|
|
|
13
|
5
|
|
|
5
|
|
42
|
use strict; |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
181
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
|
38
|
use utf8; |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
29
|
|
|
16
|
5
|
|
|
5
|
|
169
|
use Carp; |
|
|
5
|
|
|
|
|
15
|
|
|
|
5
|
|
|
|
|
951
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#_} |
|
19
|
|
|
|
|
|
|
our $VERSION = 0.01; |
|
20
|
|
|
|
|
|
|
#_{ Synopsis |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This is an abstract base class. So, I am hard pressed to write a synopsis here. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
#_} |
|
29
|
|
|
|
|
|
|
#_{ Overview |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 OVERVIEW |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Before OpenStreetMap data can be rendered, the OSM coordinates must be projected into a suitable x/y coordinate system. |
|
34
|
|
|
|
|
|
|
Descendents of this class should (must...) provide the conversion function C<> which performce |
|
35
|
|
|
|
|
|
|
this projection. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Currently, two classes are derived from this class: |
|
38
|
|
|
|
|
|
|
L<< Geo::OSM::Render::Projection::CH_LV03 >> and |
|
39
|
|
|
|
|
|
|
L<< Geo::OSM::Render::Projection::Ident >>. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#_} |
|
44
|
|
|
|
|
|
|
#_{ Methods |
|
45
|
|
|
|
|
|
|
#_{ POD |
|
46
|
|
|
|
|
|
|
=head1 METHODS |
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
#_} |
|
49
|
|
|
|
|
|
|
sub new { #_{ |
|
50
|
|
|
|
|
|
|
#_{ POD |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $proj = Geo::OSM::Render::Projection->new(); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Create an instance of a projection. Use it in a derived class. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
#_} |
|
61
|
|
|
|
|
|
|
|
|
62
|
3
|
|
|
3
|
1
|
11
|
my $class = shift; |
|
63
|
3
|
|
|
|
|
10
|
my $self = {}; |
|
64
|
3
|
|
|
|
|
16
|
bless $self, $class; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} #_} |
|
67
|
|
|
|
|
|
|
sub lat_lon_to_x_y { #_{ |
|
68
|
|
|
|
|
|
|
#_{ POD |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 lat_lon_to_x_y |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my ($x, $y) = $projection->lat_lon_to_x_y($lat, $lon); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Because this is an abstract base class, calling this method on C<> just |
|
75
|
|
|
|
|
|
|
croaks. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#_} |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
|
croak ('Override this method in a descendant'); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} #_} |
|
84
|
|
|
|
|
|
|
#_} |
|
85
|
|
|
|
|
|
|
#_{ POD: Author |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
René Nyffenegger |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#_} |
|
94
|
|
|
|
|
|
|
#_{ POD: Copyright and License |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
97
|
|
|
|
|
|
|
Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
100
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
|
101
|
|
|
|
|
|
|
copy of the full license at: L |
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#_} |
|
105
|
|
|
|
|
|
|
#_{ POD: Source Code |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 Source Code |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The source code is on L<< github|https://github.com/ReneNyffenegger/perl-Geo-OSM-Render >>. Meaningful pull requests are welcome. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#_} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
'tq84'; |