Beispiel #1
0
        //右键菜单点击事件
        private void toolManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {
            string strItemName = e.Tool.SharedProps.Caption.ToString();

            switch (strItemName)
            {
            case "键回退(&U)":
                Undo();

                break;

            case "输入左折角(&N)...":
                frmLeftCorner fromFixLeftCorner = new frmLeftCorner();
                fromFixLeftCorner.ShowDialog();

                break;

            case "长度+方位角(&F)..":
                frmLengthAzim.m_pPoint = m_pLastPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawBezierCurveMouseDown(m_pAnchorPoint);
                }

                break;

            case "输入方位角(&O)...":
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                break;

            case "输入长度(&D)...":
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                break;

            case "绝对坐标(&A)...":
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawBezierCurveMouseDown(m_pAnchorPoint);
                }

                break;

            case "相对坐标(&R)...":
                frmRelaXYZ.m_pPoint = m_pLastPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawBezierCurveMouseDown(m_pAnchorPoint);
                }

                break;

            case "平行(&P)...":
                m_pSegment  = null;
                m_bKeyCodeP = true;
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_BeginConstructParallelPoint, ref m_pAnchorPoint);

                break;

            case "直角(&S)...":
                m_bkeyCodeS = true;

                if (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                {
                    m_pLastFeedback = new NewLineFeedbackClass();
                    m_pLastLineFeed = (INewLineFeedback)m_pLastFeedback;
                    m_pLastLineFeed.Start((IPoint)m_pUndoArray.get_Element(0));
                }

                break;

            case "封闭完成(&C)":
                if (m_bInUse)
                {
                    m_pUndoArray.Add((IPoint)m_pUndoArray.get_Element(0));

                    EndDrawBezierCurve();
                }

                break;

            case "完成(&E)":
                EndDrawBezierCurve();

                break;

            case "取消(ESC)":
                Reset();

                break;

            default:

                break;
            }
        }
