def makeApproach(self): """ DOCUMENT ME! """ # check input # assert f_control l_oXY = pxy.CPosXY(self._iMouseX, self._iMouseY) assert l_oXY is not None pos = self._viewport.translate_xy(l_oXY) l_fClosest_r = 1000000 l_sClosest = "" i = 0 while (self._airspace.arrivalRunway(i)): pos1 = self._airspace.getPosition(self._airspace.arrivalRunway(i)) d = tMath.distLL(pos, pos1) a = tMath.trackDelta( self._airspace.runway(self._airspace.arrivalRunway(i)).track(), tMath.track(pos, pos1)) r = d * tMath.dsin(abs(a)) if ((r < l_fClosest_r) and (abs(a) < 90)): l_sClosest = self._airspace.arrivalRunway(i) l_fClosest_r = r i += 1 self._s_approach = l_sClosest self._i_lateral_mode = self.C_LMODE_APP
def radar_ground_speed(self): """ determine groundspeed from radar history """ # clear to go ? if len(self._lst_trail) < 3: # return return 0 # calculate ground speed l_gs = tmath.distLL(self._lst_trail[-1], self.pos) / (self._f_trail_interval / 1000.) * 3600. # return return l_gs
def makeRoute(self): """ DOCUMENT ME! """ # check input # assert f_control # get mouse position l_oXY = pxy.CPosXY(self._iMouseX, self._iMouseY) assert l_oXY is not None # converte as coordenadas de tela para mapa pos = self.__viewport.translate_xy(l_oXY) # inicia variáveis l_sClosest = "" l_fClosest_r = 1000000 # first arrival i = 0 srt = self.__airspace.arrival(0) # scan all arrival's while srt is not None: # init flag apply = False # first runway rw = 0 # scan all runway's while self.__airspace.arrivalRunway(rw): # arrival belongs to runway ? if srt.belongsToRunway(self.__airspace.arrivalRunway(rw)): # ok, found apply = True # next runway rw += 1 # no found any runway ? if not apply: # next arrival i += 1 srt = self.__airspace.arrival(i) # next loop continue n = 0 while srt.item(n) is not None: pos1 = self.__airspace.getPosition(srt.item(n)._sName) r = tMath.distLL(pos, pos1) if srt.item(n + 1): pos2 = self.__airspace.getPosition(srt.item(n + 1)._sName) rttrk = tMath.track(pos1, pos2) rtdist = tMath.distLL(pos1, pos2) mstrk = tMath.track(pos1, pos) tdelta = tMath.trackDelta(rttrk, mstrk) prog = tMath.distLL(pos, pos1) * tMath.dcos(tdelta) if ((prog > 0) and (prog < rtdist)): r = tMath.distLL(pos, pos1) * tMath.dsin(abs(tdelta)) # distância menor que a anterior ? if r < l_fClosest_r: # this is the new closest element l_sClosest = srt.getName() l_fClosest_r = r n += 1 # next arrival i += 1 srt = self.__airspace.arrival(i) # first transition i = 0 srt = self.__airspace.transition(0) # scan all transitions while srt is not None: # init flag apply = False # first runway rw = 0 # scan all runway's while self.__airspace.arrivalRunway(rw): # transition belongs to runway ? if srt.belongsToRunway(self.__airspace.arrivalRunway(rw)): # ok, found apply = True # next runway rw += 1 # no found any transition ? if not apply: # next transition i += 1 srt = self.__airspace.transition(i) # next loop continue n = 0 while srt.item(n): pos1 = self.__airspace.getPosition(srt.item(n)._sName) r = tMath.distLL(pos, pos1) if srt.item(n + 1): pos2 = self.__airspace.getPosition(srt.item(n + 1)._sName) rttrk = tMath.track(pos1, pos2) rtdist = tMath.distLL(pos1, pos2) mstrk = tMath.track(pos1, pos) tdelta = tMath.trackDelta(rttrk, mstrk) prog = tMath.distLL(pos, pos1) * tMath.dcos(tdelta) if ((prog > 0) and (prog < rtdist)): r = tMath.distLL(pos, pos1) * tMath.dsin(abs(tdelta)) if r < l_fClosest_r: l_sClosest = srt._sName() l_fClosest_r = r n += 1 # next transition i += 1 srt = self.__airspace.transition(i) self.__s_route = l_sClosest self.__i_lateral_mode = self.C_LMODE_RTE
def makeDirect(self): """ DOCUMENT ME! """ # check input # assert f_control # get mouse position l_oXY = pxy.CPosXY(self._iMouseX, self._iMouseY) assert l_oXY is not None # converte as coordenadas de tela para mapa pos = self.__viewport.translate_xy(l_oXY) # inicia variáveis l_sClosest = "" l_fClosest_r = 1000000 # primeiro waypoint i = 0 wpt = self.__airspace.waypoint(0) # scan all waypoints while wpt is not None: # calcula a distância do mouse ao waypoint r = tMath.distLL(pos, wpt.position()) # distância menor que a anterior ? if r < l_fClosest_r: # this is the new closest waypoint l_sClosest = wpt._sName() l_fClosest_r = r # next waypoint i += 1 wpt = self.__airspace.waypoint(i) # primeiro vor i = 0 wpt = self.__airspace.vor(0) # scan all vor's while wpt is not None: # calcula a distância do mouse ao vor r = tMath.distLL(pos, wpt.position()) # distância menor que a anterior ? if r < l_fClosest_r: # this is the new closest element l_sClosest = wpt._sName() l_fClosest_r = r # next vor i += 1 wpt = self.__airspace.vor(i) # primeiro ndb i = 0 wpt = self.__airspace.ndb(0) # scan all ndb's while wpt is not None: # calcula a distância do mouse ao ndb r = tMath.distLL(pos, wpt.position()) # distância menor que a anterior ? if r < l_fClosest_r: # this is the new closest element l_sClosest = wpt._sName() l_fClosest_r = r # next ndb i += 1 wpt = self.__airspace.ndb(i) # salva nome do elemento mais próximo do mouse self.__s_direct = l_sClosest self.__i_lateral_mode = self.C_LMODE_DCT