runways are not required. can be extracted out of required arrival routes
Cette révision appartient à :
@@ -8,12 +8,6 @@ import sys
|
||||
from formats.SctEseFormat import SctEseFormat
|
||||
|
||||
class Airport:
|
||||
def parseAirport(self, airport):
|
||||
if None == airport.get('runways'):
|
||||
return False
|
||||
self.runways = airport['runways'].split(':')
|
||||
return True
|
||||
|
||||
def findGngData(data, path):
|
||||
if None == data.get('gngwildcard'):
|
||||
return None, None
|
||||
@@ -32,41 +26,23 @@ class Airport:
|
||||
return latestSct, latestEse
|
||||
|
||||
def parsePlanning(self, planning):
|
||||
for key in planning:
|
||||
# check if the runways match
|
||||
rwy = key.upper()
|
||||
if rwy not in self.runways:
|
||||
sys.stderr.write('Unable to find ' + rwy + ' in defined runways')
|
||||
return False
|
||||
|
||||
# check if arrivals are defined
|
||||
arrivals = planning[key].split(':')
|
||||
if 0 == len(arrivals):
|
||||
sys.stderr.write('No arrival routes for ' + rwy)
|
||||
return False
|
||||
|
||||
# assign the arrival routes to the runways
|
||||
self.arrivalRoutes[rwy] = arrivals
|
||||
|
||||
return True
|
||||
if None == planning.get('routes'):
|
||||
return []
|
||||
return planning['routes'].split(':')
|
||||
|
||||
def __init__(self, filepath : str, icao : str):
|
||||
self.runways = []
|
||||
self.arrivalRoutes = {}
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(filepath)
|
||||
|
||||
dataConfig = None
|
||||
airportConfig = None
|
||||
planningConfig = None
|
||||
|
||||
# search the required sections
|
||||
for key in config:
|
||||
if 'DATA' == key:
|
||||
dataConfig = config['DATA']
|
||||
elif 'AIRPORT' == key:
|
||||
airportConfig = config['AIRPORT']
|
||||
elif 'PLANNING' == key:
|
||||
planningConfig = config['PLANNING']
|
||||
|
||||
@@ -76,22 +52,14 @@ class Airport:
|
||||
sys.stderr.write('No GNG-files found')
|
||||
sys.exit(-1)
|
||||
|
||||
# parse the airport information
|
||||
if None == airportConfig or False == self.parseAirport(airportConfig):
|
||||
sys.stderr.write('No or no valid airport configuration found')
|
||||
sys.exit(-1)
|
||||
|
||||
# parse the planning information
|
||||
if None == planningConfig or False == self.parsePlanning(planningConfig):
|
||||
sys.stderr.write('No or no valid planning configuration found')
|
||||
sys.stderr.write('No planning configuration found')
|
||||
sys.exit(-1)
|
||||
requiredArrivalRoutes = self.parsePlanning(planningConfig)
|
||||
if 0 == len(requiredArrivalRoutes):
|
||||
sys.stderr.write('No valid planning configuration found')
|
||||
sys.exit(-1)
|
||||
|
||||
# get all required arrival routes and avoid duplicates
|
||||
requiredArrivalRoutes = []
|
||||
for rwy in self.arrivalRoutes:
|
||||
for arrival in self.arrivalRoutes[rwy]:
|
||||
if arrival not in requiredArrivalRoutes:
|
||||
requiredArrivalRoutes.append(arrival)
|
||||
|
||||
# parse the GNG data
|
||||
print('Used GNG-Data: ' + eseFile)
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur