Convert bearing lookup to POST request
这个提交包含在:
父节点
522854377b
当前提交
3efcbf0b0d
共有 3 个文件被更改,包括 31 次插入 和 5 次删除
|
|
@ -878,7 +878,9 @@ class Logbook extends CI_Controller {
|
||||||
|
|
||||||
|
|
||||||
/* return station bearing */
|
/* return station bearing */
|
||||||
function searchbearing($locator, $station_id = null) {
|
function searchbearing() {
|
||||||
|
$locator = xss_clean($this->input->post('grid'));
|
||||||
|
$station_id = xss_clean($this->input->post('stationProfile'));
|
||||||
$this->load->library('Qra');
|
$this->load->library('Qra');
|
||||||
|
|
||||||
if($locator != null) {
|
if($locator != null) {
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,12 @@ class Qra {
|
||||||
$my = qra2latlong($tx);
|
$my = qra2latlong($tx);
|
||||||
$stn = qra2latlong($rx);
|
$stn = qra2latlong($rx);
|
||||||
|
|
||||||
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
|
if ($my !== false && $stn !== false ) {
|
||||||
|
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
|
||||||
return $bearing;
|
return $bearing;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -168,6 +171,11 @@ function qra2latlong($strQRA) {
|
||||||
if (substr_count($strQRA, ',') == 3) {
|
if (substr_count($strQRA, ',') == 3) {
|
||||||
// Handle grid corners
|
// Handle grid corners
|
||||||
$grids = explode(',', $strQRA);
|
$grids = explode(',', $strQRA);
|
||||||
|
$gridlengths = array(strlen($grids[0]), strlen($grids[1]), strlen($grids[2]), strlen($grids[3]));
|
||||||
|
$same = array_count_values($gridlengths);
|
||||||
|
if (count($same) != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$coords = array(0, 0);
|
$coords = array(0, 0);
|
||||||
for($i=0; $i<4; $i++) {
|
for($i=0; $i<4; $i++) {
|
||||||
$cornercoords[$i] = qra2latlong($grids[$i]);
|
$cornercoords[$i] = qra2latlong($grids[$i]);
|
||||||
|
|
@ -178,6 +186,9 @@ function qra2latlong($strQRA) {
|
||||||
} else if (substr_count($strQRA, ',') == 1) {
|
} else if (substr_count($strQRA, ',') == 1) {
|
||||||
// Handle grid lines
|
// Handle grid lines
|
||||||
$grids = explode(',', $strQRA);
|
$grids = explode(',', $strQRA);
|
||||||
|
if (strlen($grids[0]) != strlen($grids[1])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$coords = array(0, 0);
|
$coords = array(0, 0);
|
||||||
for($i=0; $i<2; $i++) {
|
for($i=0; $i<2; $i++) {
|
||||||
$linecoords[$i] = qra2latlong($grids[$i]);
|
$linecoords[$i] = qra2latlong($grids[$i]);
|
||||||
|
|
|
||||||
|
|
@ -829,7 +829,20 @@ $("#locator").keyup(function(){
|
||||||
markers.addLayer(marker).addTo(mymap);
|
markers.addLayer(marker).addTo(mymap);
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#locator_info').load(base_url +"index.php/logbook/searchbearing/" + $(this).val() + "/" + $('#stationProfile').val()).fadeIn("slow");
|
$.ajax({
|
||||||
|
url: base_url + 'index.php/logbook/searchbearing',
|
||||||
|
type: 'post',
|
||||||
|
data: {
|
||||||
|
grid: $(this).val(),
|
||||||
|
stationProfile: $('#stationProfile').val()
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$('#locator_info').html(data).fadeIn("slow");
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$('#locator_info').text("Error loading bearing and distance").fadeIn("slow");
|
||||||
|
},
|
||||||
|
});
|
||||||
$.get(base_url + 'index.php/logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) {
|
$.get(base_url + 'index.php/logbook/searchdistance/' + $(this).val() + "/" + $('#stationProfile').val(), function(result) {
|
||||||
document.getElementById("distance").value = result;
|
document.getElementById("distance").value = result;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用