当前位置: 首页>>代码示例>>PHP>>正文


PHP Spotter::getAirportIcao方法代码示例

本文整理汇总了PHP中Spotter::getAirportIcao方法的典型用法代码示例。如果您正苦于以下问题:PHP Spotter::getAirportIcao方法的具体用法?PHP Spotter::getAirportIcao怎么用?PHP Spotter::getAirportIcao使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spotter的用法示例。


在下文中一共展示了Spotter::getAirportIcao方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 static function add($line)
 {
     global $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBSupdate, $globalDebug;
     date_default_timezone_set('UTC');
     // signal handler - playing nice with sockets and dump1090
     // pcntl_signal_dispatch();
     // get the time (so we can figure the timeout)
     $time = time();
     //pcntl_signal_dispatch();
     $dataFound = false;
     $putinarchive = false;
     $send = false;
     // SBS format is CSV format
     if (is_array($line) && isset($line['hex'])) {
         //print_r($line);
         if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) == 6) {
             $hex = trim($line['hex']);
             $id = trim($line['hex']);
             //print_r(self::$all_flights);
             if (!isset(self::$all_flights[$id]['hex'])) {
                 self::$all_flights[$id] = array('hex' => $hex, 'datetime' => $line['datetime']);
                 if (!isset($line['aircraft_icao'])) {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('aircraft_icao' => Spotter::getAllAircraftType($hex)));
                 } else {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('aircraft_icao' => $line['aircraft_icao']));
                 }
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => ''));
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('lastupdate' => time()));
                 if ($globalDebug) {
                     echo "*********** New aircraft hex : " . $hex . " ***********\n";
                 }
             }
             if (isset($line['datetime']) && $line['datetime'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('datetime' => $line['datetime']));
             }
             if (isset($line['registration']) && $line['registration'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('registration' => $line['registration']));
             }
             if (isset($line['waypoints']) && $line['waypoints'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('waypoints' => $line['waypoints']));
             }
             if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('pilot_id' => $line['pilot_id']));
             }
             if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('pilot_name' => $line['pilot_name']));
             }
             if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && self::$all_flights[$id]['ident'] != trim($line['ident'])) {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('ident' => trim($line['ident'])));
                 if (!isset($line['id'])) {
                     if (!isset($globalDaemon)) {
                         $globalDaemon = TRUE;
                     }
                     if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) {
                         self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('id' => self::$all_flights[$id]['hex'] . '-' . self::$all_flights[$id]['ident'] . '-' . date('YmdGi')));
                     } else {
                         self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('id' => self::$all_flights[$id]['hex'] . '-' . self::$all_flights[$id]['ident']));
                     }
                 } else {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('id' => $line['id']));
                 }
                 $putinarchive = true;
                 if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
                 } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
                     $line['departure_airport_icao'] = Spotter::getAirportIcao($line['departure_airport_iata']);
                     $line['arrival_airport_icao'] = Spotter::getAirportIcao($line['arrival_airport_iata']);
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
                 } else {
                     $route = Spotter::getRouteInfo(trim($line['ident']));
                     if (count($route) > 0) {
                         //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
                         if ($route['fromairport_icao'] != $route['toairport_icao']) {
                             //    self::$all_flights[$id] = array_merge(self::$all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
                             self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop']));
                         }
                     }
                     if (!isset($globalFork)) {
                         $globalFork = TRUE;
                     }
                     if (function_exists('pcntl_fork') && $globalFork) {
                         $pids[$id] = pcntl_fork();
                         if (!$pids[$id]) {
                             $sid = posix_setsid();
                             SBS::get_Schedule($id, trim($line['ident']));
                             exit(0);
                         }
                     }
                 }
             }
             if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
                 if (!isset(self::$all_flights[$id]['latitude']) || self::$all_flights[$id]['latitude'] == '' || abs(self::$all_flights[$id]['latitude'] - $line['latitude']) < 3 || $line['format_source'] != 'sbs') {
                     if (!isset(self::$all_flights[$id]['archive_latitude'])) {
                         self::$all_flights[$id]['archive_latitude'] = $line['latitude'];
                     }
                     if (!isset(self::$all_flights[$id]['livedb_latitude']) || abs(self::$all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.02) {
                         self::$all_flights[$id]['livedb_latitude'] = $line['latitude'];
                         $dataFound = true;
                     }
                     // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
//.........这里部分代码省略.........
开发者ID:kletellier,项目名称:FlightAirMap,代码行数:101,代码来源:class.SBS.php

示例2: add


//.........这里部分代码省略.........
             if (isset($line['datetime']) && $line['datetime'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime']));
             }
             if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration']));
             }
             if (isset($line['waypoints']) && $line['waypoints'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints']));
             }
             if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id']));
             }
             if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name']));
             }
             if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && $this->all_flights[$id]['ident'] != trim($line['ident']) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
                 /*
                 		    if (!isset($line['id'])) {
                 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
                 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
                 			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
                 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
                 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
                 */
                 if (!isset($this->all_flights[$id]['id'])) {
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'] . '-' . $this->all_flights[$id]['ident']));
                 }
                 $putinarchive = true;
                 if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
                 } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
                     $Spotter = new Spotter();
                     $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
                     $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
                 } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
                     $Spotter = new Spotter();
                     $route = $Spotter->getRouteInfo(trim($line['ident']));
                     $Spotter->db = null;
                     if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
                         //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
                         if ($route['fromairport_icao'] != $route['toairport_icao']) {
                             //    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
                             $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop']));
                         }
                     }
                     if (!isset($globalFork)) {
                         $globalFork = TRUE;
                     }
                     if (function_exists('pcntl_fork') && $globalFork && !$globalIVAO) {
                         $this->nb++;
                         $pids[$id] = pcntl_fork();
                         if (!$pids[$id]) {
                             $sid = posix_setsid();
                             $this->get_Schedule($id, trim($line['ident']));
                             exit(0);
                         }
                     }
                 }
             }
             if (isset($line['speed']) && $line['speed'] != '') {
                 //    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed'])));
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true));
                 //$dataFound = true;
开发者ID:sysrun,项目名称:FlightAirMap,代码行数:67,代码来源:class.SpotterImport.php


注:本文中的Spotter::getAirportIcao方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。