/// <summary> /// 移除指定图层 /// </summary> /// <param name="layerName">图层名称</param> /// <returns></returns> public bool RemoverLayer(string layerName) { lock (layerDic) { if (!layerDic.ContainsKey(layerName)) { return(true); } if (mapControl.InvokeRequired) { mapControl.Invoke(new Action(delegate { mapControl.MgsDeleteTsLayer(layerName); })); } else { mapControl.MgsDeleteTsLayer(layerName); } layerDic.Remove(layerName); } RefreshMapDelegate(); return(true); }
/// <summary> /// 闪烁 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void flashTimer_Elapsed(object sender, ElapsedEventArgs e) { if (!isTimer) { if (mapControl.InvokeRequired) { mapControl.Invoke(new System.Action(delegate { mapControl.MgsUpdateSymVisibility(symbolName, 1); })); } else { mapControl.MgsUpdateSymVisibility(symbolName, 1); } } else { if (mapControl.InvokeRequired) { mapControl.Invoke(new System.Action(delegate { mapControl.MgsUpdateSymVisibility(symbolName, 0); })); } else { mapControl.MgsUpdateSymVisibility(symbolName, 0); } } Update(); isTimer = !isTimer; }
private void refreshTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { lock (lockObj) { isRefreshCall = true; refreshTimer.Stop(); } // 单位时间内,只执行一次,且是在单位时间结束时执行 if (axMapControl.InvokeRequired) { axMapControl.Invoke(new Action(delegate { axMapControl.update(); })); } else { axMapControl.update(); } }
/// <summary> /// 键盘按下事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mapControl_eventKeyDown(object sender, _DHOSOFTMapControlEvents_eventKeyDownEvent e) { if (mapControl.InvokeRequired) { mapControl.Invoke(new Action(delegate { if (e.nChar == 27) { ReleaseCommond(); } else if (e.nChar == 17) { isControl = true; mapControl.IMGS_WorkStation_SelectTool("GIS_TOOL_MAP_MOVE_HOSOFT"); } })); } else { if (e.nChar == 27) { ReleaseCommond(); } else if (e.nChar == 17) { isControl = true; mapControl.IMGS_WorkStation_SelectTool("GIS_TOOL_MAP_MOVE_HOSOFT"); } } //if (e.nChar == 27) //{ // ReleaseCommond(); //} //else if (e.nChar == 17) //{ // isControl = true; // mapControl.IMGS_WorkStation_SelectTool("GIS_TOOL_MAP_MOVE_HOSOFT"); //} }