Beispiel #2
0
        public override void OnKeyDown(int keyCode, int shift)
        {
            // TODO:  添加 DrawBeizerCurve.OnKeyDown 实现
            base.OnKeyDown(keyCode, shift);


            if (keyCode == 85 && m_bInUse)            //按U键,回退
            {
                Undo();

                return;
            }

            if (keyCode == 78 && m_pUndoArray.Count >= 2)           //按N键输入折角方向
            {
                frmLeftCorner fromFixLeftCorner = new frmLeftCorner();
                fromFixLeftCorner.ShowDialog();

                return;
            }

            if (keyCode == 79 && m_bInUse)            //按(O)orientation键输入固定方向
            {
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                return;
            }

            if (keyCode == 68 && m_bInUse)            //按D键输入固定长度
            {
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                return;
            }

            if (keyCode == 70 && m_bInUse)            //按F键输入长度+方位角
            {
                frmLengthAzim.m_pPoint = m_pLastPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawBezierCurveMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 65)             //按A键输入绝对坐标
            {
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawBezierCurveMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 82 && m_bInUse)            //按R键输入相对坐标
            {
                frmRelaXYZ.m_pPoint = m_pLastPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawBezierCurveMouseDown(m_pAnchorPoint);
                }

                return;
            }


            if ((keyCode == 69 || keyCode == 13 || keyCode == 32) && m_bInUse && m_pUndoArray.Count >= 2)          //按E键、ENTER 键、SPACEBAR 键结束绘制
            {
                EndDrawBezierCurve();

                return;
            }

            if (keyCode == 83 && m_pUndoArray.Count >= 2)          //按S键生成直角
            {
                m_bkeyCodeS = true;

                if (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                {
                    m_pLastFeedback = new NewLineFeedbackClass();
                    m_pLastLineFeed = (INewLineFeedback)m_pLastFeedback;
                    m_pLastLineFeed.Start((IPoint)m_pUndoArray.get_Element(0));
                }

                return;
            }

            if (keyCode == 80 && m_bInUse)            //按P键平行尺
            {
                m_pSegment  = null;
                m_bKeyCodeP = true;

                return;
            }

            if (keyCode == 67 && m_pUndoArray.Count >= 3)          //按C键封闭结束绘制
            {
                if (m_bInUse)
                {
                    m_pUndoArray.Add((IPoint)m_pUndoArray.get_Element(0));

                    EndDrawBezierCurve();
                }

                return;
            }

            if (keyCode == 27)             //ESC 键,取消所有操作
            {
                Reset();

                this.Stop();
                WSGRI.DigitalFactory.Commands.ICommand command = DFApplication.Application.GetCommand("WSGRI.DigitalFactory.DF2DControl.cmdPan");
                if (command != null)
                {
                    command.Execute();
                }

                return;
            }
        }
        public override void OnKeyDown(int keyCode, int shift)
        {
            // TODO:  添加 DrawRectRelative2P.OnKeyDown 实现
            base.OnKeyDown(keyCode, shift);

            if (keyCode == 85 && m_mouseDownCount == 1)          //按U键,回退
            {
                Undo();

                return;
            }

            if (keyCode == 70 && m_mouseDownCount == 1)          //按F键,输入长度+方位角
            {
                frmLengthAzim.m_pPoint = m_pLastPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 68 && m_mouseDownCount == 1)          //按D键,输入固定长度
            {
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                return;
            }

            if (keyCode == 79 && m_mouseDownCount == 1)          //按(O)orientation键,输入方向
            {
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                return;
            }

            if (keyCode == 66 && m_mouseDownCount == 2)          //按B键,输入边长
            {
                frmFixSideLength fromFixSideLength = new frmFixSideLength();
                fromFixSideLength.ShowDialog();

                return;
            }

            if (keyCode == 65 && m_mouseDownCount == 1)          //按A键,输入绝对坐标
            {
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 82 && m_mouseDownCount == 1)          //按R键,输入相对坐标
            {
                frmRelaXYZ.m_pPoint = m_pLastPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 80 && m_mouseDownCount == 1)          //按P键,平行尺
            {
                m_pSegment  = null;
                m_bKeyCodeP = true;

                return;
            }

            if ((keyCode == 69 || keyCode == 13 || keyCode == 32) && m_mouseDownCount == 2)           //按E键、ENTER 键、SPACEBAR 键结束绘制
            {
                EndDrawRectRelative2P();

                return;
            }

            if (keyCode == 27)             //ESC 键,取消所有操作
            {
                Reset();

                this.Stop();
                WSGRI.DigitalFactory.Commands.ICommand command = DFApplication.Application.GetCommand("WSGRI.DigitalFactory.DF2DControl.cmdPan");
                if (command != null)
                {
                    command.Execute();
                }

                return;
            }
        }
        //右键菜单点击事件
        private void toolManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {
            string strItemName = e.Tool.SharedProps.Caption.ToString();

            switch (strItemName)
            {
            case "键回退(&U)":
                Undo();

                break;

            case "输入左折角(&N)...":

                break;

            case "长度+方位角(&F)..":
                frmLengthAzim.m_pPoint = m_pLastPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                break;

            case "输入方位角(&O)...":
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                break;

            case "输入长度(&D)...":
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                break;

            case "矩形边长(&B)...":
                frmFixSideLength fromFixSideLength = new frmFixSideLength();
                fromFixSideLength.ShowDialog();

                break;

            case "绝对坐标(&A)...":
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                break;

            case "相对坐标(&R)...":
                frmRelaXYZ.m_pPoint = m_pLastPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                break;

            case "平行(&P)...":
                m_pSegment  = null;
                m_bKeyCodeP = true;
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_BeginConstructParallelPoint, ref m_pAnchorPoint);

                break;

            case "直角(&S)...":

                break;

            case "封闭完成(&C)":

                break;

            case "完成(&E)":
                EndDrawRectRelative2P();

                break;

            case "取消(ESC)":
                Reset();

                break;

            default:

                break;
            }
        }
