Exemple #1
0
        private void btnOpenConditon_Click(object sender, EventArgs e)
        {
            if (LayerID == "" || LayerID == null)
            {
                MessageBox.Show("请选择查询的图层数据!", "提示");
                return;
            }
            if (m_Workspace == null)
            {
                return;
            }
            FrmOpenSQLCondition frmOpen = new FrmOpenSQLCondition(m_Workspace);

            frmOpen.m_TableName = "SQLSOLUTION";
            frmOpen.m_LayerId   = LayerID;
            if (frmOpen.ShowDialog() == DialogResult.OK)
            {
                richTextExpression.Text = "";
                richTextExpression.Text = frmOpen.m_Condition;
            }
        }
        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
            { }
        }