Exemple #1
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            if (m_pFeature == null)
            {
                return;
            }
            IPoint pPnt = m_MapControl.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            //鼠标在选择集的范围外为选择功能
            if (ModPublic.MouseOnSelection(pPnt, m_hookHelper.ActiveView) == false && m_bMouseDown == false)
            {//若光标不在选择的对象上,为选择功能
                ControlsEditSelFeature clsSelectFeature = new ControlsEditSelFeature();
                clsSelectFeature.OnCreate(m_hookHelper.Hook);
                clsSelectFeature.OnClick();
                m_MapControl.CurrentTool = clsSelectFeature as ITool;
                return;
            }
            //范围内为移动要素功能且不在要素节点上
            else if (ModPublic.MouseOnFeatureVertex(pPnt, m_pFeature, m_hookHelper.ActiveView) == false && m_bMouseDown == false)
            {
                ControlsMoveSelFeature pControlsMoveSelFeature = new ControlsMoveSelFeature();
                pControlsMoveSelFeature.OnCreate(m_hookHelper.Hook);
                pControlsMoveSelFeature.OnClick();
                m_MapControl.CurrentTool = pControlsMoveSelFeature as ITool;
                return;
            }


            if (m_pVertexFeed == null)
            {
                return;
            }
            //捕捉节点
            if (MoData.v_bSnapStart)
            {
                m_pSnapPoint = ModPublic.SnapPoint(pPnt, m_hookHelper.ActiveView);
            }

            IHitTest pHitTest           = m_pFeature.Shape as IHitTest;
            IPoint   pHitPoint          = new PointClass();
            double   dblHitDistance     = 0;
            int      lPart              = 0;
            int      intHitSegmentIndex = 0;
            bool     bRight             = false;
            bool     bHitTest           = pHitTest.HitTest(pPnt, m_dblTolearance, esriGeometryHitPartType.esriGeometryPartVertex, pHitPoint, ref dblHitDistance, ref lPart, ref intHitSegmentIndex, ref bRight);

            if (m_pSnapPoint != null && MoData.v_bSnapStart)
            {
                m_pVertexFeed.MoveTo(m_pSnapPoint);
            }
            else
            {
                m_pVertexFeed.MoveTo(pPnt);
            }
        }
Exemple #2
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            //鼠标在选择集的范围外为选择功能
            IPoint pPnt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            if (ModPublic.MouseOnSelection(pPnt, m_hookHelper.ActiveView) == false && m_bMouseDown == false)
            {//若光标不在选择的对象上,为选择功能
                ControlsEditSelFeature clsSelectFeature = new ControlsEditSelFeature();
                clsSelectFeature.OnCreate(m_hookHelper.Hook);
                clsSelectFeature.OnClick();
                m_MapControl.CurrentTool = clsSelectFeature as ITool;
                return;
            }

            //鼠标在选择要素节点上时为节点移动功能
            if (m_MapControl.Map.SelectionCount == 1)
            {
                IEnumFeature pEnumFeature = m_MapControl.Map.FeatureSelection as IEnumFeature;
                pEnumFeature.Reset();
                IFeature pFeature = pEnumFeature.Next();
                if (ModPublic.MouseOnFeatureVertex(pPnt, pFeature, m_hookHelper.ActiveView) == true && MoData.v_bVertexSelectionTracker == true)
                {
                    ControlsMoveVertex pControlsMoveVertex = new ControlsMoveVertex();
                    pControlsMoveVertex.OnCreate(m_hookHelper.Hook);
                    pControlsMoveVertex.OnClick();
                    m_MapControl.CurrentTool = pControlsMoveVertex as ITool;
                    return;
                }
            }

            //捕捉节点
            if (MoData.v_bSnapStart)
            {
                ModPublic.SnapPoint(pPnt, m_hookHelper.ActiveView);
            }

            if (Button != 1)
            {
                return;
            }
            //进行移动
            if (m_MapControl.Map.SelectionCount > 0 && m_pMoveGeometryFeedback != null && m_pNewLineFeedback != null)
            {
                m_pMoveGeometryFeedback.MoveTo(pPnt);
                m_pNewLineFeedback.MoveTo(pPnt);
            }
        }