Beispiel #5
0
        public override void OnKeyDown(int keyCode, int shift)
        {
            // TODO:  添加 DrawPolyline.OnKeyDown 实现
            base.OnKeyDown(keyCode, shift);

            IPoint tempPoint = new PointClass();

            tempPoint.X = m_pLastPoint.X;
            tempPoint.Y = m_pLastPoint.Y;

            if (keyCode == 72)            //按H键,绘制圆弧
            {
                if (m_drawType == 1)
                {
                    m_drawState = "Line_Arc";                  //绘制直线……圆弧
                }
                else if (m_drawType == 2)
                {
                    m_drawState = "Arc_Arc";                  //绘制圆弧……圆弧
                }

                return;
            }

            if (keyCode == 76)            //按L键,绘制直线
            {
                if (m_drawType == 1)
                {
                    m_drawState = "Line_Line";;                  //绘制直线……直线
                }
                else if (m_drawType == 2)
                {
                    m_drawState = "Line_Line";                  //绘制圆弧……直线
                }

                return;
            }

            if (keyCode == 84)            //按T键,绘制圆弧……切线
            {
                m_drawState = "Arc_TLine";

                return;
            }

            if (keyCode == 85)            //按U键,回退
            {
                Undo();

                return;
            }

            if (keyCode == 78 && m_pUndoArray.Count >= 2)          //按N键,输入左折角
            {
                frmLeftCorner fromFixLeftCorner = new frmLeftCorner();
                fromFixLeftCorner.ShowDialog();

                return;
            }

            if (keyCode == 79 && m_bInUse)            //按(O)orientation键,输入方向
            {
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                return;
            }

            if (keyCode == 68 && m_bInUse)            //按D键,输入固定长度
            {
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                return;
            }


            if (keyCode == 70 && m_bInUse)            //按F键,输入长度+方位角
            {
                frmLengthAzim.m_pPoint = tempPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();

                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawPolylineMouseDown(m_pAnchorPoint, m_drawState);
                }

                return;
            }

            if (keyCode == 65)             //按A键,输入绝对坐标
            {
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawPolylineMouseDown(m_pAnchorPoint, m_drawState);
                }

                return;
            }

            if (keyCode == 82 && m_bInUse)            //按R键,输入相对坐标
            {
                frmRelaXYZ.m_pPoint = tempPoint;      // m_pToPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();

                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawPolylineMouseDown(m_pAnchorPoint, m_drawState);
                }

                return;
            }

            if (keyCode == 80 && m_bInUse)            //按P键,生成平行线
            {
                m_pSegment  = null;
                m_bKeyCodeP = true;

                return;
            }

            if (keyCode == 83 && m_pUndoArray.Count >= 2)          //按S键,生成直角
            {
                m_bkeyCodeS = true;
                if (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                {
                    m_pLastFeedback = new NewLineFeedbackClass();
                    m_pLastLineFeed = (INewLineFeedback)m_pLastFeedback;
                    IPoint pStartPoint = ((PointStruct)m_pUndoArray.get_Element(0)).Point;
                    m_pLastLineFeed.Start(pStartPoint);
                }

                return;
            }

            if (keyCode == 67 && m_pUndoArray.Count >= 4)          //按C键,封闭结束绘制
            {
                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;

                AddPointUndoArray(pEndPoint, 1, ref m_pUndoArray);
                AddPointUndoArray(pStartPoint, 1, ref m_pUndoArray);

                EndDrawPolyline();

                return;
            }


            if ((keyCode == 69 || keyCode == 13 || keyCode == 32) && m_bInUse)            //按E键、ENTER 键、SPACEBAR 键结束绘制
            {
                EndDrawPolyline();

                return;
            }

            if (keyCode == 27)             //ESC 键,取消所有操作
            {
                Reset();

                this.Stop();
                WSGRI.DigitalFactory.Commands.ICommand command = DFApplication.Application.GetCommand("WSGRI.DigitalFactory.DF2DControl.cmdPan");
                if (command != null)
                {
                    command.Execute();
                }

                return;
            }
        }