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

            pMovePt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pMovePt);
            if (m_pFeedback != null)
            {
                m_pFeedback.MoveTo(pMovePt);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 鼠标移动事件
        /// </summary>
        /// <param name="mapX"></param>
        /// <param name="mapY"></param>
        public void MouseMove(double mapX, double mapY)
        {
            if (mDisplayFeedback == null)
            {
                return;
            }
            //获取鼠标移动点位,并移动至当前点位
            IPoint pPoint = new PointClass();

            pPoint.PutCoords(mapX, mapY);
            mDisplayFeedback.MoveTo(pPoint);
        }
 private void EditMouseMove(IPoint pPnt)
 {
     if (m_editDispFeed != null)
     {
         m_mousePointer = esriControlsMousePointer.esriPointerSizeWE;
         IZAware pIZAware = null;
         pIZAware        = pPnt as IZAware;
         pIZAware.ZAware = true;
         pPnt.Z          = 0;
         m_editDispFeed.MoveTo(pPnt);
     }
 }
Esempio n. 4
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add CreatShape.OnMouseMove implementation
            if (!m_bInUse || m_Feedback == null)
            {
                return;
            }
            //移动鼠标形成线,面的结点
            IActiveView m_ActiveView = m_hookHelper.ActiveView;

            m_Feedback.MoveTo(m_ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y));
        }
Esempio n. 5
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 CalculateZimuth.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);

            m_MapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair;

            m_pStatusBarService.SetStateMessage("提示:依次点击两点");

            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            m_pAnchorPoint = m_pPoint;
            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, (IGeometry)m_pLastPoint, m_pAnchorPoint);

            if (!m_bInUse)
            {
                return;
            }

            m_pFeedback.MoveTo(m_pAnchorPoint);
        }
Esempio n. 6
0
 public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
 {
     // TODO:  添加 CalculateCorner.OnMouseMove 实现
     base.OnMouseMove(button, shift, x, y, mapX, mapY);
     m_pMapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair;
     m_pPoint       = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);
     m_pAnchorPoint = m_pPoint;
     if (!m_bInUse)
     {
         return;
     }
     m_pFeedback.MoveTo(m_pAnchorPoint);
 }
Esempio n. 7
0
        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add ModifyShape.OnMouseMove implementation

            if (m_Feedback == null)
            {
                return;
            }
            IActiveView pActiveView = m_MapControl.ActiveView;
            IPoint      pPoint      = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            m_Feedback.MoveTo(pPoint);
        }
Esempio n. 8
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            base.OnMouseMove(button, shift, x, y, mapX, mapY);

            m_MapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair;

            m_pStatusBarService.SetStateMessage("步骤:1.选择线/面要素(只能选择目标层要素);2.右键,结束选择;3.连续单击左键,确定分割线;4.右键,实施分割操作。(ESC:取消/DEL:删除)");

            if (!m_bIsSelect)
            {
                return;
            }

            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            if (!m_bBeginDrawLineFeed)            //正在选择要被分割的线要素
            {
                if (m_pFeedbackEnve == null)
                {
                    m_pFeedbackEnve         = new NewEnvelopeFeedbackClass();
                    m_pFeedbackEnve.Display = m_pActiveView.ScreenDisplay;
                    m_pFeedbackEnve.Start(m_pPoint);
                }
                m_pFeedbackEnve.MoveTo(m_pPoint);

                return;
            }
            else            //正在绘制“剪刀”
            {
                //+++++++++++++开始捕捉+++++++++++++++++++++
                CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, null, m_pPoint);

                if (m_pFeedback != null)
                {
                    m_pFeedback.MoveTo(m_pPoint);
                }
            }
        }
