Primitive/Node.pm

filter: Statementstmt 58.0% 18 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 3 / 3 totaltotal 59.0% 26 / 44 CC 2 SCAR 8.5
CC
2
Cov
55%
new
6.0
lat
2.0
lon
2.0
CRAP 2.3
« Primitive/Relation.pm ↑ Summary Primitive/Way.pm »
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<node>.
7  
8 =cut
9 package Geo::OSM::Primitive::Node;
10 1 our @ISA = qw(Geo::OSM::Primitive);
11 #_}
12 #_{ use …
13 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Geo::OSM::Primitive;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 #_}
21 1 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<Geo::OSM::DBI>.
35  
36 =cut
37  
38 #_}
39 #_{ Methods
40  
41 =head1 METHODS
42 =cut
43  
44 0 ▶sub new { #_{
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
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 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 ▶ croak "Wrong class $class" unless $self->isa('Geo::OSM::Primitive::Node');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->isa("Geo::OSM::Primitive::Node") 0 0 0
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 0 ▶sub lat { #_{
Subroutine lat: not called CC=1 SCAR=6.9
Pod documented
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 my $self = shift;
85 0 return $self->{lat};
86  
87 } #_}
88 0 ▶sub lon { #_{
Subroutine lon: not called CC=1 SCAR=6.9
Pod documented
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 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<Geo::OSM::DBI>.
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<http://www.perlfoundation.org/artistic_license_2_0>
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 1 'tq84';
« Primitive/Relation.pm ↑ Summary Primitive/Way.pm »