| 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<Geo::OSM::Render>. | ||
| 7 | |||
| 8 | =cut | ||
| 9 | package Geo::OSM::Render::Projection; | ||
| 10 | #_} | ||
| 11 | #_{ use … | ||
| 12 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 5 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 5 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | #_} | ||
| 19 | 5 | 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<<lat_lon_to_x_y>> 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 | 3 | ▶ | sub new { #_{ |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 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 | my $class = shift; | |
| 63 | 3 | my $self = {}; | |
| 64 | 3 | bless $self, $class; | |
| 65 | |||
| 66 | } #_} | ||
| 67 | 0 | ▶ | sub lat_lon_to_x_y { #_{ |
|
Subroutine
lat_lon_to_x_y: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 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<<Geo::OSM::Render::Projection>> just | ||
| 75 | croaks. | ||
| 76 | |||
| 77 | =cut | ||
| 78 | |||
| 79 | #_} | ||
| 80 | |||
| 81 | 0 | croak ('Override this method in a descendant'); | |
| 82 | |||
| 83 | } #_} | ||
| 84 | #_} | ||
| 85 | #_{ POD: Author | ||
| 86 | |||
| 87 | =head1 AUTHOR | ||
| 88 | |||
| 89 | René Nyffenegger <rene.nyffenegger at adp-gmbh.ch> | ||
| 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<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 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 | 5 | 'tq84'; | |