mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
Load geojson file in constructor
This commit is contained in:
@@ -66,11 +66,17 @@ class Geojson {
|
||||
];
|
||||
|
||||
private $qra;
|
||||
private $geojsonFile = null;
|
||||
private $geojsonData = null;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct($dxcc = null) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->library('qra');
|
||||
$this->qra = $CI->qra;
|
||||
if ($dxcc !== null) {
|
||||
$this->geojsonFile = "assets/json/geojson/states_{$dxcc}.geojson";
|
||||
$this->geojsonData = $this->loadGeoJsonFile($geojsonFile);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -114,14 +120,16 @@ class Geojson {
|
||||
return null;
|
||||
}
|
||||
|
||||
$geojsonFile = "assets/json/geojson/states_{$dxcc}.geojson";
|
||||
$geojsonData = $this->loadGeoJsonFile($geojsonFile);
|
||||
if ($this->geojsonFile === null) {
|
||||
$this->geojsonFile = "assets/json/geojson/states_{$dxcc}.geojson";
|
||||
$this->geojsonData = $this->loadGeoJsonFile($this->geojsonFile);
|
||||
}
|
||||
|
||||
if ($geojsonData === null) {
|
||||
if ($this->geojsonData === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->findFeatureContainingPoint($lat, $lng, $geojsonData);
|
||||
return $this->findFeatureContainingPoint($lat, $lng, $this->geojsonData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1583,7 +1583,7 @@ class Logbookadvanced_model extends CI_Model {
|
||||
* @return array Result array with success, dxcc_name, dxcc_number, state_code, skipped
|
||||
*/
|
||||
function fixStateBatch($dxcc) {
|
||||
$this->load->library('Geojson');
|
||||
$this->load->library('Geojson', $dxcc);
|
||||
|
||||
// Get QSO data
|
||||
$sql = "SELECT COL_PRIMARY_KEY, COL_CALL, COL_GRIDSQUARE, COL_DXCC, COL_STATE, d.name as dxcc_name, station_profile.station_profile_name
|
||||
@@ -1632,8 +1632,6 @@ class Logbookadvanced_model extends CI_Model {
|
||||
* @return array Result array with success, dxcc_name, dxcc_number, state_code, skipped
|
||||
*/
|
||||
function fixStateDxcc($qso_id) {
|
||||
$this->load->library('Geojson');
|
||||
|
||||
// Get QSO data
|
||||
$sql = "SELECT COL_PRIMARY_KEY, COL_CALL, COL_GRIDSQUARE, COL_DXCC, COL_STATE, d.name as dxcc_name
|
||||
FROM " . $this->config->item('table_name') . " qsos
|
||||
|
||||
Reference in New Issue
Block a user