Esempio n. 9
0
        private void DrawCircle3PMouseDown(IPoint pPoint, int shift)
        {
            IGeometry pGeom = null;
            IPolyline pPolyline;
            IPolygon  pPolygon;
            IPoint    pCenterPoint = new PointClass();

            if (!m_bFirst)           //如果命令没有使用
            {
                     m_pPoint1 = pPoint;
                m_bFirst  = true;
                m_bSecond = false;

                m_pFeedback         = new NewLineFeedbackClass();
                m_pLineFeed         = (INewLineFeedback)m_pFeedback;
                m_pLineFeed.Display = m_pActiveView.ScreenDisplay;
                m_pLineFeed.Start(pPoint);

                CommonFunction.DrawPointSMSSquareSymbol(m_MapControl, m_pPoint1);
            }
            else if (!m_bSecond)            //如果命令正在使用
            {
                m_pPoint2 = pPoint;
                m_bSecond = true;
                m_bThree  = false;
                CommonFunction.DrawPointSMSSquareSymbol(m_MapControl, m_pPoint2);

                m_pLineFeed.Stop();
                m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, m_pEnvelope);

                m_pFeedback = new NewCircleFeedbackClass();
            }
            else if (!m_bThree)
            {
                m_pPoint3 = m_pPoint;
                m_bFirst  = false;
                m_bThree  = true;

                m_pCenterPoint = CommonFunction.GetCenter_P123(m_pPoint1, m_pPoint2, pPoint);

                m_pCircleFeed         = (NewCircleFeedbackClass)m_pFeedback;
                m_pCircleFeed.Display = m_pActiveView.ScreenDisplay;

                m_pCircleFeed.Stop();
                m_pCircleFeed.Start(m_pCenterPoint);
                m_pFeedback.MoveTo(pPoint);

                ICircularArc pCircularArc = new CircularArcClass();
                pCircularArc = m_pCircleFeed.Stop();

                pCenterPoint = pCircularArc.CenterPoint;

                if (shift == 1)                //若果按住shift健弹出对话框,让用户修改圆周上的坐标值
                {
                    frmCircle3P formCircle3P = new frmCircle3P();
                    formCircle3P.ShowDialog();

                    if (m_bModify) //修改坐标值了
                    {
                                   //计算圆心坐标
                            pCenterPoint = CommonFunction.GetCenter_P123(m_pPoint1, m_pPoint2, m_pPoint3);
                        m_bModify = false;
                    }
                }

                switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType)
                {
                case  esriGeometryType.esriGeometryPolyline:
                    pPolyline = CommonFunction.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise);
                    pGeom     = pPolyline;
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    pPolyline = CommonFunction.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise);
                    pPolygon  = CommonFunction.PolylineToPolygon(pPolyline);
                    pGeom     = pPolygon;
                    break;

                default:
                    break;
                }                //end switch

                m_pEnvelope = pGeom.Envelope;
                if (m_pEnvelope != null && !m_pEnvelope.IsEmpty)
                {
                    m_pEnvelope.Expand(10, 10, false);
                }
                ;
                CommonFunction.CreateFeature(m_App.Workbench, pGeom, m_FocusMap, m_CurrentLayer);

                Reset();
            }            // end if(!m_bThree)

            m_pLastPoint = pPoint;

            m_pSegment = null;
        }
