line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::MobileAgent::Plugin::Location::LocationObject; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
49
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
300
|
|
4
|
8
|
|
|
8
|
|
275
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
236
|
|
5
|
8
|
|
|
8
|
|
48
|
use Carp; |
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
646
|
|
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
43
|
use version; our $VERSION = qv('0.0.2'); |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
46
|
|
8
|
8
|
|
|
8
|
|
756
|
use base qw/Class::Data::Inheritable Class::Accessor::Fast/; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
1223
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/accuracy mode method/); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub __create_coord{ |
13
|
0
|
|
|
0
|
|
|
my $class = shift; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
if (HTTP::MobileAgent->_use_geopoint) { |
|
|
0
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
require HTTP::MobileAgent::Plugin::Location::LocationObject::GP; |
17
|
0
|
|
|
|
|
|
$class = "HTTP::MobileAgent::Plugin::Location::LocationObject::GP"; |
18
|
|
|
|
|
|
|
} elsif (HTTP::MobileAgent->_use_geocoordinate) { |
19
|
0
|
|
|
|
|
|
require HTTP::MobileAgent::Plugin::Location::LocationObject::GCC; |
20
|
0
|
|
|
|
|
|
$class = "HTTP::MobileAgent::Plugin::Location::LocationObject::GCC"; |
21
|
|
|
|
|
|
|
} else { |
22
|
0
|
|
|
|
|
|
require HTTP::MobileAgent::Plugin::Location::LocationObject::LG; |
23
|
0
|
|
|
|
|
|
$class = "HTTP::MobileAgent::Plugin::Location::LocationObject::LG"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$class->create_coord(@_); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub mesh7{ |
30
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my ($lat,$lon); |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (HTTP::MobileAgent->_use_geopoint) { |
|
|
0
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $point = $self->transform('tokyo'); |
36
|
0
|
|
|
|
|
|
($lat,$lon) = map { int ($_ * 3600000) } ( $point->lat, $point->long ); |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} elsif (HTTP::MobileAgent->_use_geocoordinate) { |
38
|
0
|
|
|
|
|
|
my $point = $self->convert( degree => 'tokyo' ); |
39
|
0
|
|
|
|
|
|
($lat,$lon) = map { int ($_ * 3600000) } ($point->lat,$point->lng); |
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} else { |
41
|
0
|
|
|
|
|
|
($lat,$lon) = map { int ($_ * 1000) } $self->datum_tokyo->format_second->array; |
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my @mesh = (); |
45
|
0
|
|
|
|
|
|
my $ab = int($lat / 2400000); |
46
|
0
|
|
|
|
|
|
my $cd = int($lon / 3600000) - 100; |
47
|
0
|
|
|
|
|
|
my $x1 = ($cd +100) * 3600000; |
48
|
0
|
|
|
|
|
|
my $y1 = $ab * 2400000; |
49
|
0
|
|
|
|
|
|
my $e = int(($lat - $y1) / 300000); |
50
|
0
|
|
|
|
|
|
my $f = int(($lon - $x1) / 450000); |
51
|
0
|
|
|
|
|
|
$mesh[0] = $ab.$cd.$e.$f; |
52
|
0
|
|
|
|
|
|
my $x2 = $x1 + $f * 450000; |
53
|
0
|
|
|
|
|
|
my $y2 = $y1 + $e * 300000; |
54
|
0
|
|
|
|
|
|
my $l3 = int(($lon - $x2) / 225000); |
55
|
0
|
|
|
|
|
|
my $m3 = int(($lat - $y2) / 150000); |
56
|
0
|
|
|
|
|
|
my $g = $l3 + $m3 * 2; |
57
|
0
|
|
|
|
|
|
$mesh[1] = $mesh[0].$g; |
58
|
0
|
|
|
|
|
|
my $x3 = $x2 + $l3 * 225000; |
59
|
0
|
|
|
|
|
|
my $y3 = $y2 + $m3 * 150000; |
60
|
0
|
|
|
|
|
|
my $l4 = int(($lon - $x3) / 112500); |
61
|
0
|
|
|
|
|
|
my $m4 = int(($lat - $y3) / 75000); |
62
|
0
|
|
|
|
|
|
my $h = $l4 + $m4 * 2; |
63
|
0
|
|
|
|
|
|
$mesh[2] = $mesh[1].$h; |
64
|
0
|
|
|
|
|
|
my $x4 = $x3 + $l4 * 112500; |
65
|
0
|
|
|
|
|
|
my $y4 = $y3 + $m4 * 75000; |
66
|
0
|
|
|
|
|
|
my $l5 = int(($lon - $x4) / 56250); |
67
|
0
|
|
|
|
|
|
my $m5 = int(($lat - $y4) / 37500); |
68
|
0
|
|
|
|
|
|
my $i = $l5 + $m5 * 2; |
69
|
0
|
|
|
|
|
|
$mesh[3] = $mesh[2].$i; |
70
|
0
|
|
|
|
|
|
my $x5 = $x4 + $l5 * 56250; |
71
|
0
|
|
|
|
|
|
my $y5 = $y4 + $m5 * 37500; |
72
|
0
|
|
|
|
|
|
my $l6 = int(($lon - $x5) / 28125); |
73
|
0
|
|
|
|
|
|
my $m6 = int(($lat - $y5) / 18750); |
74
|
0
|
|
|
|
|
|
my $j = $l6 + $m6 * 2; |
75
|
0
|
|
|
|
|
|
$mesh[4] = $mesh[3].$j; |
76
|
0
|
|
|
|
|
|
my $x6 = $x5 + $l6 * 28125; |
77
|
0
|
|
|
|
|
|
my $y6 = $y5 + $m6 * 18750; |
78
|
0
|
|
|
|
|
|
my $l7 = int(($lon - $x6) / 14062.5); |
79
|
0
|
|
|
|
|
|
my $m7 = int(($lat - $y6) / 9375); |
80
|
0
|
|
|
|
|
|
my $k = $l7 + $m7 * 2; |
81
|
0
|
|
|
|
|
|
$mesh[5] = $mesh[4].$k; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return $mesh[5]; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
HTTP::MobileAgent::Plugin::Location::LocationObject - Object for handling location object |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 VERSION |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This document describes HTTP::MobileAgent::Plugin::Location::LocationObject version 0.0.1 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
use HTTP::MobileAgent::Plugin::Location; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $ma = HTTP::MobileAgent->new; |
104
|
|
|
|
|
|
|
$ma->parse_location; |
105
|
|
|
|
|
|
|
my $loc = $ma->location; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# If $loc is not undef, it is L object. |
108
|
|
|
|
|
|
|
# More detail information of above sequence, see L. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# This class is subclass of L on default, or subclass of |
111
|
|
|
|
|
|
|
# L on optional. |
112
|
|
|
|
|
|
|
# So see L or L to know basic methods and properties. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
if ($loc->mode eq "gps") { ... } |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Get location requested mode by B method. |
117
|
|
|
|
|
|
|
# It returns "gps" or "sector". |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
if ($loc->accuracy eq "gps") { ... } |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# Get Accuracy of returned location by B method. |
122
|
|
|
|
|
|
|
# It returns "gps", "hybrid" or "sector". |
123
|
|
|
|
|
|
|
# Real accuracy value is different by carrears and generations, but almost like below: |
124
|
|
|
|
|
|
|
# gps: 0m - 50m |
125
|
|
|
|
|
|
|
# hybrid: 50m - 300m |
126
|
|
|
|
|
|
|
# sector: 300m - |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
my $mesh7 = $loc->mesh7; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# Get 7th mesh code of i-Area specification. |
131
|
|
|
|
|
|
|
# See more detail on L. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 NOTE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Value of B and B is sometimes not same. |
137
|
|
|
|
|
|
|
Even if User want to get gps level accuracy data, but terminal cannot access gps satellite, |
138
|
|
|
|
|
|
|
it fallback to hyblid or sector level accuracy. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 METHOD |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=over |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item L |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=back |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=over |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item L |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item L |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item L |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item L |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item L |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=back |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
No bugs have been reported. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Please report any bugs or feature requests to C. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
OHTSUKA Ko-hei C<< >> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Copyright (c) 2007, OHTSUKA Ko-hei C<< >>. All rights reserved. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
184
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
190
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
191
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
192
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
193
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
194
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
195
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
196
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
197
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
200
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
201
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE |
202
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
203
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
204
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
205
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
206
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
207
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
208
|
|
|
|
|
|
|
SUCH DAMAGES. |