?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
package Net::DNS::RR::LOC;
#
# $Id: LOC.pm 388 2005-06-22 10:06:05Z olaf $
#
use strict;
BEGIN {
eval { require bytes; }
}
use vars qw(
@ISA $VERSION @poweroften $reference_alt
$reference_latlon $conv_sec $conv_min $conv_deg
$default_min $default_sec $default_size
$default_horiz_pre $default_vert_pre
);
@ISA = qw(Net::DNS::RR);
$VERSION = (qw$LastChangedRevision: 388 $)[1];
# Powers of 10 from 0 to 9 (used to speed up calculations).
@poweroften = (1, 10, 100, 1_000, 10_000, 100_000, 1_000_000,
10_000_000, 100_000_000, 1_000_000_000);
# Reference altitude in centimeters (see RFC 1876).
$reference_alt = 100_000 * 100;
# Reference lat/lon (see RFC 1876).
$reference_latlon = 2**31;
# Conversions to/from thousandths of a degree.
$conv_sec = 1000;
$conv_min = 60 * $conv_sec;
$conv_deg = 60 * $conv_min;
# Defaults (from RFC 1876, Section 3).
$default_min = 0;
$default_sec = 0;
$default_size = 1;
$default_horiz_pre = 10_000;
$default_vert_pre = 10;
sub new {
my ($class, $self, $data, $offset) = @_;
if ($self->{"rdlength"} > 0) {
my ($version) = unpack("\@$offset C", $$data);
++$offset;
$self->{"version"} = $version;
if ($version == 0) {
my ($size) = unpack("\@$offset C", $$data);
$size = precsize_ntoval($size);
++$offset;
my ($horiz_pre) = unpack("\@$offset C", $$data);
$horiz_pre = precsize_ntoval($horiz_pre);
++$offset;
my ($vert_pre) = unpack("\@$offset C", $$data);
$vert_pre = precsize_ntoval($vert_pre);
++$offset;
my ($latitude) = unpack("\@$offset N", $$data);
$offset += Net::DNS::INT32SZ();
my ($longitude) = unpack("\@$offset N", $$data);
$offset += Net::DNS::INT32SZ();
my ($altitude) = unpack("\@$offset N", $$data);
$offset += Net::DNS::INT32SZ();
$self->{"size"} = $size;
$self->{"horiz_pre"} = $horiz_pre;
$self->{"vert_pre"} = $vert_pre;
$self->{"latitude"} = $latitude;
$self->{"longitude"} = $longitude;
$self->{"altitude"} = $altitude;
}
else {
# What to do for unsupported versions?
}
}
return bless $self, $class;
}
sub new_from_string {
my ($class, $self, $string) = @_;
if ($string &&
$string =~ /^ (\d+) \s+ # deg lat
((\d+) \s+)? # min lat
(([\d.]+) \s+)? # sec lat
(N|S) \s+ # hem lat
(\d+) \s+ # deg lon
((\d+) \s+)? # min lon
(([\d.]+) \s+)? # sec lon
(E|W) \s+ # hem lon
(-?[\d.]+) m? # altitude
(\s+ ([\d.]+) m?)? # size
(\s+ ([\d.]+) m?)? # horiz precision
(\s+ ([\d.]+) m?)? # vert precision
/ix) {
# What to do for other versions?
my $version = 0;
my ($latdeg, $latmin, $latsec, $lathem) = ($1, $3, $5, $6);
my ($londeg, $lonmin, $lonsec, $lonhem) = ($7, $9, $11, $12);
my ($alt, $size, $horiz_pre, $vert_pre) = ($13, $15, $17, $19);
$latmin = $default_min unless $latmin;
$latsec = $default_sec unless $latsec;
$lathem = uc($lathem);
$lonmin = $default_min unless $lonmin;
$lonsec = $default_sec unless $lonsec;
$lonhem = uc($lonhem);
$size = $default_size unless $size;
$horiz_pre = $default_horiz_pre unless $horiz_pre;
$vert_pre = $default_vert_pre unless $vert_pre;
$self->{"version"} = $version;
$self->{"size"} = $size * 100;
$self->{"horiz_pre"} = $horiz_pre * 100;
$self->{"vert_pre"} = $vert_pre * 100;
$self->{"latitude"} = dms2latlon($latdeg, $latmin, $latsec,
$lathem);
$self->{"longitude"} = dms2latlon($londeg, $lonmin, $lonsec,
$lonhem);
$self->{"altitude"} = $alt * 100 + $reference_alt;
}
return bless $self, $class;
}
sub rdatastr {
my $self = shift;
my $rdatastr;
if (exists $self->{"version"}) {
if ($self->{"version"} == 0) {
my $lat = $self->{"latitude"};
my $lon = $self->{"longitude"};
my $altitude = $self->{"altitude"};
my $size = $self->{"size"};
my $horiz_pre = $self->{"horiz_pre"};
my $vert_pre = $self->{"vert_pre"};
$altitude = ($altitude - $reference_alt) / 100;
$size /= 100;
$horiz_pre /= 100;
$vert_pre /= 100;
$rdatastr = latlon2dms($lat, "NS") . " " .
latlon2dms($lon, "EW") . " " .
sprintf("%.2fm", $altitude) . " " .
sprintf("%.2fm", $size) . " " .
sprintf("%.2fm", $horiz_pre) . " " .
sprintf("%.2fm", $vert_pre);
} else {
$rdatastr = "; version " . $self->{"version"} . " not supported";
}
} else {
$rdatastr = '';
}
return $rdatastr;
}
sub rr_rdata {
my $self = shift;
my $rdata = "";
if (exists $self->{"version"}) {
$rdata .= pack("C", $self->{"version"});
if ($self->{"version"} == 0) {
$rdata .= pack("C3", precsize_valton($self->{"size"}),
precsize_valton($self->{"horiz_pre"}),
precsize_valton($self->{"vert_pre"}));
$rdata .= pack("N3", $self->{"latitude"},
$self->{"longitude"},
$self->{"altitude"});
}
else {
# What to do for other versions?
}
}
return $rdata;
}
sub precsize_ntoval {
my $prec = shift;
my $mantissa = (($prec >> 4) & 0x0f) % 10;
my $exponent = ($prec & 0x0f) % 10;
return $mantissa * $poweroften[$exponent];
}
sub precsize_valton {
my $val = shift;
my $exponent = 0;
while ($val >= 10) {
$val /= 10;
++$exponent;
}
return (int($val) << 4) | ($exponent & 0x0f);
}
sub latlon2dms {
my ($rawmsec, $hems) = @_;
# Tried to use modulus here, but Perl dumped core if
# the value was >= 2**31.
my ($abs, $deg, $min, $sec, $msec, $hem);
$abs = abs($rawmsec - $reference_latlon);
$deg = int($abs / $conv_deg);
$abs -= $deg * $conv_deg;
$min = int($abs / $conv_min);
$abs -= $min * $conv_min;
$sec = int($abs / $conv_sec);
$abs -= $sec * $conv_sec;
$msec = $abs;
$hem = substr($hems, ($rawmsec >= $reference_latlon ? 0 : 1), 1);
return sprintf("%d %02d %02d.%03d %s", $deg, $min, $sec, $msec, $hem);
}
sub dms2latlon {
my ($deg, $min, $sec, $hem) = @_;
my ($retval);
$retval = ($deg * $conv_deg) + ($min * $conv_min) + ($sec * $conv_sec);
$retval = -$retval if ($hem eq "S") || ($hem eq "W");
$retval += $reference_latlon;
return $retval;
}
sub latlon {
my $self = shift;
my ($retlat, $retlon);
if ($self->{"version"} == 0) {
$retlat = latlon2deg($self->{"latitude"});
$retlon = latlon2deg($self->{"longitude"});
}
else {
$retlat = $retlon = undef;
}
return ($retlat, $retlon);
}
sub latlon2deg {
my $rawmsec = shift;
my $deg;
$deg = ($rawmsec - $reference_latlon) / $conv_deg;
return $deg;
}
1;
__END__
=head1 NAME
Net::DNS::RR::LOC - DNS LOC resource record
=head1 SYNOPSIS
C