Esempio n. 10
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawArc3P.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);


            m_pPoint       = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);
            m_pAnchorPoint = m_pPoint;

            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, null, m_pAnchorPoint);

            if (m_pLastPoint != null)
            {
                //########################平行尺########################
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_pPoint, ref m_pAnchorPoint);

                //&&&&&&&&&&&&&&&&&&&&&&&& 正 交 &&&&&&&&&&&&&&&&&&&&&&&
                CommonFunction.PositiveCross(m_pLastPoint, ref m_pAnchorPoint, m_App.CurrentConfig.cfgPositiveCross.IsPositiveCross);
            }

            if (pLineArray.Count >= 1)
            {
                if (m_pFeedback != null)
                {
                    m_pFeedback.Display = m_pActiveView.ScreenDisplay;
                }
                m_pFeedback.MoveTo(m_pAnchorPoint);
            }

            if (m_bInUse)
            {
                pLineArray.Add(m_pAnchorPoint);
                if (pLineArray.Count >= 3)
                {
                    IPoint pPoint1 = (IPoint)pLineArray.get_Element(0);
                    IPoint pPoint2 = (IPoint)pLineArray.get_Element(1);
                    IPoint pPoint3 = (IPoint)pLineArray.get_Element(pLineArray.Count - 1);

                    //计算圆心坐标 和 半径
                    double R;
                    m_pCenterPoint = CommonFunction.GetCenter_P123(pPoint1, pPoint2, pPoint3);
                    R = CommonFunction.GetDistance_P12(pPoint1, m_pCenterPoint);

                    //计算m_pCenterPoint到起点p1的方位角和到端点的方位角
                    double Ap01;
                    double Ap03;
                    double Ap12;
                    double Ap13;
                    Ap01 = CommonFunction.GetAzimuth_P12(m_pCenterPoint, pPoint1);
                    Ap03 = CommonFunction.GetAzimuth_P12(m_pCenterPoint, pPoint3);
                    Ap12 = CommonFunction.GetAzimuth_P12(pPoint1, pPoint2);
                    Ap13 = CommonFunction.GetAzimuth_P12(pPoint1, pPoint3);

                    //计算圆心角
                    double dA;
                    dA = Ap13 - Ap12;
                    if (dA < 0)
                    {
                        dA = dA + Math.PI * 2;
                    }
                    if (dA >= 0 && dA < Math.PI)
                    {
                        m_Ca = Ap03 - Ap01;
                    }
                    else if (dA >= Math.PI && dA < Math.PI * 2)
                    {
                        m_Ca = Ap01 - Ap03;
                    }

                    if (m_Ca < 0)
                    {
                        m_Ca = m_Ca + 2 * Math.PI;
                    }

                    m_pLineFeed.Stop();
                    m_pLineFeed.Start(pPoint1);
                    IPoint pm = new PointClass();

                    if (dA >= 0 && dA < Math.PI)
                    {
                        for (int i = 0; i <= m_Ca / CommonFunction.DegToRad(5) - 1; i++)
                        {
                            pm.X = m_pCenterPoint.X + R * Math.Cos(Ap01 + CommonFunction.DegToRad(5 * (i + 1)));
                            pm.Y = m_pCenterPoint.Y + R * Math.Sin(Ap01 + CommonFunction.DegToRad(5 * (i + 1)));
                            m_pLineFeed.AddPoint(pm);
                        }
                    }
                    else if (dA >= Math.PI && dA < Math.PI * 2)
                    {
                        for (int i = 0; i <= m_Ca / CommonFunction.DegToRad(5) - 1; i++)
                        {
                            pm.X = m_pCenterPoint.X + R * Math.Cos(Ap01 - CommonFunction.DegToRad(5 * (i + 1)));
                            pm.Y = m_pCenterPoint.Y + R * Math.Sin(Ap01 - CommonFunction.DegToRad(5 * (i + 1)));
                            m_pLineFeed.AddPoint(pm);
                        }
                    }
                    m_pLineFeed.AddPoint(pPoint3);
                }
            }
        }
