Exemple #1
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            IPoint pt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            pt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pt);
            if (m_newBezierCurveFeedback != null)
            {
                m_newBezierCurveFeedback.MoveTo(pt);
                DataEditCommon.g_pAxMapControl.Focus();
            }
        }
        //回退操作
        private void  Undo()
        {
            if (m_pUndoArray.Count == 0)
            {
                return;
            }

            if (m_pUndoArray.Count > 1)
            {
                m_pEnvelope = CommonFunction.GetMinEnvelopeOfTheArray(m_pUndoArray);
            }
            else if (m_pUndoArray.Count == 1)
            {
                IPoint pTempPoint = new PointClass();
                pTempPoint.X = (m_pUndoArray.get_Element(0) as Point).X;
                pTempPoint.Y = (m_pUndoArray.get_Element(0) as Point).Y;

                m_pEnvelope.Width  = Math.Abs(m_pPoint.X - pTempPoint.X);
                m_pEnvelope.Height = Math.Abs(m_pPoint.Y - pTempPoint.Y);

                pTempPoint.X = (pTempPoint.X + m_pPoint.X) / 2;
                pTempPoint.Y = (pTempPoint.Y + m_pPoint.Y) / 2;

                m_pEnvelope.CenterAt(pTempPoint);
            }
            if (m_pEnvelope != null && !m_pEnvelope.IsEmpty)
            {
                m_pEnvelope.Expand(10, 10, false);
            }

            IPoint pPoint = new PointClass();

            pPoint = (IPoint)m_pUndoArray.get_Element(m_pUndoArray.Count - 1);
            IEnvelope enve = new EnvelopeClass();

            enve = CommonFunction.NewRect(pPoint, m_dblTolerance);

            IEnumElement pEnumElement = m_MapControl.ActiveView.GraphicsContainer.LocateElementsByEnvelope(enve);

            if (pEnumElement != null)
            {
                pEnumElement.Reset();
                IElement pElement = pEnumElement.Next();

                while (pElement != null)
                {
                    m_MapControl.ActiveView.GraphicsContainer.DeleteElement(pElement);
                    pElement = pEnumElement.Next();
                }
            }
            m_MapControl.ActiveView.Refresh();

            m_pUndoArray.Remove(m_pUndoArray.Count - 1);          //删除数组中最后一个点

            //屏幕刷新
            //m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground,null,null);

            m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, m_pEnvelope);            //视图刷新

            m_pActiveView.ScreenDisplay.UpdateWindow();

            //开始作复位工作
            if (m_pUndoArray.Count != 0)
            {
                UpdataBezierCurveFeed(m_MapControl, ref m_pUndoArray);
                m_pBezierCurveFeed.MoveTo(m_pAnchorPoint);
            }
            else
            {
                Reset();                 //复位
            }
        }