using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using ESRI.ArcGIS.SystemUI; using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using KGIS.Framework.Views; using Kingo.Plugin.BHTB_Extract.View; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Kingo.Plugin.BHTB_Extract.Commands { /// /// 卷帘比对 /// public class CmdRollerShuttersForm : BaseMenuCommand { private object hookHelper = null; private ICommand m_FlickCmd = null; private ILayerEffectProperties m_LayerEffectProperties; private RollerShuttersView rollerShuttersView = null; public override void OnClick() { try { rollerShuttersView = new RollerShuttersView(hookHelper); rollerShuttersView.Closed += (s, e) => { rollerShuttersView = null; KGIS.Framework.Maps.MapsManager.Instance.MapService.getAxMapControl().CurrentTool = null; }; rollerShuttersView.OKComplate += (layer, e) => { m_LayerEffectProperties.SwipeLayer = layer as ILayer; MapsManager.Instance.MapService.getAxMapControl().CurrentTool = m_FlickCmd as ITool; }; rollerShuttersView.ShowInMainWindow(); } catch (Exception ex) { LogAPI.Debug(ex); MessageHelper.ShowError("卷帘比对出现错误,可能的原因是:" + ex.Message); } } public override void OnCreate(object Hook) { if (hookHelper == null) { hookHelper = new HookHelperClass(); } hookHelper = Hook; m_LayerEffectProperties = new CommandsEnvironmentClass(); m_FlickCmd = new ControlsMapSwipeTool(); m_FlickCmd.OnCreate(Hook); } public override bool Enabled { get { return KGIS.Framework.Maps.MapsManager.Instance.MapService.GetProjectInfo() == null ? false : true; } } } }