예제 #1
0
        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 写日志
            }
        }
예제 #2
0
        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
            { }
        }