コード例 #1
0
        // 处理预警结果
        public void DealWarnData(RealData data, bool isWarn, List <string> warnNames)
        {
            IMFLayer layer = mapLogic.GetLayer(GetModelLayerName(data.TargetType));

            if (layer == null)
            {
                return;
            }

            IMFElement element = layer.GetElement(data.TargetNum.ToString());

            if (element == null)
            {
                return;
            }

            if (isWarn == false)
            {
                element.Flash(false);
            }
            else
            {
                if (element.IsFlash == false)
                {
                    element.Flash(true, 500);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 执行工具命令
        /// </summary>
        public void RunCommond()
        {
            if (mapLogic.GetLayer(layerName) == null)
            {
                mapLogic.AddLayer(layerName);
            }

            lineName += Utils.ElementIndex.ToString();//图元名称
            gmapControl.MouseDown += gmapControl_MouseDown;
            gmapControl.MouseMove += gmapControl_MouseMove;
            gmapControl.KeyDown   += new KeyEventHandler(gmapControl_KeyDown);
        }
コード例 #3
0
ファイル: WarnManager.cs プロジェクト: siszoey/MapFrame
        /// 重绘区域
        /// </summary>
        /// <param name="name"></param>
        /// <param name="points"></param>
        public void ReDrawArea(string name, List <MapLngLat> points)
        {
            // 先删除之前的面,再添加新的面
            if (!warnAresDic.ContainsKey(name))
            {
                return;
            }

            WarnArea area = warnAresDic[name];

            foreach (string polygonName in area.Polygons)
            {
                IMFLayer layer = globeMapLogic.GetLayer(layerName);
                if (layer == null)
                {
                    return;
                }

                layer.RemoveElement(polygonName);
            }

            bool isWarn      = area.IsWarn;
            bool isImportant = area.IsImportant;

            warnAresDic.Remove(name);

            DrawAreaGlobe(name, points, isWarn, isImportant);

            // arcmap
            IMFLayer layerMap = mapMapLogic.AddLayer(layerName);

            if (layerMap == null)
            {
                return;
            }

            IMFElement ele = layerMap.GetElement(name);

            if (ele == null)
            {
                return;
            }
            IMFPolygon polygon = ele as IMFPolygon;

            if (polygon == null)
            {
                return;
            }
            polygon.UpdatePosition(points);
        }
コード例 #4
0
ファイル: WarnManager.cs プロジェクト: siszoey/MapFrame
        private void SetAreaVisibleArcMap(string name, bool visible)
        {
            var layer = mapMapLogic.GetLayer(layerName);

            if (layer == null)
            {
                return;
            }

            var element = layer.GetElement(name);

            if (element == null)
            {
                return;
            }

            element.SetVisible(visible);
        }
コード例 #5
0
        // 清除
        private void barButtonItem16_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            foreach (IMFElement element in drawElements)
            {
                if (element.BelongLayer == null)
                {
                    continue;
                }

                string layerName = element.BelongLayer.LayerName;
                var    layer     = mapLogic.GetLayer(layerName);
                layer.RemoveElement(element);
            }

            drawElements.Clear();
        }
コード例 #6
0
        // 绘图完成事件
        private void Tool_CommondExecutedEvent(object sender, MapFrame.Core.Model.MessageEventArgs e)
        {
            this.Visible = true;

            var tool = mapLogic.GetToolBox();

            if (tool == null)
            {
                return;
            }

            tool.CommondExecutedEvent -= Tool_CommondExecutedEvent;
            tool.ReleaseTool();

            IMFPolygon polygon = e.Data as IMFPolygon;

            if (polygon == null)
            {
                return;
            }

            List <MapLngLat> points = polygon.GetLngLat();

            if (points == null || points.Count <= 0)
            {
                return;
            }

            txtAreaName.Text = polygon.ElementName;
            var layer = mapLogic.GetLayer(polygon.BelongLayer.LayerName);

            layer.RemoveElement(polygon);

            bool isWarn      = cmbIsWarningArea.SelectedIndex == 0 ? true : false;
            bool isImportant = cmbImportantArea.SelectedIndex == 0 ? true : false;

            wanrMgr.DrawArea(txtAreaName.Text, points, isWarn, isImportant);

            ShowInfo(txtAreaName.Text);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: AnuoF/MapFrame
 private void 添加ToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("添加点程序线程ID" + Thread.CurrentThread.ManagedThreadId);
     for (int i = 0; i < 5000; i++)
     {
         Kml    kml     = new Kml();
         string iconUrl = AppDomain.CurrentDomain.BaseDirectory + @"Image\hoverplane.png";
         kml.Placemark.Name = "point" + i;
         MapLngLat lnglat = new MapLngLat(random.Next(-18000, 18000) / 100, random.Next(-9000, 9000) / 100);
         kml.Placemark.Graph = new KmlPicture()
         {
             Position = lnglat, IconUrl = iconUrl, Scale = 1, TipText = "标牌测试...."
         };
         mapLogic.GetLayer(drawLayerName).AddElement(kml, out element);
         picElement = element as IMFPicture;
         picList.Add(picElement);
     }
 }