line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GPS::Poi; |
2
|
1
|
|
|
1
|
|
41666
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
1307
|
use Class::Std::Utils; |
|
1
|
|
|
|
|
12710
|
|
|
1
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
{ |
7
|
|
|
|
|
|
|
my %file_of ; |
8
|
|
|
|
|
|
|
my @ref_entry_of; |
9
|
|
|
|
|
|
|
sub new{ |
10
|
0
|
|
|
0
|
1
|
|
my ($class,$arg_ref) =@_; |
11
|
0
|
|
|
|
|
|
my $new_object =bless anon_scalar(),$class; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
0
|
|
|
|
$file_of{ident $new_object}= $arg_ref->{file}||'NULL'; |
14
|
0
|
|
|
|
|
|
return $new_object; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub DESTROY { |
18
|
|
|
|
|
|
|
my ($self)=@_; |
19
|
|
|
|
|
|
|
delete $file_of{ident $self}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub parse { |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
1
|
|
my ($self,$arg_ref) =@_; |
25
|
0
|
0
|
|
|
|
|
$file_of{ident $self}= $arg_ref->{file} if exists $arg_ref->{file} ; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
return 0 if $file_of{ident $self} eq 'NULL' ; |
28
|
0
|
0
|
|
|
|
|
(open my $input, '<',$file_of{ident $self}) ||return 0 ; |
29
|
0
|
|
|
|
|
|
while ($input) { |
30
|
0
|
|
|
|
|
|
read ($input,$a,1); |
31
|
0
|
|
|
|
|
|
my $code = unpack "C" ,$a; |
32
|
0
|
0
|
|
|
|
|
last unless defined $code ; |
33
|
0
|
0
|
0
|
|
|
|
if ($code== 0 or $code ==2) |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
|
read ($input,$a,4); |
36
|
0
|
|
|
|
|
|
my $long= unpack "V",$a; |
37
|
0
|
|
|
|
|
|
my $total= $long-5; |
38
|
0
|
|
|
|
|
|
read ($input,$a,$total); |
39
|
0
|
|
|
|
|
|
my ($longitude,$latitude,$chaine_c)= unpack "VVa*",$a; |
40
|
0
|
|
|
|
|
|
$longitude = $longitude / 100000.000000; |
41
|
0
|
|
|
|
|
|
$longitude =sprintf ("%.6f",$longitude); |
42
|
0
|
|
|
|
|
|
my $i =length ($longitude); |
43
|
0
|
|
|
|
|
|
for ($i;$i < 13 ;$i++) { |
44
|
0
|
|
|
|
|
|
$longitude = "0".$longitude ; |
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
|
$latitude = $latitude/ 100000.000000; |
47
|
0
|
|
|
|
|
|
$latitude =sprintf ("%.6f",$latitude); |
48
|
0
|
|
|
|
|
|
my $i =length ($latitude); |
49
|
0
|
|
|
|
|
|
for ($i;$i < 13 ;$i++) { |
50
|
0
|
|
|
|
|
|
$latitude = "0".$latitude ; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
my $chaine=substr($chaine_c,0,-1); |
53
|
0
|
|
|
|
|
|
my $entry = GPS::Poi::Entry->new ({ 'code' =>$code , |
54
|
|
|
|
|
|
|
'label' => $chaine, |
55
|
|
|
|
|
|
|
'long' => $longitude, |
56
|
|
|
|
|
|
|
'lat' => $latitude , |
57
|
|
|
|
|
|
|
}); |
58
|
0
|
|
|
|
|
|
push @ref_entry_of,$entry; |
59
|
|
|
|
|
|
|
} else |
60
|
0
|
|
|
|
|
|
{ last; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
close $input; |
65
|
0
|
|
|
|
|
|
return ($#ref_entry_of + 1) ; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
sub clear_list { |
69
|
0
|
|
|
0
|
1
|
|
my ($self)=@_; |
70
|
0
|
|
|
|
|
|
@ref_entry_of=(); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub all_as_list { |
75
|
0
|
|
|
0
|
1
|
|
my ($self)=@_; |
76
|
0
|
|
|
|
|
|
my @tmp; |
77
|
0
|
|
|
|
|
|
for my $entry (@ref_entry_of) { |
78
|
0
|
|
|
|
|
|
push @tmp,$entry->as_list; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return @tmp; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
sub dump_list { |
86
|
0
|
|
|
0
|
1
|
|
my ($self)=@_; |
87
|
0
|
|
|
|
|
|
my @tmp; |
88
|
0
|
|
|
|
|
|
for my $entry (@ref_entry_of) { |
89
|
0
|
|
|
|
|
|
push @tmp,$entry->as_print; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
my $a= join "\n" ,@tmp ; |
94
|
0
|
|
|
|
|
|
return "$a\n"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub DESTROY { |
98
|
0
|
|
|
0
|
|
|
my ($self)=@_; |
99
|
0
|
|
|
|
|
|
delete $file_of{ident $self}; |
100
|
0
|
|
|
|
|
|
undef @ref_entry_of; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
package GPS::Poi::Entry; |
105
|
1
|
|
|
1
|
|
892
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
59
|
|
106
|
1
|
|
|
1
|
|
6
|
use Class::Std::Utils; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
107
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
108
|
|
|
|
|
|
|
{ |
109
|
|
|
|
|
|
|
my %label_of; |
110
|
|
|
|
|
|
|
my %long_of; |
111
|
|
|
|
|
|
|
my %lat_of; |
112
|
|
|
|
|
|
|
my %code_of; |
113
|
|
|
|
|
|
|
sub new { |
114
|
0
|
|
|
0
|
|
|
my ($class,$arg_ref) =@_; |
115
|
0
|
|
|
|
|
|
my $new_object =bless anon_scalar(),$class; |
116
|
0
|
|
0
|
|
|
|
$label_of{ident $new_object}= $arg_ref->{label}||'NULL'; |
117
|
0
|
|
0
|
|
|
|
$long_of{ident $new_object}= $arg_ref->{long}||'NULL'; |
118
|
0
|
|
0
|
|
|
|
$lat_of{ident $new_object}= $arg_ref->{lat}||'NULL'; |
119
|
0
|
|
0
|
|
|
|
$code_of{ident $new_object}= $arg_ref->{code}||'NULL'; |
120
|
0
|
|
|
|
|
|
return $new_object; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
sub as_list { |
123
|
0
|
|
|
0
|
|
|
my ($self)=@_; |
124
|
0
|
|
|
|
|
|
my @tmp= ($label_of{ident $self}, $long_of{ident $self} ,$lat_of{ident $self} ,$code_of{ident $self}); |
125
|
0
|
|
|
|
|
|
return \@tmp; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
sub as_print { |
128
|
0
|
|
|
0
|
|
|
my ($self)=@_; |
129
|
0
|
|
|
|
|
|
my $a = "$long_of{ident $self} Lg - $lat_of{ident $self} Lt - $label_of{ident $self} - $code_of{ident $self}"; |
130
|
0
|
|
|
|
|
|
return $a; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub DESTROY { |
134
|
0
|
|
|
0
|
|
|
my ($self)=@_; |
135
|
0
|
|
|
|
|
|
delete $label_of{ident $self}; |
136
|
0
|
|
|
|
|
|
delete $long_of{ident $self}; |
137
|
0
|
|
|
|
|
|
delete $lat_of{ident $self}; |
138
|
0
|
|
|
|
|
|
delete $code_of{ident $self}; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# Preloaded methods go here. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; |
146
|
|
|
|
|
|
|
__END__ |