Example #1
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);
        }
        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;
        }
Example #3
0
 public AntennaLeaveAngleAreaSubject()
 {
     Areas    = new List <KeyValuePair <ILeaveAngleAreaObserver, AngleArea> >();
     _antenna = TargetManagerFactory.CreateAntennaDataProvider();
     _antenna.RegisterObserver(this);
 }
Example #4
0
 private static bool IsSectionSweeping() => TargetManagerFactory.CreateAntennaDataProvider().IsSectionSweeping();