|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.ADF.BaseClasses;
|
|
|
|
|
using ESRI.ArcGIS.Controls;
|
|
|
|
|
using System;
|
|
|
|
|
using Kingo.Plugin.ResultsOfProof.View.JZTBXX;
|
|
|
|
|
using KGIS.Framework.Utils.Helper;
|
|
|
|
|
using KGIS.Framework.Maps;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using KGIS.Framework.Utils.Interface;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using KGIS.Framework.Commands;
|
|
|
|
|
using KUI.Windows;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.ResultsOfProof.Commands
|
|
|
|
|
{
|
|
|
|
|
public class BGExportXJJZTBXXCommand : BaseMenuCommand
|
|
|
|
|
{
|
|
|
|
|
private IMapService m_MapManager;
|
|
|
|
|
private IHookHelper m_hookHelper = null;
|
|
|
|
|
private BGFrmJZTBList ucXJJZTBList = null;
|
|
|
|
|
public override void OnCreate(object hook)
|
|
|
|
|
{
|
|
|
|
|
if (hook == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (m_hookHelper == null)
|
|
|
|
|
{
|
|
|
|
|
m_hookHelper = new HookHelperClass();
|
|
|
|
|
}
|
|
|
|
|
m_hookHelper.Hook = hook;
|
|
|
|
|
if (m_hookHelper.ActiveView == null)
|
|
|
|
|
{
|
|
|
|
|
m_hookHelper = null;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_MapManager = MapsManager.Instance.MapService;
|
|
|
|
|
m_MapManager.ProjectClosed += M_ViewManager_CloseProjectHandler;
|
|
|
|
|
m_MapManager.ProjectOpened += M_ViewManager_OpenProjectHandler;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
m_hookHelper = null;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void M_ViewManager_CloseProjectHandler(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (ucXJJZTBList != null)
|
|
|
|
|
{
|
|
|
|
|
ucXJJZTBList.ClosePanel();
|
|
|
|
|
ucXJJZTBList = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void M_ViewManager_OpenProjectHandler(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (ucXJJZTBList != null)
|
|
|
|
|
{
|
|
|
|
|
ucXJJZTBList.ClosePanel();
|
|
|
|
|
ucXJJZTBList = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick()
|
|
|
|
|
{
|
|
|
|
|
IEngineEditor pEditor = new EngineEditorClass();
|
|
|
|
|
if (pEditor.EditState == esriEngineEditState.esriEngineStateEditing)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("请先关闭编辑!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IFeatureLayer JZTB_FC = null;
|
|
|
|
|
IFeatureLayer JCDLTB_FC = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
JZTB_FC = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB");
|
|
|
|
|
JCDLTB_FC = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("地类图斑");
|
|
|
|
|
|
|
|
|
|
if (JZTB_FC == null || JZTB_FC.FeatureClass == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowWarning("未找到举证成果图斑图层!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (JZTB_FC.FeatureClass.FeatureCount(null) == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowWarning("举证成果图斑数据为空,请先导入举证成果数据!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (JCDLTB_FC == null || JCDLTB_FC.FeatureClass == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowWarning("未找到基础地类图斑图层!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (JCDLTB_FC.FeatureClass.FeatureCount(null) == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowWarning("基础地类图斑数据为空,请先导入基础地类图斑数据!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (ucXJJZTBList != null)
|
|
|
|
|
{
|
|
|
|
|
ucXJJZTBList.ClosePanel();
|
|
|
|
|
ucXJJZTBList = null;
|
|
|
|
|
}
|
|
|
|
|
this.ShowLoading("正在加载举证图斑信息表数据,请稍等……", 0, 0);
|
|
|
|
|
if (ucXJJZTBList == null)
|
|
|
|
|
{
|
|
|
|
|
ucXJJZTBList = new BGFrmJZTBList(m_hookHelper);
|
|
|
|
|
ucXJJZTBList.CloseViewHandler += ucXJJZTBList_CloseViewHandler;
|
|
|
|
|
}
|
|
|
|
|
ucXJJZTBList.ShowPanel();
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("BG县举证图斑信息表导出失败" + ex.Message);
|
|
|
|
|
MessageHelper.ShowError("BG县举证图斑信息表导出失败,可能的原因是:" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
if (JZTB_FC != null)
|
|
|
|
|
{
|
|
|
|
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(JZTB_FC);
|
|
|
|
|
}
|
|
|
|
|
if (JCDLTB_FC != null)
|
|
|
|
|
{
|
|
|
|
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(JCDLTB_FC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ucXJJZTBList_CloseViewHandler(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (ucXJJZTBList != null)
|
|
|
|
|
{
|
|
|
|
|
ucXJJZTBList = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public event Action<NotifyMsgPackage> NotifyMsgEven;
|
|
|
|
|
public void SetNotifyMsg(NotifyMsgPackage msg)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (NotifyMsgEven != null)
|
|
|
|
|
NotifyMsgEven(msg);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowError(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ucXJJZTBList_Closed()
|
|
|
|
|
{
|
|
|
|
|
ucXJJZTBList = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main_Closed(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//if (!(sender as FrmBaseDataLoad).IsCancel)
|
|
|
|
|
//{
|
|
|
|
|
// NotifyMsgPackage msg = new NotifyMsgPackage();
|
|
|
|
|
// msg.MsgType = "OpenPrj";
|
|
|
|
|
// SetNotifyMsg(msg);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Enabled
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo pTemp))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(pTemp.DBPath))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|