Ejemplo n.º 1
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 = m_hookHelper.ActiveView;
                IPoint      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 SelectionEnvironment();

                double Length;
                Length = pConvert.ConvertPixelDistanceToMapDistance(pActiveView, pSelectEnv.SearchTolerance);
                ITopologicalOperator pTopoOpera;
                IGeometry            pBuffer;
                pTopoOpera = (ITopologicalOperator)pGeometry;
                pBuffer    = pTopoOpera.Buffer(Length);

                pGeometry = (IGeometry)m_pMapControl.TrackCircle();
                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)
            {
            }
        }