Esempio n. 11
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawBeizerCurve.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);


            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            if (m_bkeyCodeS == true)            //按S键生成直角
            {
                m_pPoint = CommonFunction.SquareEnd((IPoint)m_pUndoArray.get_Element(0), (IPoint)m_pUndoArray.get_Element(m_pUndoArray.Count - 1), m_pPoint);
            }

            double dx, dy;
            double tempA;

            if (m_bFixDirection && m_bInputWindowCancel == false)             //此处固定m_pAnchorPoint使其在一个固定方向上
            {
                m_pPoint = CommonFunction.GetTwoPoint_FormPointMousePointFixDirection(m_pLastPoint, m_pPoint, m_dblFixDirection);
            }
            else if (m_bFixLength && m_bInputWindowCancel == false)           //以给定一个长度值
            {
                m_dblFixDirection = CommonFunction.GetAzimuth_P12(m_pLastPoint, m_pPoint);

                tempA = CommonFunction.azimuth(m_pLastPoint, m_pPoint);
                dx    = m_dblFixLength * Math.Cos(tempA * Math.PI / 180);
                dy    = m_dblFixLength * Math.Sin(tempA * Math.PI / 180);

                //计算更正后的锚点坐标值
                dx = m_pLastPoint.X + dx;
                dy = m_pLastPoint.Y + dy;

                m_pPoint.PutCoords(dx, dy);
            }
            else if (m_bFixLeftCorner && m_pUndoArray.Count > 1 && m_bInputWindowCancel == false)         //给定左折角
            {
                //计算最后一段的方位角
                double TempTA = CommonFunction.GetAzimuth_P12((IPoint)m_pUndoArray.get_Element(m_pUndoArray.Count - 2), (IPoint)m_pUndoArray.get_Element(m_pUndoArray.Count - 1));
                        //计算将要形成的一段的方位角
                    tempA = (180 + CommonFunction.RadToDeg(TempTA)) - m_dbFixlLeftCorner;

                if (m_dbFixlLeftCorner > 360)
                {
                    m_dbFixlLeftCorner = m_dbFixlLeftCorner - 360;
                }

                if (m_dbFixlLeftCorner != tempA)
                {
                    m_pPoint = CommonFunction.GetOnePoint_FormPointMousePointFixDirection(m_pLastPoint, m_pPoint, tempA);
                }
            }

            m_pAnchorPoint = m_pPoint;

            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, (IGeometry)m_pLastPoint, m_pAnchorPoint);

            if (!m_bInUse)
            {
                return;
            }

            //########################平行尺########################
            CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_pPoint, ref m_pAnchorPoint);

            //&&&&&&&&&&&&&&&&&&&&&&&& 正 交 &&&&&&&&&&&&&&&&&&&&&&&
            CommonFunction.PositiveCross(m_pLastPoint, ref m_pAnchorPoint, m_App.CurrentConfig.cfgPositiveCross.IsPositiveCross);

            m_pFeedback.MoveTo(m_pAnchorPoint);

            if ((m_pUndoArray.Count > 1) && ((((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) || m_bkeyCodeS == true))
            {
                if (m_pLastFeedback != null)
                {
                    m_pLastFeedback.Display = m_pActiveView.ScreenDisplay;
                }
                m_pLastFeedback.MoveTo(m_pAnchorPoint);
            }
        }
Esempio n. 12
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawRectRelative2P.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);


            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            m_pAnchorPoint = m_pPoint;
            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, (IGeometry)m_pLastPoint, m_pAnchorPoint);

            if (m_bInUse == true)
            {
                //########################平行尺########################
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_pPoint, ref m_pAnchorPoint);

                //&&&&&&&&&&&&&&&&&&&&&&&& 正 交 &&&&&&&&&&&&&&&&&&&&&&&
                CommonFunction.PositiveCross(m_pLastPoint, ref m_pAnchorPoint, m_App.CurrentConfig.cfgPositiveCross.IsPositiveCross);

                if (m_mouseDownCount == 1)//计数器小于2时
                {
                    double dx, dy;
                    double tempA;

                    if (m_bFixDirection && m_bInputWindowCancel == false)//固定m_pAnchorPoint使其在一个固定方向上
                    {
                        m_pPoint       = CommonFunction.GetTwoPoint_FormPointMousePointFixDirection(m_pLastPoint, m_pPoint, m_dblFixDirection);
                        m_pAnchorPoint = m_pPoint;
                    }
                    else if (m_bFixLength && m_bInputWindowCancel == false)//以给定一个长度值
                    {
                        m_dblFixDirection = CommonFunction.GetAzimuth_P12(m_pLastPoint, m_pPoint);

                        tempA = CommonFunction.azimuth(m_pLastPoint, m_pPoint);
                        dx    = m_dblFixLength * Math.Cos((90 - tempA) * Math.PI / 180);
                        dy    = m_dblFixLength * Math.Sin((90 - tempA) * Math.PI / 180);

                        //计算更正后的锚点坐标值
                        dx = m_pLastPoint.X + dx;
                        dy = m_pLastPoint.Y + dy;

                        m_pPoint.PutCoords(dx, dy);

                        m_pAnchorPoint = m_pPoint;
                    }

                    m_pFeedback.MoveTo(m_pAnchorPoint);
                }
                else if (m_mouseDownCount == 2)
                {
                    m_pLineFeed.Stop();

                    double RelativeLength = CommonFunction.GetDistance_P12((IPoint)m_pUndoArray.get_Element(0), (IPoint)m_pUndoArray.get_Element(1));

                    if (m_bFixDirection && m_bInputWindowCancel == false)                     //固定m_pAnchorPoint使其在一个固定方向上
                    {
                        m_pPoint       = CommonFunction.GetTwoPoint_FormPointMousePointFixDirection(m_pLastPoint, m_pPoint, m_dblFixDirection);
                        m_pAnchorPoint = m_pPoint;
                    }
                    else if (!m_bFixSideLength)                    //获取矩形一边长
                    {
                        m_dblSideLength = CommonFunction.GetDistance_P12(m_pAnchorPoint, (IPoint)m_pUndoArray.get_Element(1));
                        if (m_dblSideLength > RelativeLength)
                        {
                            m_dblSideLength = RelativeLength;
                        }
                    }
                    else if (m_bInputWindowCancel == false)                    //按B键,用户输入边长,修正m_dblSideLength值
                    {
                        if (m_dblSideLength > RelativeLength)
                        {
                            m_dblSideLength = RelativeLength;
                        }
                    }

                    //判断鼠标是否位于P1到P2方向的右边
                    bool bRight = false;
                    bRight = CommonFunction.GetRectP0_Right((IPoint)m_pUndoArray.get_Element(0), (IPoint)m_pUndoArray.get_Element(1), m_pAnchorPoint);
                    //获取矩形另两点坐标
                    m_pSavePointArray.RemoveAll();
                    m_pSavePointArray = CommonFunction.GetPointRectangleOfRelative_Length((IPoint)m_pUndoArray.get_Element(0), (IPoint)m_pUndoArray.get_Element(1), m_dblSideLength, bRight);

                    //绘制矩形
                    m_pLineFeed.Start((IPoint)m_pUndoArray.get_Element(0));
                    m_pLineFeed.AddPoint((IPoint)m_pSavePointArray.get_Element(0));
                    m_pLineFeed.AddPoint((IPoint)m_pUndoArray.get_Element(1));
                    m_pLineFeed.AddPoint((IPoint)m_pSavePointArray.get_Element(1));
                    m_pLineFeed.AddPoint((IPoint)m_pUndoArray.get_Element(0));

                    m_pSavePointArray.Insert(0, (IPoint)m_pUndoArray.get_Element(0));
                    m_pSavePointArray.Insert(2, (IPoint)m_pUndoArray.get_Element(1));
                    m_pSavePointArray.Add((IPoint)m_pSavePointArray.get_Element(0));
                }//m_mouseDownCount == 2
            }
        }
