def addVariables (self, donnees) : """ Disperssion des données """ # Les données arrivent sous la forme: # Name # | Lat/Long # | | Type # | | | Rel fix # | | | | Airport List fixes # | | | | | PIL display # | | | | | | DTI # | | | | | | | Comment # | | | | | | | | # V V V V V V V V # ------|-----------|-----------|---|---------|---|---|------- # # La dispertion va donc de faire à l'aide du séparateur "|" donnees = donnees.strip(None) tabDonnees = donnees.split("|") # Assignation des variables self.name = tabDonnees[0].strip(None) self.coordinate = tabDonnees[1].strip(None) self.theType = tabDonnees[2].strip(None) self.airportListFixes = tabDonnees[4].strip(None) self.comment = tabDonnees[7].strip(None) if tabDonnees[3].strip(None) == "Y" : self.relFix = True else : self.relFix = False if tabDonnees[5].strip(None) == "Y" : self.pilDisplay = True else : self.pilDisplay = False if tabDonnees[6].strip(None) == "Y" : self.dti = True else : self.dti = False # Convertion des coordonnées en decimales self.decimalCoordinate = Convertion.convertCoordinate(self.coordinate) self.latitude = self.decimalCoordinate['latitude'] self.longitude = self.decimalCoordinate['longitude']
def definition (self, donnees) : """ # The data arrives in this form: # /CODED_ROUTE/ # # NAME # | COORDINATE # | | # --V--|--V-- # # The separation will therefore be using the separator "|" """ donnees = donnees.strip(None) tabDonnees = donnees.split("|") for x in xrange(len(tabDonnees)) : tabDonnees[x] = tabDonnees[x].strip(None) # Assigning variables self.name = str(tabDonnees[0]) self.coordinate = Convertion.convertCoordinate(str(tabDonnees[1]))
def addPoints (self) : pointsAndRoutes = self.pointsAndRoutes self.listOfPoints=[] pointRoute = [] convert = Convertion.speedAndLevel(pointsAndRoutes[0]) curentAltitude = convert['altitude'] curentSpeed = convert['speed'] self.listOfPoints.append(self.deparatureAerodrome) self.altitude[self.deparatureAerodrome] = curentAltitude self.speed[self.deparatureAerodrome] = curentSpeed #print 'debut: ' + str(pointsAndRoutes[0]) for x in xrange(1,len(pointsAndRoutes)): if "/" in pointsAndRoutes[x]: tab = pointsAndRoutes[x].split("/") if tab[1] : convert = Convertion.speedAndLevel(tab[1]) curentAltitude = convert['altitude'] curentSpeed = convert['speed'] if tab[0] : pointRoute.append(tab[0]) self.altitude[tab[0]] = curentAltitude self.speed[tab[0]] = curentSpeed else : if pointsAndRoutes[x] : pointRoute.append(pointsAndRoutes[x]) self.altitude[pointsAndRoutes[x]] = curentAltitude self.speed[pointsAndRoutes[x]] = curentSpeed for x in xrange(len(pointRoute)): if pointRoute[x] in self.defPoints : point = self.defPoints[pointRoute[x]] self.listOfPoints.append(point.name) elif pointRoute[x] in self.defRoutes : route = self.defRoutes[pointRoute[x]] curentRouteAltitude = self.altitude[pointRoute[x]] curentRouteSpeed = self.speed[pointRoute[x]] yDebut = -1 yFin = -1 listPoint = [] for y in xrange(len(route.points)) : if route.points[y] == pointRoute[x-1] : yDebut = y elif route.points[y] == pointRoute[x+1] : yFin = y if yDebut == -1 or yFin == -1 : pass elif yDebut < yFin : for i in range(yDebut+1, yFin) : point = route.points[i] listPoint.append(point) self.altitude[point] = curentRouteAltitude self.speed[point] = curentRouteSpeed for i in xrange(len(listPoint)) : point = listPoint[i] self.listOfPoints.append(point) else : for i in range(yFin+1, yDebut) : point = route.points[i] listPoint.append(point) self.altitude[point] = curentRouteAltitude self.speed[point] = curentRouteSpeed leng = len(self.listOfPoints) for i in xrange(len(listPoint)) : point = listPoint[i] self.listOfPoints.insert(leng, point) else : self.listOfPoints.append(pointRoute[x]) self.listOfPoints.append(self.destinationAerodrome) self.altitude[self.destinationAerodrome] = curentAltitude self.speed[self.destinationAerodrome] = curentSpeed i = 0 for x in xrange(len(self.listOfPoints)): point = self.listOfPoints[x] if point in self.defPoints : defPoint = self.defPoints[self.listOfPoints[x]] coordinate = defPoint.decimalCoordinate name = defPoint.name self.points[i]= { 'coordinate' : coordinate, 'name' : name, 'altitude' : self.altitude[name], 'speed' : self.speed[name] } i += 1 elif point == 'DCT' or point == '': pass else : try : coordinate = Convertion.convertCoordinate(point) name = point self.points[i]= { 'coordinate' : coordinate, 'name' : name, 'altitude' : self.altitude[name], 'speed' : self.speed[name] } i += 1 except : Fpl.log += ('POINT error = Flight : ' + self.name + ' Point: ' + str(point) + '\n')