public override void OnMouseDown(int Button, int Shift, int X, int Y)
 {
     // TODO:  Add Controls_CoverAnalysisBasePolygonDrawTool.OnMouseDown implementation
     try
     {
         if (Button == 1)//表示左键
         {
             //IGeometry需要引用Geometry
             IGeometry polygon = m_mapControl.TrackPolygon();
             //将值传入到另一个窗体
             if (AnalysisForm.curForm == null || AnalysisForm.curForm.IsDisposed == true)
             {
                 AnalysisForm form = new AnalysisForm();
                 form.MapControl = m_mapControl;
                 form.Geometry   = polygon;
                 form.TopMost    = true;//顶层显示
                 form.Show();
                 form.RefreshGeometry();
             }
             else
             {
                 AnalysisForm.curForm.MapControl = m_mapControl;
                 AnalysisForm.curForm.Geometry   = polygon;
                 AnalysisForm.curForm.TopMost    = true;//顶层显示
                 AnalysisForm.curForm.Show();
                 AnalysisForm.curForm.RefreshGeometry();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add SelectByShapeTool.OnMouseDown implementation
            //²úÉúÍÏÒ·¶à±ßÐÎ
            IGeometry pGeom = m_mapControl.TrackPolygon();

            m_mapControl.Map.SelectByShape(pGeom, null, false);
            m_mapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
        }
Ejemplo n.º 3
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (m_hookHelper != null)
            {
                ClsMapLayer pConvert = new ClsMapLayer();
                IGeometry   pGeometry;
                IActiveView pActiveView;
                pActiveView = m_hookHelper.ActiveView;

                IPoint pPoint;
                pPoint    = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
                pGeometry = (IGeometry)pPoint;
                if (ClsDeclare.g_pMap.SelectionCount != 0)
                {
                    ClsDeclare.g_pMap.ClearSelection();
                }
                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                ISelectionEnvironment pSelectEnv = new SelectionEnvironmentClass();
                double length;
                length = pConvert.ConvertPixelDistanceToMapDistance(pActiveView, pSelectEnv.SearchTolerance);

                ITopologicalOperator pTopoOpera;
                IGeometry            pBuffer;
                pTopoOpera = (ITopologicalOperator)pGeometry;
                pBuffer    = pTopoOpera.Buffer(length);

                pGeometry = m_pMapControl.TrackPolygon();

                Application.DoEvents();
                m_pMapControl.MousePointer = esriControlsMousePointer.esriPointerHourglass;
                if (pGeometry != null)
                {
                    if (pGeometry.Envelope.IsEmpty)
                    {
                        pGeometry = pBuffer.Envelope;
                    }
                }
                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 = false;
                    m_pQueryResultCln = new Collection();
                    ClsSelectQuery.SelectGeometry(ref blntemp, pGeometry, pselecttype, ref m_pQueryResultCln);
                    pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, 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;

                m_pMapControl.MousePointer = esriControlsMousePointer.esriPointerDefault;
            }
            else if (m_sceneHookHelper != null)
            {
            }
            else if (m_globeHookHelper != null)
            {
            }
        }