Exemplo n.º 1
0
        private bool CorelateTrack(TargetTrack track, Sector sector)
        {
            bool ret = false;

            if (track.IsFake)       //假航迹,满分,直接返回
            {
                track.ScoreAdd(TargetTrack.ScoreMaximum);
                return(false);
            }
            PolarCoordinate predictCoordinate = track.PredictCoordinate(DateTime.Now);  //预测的位置

            foreach (TargetDot newDot in sector.NewDots)
            {
                if (newDot.Adopted || !newDot.IsClotDot) //被之前的航迹相关上了,或者不是凝聚点
                {
                    continue;
                }
                if (!(predictCoordinate.DistanceTo(newDot.CurrentCoordinate) < track.GetCorelateRadius()))
                {
                    continue;
                }
                newDot.Adopted = true;
                track.Update(newDot.CurrentCoordinate);
                track.ScoreAdd(3);
                ret = true;
                break; //已经相关上,返回上层循环
            }

            return(ret);
        }
Exemplo n.º 2
0
        public bool IsCoordinateInWaveGate(PolarCoordinate c)
        {
            if (c == null)
            {
                return(false);
            }

            return(IsAngleInArea(c.Az) && IsDistanceInWaveGateRange(c.ProjectedDis));
        }
Exemplo n.º 3
0
        private static byte[] AngleToBytes(float angle)  //要求长度为2字节,产生的数字只有长度为1,则前面部0
        {
            byte[] d = PolarCoordinate.FloatToBytes(angle, 1);
            if (d.Length == 1)  //长度为1时
            {
                d = new byte[] { 0x00, d[0] };
            }

            return(d);
        }
Exemplo n.º 4
0
        public TrackGenerator(TargetManager targetManager, PolarCoordinate coordinate)
        {
            this.targetManager = targetManager;
            //track = new TargetTrack(coordinate);

            track = TargetTrack.CreateTargetTrack(new TargetDot(coordinate.Az, coordinate.El, coordinate.Dis), null, 13);
            int sectorIndex = GetTrackSectorId(track);

            targetManager.Sectors[sectorIndex].AddTrack(track);
            track.IsFake      = true;
            track.SectorIndex = GetTrackSectorId(track);
            targetManager.NotifyAllObservers(track, NotifyType.Add);
            center = coordinate;
        }
Exemplo n.º 5
0
        public static (int, PolarCoordinate) GetSerialDataCoordinate(byte[] data)
        {
            if (data[3] != 0x04)
            {
                return(-1, null);
            }

            int   trackId = data[4];
            float az      = (float)(data[5] + data[6] << 8) / 100;
            float el      = (float)(data[7] + data[8] << 8) / 100;
            float dis     = 0f;

            PolarCoordinate coordinate = new PolarCoordinate(az, el, dis);

            return(trackId, coordinate);
        }
Exemplo n.º 6
0
        private PolarCoordinate NextCircleCoordinate()
        {
            PolarCoordinate coordinate          = new PolarCoordinate();
            int             distanceRandomValue = Tools.RandomInt(10, 50);
            int             azRandomValue       = Tools.RandomInt(0, 10);
            double          x     = center.Dis * Math.Cos(Tools.DegreeToRadian(90 - center.Az));
            double          y     = center.Dis * Math.Sin(Tools.DegreeToRadian(90 - center.Az));
            double          x1    = x + 100 * Math.Cos(Tools.DegreeToRadian(90 - angle));
            double          y1    = y + 100 * Math.Sin(Tools.DegreeToRadian(90 - angle));
            double          alpha = 90 - Tools.RadianToDegree(Math.Atan2(y1, x1));

            alpha = Tools.StandardAngle((float)alpha);
            double r = Math.Sqrt(Math.Pow(x1, 2) + Math.Pow(y1, 2));

            coordinate.Az  = (float)alpha;
            coordinate.Dis = (float)r + distanceRandomValue;
            coordinate.El  = 0;
            angle         += 51.4f + azRandomValue;;
            return(coordinate);
        }
Exemplo n.º 7
0
 public void AddTrackGenerator(PolarCoordinate coordinate)
 {
     trackGenerators.Add(new TrackGenerator(this, coordinate));
 }