Example #1
0
        // 处理实时数据
        public void DealRealData(Model.RealData data)
        {
            var   position = new MapLngLat(data.Longitude, data.Latitude, data.Altitude);
            Plane plane    = CreateStateModel(data, position);

            trackMgr.AddTrackPoint(plane.Name, data.TargetType, position);

            if (!planeMgr.HasModel(plane))
            {
                if (CreatePlane(plane))
                {
                    planeMgr.AddModel(plane);
                }
            }
            else
            {
                planeMgr.UpdataModel(plane);
                UpdatePlanePosition(plane);

                if (trackMgr.IsShowTrack(plane.Name))
                {
                    UpdateTrackPoint(plane);
                }
            }

            // 目标跟踪
            if (trackPicture != null)
            {
                MapLngLat pos = trackPicture.GetLngLat();
                mapLogic.GetToolBox().ZoomToPosition(pos);
                EventPublisher.PublishJumpToGlobeViewEvent(this, new Model.JumpToGlobeViewEventArgs(trackPicture.ElementName, pos));
            }
        }
Example #2
0
        // 更新目标
        private bool UpdateElement(RealData data)
        {
            var layer = mapLogic.GetLayer(objLayer);

            if (layer == null)
            {
                return(false);
            }

            string name = data.TargetNum.ToString();

            if (!elementMgr.IsHaveElement(name))
            {
                return(false);
            }

            var element = mapLogic.GetLayer(objLayer).GetElement(name);

            if (element == null)
            {
                return(false);
            }
            IMFPicture picElement = element as IMFPicture;

            if (picElement == null)
            {
                return(false);
            }
            // 更新目标位置
            picElement.UpdatePosition(data.Longitude, data.Latitude);

            // 更新目标航迹
            if (trackMgr.IsShowTrack(name))
            {
                UpdateElementTrackLine(name);
            }

            return(true);
        }
Example #3
0
        // 处理实时数据
        public void DealRealData(RealData data)
        {
            var     point = new MapLngLat(data.Longitude, data.Latitude, data.Altitude);
            Model3D model = CreateStateModel(data, point);

            if (!tsModelMgr.HasModel(model))  // 新的目标
            {
                if (AddModel2Earth(model))    // 创建目标
                {
                    tsModelMgr.AddModel(model);
                }
            }
            else   // 目标已存在
            {
                tsModelMgr.UpdataModel(model);
                UpdateModelPosition(model);          // 更新目标位置

                if (trackMgr.IsShowTrack(model.ModelName))
                {
                    UpdateTrackPoint(model);         // 更新目标航迹
                }
            }
        }