} //获得天线离开波门通知 private void NotifyAllObservers(WaveGate gate, WaveGateSubjectNotifyState type) { foreach (IWaveGateObserver ob in obs) { ob.NotifyChange(gate, type); } } //主动通知所有观察者,有波门发生变化
protected override bool DotsCanCorelate(TargetDot dot1, TargetDot dot2) { WaveGate gate1 = waveGateDataProvider.IsTargetInWaveGate(dot1); WaveGate gate2 = waveGateDataProvider.IsTargetInWaveGate(dot2); if (gate1 != null && gate2 != null && gate1 == gate2) { return(true); } else { return(false); } }
public void NotifyLeaveAngleArea(AngleArea area) { WaveGate gate = (WaveGate)area; gate.SweepCount = gate.SweepCount + 1; //该波门扫过计数加一 if (gate.SweepCount < SemiAutoWaveGateLife) { return; } Subject.UnregisterAngleArea(this, gate); NotifyAllObservers(gate, WaveGateSubjectNotifyState.Delete); waveGates.Remove(gate); } //获得天线离开波门通知
public void AddWaveGate(WaveGate gate) { if (gate == null) { return; } waveGates.Add(gate); if (gate.IsSemiAuto) //半自动波门注册,监视角度区域,天线扫出该波门获得通知 { Subject.RegisterAngleArea(this, gate); } NotifyAllObservers(gate, WaveGateSubjectNotifyState.Add); }
public void DelWaveGate(WaveGate gate) { if (gate == null) { return; } if (waveGates.Contains(gate)) { waveGates.Remove(gate); } if (gate.IsSemiAuto) //手动删除的是半自动波门,反注册监听区域,天线扫出该区域不在获得通知 { Subject.UnregisterAngleArea(this, gate); } NotifyAllObservers(gate, WaveGateSubjectNotifyState.Delete); }