public override void OnClick() { Plugin.Application.IAppGisUpdateRef phook = _AppHk as Plugin.Application.IAppGisUpdateRef; SysCommon.BottomQueryBar pBar = phook.QueryBar; if (pBar.m_WorkSpace == null) { pBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (pBar.ListDataNodeKeys == null) { pBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID; } if (_AppHk == null) { return; } if (_AppHk.MapControl == null) { return; } IMap pMap = _AppHk.MapControl.Map; if (frmSQL != null) { frmSQL.Close(); frmSQL = null; } frmSQL = new FrmSQLQuery(_AppHk.MapControl, Plugin.ModuleCommon.TmpWorkSpace); frmSQL._QueryBar = pBar; frmSQL.Show((_AppHk as Plugin.Application.IAppFormRef).MainForm); if (WriteLog) { Plugin.LogTable.Writelog("自定义查询"); //ygc 2012-9-14 写日志 } }
public override void OnClick() { if (_AppHk == null) { return; } if (_AppHk.MapControl == null) { return; } IMap pMap = _AppHk.MapControl.Map; if (frmSQL != null) { frmSQL.Close(); } if (this.WriteLog) { Plugin.LogTable.Writelog("河流查询");//xisheng 日志记录; } string strLayerName = ""; string strFieldName = ""; //名称字段 string strFieldCode = ""; //编码字段 IFeatureClass pRiverFeaClass = null; try {//查找河流地物类 ModQuery.GetQueryConfig("河流查询", out pRiverFeaClass, out strLayerName, out strFieldName, out strFieldCode); if (pRiverFeaClass == null) { MessageBox.Show("找不到河流数据,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //检查河流名称字段 if (pRiverFeaClass.FindField(strFieldName) < 0) { MessageBox.Show("找不到河流名称属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); pRiverFeaClass = null; return; } //检查河流编码字段 if (pRiverFeaClass.FindField(strFieldCode) < 0) { MessageBox.Show("找不到河流编码属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); pRiverFeaClass = null; return; } frmQueryRoad fmQD = new frmQueryRoad((_AppHk as Plugin.Application.IAppFormRef).MainForm, _AppHk.MapControl, pRiverFeaClass, strLayerName, strFieldName, strFieldCode, "河 流 名:", "河流编码:", "河流查询"); fmQD.WriteLog = this.WriteLog; fmQD.Show((_AppHk as Plugin.Application.IAppFormRef).MainForm); } catch (Exception ex) { ErrorHandle.ShowFrmErrorHandle("提示", ex.Message); } }
public override void OnClick() { Plugin.Application.IAppGisUpdateRef phook = _AppHk as Plugin.Application.IAppGisUpdateRef; SysCommon.BottomQueryBar pBar = phook.QueryBar; if (pBar.m_WorkSpace == null) { pBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (_AppHk == null) { return; } if (_AppHk.MapControl == null) { return; } IMap pMap = _AppHk.MapControl.Map; if (frmSQL != null) { frmSQL.Close(); frmSQL = null; } if (WriteLog) { Plugin.LogTable.Writelog("打开查询方案"); //ygc 2012-9-14 写日志 } SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = false; vProgress.FakeProgress = true; vProgress.TopMost = true; //vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); FrmOpenSQLCondition newfrm = new FrmOpenSQLCondition(Plugin.ModuleCommon.TmpWorkSpace); newfrm.m_TableName = "SQLSOLUTION"; newfrm.m_showAllLayer = true; if (newfrm.ShowDialog() != DialogResult.OK) { return; } vProgress.ShowProgress(); string strSQL = newfrm.m_Condition; string layerName = newfrm.m_LayerName; if (strSQL == "") { MessageBox.Show("未选择查看的查询方案!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); return; } IFeatureLayer pFeatureLayer = GetLayerByName(layerName, pMap); if (pFeatureLayer == null) { MessageBox.Show("当前地图无该查询方案图层!", "提示"); return; } //构造查询过滤器 IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = strSQL; esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; vProgress.SetProgress("正在查询符合条件的结果"); pBar.m_pMapControl = _AppHk.MapControl; pBar.EmergeQueryData(_AppHk.MapControl.Map, pFeatureLayer, pQueryFilter, pSelectionResult, vProgress); vProgress.Close(); try { DevComponents.DotNetBar.Bar pBar0 = pBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar0 != null) { pBar0.AutoHide = false; //pBar0.SelectedDockTab = 1; int tmpindex = pBar0.Items.IndexOf("dockItemDataCheck"); pBar0.SelectedDockTab = tmpindex; } } catch { } }