コード例 #1
0
        private void RegisterAngleAreaNotification(AngleArea area)
        {
            var antennaLeaveAngleAreaSubject = TargetManagerFactory.CreateAntennaLeaveAngleAreaSubject();

            _modifiedSection = _rotateController.CalAntiInertiaSection(area);
            antennaLeaveAngleAreaSubject.RegisterAngleArea(this, _modifiedSection);
        }
コード例 #2
0
        protected const int SemiAutoWaveGateLife = 3;   //半自动波门的生命长度(天线扫出该波门的次数)

        public WaveGateManager()
        {
            waveGates = new List <WaveGate>();

            obs = new List <IWaveGateObserver>();

            Subject = TargetManagerFactory.CreateAntennaLeaveAngleAreaSubject();
        }
コード例 #3
0
        private void ConnectNewCycleDataSubject(string type, string source) //链接新数据源
        {
            _cycleDataSubject = GetCycleDataSubject(type);                  //获取新的周期数据对象

            _cycleDataMatrix.Clear();
            _cycleDataSubject.RegisterObserver(_cycleDataMatrix);
            TargetManagerFactory.CreateTrackManager().InitializeSectors(); //删除所有目标
            _cycleDataSubject.RegisterObserver(_antennaManager);
            _cycleDataSubject.RebindSource(source);                        //绑定数据源
        }
コード例 #4
0
 private void DestroySectors()
 {
     lock (_locker)
     {
         //获得角度区域监听器
         var antennaLeaveAngleAreaSubject = TargetManagerFactory.CreateAntennaLeaveAngleAreaSubject();
         if (Sectors == null) return;
         foreach (Sector s in Sectors) //注销角度区域
             antennaLeaveAngleAreaSubject.UnregisterAngleArea(this, s);
     }
 }
コード例 #5
0
        private AngleArea CalculateSweepArea(int sectorIndex)
        {
            float sectorCoverage = (float)360 / TargetManagerFactory.CreateTargetDataProvider().GetSectorCount();
            float beginAngle     = sectorIndex * sectorCoverage;
            float endAngle       = (sectorIndex + 1) * sectorCoverage;

            beginAngle = Tools.StandardAngle(beginAngle - sectorCoverage * 2);
            endAngle   = Tools.StandardAngle(endAngle + sectorCoverage * 2);

            return(new AngleArea(beginAngle, endAngle));
        }
コード例 #6
0
        public void SetRotationRate(uint countPerMinute)    //不改变方向,只改变转速,界面
        {
            SetAntennaSweepState(_intentionalDirection, countPerMinute);
            if (!_isSectionSweeping)
            {
                return;                             //不是扇扫状态
            }
            var angleAreaSurveillance = TargetManagerFactory.CreateAngleAreaSurveillance();

            angleAreaSurveillance.UnregisterAngleArea(this, _modifiedSection);
            _modifiedSection = CalAntiInertiaSection(_sweepSection);
            angleAreaSurveillance.RegisterAngleArea(this, _modifiedSection);
        }
コード例 #7
0
        public void SetSectionSweepMode(AngleArea area) //扇扫模式
        {
            if (_isSectionSweeping)
            {
                StopSectionSweep();     //先停止扇扫
            }
            _isSectionSweeping = true;
            _sweepSection      = area;
            var angleAreaSurveillance = TargetManagerFactory.CreateAngleAreaSurveillance();

            _modifiedSection = CalAntiInertiaSection(_sweepSection);
            angleAreaSurveillance.RegisterAngleArea(this, _modifiedSection);
            NotifySweepModeChange();
        }
コード例 #8
0
        private void CreateSectors()
        {
            lock (_locker)
            {
                //获得角度区域监听器
                var antennaLeaveAngleAreaSubject = TargetManagerFactory.CreateAntennaLeaveAngleAreaSubject();

                //初始化扇区并注册角度区域观察者
                Sectors = new Sector[Sector.SectorCount];
                for (int i = 0; i < Sector.SectorCount; i++)
                {
                    Sectors[i] = CreateSector(i, Sector.SectorCount);
                    antennaLeaveAngleAreaSubject.RegisterAngleArea(this, Sectors[i]);
                }
            }
        }