Esempio n. 13
0
        //private void EndDrawCircleCentRadWihtShift()
        //{
        //    frmCentRad formCentRad = new frmCentRad();
        //    formCentRad.ShowDialog();

        //    if( m_bFixRadius )
        //    {
        //        IGeometry pGeom = null;
        //        IPolyline pPolyline;
        //        IPolygon  pPolygon;

        //   IPoint pPoint = new PointClass();
        //        pPoint.X = m_pCenterPoint.X + m_dblRadius;
        //        pPoint.Y = m_pCenterPoint.Y;

        //        pPolyline = CommonFunction.ArcToPolyline(pPoint, m_pCenterPoint, pPoint,esriArcOrientation.esriArcClockwise);

        //        switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType)
        //        {
        //            case  esriGeometryType.esriGeometryPolyline:
        //                pGeom = pPolyline;
        //                break;
        //            case esriGeometryType.esriGeometryPolygon:
        //                pPolygon  =  CommonFunction.PolylineToPolygon(pPolyline);
        //                pGeom = pPolygon;                
        //                break;
        //            default:
        //                break;
        //        }//end switch

        //        m_pEnvelope = pGeom.Envelope;
        //        if(m_pEnvelope != null &&!m_pEnvelope.IsEmpty )  m_pEnvelope.Expand(10,10,false);;
        //        CommonFunction.CreateFeature(m_App.Workbench,pGeom, m_FocusMap, m_CurrentLayer);

        //        m_App.Workbench.CommandBarManager.Tools["2dmap.DFEditorTool.Undo"].SharedProps.Enabled = true;

        //    }

        //    Reset();
        //}

        private void DrawCircleCentRadMouseDown(IPoint pPoint, int shift)
        {
            Class.Common.DrawPointSMSSquareSymbol(m_MapControl, pPoint);

            if (!m_bInUse)           //如果命令没有使用
            {
                m_bInUse       = true;
                m_pCenterPoint = pPoint;

                m_pFeedback           = new NewCircleFeedbackClass();
                m_pCircleFeed         = (NewCircleFeedbackClass)m_pFeedback;
                m_pCircleFeed.Display = m_pActiveView.ScreenDisplay;
                m_pCircleFeed.Start(m_pCenterPoint);
            }
            else             //如果命令已经使用使用
            {
                IGeometry    pGeom = null;
                IPolyline    pPolyline;
                IPolygon     pPolygon;
                ICircularArc pCircularArc = new CircularArcClass();

                //if (shift == 1)//若果按住shift健弹出对话框,让用户修改圆周上的坐标值
                //{
                //     EndDrawCircleCentRadWihtShift();
                //}
                //else
                //{
                m_pFeedback.MoveTo(pPoint);
                pCircularArc = m_pCircleFeed.Stop();
                m_dblRadius  = pCircularArc.Radius;

                switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType)
                {
                case  esriGeometryType.esriGeometryPolyline:
                    pPolyline = Class.Common.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise);
                    pGeom     = pPolyline;
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    pPolyline = Class.Common.ArcToPolyline(pCircularArc.FromPoint, pCircularArc.CenterPoint, pCircularArc.FromPoint, esriArcOrientation.esriArcClockwise);
                    pPolygon  = Class.Common.PolylineToPolygon(pPolyline);
                    pGeom     = pPolygon;                
                    break;

                default:
                    break;
                }                        //end switch

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

                Class.Common.CreateFeature(pGeom, m_FocusMap, m_CurrentLayer);
                m_App.Workbench.UpdateMenu();

                Reset();

                //}
            }

            m_pLastPoint = pPoint;
        }
