Eve/Geometry/Point.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 100% 28 / 28 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Eve/Event/HttpRequestReceived.pm ↑ Summary Eve/Geometry/Polygon.pm »
1 package Eve::Geometry::Point;
2  
3 4 ▶use parent qw(Eve::Geometry);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 B<Eve::Geometry::Point> - 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<init()>
26  
27 =cut
28  
29 7 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
30 7 my ($self, %arg_hash) = @_;
31 7 Eve::Support::arguments(\%arg_hash, my ($data));
32  
33 7 $self->{'latitude'} = $data->[0];
34 7 $self->{'longitude'} = $data->[1];
35 }
36  
37 =head2 B<export()>
38  
39 Returns an array reference with the representation of the geometry object.
40  
41 =head3 Returns
42  
43 C<ARRAY>.
44  
45 =cut
46  
47 3 ▶sub export {
Subroutine export: called CC=1 SCAR=0.0
Pod documented
48 3 my ($self) = @_;
49  
50 3 return [$self->latitude, $self->longitude];
51 }
52  
53 =head2 B<serialize()>
54  
55 Returns a string representation of the geometry object.
56  
57 =head3 Returns
58  
59 C<ARRAY>.
60  
61 =cut
62  
63 1 ▶sub serialize {
Subroutine serialize: called CC=1 SCAR=0.0
Pod documented
64 1 my ($self) = @_;
65  
66 1 return 'POINT(' . join(' ', reverse(@{$self->export()})) . ')';
67 }
68  
69 =head1 SEE ALSO
70  
71 =over 4
72  
73 =item C<Eve::Class>
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<Igor Zinovyev|mailto:zinigor@gmail.com>
93  
94 =back
95  
96 =cut
97  
98 4 1;
« Eve/Event/HttpRequestReceived.pm ↑ Summary Eve/Geometry/Polygon.pm »