private CoordinateTargetDotView GenerateGraphicTargetDotViewFromMouseLocation(Point mouseLocation)
        {
            PolarCoordinate coordinate =
                ((GraphicTrackDisplayer)displayer).coordinateSystem.PointToCoordinate(Tools.PointToPoint2F(mouseLocation));

            //计算所属扇区
            int    sectorCount = targetProvider.GetSectorCount();
            int    sectorIndex = 0;
            double angleSpan   = ((double)360) / sectorCount;

            for (int index = 0; index < sectorCount; index++)
            {
                if (coordinate.Az >= index * angleSpan && coordinate.Az < (index + 1) * angleSpan)
                {
                    sectorIndex = index;
                    break;
                }
            }//计算所属扇区完成
            TargetDot dot = new TargetDot(coordinate.Az, coordinate.El, coordinate.Dis)
            {
                SectorIndex = sectorIndex
            };
            TargetView view = ((GraphicTrackDisplayer)displayer).targetsManager.CreateTargetView(dot);

            return((CoordinateTargetDotView)view);
        }
Esempio n. 2
0
        //public override void Corelate(Sector center, Sector left, Sector right)
        //{
        //    foreach(TargetDot oldDot in center.OldDots)
        //    {
        //        if (CorelateDot(oldDot, center)) continue;
        //        if (CorelateDot(oldDot, right)) continue;
        //        CorelateDot(oldDot, left);
        //    }

        //    NotifyDeleteSectorTrack(center);
        //}

        private bool CorelateDot(TargetDot oldDot, Sector center)
        {
            bool ret = false;

            foreach (TargetDot newDot in center.NewDots)
            {
                if (newDot.Adopted) //已经被航迹相关
                {
                    continue;
                }
                float distance = oldDot.DistanceTo(newDot);

                if (distance < threshold)
                {
                    TargetTrack track = TargetTrack.CreateTargetTrack(newDot, oldDot, 3);
                    if (track == null)   //创建航迹失败
                    {
                        continue;
                    }

                    //newDot.Adopted = true;
                    oldDot.Adopted = true;
                    center.AddTrack(track);
                    ret = true;
                    break;  //相关成功,返回上层循环
                }
            }

            return(ret);
        }