Allow grids up to 10 chars
这个提交包含在:
父节点
4050015d42
当前提交
eb301296b8
共有 1 个文件被更改,包括 6 次插入 和 3 次删除
|
|
@ -215,16 +215,17 @@ function qra2latlong($strQRA) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strlen($strQRA) % 2 == 0) && (strlen($strQRA) <= 8)) { // Check if QRA is EVEN (the % 2 does that) and smaller/equal 8
|
if ((strlen($strQRA) % 2 == 0) && (strlen($strQRA) <= 10)) { // Check if QRA is EVEN (the % 2 does that) and smaller/equal 8
|
||||||
$strQRA = strtoupper($strQRA);
|
$strQRA = strtoupper($strQRA);
|
||||||
if (strlen($strQRA) == 4) $strQRA .= "MM"; // Only 4 Chars? Fill with center "MM"
|
if (strlen($strQRA) == 4) $strQRA .= "MM"; // Only 4 Chars? Fill with center "MM"
|
||||||
if (strlen($strQRA) == 6) $strQRA .= "55"; // Only 6 Chars? Fill with center "55"
|
if (strlen($strQRA) == 6) $strQRA .= "55"; // Only 6 Chars? Fill with center "55"
|
||||||
|
if (strlen($strQRA) == 8) $strQRA .= "MM"; // Only 6 Chars? Fill with center "MM"
|
||||||
|
|
||||||
if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}$/', $strQRA)) {
|
if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $strQRA)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($a, $b, $c, $d, $e, $f, $g, $h) = str_split($strQRA, 1); // Maidenhead is always alternating. e.g. "AA00AA00AA00" - doesn't matter how deep. 2 chars, 2 numbers, etc.
|
list($a, $b, $c, $d, $e, $f, $g, $h, $i, $j) = str_split($strQRA, 1); // Maidenhead is always alternating. e.g. "AA00AA00AA00" - doesn't matter how deep. 2 chars, 2 numbers, etc.
|
||||||
$a = ord($a) - ord('A');
|
$a = ord($a) - ord('A');
|
||||||
$b = ord($b) - ord('A');
|
$b = ord($b) - ord('A');
|
||||||
$c = ord($c) - ord('0');
|
$c = ord($c) - ord('0');
|
||||||
|
|
@ -233,6 +234,8 @@ function qra2latlong($strQRA) {
|
||||||
$f = ord($f) - ord('A');
|
$f = ord($f) - ord('A');
|
||||||
$g = ord($g) - ord('0');
|
$g = ord($g) - ord('0');
|
||||||
$h = ord($h) - ord('0');
|
$h = ord($h) - ord('0');
|
||||||
|
$i = ord($i) - ord('A');
|
||||||
|
$j = ord($j) - ord('A');
|
||||||
|
|
||||||
$nLong = ($a*20) + ($c*2) + (($e+0.5)/12) + (($g-5)/120) - 180; // the 4th pair is "in the middle", so we've to substract 5
|
$nLong = ($a*20) + ($c*2) + (($e+0.5)/12) + (($g-5)/120) - 180; // the 4th pair is "in the middle", so we've to substract 5
|
||||||
$nLat = ($b*10) + $d + (($f+0.5)/24) + (($h-5)/240) - 90;
|
$nLat = ($b*10) + $d + (($f+0.5)/24) + (($h-5)/240) - 90;
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用