示例#1
0
        protected TargetDot GetDot(List <DistanceCell> ls)
        {
            //int indexSum = 0;
            float azSum    = 0;
            int   speedSum = 0;
            float elSum    = 0;
            int   disSum   = 0;
            int   count    = 0;

            foreach (DistanceCell dis in ls)
            {
                if (dis != null)
                {
                    //azSum += dis.azIndex;
                    disSum   += dis.Distance;
                    elSum    += dis.el;
                    speedSum += dis.speed;
                    count++;
                }
            }
            float az       = azSum / count;
            float distance = disSum / count;
            float el       = elSum / count;
            float speed    = speedSum / count;

            TargetDot dot = new TargetDot(az, el, distance);

            return(dot);
        }
示例#2
0
        protected virtual bool CorelateDotToSector(TargetDot oldDot, Sector sector)   //自由点和一个扇区的新点相关,返回true表示相关成功
        {
            bool ret = false;

            if (!oldDot.IsClotDot)
            {
                return(false);
            }
            foreach (TargetDot newDot in sector.NewDots)
            {
                if (newDot.Adopted || !newDot.IsClotDot) //已经被航迹相关上的点不作处理
                {
                    continue;
                }

                if (oldDot.IsDotRelated(newDot) && DotsCanCorelate(oldDot, newDot))   //两个点是否相关成功
                {
                    TargetTrack track =
                        TargetTrack.CreateTargetTrack(newDot, oldDot, 3);
                    if (track == null)   //创建航迹失败,航迹编号满
                    {
                        continue;
                    }

                    //newDot.Adopted = true;    //自由点相关时,一个目标点可以与多个自由点相关
                    oldDot.Adopted = true;
                    sector.AddTrack(track);

                    ret = true;
                    break;  //相关成功,返回上层循环
                }
            }
            return(ret);
        }
示例#3
0
        public bool IsDotRelated(TargetDot dot)
        {
            float dis    = DistanceTo(dot);
            float disMax = MaximumFlyDistanceSinceLastRefresh(dot.LastRefreshTime);
            float disMin = MinimumFlyDistanceSinceLastRefresh(dot.LastRefreshTime);

            return(dis <= disMax && dis > disMin);
        }
示例#4
0
 public void AddPrepareDot(TargetDot dot)
 {
     lock (_locker)
     {
         dot.SectorIndex = Index;
         PrepareDots.Add(dot);
     }
 }
示例#5
0
 public void AddNewDot(TargetDot dot)
 {
     lock (_locker)
     {
         dot.SectorIndex = Index;
         NewDots.Add(dot);
     }
 }
示例#6
0
        public TargetDot GetMiddleDot(TargetDot dot)
        {
            float az  = (Az + dot.Az) / 2;
            float el  = (El + dot.El) / 2;
            float dis = (Dis + dot.Dis) / 2;
            int   am  = (AmValue + dot.AmValue) / 2;

            TargetDot dot1 = new TargetDot(az, el, dis)
            {
                AmValue = am
            };

            return(dot1);
        }
示例#7
0
        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 static List<TargetDot> ClotTargetDots(List<TargetArea> areas)
        {
            List<TargetDot> dots = new List<TargetDot>();
            foreach (TargetArea area in areas)
            {
                if (area.Width < AreaWidthMinimum || area.Width > AreaWidthMaximum)
                    continue;
                List<DistanceCell> disCells = area.GetDistanceCells();
                TargetDot dot = ClotSingleDot_MaxAm(disCells);
                dot.DotWidth = area.Width;      //凝聚点的宽度
                dots.Add(dot);
            }

            return dots;
        }
示例#9
0
 protected void ShowOriginalVideo(Sector center, Sector right, Sector left, AzimuthCell[] cells)
 {
     foreach (AzimuthCell cell in cells)
     {
         foreach (object o in cell.DisCells.Values)
         {
             if (center.IsAngleInArea(cell.GetAngle()))
             {
                 DistanceCell dis = (DistanceCell)o;
                 TargetDot    dot = new TargetDot(cell.GetAngle(), dis.el, dis.Distance)
                 {
                     AmValue = dis.sumAM
                 };
                 center.AddNewDot(dot);
             }
         }
     }
 }
示例#10
0
        public override void Clot(Sector center, Sector right, Sector left, AzimuthCell[] cells)
        {
            MoveNewDotToOldDot(center);

            foreach (AzimuthCell cell in cells)
            {
                foreach (object o in cell.DisCells.Values)
                {
                    if (center.IsAngleInArea(cell.GetAngle()))
                    {
                        DistanceCell dis = (DistanceCell)o;
                        TargetDot    dot = new TargetDot(cell.GetAngle(), dis.el, dis.Distance)
                        {
                            AmValue = dis.sumAM
                        };
                        center.AddNewDot(dot);
                    }
                }
            }

            NotifyUpdateSectorDot(center);  //通知更新该扇区的目标点视图
        }
示例#11
0
 protected virtual bool DotsCanCorelate(TargetDot dot1, TargetDot dot2) //根据不同起批状态判断两个点击是否可以相关,波门状态下需判断两个点是否在同一波门
 => true;
        public TrackManager_TestCase_Random()
        {
            mode = TargetManagerMode.Auto;

            tracks            = new List <TargetTrack>();
            dots              = new List <TargetDot>();
            obs               = new List <ITargetObserver>();
            timerDot          = new Timer();
            timerDot.Interval = 1000;
            timerDot.Tick    += TimerDot_Tick;
            timerDot.Start();


            timerTrack          = new Timer();
            timerTrack.Interval = 1000;
            timerTrack.Tick    += TimerTrack_Tick;
            timerTrack.Start();

            if (dot1 == null)       //dot1是静态成员,只有第一次实例化时才对dot1赋值
            {
                Random rd = new Random();
                dot1     = new TargetDot();
                dot1.AZ  = rd.Next(0, 180);
                dot1.EL  = rd.Next(10, 19);
                dot1.Dis = rd.Next(2000, 4000);

                dot2     = new TargetDot();
                dot2.AZ  = dot1.AZ + 2;
                dot2.EL  = dot1.EL + 1;
                dot2.Dis = dot1.Dis + 100;
            }

            dots.Add(dot1);
            NotifyAllObservers(dot1, NotifyType.Add);
            dots.Add(dot2);
            NotifyAllObservers(dot2, NotifyType.Add);

            if (track1 == null)
            {
                Random rd = new Random();
                track1         = new TargetTrack();
                track1.trackID = 15;
                track1.AZ      = rd.Next(180, 360);
                track1.EL      = rd.Next(20, 89);
                track1.Dis     = rd.Next(100, 4000);
            }

            float dis    = 4000;
            float el     = 10;
            float az     = 0;
            float azStep = 30;

            for (int i = 1; az < 360; i++)
            {
                TargetTrack t = new TargetTrack();
                az        = 15 + azStep * i;
                t.AZ      = az;
                t.Dis     = dis;
                t.EL      = el;
                t.trackID = i;
                tracks.Add(t);
                NotifyAllObservers(t, NotifyType.Add);
            }
            tracks.Add(track1);
            NotifyAllObservers(track1, NotifyType.Add);
        }