コード例 #1
0
        // 更新目标位置
        private bool UpdatePlanePosition(Plane plane)
        {
            var layer = mapLogic.GetLayer(plane.LayerName);

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

            var element = layer.GetElement(plane.Name);

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

            IMFPicture picture = element as IMFPicture;

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

            picture.UpdatePosition(plane.Coordinate);
            if (plane.TargetType == 0)    // 只有飞机才设置方位角
            {
                picture.SetAngle((float)plane.Azimuth);
            }

            layer.Refresh();
            return(true);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: AnuoF/MapFrame
 private void 更新位置ToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (picElement == null)
     {
         return;
     }
     picElement.UpdatePosition(new MapLngLat(101, 33));
 }
コード例 #3
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);
        }