Added distance function to QRA library, Added Distance between the Worked Station and Station Profile to QSO Popup

pull/518/head
Peter Goodhall 2020-05-23 21:35:46 +01:00
rodzic 42d7db589c
commit 2ea3233ee2
2 zmienionych plików z 60 dodań i 9 usunięć

Wyświetl plik

@ -2,14 +2,26 @@
class Qra {
// Name: QRA
/*
* Class Description: QRA handles manipulation of the Gridsquares used within amateur radio
*
* Units of measurement are the following
*
* Info: Distance Function
*
* M = Miles
* K = Kilometers
* N = Nautical Miles
*/
// Name: qra2latlong
// Task: convert qra to lat/long
function qra2latlong($strQRA)
{
return qra2latlong($strQRA);
}
// calculate the bearing between two squares
function bearing($tx, $rx, $unit = 'M') {
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
@ -18,16 +30,27 @@ class Qra {
return $bearing;
}
/*
* Function: calculate the distance between two gridsqaures
*
* Inputs are QRA's TX and TX and the unit
*
*/
function distance($tx, $rx, $unit = 'M') {
// Calc LatLongs
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
// Feed in Lat Longs plus the unit type
$total_distance = distance($my[0], $my[1], $stn[0], $stn[1], $unit);
// Return the distance
return $total_distance;
}
}
/*
Info: Distance Function
M = Miles
K = Kilometers
N = Nautical Miles
*/
function distance($lat1, $lon1, $lat2, $lon2, $unit = 'M') {
$theta = $lon1 - $lon2;

Wyświetl plik

@ -67,6 +67,34 @@
</tr>
<?php } ?>
<?php if($row->COL_GRIDSQUARE != null) { ?>
<!-- Total Distance Between the Station Profile Gridsquare and Logged Square -->
<tr>
<td>Total Distance</td>
<td>
<?php
// Load the QRA Library
$CI =& get_instance();
$CI->load->library('qra');
// Cacluate Distance
echo $CI->qra->distance($row->station_gridsquare, $row->COL_GRIDSQUARE, 'M');
switch ($this->config->item('measurement_base')) {
case 'M':
echo "mi";
break;
case 'K':
echo "km";
break;
case 'N':
echo "nmi";
break;
}
?>
</td>
</tr>
<?php } ?>
<?php if($row->COL_VUCC_GRIDS != null) { ?>
<tr>
<td>Gridsquare (Multi):</td>