Esempio n. 14
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawPolyline.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);

            m_MapView.CurrentTool = this;

            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); //获取鼠标坐标

            if (m_bkeyCodeS == true)                                                       //按S键生成直角
            {
                IPoint pStartPoint = new PointClass();
                IPoint pEndPoint   = new PointClass();
                pStartPoint = ((PointStruct)m_pUndoArray.get_Element(0)).Point;
                pEndPoint   = ((PointStruct)m_pUndoArray.get_Element(m_pUndoArray.Count - 1)).Point;
                m_pPoint    = CommonFunction.SquareEnd(pStartPoint, pEndPoint, m_pPoint);
            }

            double dx, dy;
            double tempA;
            IPoint p0;                                            //圆心

            if (m_bFixDirection && m_bInputWindowCancel == false) //此处固定m_pAnchorPoint使其在一个固定方向上
            {
                m_pPoint = CommonFunction.GetTwoPoint_FormPointMousePointFixDirection(m_pToPoint, m_pPoint, m_dblFixDirection);
            }
            else if (m_bFixLength && m_bInputWindowCancel == false)           // 给定一个长度值
            {
                m_dblFixDirection = CommonFunction.GetAzimuth_P12(m_pToPoint, m_pPoint);

                tempA = CommonFunction.azimuth(m_pToPoint, m_pPoint);
                dx    = m_dblFixLength * Math.Cos(tempA * Math.PI / 180);
                dy    = m_dblFixLength * Math.Sin(tempA * Math.PI / 180);

                //计算更正后的锚点坐标值
                dx = m_pToPoint.X + dx;
                dy = m_pToPoint.Y + dy;

                m_pPoint.PutCoords(dx, dy);
            }
            else if (m_bFixLeftCorner && m_bInputWindowCancel == false)             //给定左折角
            {
                tempA = (180 + CommonFunction.RadToDeg(TempTA)) - m_dbFixlLeftCorner;

                if (m_dbFixlLeftCorner > 360)
                {
                    m_dbFixlLeftCorner = m_dbFixlLeftCorner - 360;
                }

                if (m_dbFixlLeftCorner != tempA)
                {
                    m_pPoint = CommonFunction.GetOnePoint_FormPointMousePointFixDirection(m_pToPoint, m_pPoint, tempA);
                }
            }

            m_pAnchorPoint = m_pPoint;

            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, (IGeometry)m_pLastPoint, m_pAnchorPoint);

            if (m_bInUse)            //如果命令正在使用
            {
                //########################平行尺########################
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_pPoint, ref m_pAnchorPoint);

                //&&&&&&&&&&&&&&&&&&&&&&&& 正 交 &&&&&&&&&&&&&&&&&&&&&&&
                CommonFunction.PositiveCross(m_pLastPoint, ref m_pAnchorPoint, m_App.CurrentConfig.cfgPositiveCross.IsPositiveCross);

                switch (m_drawState)
                {
                case "Line_Line":                         //绘制直线
                    m_drawType = 1;
                    m_pLineFeedArray.Add(m_pAnchorPoint); //将点保存到变量
                    m_pLineFeed.Stop();
                    m_pLineFeed.Start((IPoint)m_pLineFeedArray.get_Element(0));
                    m_pFeedback.MoveTo(m_pAnchorPoint);
                    break;

                case "Line_Arc":                                                                      //绘制直线-圆弧
                    m_drawType = 2;
                    p0         = CommonFunction.GetCenterL(m_pFromPoint, m_pToPoint, m_pAnchorPoint); //获取圆心坐标
                    DrawArc_FromPCenterPToPTa(m_pToPoint, p0, m_pAnchorPoint, TempTA);                //起点+圆心+端点+通过起点的切线方位角画弧
                    break;

                case "Arc_Arc":                                                                                       //绘制圆弧-圆弧
                    m_drawType = 2;
                    p0         = CommonFunction.GetCenterC(m_pFromPoint, m_pMiddlePoint, m_pToPoint, m_pAnchorPoint); //获取圆心坐标
                    DrawArc_FromPCenterPToPTa(m_pToPoint, p0, m_pAnchorPoint, TempTA);                                //起点+圆心+端点+通过起点的切线方位角画弧
                    break;

                case "Arc_TLine":                                                          //绘制圆弧-切线
                    m_drawType = 1;
                    double d = CommonFunction.GetDistance_P12(m_pToPoint, m_pAnchorPoint); //计算鼠标点到弧端点距离
                    //计算切线方向上距离d的点坐标
                    IPoint tPoint = new PointClass();
                    tPoint.X = m_pToPoint.X + d * Math.Cos(TempTA);
                    tPoint.Y = m_pToPoint.Y + d * Math.Sin(TempTA);
                    m_pLineFeedArray.Add(tPoint);                             //将点保存到变量
                    m_pAnchorPoint = tPoint;
                    m_pLineFeed.Stop();
                    m_pLineFeed.Start((IPoint)m_pLineFeedArray.get_Element(0));
                    m_pFeedback.MoveTo(m_pAnchorPoint);
                    break;

                default:
                    break;
                }        //end switch
            }            //end if (m_bInUse)

            if ((m_pUndoArray.Count > 1) && (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon || m_bkeyCodeS == true))
            {
                if (m_pLastFeedback != null)
                {
                    m_pLastFeedback.Display = m_pActiveView.ScreenDisplay;
                }
                m_pLastFeedback.MoveTo(m_pAnchorPoint);
            }
        }
