private void ProcessSector(object o)        //天线扫过一个扇区时调用该函数,对该扇区的前后扇区进行操作
        {
            lock (this)
            {
                //s的编号为index
                Sector s = (Sector)o;

                Sector s1 = NextSector(s);
                _viewDeleter.DeleteViews(s1, false);

                Sector tmp = PreviousSector(s);
                //Sector tmp = s;

                //index - 1扇区点迹凝聚
                AzimuthCell[] azCells = CycleDataMatrix.CreateCycleDataMatrix().GetAzimuthCellsInSectorSpan(tmp, tmp);//获取刚扫过的扇区所包含的方位单元数组
                _clotter47.Clot(tmp, NextSector(tmp), PreviousSector(tmp), azCells);

                tmp = PreviousSector(tmp);
                _trackCorelator.Corelate(tmp, NextSector(tmp), PreviousSector(tmp));    //航迹相关
                _dotCorelator.Corelate(tmp, NextSector(tmp), PreviousSector(tmp));      //自由点起批

                foreach (var generator in trackGenerators)  //更新产生的航迹
                    generator.UpdateTrack(s);
            }
        }
 public DataSourceController()
 {
     _antennaManager  = (AntennaSectionSweepController)TargetManagerFactory.CreateAntennaContoller();
     _cycleDataMatrix = CycleDataMatrix.CreateCycleDataMatrix();
 }
        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;
        }
 public static CycleDataMatrix CreateCycleDataMatrix() => _cycleDataMatrix ?? (_cycleDataMatrix = new CycleDataMatrix());