File Coverage

blib/lib/Eve/Geometry/Point.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 3 3 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             package Eve::Geometry::Point;
2              
3 3     3   5557 use parent qw(Eve::Geometry);
  3         6  
  3         20  
4              
5 3     3   152 use strict;
  3         5  
  3         82  
6 3     3   13 use warnings;
  3         4  
  3         583  
7              
8             =head1 NAME
9              
10             B - a point geometry class for map projection purposes.
11              
12             =head1 SYNOPSIS
13              
14             use Eve::Geometry::Point;
15              
16             my $geo = Eve::Geometry->new(data => [$lat, $lng]);
17              
18             =head1 DESCRIPTION
19              
20             The class is a base for a generic geometry object that is required in
21             all operations with objects on the map projection.
22              
23             =head1 METHODS
24              
25             =head2 B
26              
27             =cut
28              
29             sub init {
30 7     7 1 24 my ($self, %arg_hash) = @_;
31 7         27 Eve::Support::arguments(\%arg_hash, my ($data));
32              
33 7         92 $self->{'latitude'} = $data->[0];
34 7         23 $self->{'longitude'} = $data->[1];
35             }
36              
37             =head2 B
38              
39             Returns an array reference with the representation of the geometry object.
40              
41             =head3 Returns
42              
43             C.
44              
45             =cut
46              
47             sub export {
48 3     3 1 136 my ($self) = @_;
49              
50 3         27 return [$self->latitude, $self->longitude];
51             }
52              
53             =head2 B
54              
55             Returns a string representation of the geometry object.
56              
57             =head3 Returns
58              
59             C.
60              
61             =cut
62              
63             sub serialize {
64 1     1 1 144 my ($self) = @_;
65              
66 1         3 return 'POINT(' . join(' ', reverse(@{$self->export()})) . ')';
  1         3  
67             }
68              
69             =head1 SEE ALSO
70              
71             =over 4
72              
73             =item C
74              
75             =back
76              
77             =head1 LICENSE AND COPYRIGHT
78              
79             Copyright 2012 Igor Zinovyev.
80              
81             This program is free software; you can redistribute it and/or modify it
82             under the terms of either: the GNU General Public License as published
83             by the Free Software Foundation; or the Artistic License.
84              
85             See http://dev.perl.org/licenses/ for more information.
86              
87              
88             =head1 AUTHOR
89              
90             =over 4
91              
92             =item L
93              
94             =back
95              
96             =cut
97              
98             1;