Esempio n. 15
0
        public override void OnMouseMove(int button, int shift, int x, int y, double mapX, double mapY)
        {
            // TODO:  添加 DrawArcCenRadFATA.OnMouseMove 实现
            base.OnMouseMove(button, shift, x, y, mapX, mapY);


            m_pPoint = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);

            m_pAnchorPoint = m_pPoint;

            //+++++++++++++开始捕捉+++++++++++++++++++++
            bool flag = CommonFunction.Snap(m_MapControl, m_App.CurrentConfig.cfgSnapEnvironmentSet, null, m_pAnchorPoint);

            if (m_pLastPoint != null)
            {
                //########################平行尺########################
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_pPoint, ref m_pAnchorPoint);

                //&&&&&&&&&&&&&&&&&&&&&&&& 正 交 &&&&&&&&&&&&&&&&&&&&&&&
                CommonFunction.PositiveCross(m_pLastPoint, ref m_pAnchorPoint, m_App.CurrentConfig.cfgPositiveCross.IsPositiveCross);
            }

            if (pLineArray.Count >= 1)
            {
                if (m_pFeedback != null)
                {
                    m_pFeedback.Display = m_pActiveView.ScreenDisplay;
                }
                m_pFeedback.MoveTo(m_pAnchorPoint);
            }

            if (m_bInUse)
            {
                pLineArray.Add(m_pAnchorPoint);

                if (pLineArray.Count >= 3)
                {
                    IPoint pPoint1 = (IPoint)pLineArray.get_Element(1);
                    IPoint p0      = (IPoint)pLineArray.get_Element(0);
                    IPoint pPoint3 = (IPoint)pLineArray.get_Element(pLineArray.Count - 1);

                    //计算半径
                    m_R = CommonFunction.GetDistance_P12(pPoint1, p0);

                    //计算p0到起点p1的方位角和到端点的方位角
                    double Ap01;
                    double Ap03;

                    Ap01 = CommonFunction.GetAzimuth_P12(p0, pPoint1);
                    Ap03 = CommonFunction.GetAzimuth_P12(p0, pPoint3);
                    //计算端点坐标
                    pPoint3.X = p0.X + m_R * Math.Cos(Ap03);
                    pPoint3.Y = p0.Y + m_R * Math.Sin(Ap03);

                    //计算圆心角
                    m_Ca = Ap03 - Ap01;

                    if (m_Ca < 0)
                    {
                        m_Ca = m_Ca + 2 * Math.PI;
                    }

                    m_pLineFeed.Stop();
                    m_pLineFeed.Start(pPoint1);
                    IPoint pm = new PointClass();
                    for (int i = 0; i <= m_Ca / CommonFunction.DegToRad(5) - 1; i++)
                    {
                        pm.X = p0.X + m_R * Math.Cos(Ap01 + CommonFunction.DegToRad(5 * (i + 1)));
                        pm.Y = p0.Y + m_R * Math.Sin(Ap01 + CommonFunction.DegToRad(5 * (i + 1)));
                        m_pLineFeed.AddPoint(pm);
                    }

                    m_pLineFeed.AddPoint(pPoint3);
                }
            }
        }