Ejemplo n.º 1
0
 def __init__(self, call_sign):
     self.current = {}
     self.history = []
     self.air_plane = call_sign
     self.is_took = False
     gl.get_value("queueForAirPlane").put(
         {"AirPlane": self.air_plane,
          "classType": 'Radar'})
Ejemplo n.º 2
0
 def __init__(self, call_sign):
     self.air_plane = call_sign
     self.current_fly_plan = {}
     self.arrived = 0
     print("AirPlaneFlyPlanModel New")
     gl.get_value("queueForAirPlane").put({
         "AirPlane": self.air_plane,
         "classType": 'FlyPlan'
     })
Ejemplo n.º 3
0
def info_process(*args):
    for manager in args:
        if gl.get_value('stop') is False:
            if gl.get_value('currentTime') > 1577203181:
                AirPlaneHandler.stop_play(True)
                AirPlaneHandler.release_all()
                RadarHandler.release_all()
                FlyPlanHandler.release_all()
            gl.increase('currentTime', 4 * gl.get_value('playSpeed'))
        manager.tick_run()
Ejemplo n.º 4
0
 def __init__(self):
     self.event_tick = threading.Event()
     self.new_plane_queue = gl.get_value('queueForAirPlane')
     print(gl.get_value('queueForAirPlane'))
     self.thread_for_new_plane = ThreadHandler.create_task(
         'JoinNewAirPlane',
         self.new_air_plane,
         self.new_plane_queue,
         None,
     )
     TimerHandler.new_timer(2, self.update_resource_loop)
     self.is_stop = False
Ejemplo n.º 5
0
 def is_outdate(self):
     if self.radar is None:
         return False
     elif abs(self.radar.get_current_time() -
              gl.get_value("currentTime")) > 60 * 60:
         return True
     else:
         return False
Ejemplo n.º 6
0
    def is_arrived(self):
        if self.plan is None:
            return False

        if self.plan.arrived_time() == 0:
            return False
        elif self.plan.arrived_time() + 20 < gl.get_value("currentTime"):
            return True
        else:
            return False
Ejemplo n.º 7
0
 def get_next_data_from_db(self, task):
     #print("out:: {}: processing".format(task.get_name()))
     self.event_tick.wait()
     if self.is_stop is True:
         self.event_tick.clear()
         return
     timestamp = gl.get_value('currentTime')
     sql = "select ARCID,timestamp,ETA,ADA_ATA,ATIME,RWY,ARWY,STAR,ROUTE,RTEPTS,SECTOR,TTLEET"
     sql += " from flyplan where timestamp > %d and timestamp < %d;" % (
         self.current_time, timestamp)
     self.current_time = timestamp
     fly_plans = self.db.find_by_sql(sql)
     if fly_plans is not None and len(fly_plans) > 0:
         for plan in fly_plans:
             self.flyplan_info_queue.put(plan)
     self.event_tick.clear()
Ejemplo n.º 8
0
 def get_next_data_from_db(self, task):
     #print("out:: {}: processing".format(task.get_name()))
     self.event_tick.wait()
     if self.is_stop is True:
         self.event_tick.clear()
         return
     timestamp = gl.get_value('currentTime')
     sql = "select callsign,X,Y,longitude,latitude,C_altitude,A_altitude,speed,heading,utctime,rise,CTL,Wake"
     sql += " from radar where utctime > %d and utctime < %d;" % (self.current_time, timestamp)
     print(sql)
     self.current_time = timestamp
     radars = self.db.find_by_sql(sql)
     if radars is not None and len(radars) > 0:
         print(len(radars))
         for radar in radars:
             self.radar_info_queue.put(radar)
     self.event_tick.clear()
Ejemplo n.º 9
0
        if gl.get_value('stop') is False:
            if gl.get_value('currentTime') > 1577203181:
                AirPlaneHandler.stop_play(True)
                AirPlaneHandler.release_all()
                RadarHandler.release_all()
                FlyPlanHandler.release_all()
            gl.increase('currentTime', 4 * gl.get_value('playSpeed'))
        manager.tick_run()


def init_data():
    gl.set_value('currentTime', 1574783981)
    gl.set_value('currentDate', "20191126000000")


if __name__ == "__main__":
    init_data()
    RadarHandler.update_current_time(gl.get_value('currentTime'))
    FlyPlanHandler.update_current_time(gl.get_value('currentTime'))
    FrontCmder.start()
    #AirPlaneHandler.start()
    #(radar_handler, flyplan_handler)
    TimerHandler.new_timer(4, info_process, (RadarHandler, FlyPlanHandler,))
    ThreadHandler.run_all()
    TimerHandler.start_all()

    ThreadHandler.thread_checker()
    TimerHandler.cancel_all()
    print("Dog Aman is stopped!!")