Exemplo n.º 1
0
 private void UcMap_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
 {
     if (e.button == 2)
     {
         UcMap.Pan();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 释放uc中使用的资源
        /// </summary>
        public void UCDispose()
        {
            try
            {
                ////情况dock上的文本
                dockResults.Text = "";
                try
                {
                    this.dockTree.Visibility = DockVisibility.Hidden;
                }
                catch { }
                try
                {
                    this.dockResults.Visibility = DockVisibility.Hidden;
                }
                catch { }

                //try
                //{
                //    this.dockAttribute.Visibility = DockVisibility.Hidden;
                //}
                //catch { }

                //try
                //{
                //    this.dockLegend.Visibility = DockVisibility.Hidden;
                //}
                //catch { }

                this.TocControl.SetBuddyControl(null);
                //删除图上所有的图形要素
                this.UcMap.Map.ClearSelection();
                //删除地图上所有的绘制的要素
                IGraphicsContainer pGraphContainer = UcMap.ActiveView.GraphicsContainer;
                pGraphContainer.DeleteAllElements();

                //清楚所有的图层信息
                UcMap.ClearLayers();
                UcMap.ActiveView.Refresh();

                //清空结果库连接
                if (m_CurrentTask != null)
                {
                    AdoDbHelper.CloseDbConnection(m_CurrentTask.ResultConnection);
                    m_CurrentTask.Release();
                }

                //清空tree的结果
                //ucRulesTree.Dispose();

                //TocControl = null;
                GC.Collect();
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the task.
        /// </summary>
        /// <param name="task">The task.</param>
        public void SetTask(CheckTask task)
        {
            XGifProgress progressbar = new XGifProgress();

            try
            {
                //如果task为null则认为释放资源
                if (task == null)
                {
                    UCDispose();
                    return;
                }

                //如果不为空,做处理
                m_CurrentTask = task;

                //如果打开新建的任务
                progressbar.ShowHint("正在打开当前质检任务.....");
                //初始化规则树

                this.ucRulesTree.CurrentSchemaId = task.SchemaID;
                this.ucRulesTree.CurrentTaskName = task.Name;
                //采用委托,在创建此控件的线程上调用加载tree方法,防止出现“当前对象正在其他地方使用”的错误;
                LoadRules Load = new LoadRules(this.ucRulesTree.LoadRulesTree);
                this.BeginInvoke(Load);

                this.ucResult.CurrentTask = m_CurrentTask;
                if (File.Exists(task.GetMXDFile()))
                {
                    //打开配置的mxd模板图层
                    UcMap.LoadMxFile(task.GetMXDFile());
                    TocControl.SetBuddyControl(UcMap.Object);
                    TocControl.Update();
                    UcMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                    m_MapLayersController = new MapLayersController(UcMap.Map);
                }
                else
                {
                    progressbar.Hide();
                    MessageBoxApi.ShowErrorMessageBox(task.GetMXDFile() + "不存在!无法打开此任务");
                    return;
                }
                //加载结果
                if (task.ResultConnection != null)
                {
                    //加载已经检查完成的任务
                    this.TabCtrl.ShowTabHeader         = DefaultBoolean.True;
                    this.TabCtrl.SelectedTabPage       = this.TabPageCheckResults;
                    this.ucResultsTree.CurrentSchemaId = task.SchemaID;
                    this.ucResultsTree.CurrentTaskName = task.Name;
                    Sundary.ResultDbOper resultOper = new Hy.Check.UI.UC.Sundary.ResultDbOper(task.ResultConnection);
                    this.ucResultsTree.LayersResultsDt   = resultOper.GetLayersResults();
                    this.ucResultsTree.ResultsDt         = resultOper.GetAllResults();
                    this.ucResultsTree.CheckResultsCount = resultOper.GetResultsCount();
                    this.ucResultsTree.LoadResultsTree();
                }
                else
                {
                    TabCtrl.SelectedTabPage    = this.TabPageRules;
                    this.TabCtrl.ShowTabHeader = DefaultBoolean.False;
                    this.ucResultsTree.CurrentTreeList.Nodes.Clear();
                }
                //加载top错误图层到map
                if (task.TopoWorkspace != null)
                {
                    //获取当前任务子库中的图层集名
                    m_pDatasetSon = TopoOperAPI.GetCurrentSonDataSet(task.TopoWorkspace as IFeatureWorkspace);
                    // 获取子库中所有的要素类的名称
                    TopoOperAPI.GetFcTopoNameInSon(UcMap, task.TopoWorkspace as IFeatureWorkspace, m_pDatasetSon);
                }
                this.dockTree.Visibility   = DockVisibility.Visible;
                this.dockTree.Text         = "规则列表";
                this.dockTree.Width        = 260;
                this.dockLegend.Visibility = DockVisibility.Visible;
            }
            catch (Exception ex)
            {
                progressbar.Hide();
                //GT_CONST.LogAPI.CheckLog.AppendErrLogs(ex.Message);
                XtraMessageBox.Show("打开结果库失败!", "提示");
            }
            finally
            {
                progressbar.Hide(); //关闭打开结果库进度服务
            }
        }