def definition (self, donnees) : """ # The data arrives in this form: # /CODED_ROUTE/ # # Couche (NAME) # | Plafond # | | # --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]) newLevel = str(int(Convertion.convertLevel(float(tabDonnees[1][1:])))) self.level = { 'min' : Layer.lastLevel, 'max' : newLevel} Layer.lastLevel = newLevel
def findAoiIntersection(i, kml, tmpPoints, allObjects, theFpl, lookAt, tmpBegin) : # Find intrsection with AOI deparatureTime = theFpl.deparatureTime estimatedTime = theFpl.estimatedTime arrivalTime = deparatureTime + estimatedTime line1 = { 'lat1' : tmpPoints[0]['latitude'], 'long1' : tmpPoints[0]['longitude'], 'lat2' : tmpPoints[1]['latitude'], 'long2' : tmpPoints[1]['longitude'], } aoi = allObjects['aoi']['aoi'] aoiPoints = aoi['VCC1_AOI'].points for j in xrange(len(aoiPoints)-1) : line2 = { 'lat1' : aoiPoints[j].coordinate['latitude'], 'long1' : aoiPoints[j].coordinate['longitude'], 'lat2' : aoiPoints[j+1].coordinate['latitude'], 'long2' : aoiPoints[j+1].coordinate['longitude'], } intersection = usualFonction.findIntersection(line1, line2) if intersection: distance = Convertion.distanceBetwennTwoPoint( intersection['latitude'], intersection['longitude'], tmpPoints[0]['latitude'], tmpPoints[0]['longitude'], theFpl.points[i]['altitude'] ) pToPTime = theFpl.points[i+1]['estimatedPointTime'] pToPDistance = theFpl.points[i+1]['lastPointDistance'] iTime = pToPTime *int(distance * 1000000000 / pToPDistance) iTime =iTime / 1000000000 intersectionTime = tmpBegin + iTime begin = deparatureTime.strftime("%Y-%m-%dT%H:%MZ") end = arrivalTime.strftime("%Y-%m-%dT%H:%MZ") position = lookAt.copy() position['longitude'] = intersection['longitude'] position['latitude'] = intersection['latitude'] description ='' style = 'redCircle' visibility = 1 ptName = ( str(intersectionTime.strftime("%H:%M - ")) + str(theFpl.name)) kml.addPlacemark( ptName, description , position, visibility, style, begin, end ) return kml
def definition (self, donnees): """ Disperssion des données # The data arrives in this form: # /SID/ # Convention is as follows: # 1st & 2nd character for the SID point # 3rd & 4th character for the SID number # 5th & 6th character for runway number: 5L=05L, 5R=05R, # 3L=23L, 3R=23R # NAME # | COUCHE # | | POINTS # | | | # V V V # ------|---------|---------------------- # # La dispertion va donc de faire à l'aide du séparateur "|" """ donnees = donnees.strip(None) tabDonnees = donnees.split("|") for x in xrange(len(tabDonnees)) : tabDonnees[x] = tabDonnees[x].strip(None) # Assignation des variables self.name = str(tabDonnees[0]) tabLevel = tabDonnees[1].split('-') altMin = Convertion.convertLevel(str(tabLevel[0][1:].strip(None))) altMax = Convertion.convertLevel(str(tabLevel[1][1:].strip(None))) #print altMin #print altMax self.altitude['min'] = altMin self.altitude['max'] = altMax i = len(self.points) tabPoints = tabDonnees[2].split(' ') for x in tabPoints: if x != '' : self.points[i] = self.defPoints[x] i += 1
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 setDistance (self) : """ Add distance in milles """ # initiate the first point self.points[0]['totalDistance'] = 0 self.points[0]['lastPointDistance'] = 0 for i in xrange(1,len(self.points)): point = self.points[i] lastPoint = self.points[i-1] ltd = lastPoint['totalDistance'] distance = Convertion.distanceBetwennTwoPoint( point['coordinate']['latitude'], point['coordinate']['longitude'], lastPoint['coordinate']['latitude'], lastPoint['coordinate']['longitude'], lastPoint['altitude'] ) lpd = distance td = ltd + lpd point['totalDistance'] = td point['lastPointDistance'] = lpd
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')