//按钮的click事件 public override void OnClick() { string pSysName = ""; //数据集成管理子系统Name string pSysCaption = ""; //数据集成管理子系统Caption pSysName = "GeoDBIntegration.ControlDBIntegrationTool"; //根据Name获得子系统的caption XmlDocument sysXml = new XmlDocument(); sysXml.Load(ModFrameData.m_SysXmlPath); XmlNode sysNode = sysXml.SelectSingleNode("//Main//System[@Name='" + pSysName + "']"); if (sysNode == null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "不存在Name为" + pSysName + "的系统"); return; } pSysCaption = (sysNode as XmlElement).GetAttribute("Caption").Trim(); //caption //进入数据中心管理子系统界面 ModDBOperate.InitialForm(pSysName, pSysCaption); //功能日志 enter feature Db Log if (ModFrameData.v_SysLog != null) { List <string> Pra = new List <string>(); ModFrameData.v_SysLog.Write("进入数据库集成管理子系统", Pra, DateTime.Now); } }
public override void OnClick() { if (m_Hook == null) { return; } if (m_Hook.MapControl == null) { return; } if (m_Hook.MapControl.Map == null) { return; } IMap pMap = m_Hook.MapControl.Map; if (pMap.LayerCount == 0) { return; } string strZLDJ = ""; IFeatureClass pZLDJFeaClass = null; string ZLDJLayerName = ""; SysCommon.ModSysSetting.CopyConfigXml(Plugin.ModuleCommon.TmpWorkSpace, "统计配置", ModQuery.m_StatisticsPath); //added by chulili 20111110先从业务库拷贝配置文件 try { //获取地名地物类 GeoDataCenterFunLib.ModQuery.GetPlaceNameStatisticsConfig(out pZLDJFeaClass, out ZLDJLayerName, out strZLDJ, "林业用地分布"); if (pZLDJFeaClass == null) { MessageBox.Show("林地图斑数据,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (pZLDJFeaClass != null) { if (pZLDJFeaClass.FindField(strZLDJ) < 0) { MessageBox.Show("找不到林地图斑数据地类属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); pZLDJFeaClass = null; return; } } frmSetStatistic pfrmSetStatistic = new frmSetStatistic(); if (pfrmSetStatistic.ShowDialog() == DialogResult.OK) { ExportToExcel pExportToExcel = new ExportToExcel(); IFeatureCursor pFeatureCursor = null;; if (pfrmSetStatistic.bIsCheck) { if (pMap.SelectionCount == 0) { MessageBox.Show("请在当前地图上选择林地图斑数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //IFeatureLayer pFeatureLayer = GetLayerByName(ZLDJLayerName, pMap) as IFeatureLayer; //if (pFeatureLayer == null) //{ // MessageBox.Show("找不到林地图斑数据,请先加载该数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; //} IGeometry pGeo = ModDBOperate.GetSelectFeatureGeom(pMap); ISpatialFilter pSpatialFilter = new SpatialFilterClass(); pSpatialFilter.GeometryField = "SHAPE"; pSpatialFilter.Geometry = pGeo; pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; pFeatureCursor = pZLDJFeaClass.Search(pSpatialFilter, false); //IFeatureSelection pFeatureSelection = pFeatureLayer as IFeatureSelection; //ISelectionSet pFeatSet = pFeatureSelection.SelectionSet; //pFeatSet.Search(null, true, out pCursor); //pFeatureCursor = pCursor as IFeatureCursor; } else { pFeatureCursor = pZLDJFeaClass.Search(null, false); } pExportToExcel.ExportLDFB(pZLDJFeaClass, pFeatureCursor, "林业用地分布", "地类名称", strZLDJ); System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor); } if (this.WriteLog) { Plugin.LogTable.Writelog("专题图统计-林业用地统计");//ygc 2012-9-14 写日志 } } catch (Exception ex) { ErrorHandle.ShowFrmErrorHandle("提示", ex.Message); } }