public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add Controls_CoverAnalysisBasePolylineDrawTool.OnMouseDown implementation
            try
            {
                if (Button == 1)//表示左键
                {
                    //IGeometry需要引用Geometry
                    IGeometry Polyline = m_mapControl.TrackLine();

                    QurryDistanceForm f = new QurryDistanceForm();
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        if (AnalysisForm.curForm == null || AnalysisForm.curForm.IsDisposed == true)
                        {
                            AnalysisForm form = new AnalysisForm();
                            form.MapControl = m_mapControl;
                            form.Geometry   = Polyline;
                            form.Radius     = f.m_distance;
                            form.TopMost    = true;//顶层显示
                            form.Show();
                            form.RefreshGeometry();
                        }
                        else
                        {
                            AnalysisForm.curForm.MapControl = m_mapControl;
                            AnalysisForm.curForm.Geometry   = Polyline;
                            AnalysisForm.curForm.Radius     = f.m_distance;
                            AnalysisForm.curForm.TopMost    = true;//顶层显示
                            AnalysisForm.curForm.Show();
                            AnalysisForm.curForm.RefreshGeometry();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (m_hookHelper != null)
            {
                try
                {
                    IActiveView pActiveView;
                    pActiveView = m_hookHelper.ActiveView;

                    m_pGeometry = m_pMapControl.TrackLine();
                    esriSelectionResultEnum pselecttype = new esriSelectionResultEnum();
                    switch (Shift)
                    {
                    case 0:
                    {
                        pselecttype = esriSelectionResultEnum.esriSelectionResultNew;
                        switch (mvarSelectMethod)
                        {
                        case "New":
                            pselecttype = esriSelectionResultEnum.esriSelectionResultNew;
                            break;

                        case "Add":
                            pselecttype = esriSelectionResultEnum.esriSelectionResultAnd;
                            break;

                        case "Sub":
                            pselecttype = esriSelectionResultEnum.esriSelectionResultSubtract;
                            break;

                        case "Xor":
                            pselecttype = esriSelectionResultEnum.esriSelectionResultXOR;
                            break;
                        }
                        break;
                    }

                    case 1:
                        pselecttype = esriSelectionResultEnum.esriSelectionResultAdd;
                        break;

                    case 2:
                        pselecttype = esriSelectionResultEnum.esriSelectionResultXOR;
                        break;

                    case 3:
                        pselecttype = esriSelectionResultEnum.esriSelectionResultNew;
                        break;

                    case 4:
                        pselecttype = esriSelectionResultEnum.esriSelectionResultSubtract;
                        break;
                    }
                    if (m_FeatClsCln == null)
                    {
                        bool blntemp = true;
                        m_pQueryResultCln = new Collection();
                        ClsSelectQuery.SelectGeometry(ref blntemp, m_pGeometry, pselecttype, ref m_pQueryResultCln);
                        pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                        if (m_frmQuery == null)
                        {
                            m_frmQuery = new FrmQuery();
                        }
                        if (m_frmQuery.IsDisposed)
                        {
                            m_frmQuery = new FrmQuery();
                        }
                        m_frmQuery.QueryResultCln = m_pQueryResultCln;
                        m_frmQuery.ReLoadQueryResult();
                        m_frmQuery.Visible = false;
                        m_frmQuery.Show((Form)(ClsDeclare.g_Sys.FrmMain));
                    }
                    m_pQueryResultCln = null;
                    if (ClsDeclare.g_pMap.SelectionCount > ClsDeclare.g_Sys.MaxSelectCount && ClsDeclare.g_Sys.MaxSelectCount != 0)
                    {
                        //if (ClsDeclare.g_ErrorHandler.DisplayInformation("你选择的结果大于" + Convert.ToString(ClsDeclare.g_Sys.MaxSelectCount) + "个地物,是否继续选择操作?", true, "确定", "取消") == false)
                        {
                            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                            ClsDeclare.g_pMap.ClearSelection();
                            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("错误", ex.StackTrace, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //ClsDeclare.g_ErrorHandler.HandleError(true,null,0,null,ex.StackTrace);
                    throw;
                }
            }
            else if (m_sceneHookHelper != null)
            {
            }
            else if (m_globeHookHelper != null)
            {
            }
        }