Import navigation data from Navigraph files

This commit is contained in:
Nabeel Shahzad
2017-12-20 16:34:52 -06:00
parent 3f8073e552
commit 17093e9fe9
9 changed files with 289 additions and 53 deletions

View File

@@ -28,7 +28,7 @@ class Airport extends Model
];
protected $casts = [
'id' => 'string',
];
/**

View File

@@ -5,16 +5,19 @@
namespace App\Models\Enums;
/**
* Class Days
* @package App\Models\Enums
*/
class Days extends EnumBase {
const MONDAY = 1;
const TUESDAY = 2;
const WEDNESDAY = 4;
const THURSDAY = 8;
const FRIDAY = 16;
const SATURDAY = 32;
const SUNDAY = 64;
const MONDAY = 1 << 0;
const TUESDAY = 1 << 1;
const WEDNESDAY = 1 << 2;
const THURSDAY = 1 << 3;
const FRIDAY = 1 << 4;
const SATURDAY = 1 << 5;
const SUNDAY = 1 << 6;
protected static $labels = [
Days::MONDAY => 'system.days.mon',

View File

@@ -0,0 +1,45 @@
<?php
/**
* The types of navaids
*/
namespace App\Models\Enums;
/**
* Class NavaidType
* Types based on/compatible with OpenFMC
* https://github.com/skiselkov/openfmc/blob/master/airac.h
* @package App\Models\Enums
*/
class NavaidType extends EnumBase
{
const VOR = 1 << 0;
const VOR_DME = 1 << 1;
const LOC = 1 << 4;
const LOC_DME = 1 << 5;
const NDB = 1 << 6;
const TACAN = 1 << 7;
const UNKNOWN = 1 << 8;
const INNER_MARKER = 1 << 9;
const OUTER_MARKER = 1 << 10;
const FIX = 1 << 11;
const ANY_VOR = NavaidType::VOR | NavaidType::VOR_DME;
const ANY_LOC = NavaidType::LOC | NavaidType::LOC_DME;
const ANY = (NavaidType::UNKNOWN << 1) - 1;
/**
* Names and titles
* @var array
*/
public static $labels = [
NavaidType::VOR => 'VOR',
NavaidType::VOR_DME => 'VOR DME',
NavaidType::LOC => 'Localizer',
NavaidType::LOC_DME => 'Localizer DME',
NavaidType::NDB => 'Non-directional Beacon',
NavaidType::TACAN => 'TACAN',
NavaidType::UNKNOWN => 'Unknown',
NavaidType::ANY_VOR => 'VOR',
NavaidType::ANY_LOC => 'Localizer',
];
}

26
app/Models/Navdata.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Navdata extends Model
{
public $table = 'navdata';
public $timestamps = false;
public $incrementing = false;
public $fillable = [
'id',
'name',
'type',
'lat',
'lon',
'freq',
];
public $casts = [
'id' => 'string',
'type' => 'integer',
];
}

View File

@@ -1,10 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Navpoint extends Model
{
public $table = 'navpoints';
}