コード例 #9
0
        private static List <byte> AddAntennaSectionSweepData(List <byte> cmdData)
        {
            IAntennaDataProvider antenna = TargetManagerFactory.CreateAntennaDataProvider();
            byte isSectionSweep          = (byte)(antenna.IsSectionSweeping() ? 1 : 0);

            cmdData.Add(isSectionSweep);
            if (isSectionSweep == 1)
            {
                cmdData.AddRange(AngleToBytes(antenna.GetSweepBeginAngle()));
                cmdData.AddRange(AngleToBytes(antenna.GetSweepEndAngle()));
            }
            else
            {
                cmdData.AddRange(new byte[] { 0, 0, 0, 0 });
            }

            return(cmdData);
        }
コード例 #10
0
 protected Sector NextSector(Sector s)   //返回该扇区的下一个扇区的引用
 {
     RotateDirection direction = TargetManagerFactory.GetAntennaDirection();
     switch (direction)
     {
         case RotateDirection.ClockWise:
             lock (_locker)
             {
                 return s.Index == Sector.SectorCount - 1 ? Sectors[0] : Sectors[s.Index + 1];
             }
         case RotateDirection.CounterClockWise:
             lock (_locker)
             {
                 return s.Index == 0 ? Sectors[Sector.SectorCount - 1] : Sectors[s.Index - 1];
             }
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
コード例 #11
0
        private static void ProcessRemoteTargetManagerUdpData(byte[] data)
        {
            byte head = data[1];

            int sectorNum = data[3];

            int targetCount = DistanceCell.MakeInt(data, 4, 2);

            if (head == 0xb1)
            {
                List <TargetDot> ls = GetTargetDotsFromSerialData(data, targetCount, sectorNum);
                TargetManagerFactory.CreateTrackManager().TargetDotDataReceivedFromRemoteTargetManager(sectorNum, ls);
            }

            if (head == 0xb2)
            {
                List <TargetTrack> ls = GetTargetTracksFromSerialData(data, targetCount, sectorNum);
                TargetManagerFactory.CreateTrackManager().TargetTrackDataReceivedFromRemoteTargetManager(sectorNum, ls);
            }
        }
コード例 #12
0
        private void ChangeSectorHandler(Target target, int tosectorindex)
        {
            AntennaSectionSweepController sweepController = TargetManagerFactory.CreateAntennaManager();

            sweepController.SetSectionSweepMode(CalculateSweepArea(tosectorindex));
        }
コード例 #13
0
        public void NotifyLeaveAngleArea(AngleArea area) => AntennaLeaveSectionSweepAngleArea();//天线扫过了扇扫区域,需要翻转天线

        private void AntennaLeaveSectionSweepAngleArea()
        {
            _rotateController.ReverseSweepDirection();
            TargetManagerFactory.CreateTrackManager().DeleteOutRangedTargets(_sweepSection);
        }
コード例 #14
0
        private void UnregisterAngleAreaNotification()
        {
            var antennaLeaveAngleAreaSubject = TargetManagerFactory.CreateAntennaLeaveAngleAreaSubject();

            antennaLeaveAngleAreaSubject.UnregisterAngleArea(this, _modifiedSection);
        }
コード例 #15
0
        public static List<TargetArea> GetTargetAreas(List<AzimuthCell> azCells)
        {
            azCells.Sort();     //按方位排序
            List<AzimuthCell> moreAzimuthCells = new List<AzimuthCell>();

            //获取下个扇区的数据,准备将本扇区的TargetArea向下个扇区扩展
            if (TargetManagerFactory.CreateAntennaDataProvider().GetAntennaDirection() == RotateDirection.ClockWise)
            {
                if (azCells.Count > 0)
                {
                    AngleArea angleArea = new AngleArea(azCells[azCells.Count - 1].Angle,
                        azCells[azCells.Count - 1].Angle + 20.25f);
                    moreAzimuthCells = new List<AzimuthCell>(CycleDataMatrix.CreateCycleDataMatrix().AzimuthCellsInAngleArea(angleArea));
                    moreAzimuthCells.Sort();
                }
            }
            else
            {
                azCells.Reverse(); //沿着天线转动方向凝聚
                if (azCells.Count > 0)
                {
                    AngleArea angleArea = new AngleArea(azCells[azCells.Count - 1].Angle - 20.25f,
                        azCells[azCells.Count - 1].Angle);
                    moreAzimuthCells = new List<AzimuthCell>(CycleDataMatrix.CreateCycleDataMatrix().AzimuthCellsInAngleArea(angleArea));
                    moreAzimuthCells.Sort();
                    moreAzimuthCells.Reverse();
                }
            }

            List<TargetArea> areas = new List<TargetArea>();
            foreach (AzimuthCell azimuthCell in azCells)
            {
                List<TargetAreaEdge> edges = FourSevenClotter.GetAzCellTargetAreaEdges(azimuthCell);
                foreach (TargetArea area in areas)      //先延伸现有的区域
                {
                    if (area.ExtentionEnd)
                        continue;    //已经终止延伸的区域不处理
                    area.Extend(ref edges);             //延伸区域
                }

                foreach (TargetAreaEdge edge in edges)  //将未合并的edge升级为area,供下一循环延伸
                {
                    if (edge.IsInArea)
                        continue;
                    areas.Add(new TargetArea(new List<TargetAreaEdge>() { edge }));
                    edge.IsInArea = true;
                }
            }

            int extendingCount = 0;
            for (int i = areas.Count - 1; i >= 0; i--)
            {
                if (!areas[i].ExtentionEnd) //尚未结束的区域
                    extendingCount++;
            }

            if (extendingCount == 0)
                return areas;  //所有区域都已经结束扩展

            //未完成扩展的区域继续向下个扇区扩展
            foreach (TargetArea extendingArea in areas)
            {
                if (extendingArea.ExtentionEnd) continue;
                foreach (TargetAreaEdge edge in extendingArea.RigthMostEdges)
                {
                    foreach (AzimuthCell azimuthCell in moreAzimuthCells)
                    {
                        List<TargetAreaEdge> edges = new List<TargetAreaEdge>();
                        foreach (DistanceCell disCell in azimuthCell.DisCells.Values)
                        {
                            if (!edge.IsDistanceCellAdjacentDistanceWise(disCell) || disCell.Occupied)
                                continue;
                            disCell.Occupied = true;
                            List<DistanceCell> distanceCells = new List<DistanceCell>() { disCell };
                            TargetAreaEdge tae = new TargetAreaEdge(distanceCells);
                            edges.Add(tae);
                        }
                        extendingArea.Extend(ref edges);
                    }
                }
            }

            return areas;
        }
コード例 #16
0
 protected void StopSectionSweep()
 {
     _sweepSection      = null;
     _isSectionSweeping = false;
     TargetManagerFactory.CreateAngleAreaSurveillance().UnregisterAngleArea(this, _modifiedSection);
 }
コード例 #17
0
 public AntennaLeaveAngleAreaSubject()
 {
     Areas    = new List <KeyValuePair <ILeaveAngleAreaObserver, AngleArea> >();
     _antenna = TargetManagerFactory.CreateAntennaDataProvider();
     _antenna.RegisterObserver(this);
 }
コード例 #18
0
 public DataSourceController()
 {
     _antennaManager  = (AntennaSectionSweepController)TargetManagerFactory.CreateAntennaContoller();
     _cycleDataMatrix = CycleDataMatrix.CreateCycleDataMatrix();
 }
コード例 #19
0
 public DotCorelator_WaveGate() : base()
 {
     waveGateDataProvider = TargetManagerFactory.CreateWaveGateDataProvider();
 }
コード例 #20
0
 private static bool IsSectionSweeping() => TargetManagerFactory.CreateAntennaDataProvider().IsSectionSweeping();
コード例 #21
0
 public DotCorelator_WaveGate(List <ITargetObserver> ls) : base(ls)
 {
     waveGateDataProvider = TargetManagerFactory.CreateWaveGateDataProvider();
 }