Рефактор
This commit is contained in:
@@ -120,26 +120,26 @@ func _ready():
|
||||
btns_select.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_select').bind(btn, btns_select)))
|
||||
var nodes: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
nodes.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes)))
|
||||
threats.connect('threat_new', Callable(self, 'on_threat_new'))
|
||||
threats.connect('threat_lost', Callable(self, 'on_threat_lost'))
|
||||
threats.connect('threats_resized', Callable(self, 'on_threats_resized'))
|
||||
threats.connect('threat_update', Callable(self, 'on_threat_update'))
|
||||
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(nodes))
|
||||
signaller.connect('bip_pressed', Callable(self, 'on_bip_pressed').bind(nodes))
|
||||
signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(nodes))
|
||||
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(nodes))
|
||||
signaller.connect('interfer_selected', Callable(self, 'on_interfer_selected').bind(nodes))
|
||||
signaller.connect('interfer_new', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno').bind(nodes))
|
||||
signaller.connect('fs_selected', Callable(self, 'on_fs_selected'))
|
||||
signaller.connect('fs_update_color', Callable(self, 'on_fs_update_color'))
|
||||
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_chk_interfer_prinuditelno'))
|
||||
signaller.connect('fs_update_state', Callable(self, 'on_fs_update_state'))
|
||||
signaller.connect('map_user_panning', Callable(self, 'on_user_panning'))
|
||||
threats.connect('threat_new', Callable(self, 'on_threat_new'))
|
||||
threats.connect('threat_lost', Callable(self, 'on_threat_lost'))
|
||||
threats.connect('threats_resized', Callable(self, 'on_threats_resized'))
|
||||
threats.connect('threat_update', Callable(self, 'on_threat_update'))
|
||||
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(nodes))
|
||||
signaller.connect('bip_pressed', Callable(self, 'on_bip_pressed').bind(nodes))
|
||||
signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(nodes))
|
||||
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(nodes))
|
||||
signaller.connect('interfer_selected', Callable(self, 'on_interfer_selected').bind(nodes))
|
||||
signaller.connect('interfer_new', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno').bind(nodes))
|
||||
signaller.connect('fs_selected', Callable(self, 'on_fs_selected'))
|
||||
signaller.connect('fs_update_color', Callable(self, 'on_fs_update_color'))
|
||||
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_chk_interfer_prinuditelno'))
|
||||
signaller.connect('fs_update_state', Callable(self, 'on_fs_update_state'))
|
||||
signaller.connect('map_user_panning', Callable(self, 'on_user_panning'))
|
||||
signaller.connect('update_coordinates_map', Callable(self, 'on_update_coordinates_label'))
|
||||
signaller.connect('update_scale_map', Callable(self, 'on_update_scale_label'))
|
||||
signaller.connect('update_scale_map', Callable(self, 'on_update_scale_label'))
|
||||
on_btn_center_toggled(true)
|
||||
on_btn_activate_toggled(true)
|
||||
|
||||
@@ -176,7 +176,7 @@ func map_threat_to_bip(th: threats.Threat, bip: Control):
|
||||
if freq_range[0] <= freq and freq <= freq_range[1]:
|
||||
sector_key = key
|
||||
break
|
||||
if sector_key!= null:
|
||||
if sector_key != null:
|
||||
radius_internal = fs_band[sector_key][0]
|
||||
radius_outter = fs_band[sector_key][1]
|
||||
freq_low = prd.FS_FREQ[sector_key][0]
|
||||
|
||||
@@ -17,7 +17,7 @@ class CapsRpb extends unit.Unit:
|
||||
var source_addr: Array ## Адрес отправителя данных
|
||||
|
||||
func _to_string() -> String: return String('CapsRpb(\"%s\")' % self.name)
|
||||
func _init(nm): self.name = nm
|
||||
func _init(unit_name): self.name = unit_name
|
||||
|
||||
func parse(data: PackedByteArray, now_tick: int):
|
||||
tick = now_tick
|
||||
|
||||
@@ -207,15 +207,15 @@ func on_nav_data_received(coords: Dictionary, unit_caps):
|
||||
|
||||
|
||||
## Проверяет состояние отправки пакета и если не доставлен, повторяет отправку.
|
||||
func on_timer_check_state(unit, ecms, resend_timeout) -> void:
|
||||
func on_timer_check_state(unit_instance, ecms, resend_timeout) -> void:
|
||||
var tick = Time.get_ticks_msec()
|
||||
for ecm in ecms.values():
|
||||
if (tick - ecm.tick_tx) >= resend_timeout:
|
||||
send_ecm(ecm, unit)
|
||||
send_ecm(ecm, unit_instance)
|
||||
ecm.tick_tx = tick
|
||||
|
||||
|
||||
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit) -> void:
|
||||
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> void:
|
||||
for thr in threats.values():
|
||||
var th_id = thr.id
|
||||
for ecm_i in thrs.keys():
|
||||
@@ -223,7 +223,7 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit) -> void:
|
||||
var ecm = ecms[ecm_i]
|
||||
ecm.params['freq'] = thr.freq
|
||||
ecm.kni = thr.aoa
|
||||
send_ecm(ecm, unit)
|
||||
send_ecm(ecm, unit_instance)
|
||||
signaller.emit_signal('fs_update_color', ecms)
|
||||
prd.update_fs_state(ecms)
|
||||
|
||||
@@ -238,29 +238,44 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit) -> void:
|
||||
|
||||
|
||||
## Производит приём состояния помех. [param unit] -> [param ecms].
|
||||
func on_data_capsrpb_received(unit0: capsrpb.CapsRpb, ecms: Dictionary) -> void:
|
||||
if not unit0.json_dic.has('ts'): return
|
||||
if not (unit0.json_dic['ts'] is float): return
|
||||
if unit0.json_dic['ts'] != 5: return
|
||||
if not unit0.json_dic.has('msvk'): return
|
||||
if not (unit0.json_dic['msvk'] is Array): return
|
||||
var msvk = unit0.json_dic['msvk']
|
||||
func on_data_capsrpb_received(unit_instance: capsrpb.CapsRpb, ecms: Dictionary) -> void:
|
||||
if not unit_instance.json_dic.has('ts'): return
|
||||
if not (unit_instance.json_dic['ts'] is float): return
|
||||
if unit_instance.json_dic['ts'] != 5: return
|
||||
map_msvk_to_ecms(unit_instance, ecms)
|
||||
map_mpchf_to_view(unit_instance)
|
||||
|
||||
|
||||
## Извлекает массив состояний выполнения команды
|
||||
func map_msvk_to_ecms(unit_instance: unit.Unit, ecms: Dictionary):
|
||||
var json_dic = unit_instance.json_dic
|
||||
if not json_dic.has('msvk'): return
|
||||
var msvk = unit_instance.json_dic['msvk']
|
||||
if msvk is not Array: return
|
||||
for dic_msvk in msvk:
|
||||
if not (dic_msvk is Dictionary): continue
|
||||
if dic_msvk.has('ispp'):
|
||||
var ispp = int(dic_msvk['ispp'])
|
||||
var errmsg = dic_msvk.get('errmsg', '')
|
||||
if errmsg:
|
||||
log.error('сеанс %d: \"%s\"' % [ispp, errmsg])
|
||||
if ecms.has(ispp):
|
||||
var ecm = ecms[ispp]
|
||||
ecm.set_from_dic(dic_msvk)
|
||||
call_deferred('emit_signal', 'interfer_update', ecm)
|
||||
else:
|
||||
var ecm = Interfer.new()
|
||||
ecm.set_from_dic(dic_msvk)
|
||||
ecm.krp = INTERFER_OFF
|
||||
send_ecm(ecm, unit0)
|
||||
if not dic_msvk.has('ispp'): continue
|
||||
var ispp = int(dic_msvk['ispp'])
|
||||
var errmsg = dic_msvk.get('errmsg', '')
|
||||
if errmsg:
|
||||
log.error('сеанс %d: \"%s\"' % [ispp, errmsg])
|
||||
if ecms.has(ispp):
|
||||
var ecm = ecms[ispp]
|
||||
ecm.set_from_dic(dic_msvk)
|
||||
call_deferred('emit_signal', 'interfer_update', ecm)
|
||||
else:
|
||||
var ecm = Interfer.new()
|
||||
ecm.set_from_dic(dic_msvk)
|
||||
ecm.krp = INTERFER_OFF
|
||||
send_ecm(ecm, unit_instance)
|
||||
|
||||
|
||||
## Извлекает массив пространственно-частотных фильтров
|
||||
func map_mpchf_to_view(unit_instance: unit.Unit):
|
||||
var json_dic = unit_instance.json_dic
|
||||
if not json_dic.has('mpchf'): return
|
||||
var mpchf = json_dic['mpchf']
|
||||
if mpchf is not Array: return
|
||||
|
||||
|
||||
## Вызыватся, когда пользователь выбрал помеху и выбраны цели.
|
||||
|
||||
Reference in New Issue
Block a user