Example #1
0
        private void HandleMouseWheel(MouseEventArgs e)
        {
            if (mDrawContext is DrawContextGLOrtho)
            {
                mController.Mouse.MouseWheel(mDrawContext, e.X, e.Y, e.Delta);
                Redraw();
            }
            else
            {
                DrawContextGLPers dc = mDrawContext as DrawContextGLPers;

                if (CadKeyboard.IsCtrlKeyDown())
                {
                    if (e.Delta > 0)
                    {
                        dc.MoveForwardEyePoint(3);
                    }
                    else if (e.Delta < 0)
                    {
                        dc.MoveForwardEyePoint(-3);
                    }

                    Redraw();
                }
            }
        }
Example #2
0
        public override DrawContext Clone()
        {
            DrawContextGLPers dc = new DrawContextGLPers();

            dc.CopyProjectionMetrics(this);
            dc.WorldScale = WorldScale;

            dc.CopyCamera(this);
            dc.SetViewSize(ViewWidth, ViewHeight);

            dc.SetViewOrg(ViewOrg);

            return(dc);
        }
Example #3
0
        private void HandleMouseMove(MouseEventArgs e)
        {
            if (mDrawContext is DrawContextGLOrtho)
            {
                mController.Mouse.MouseMove(mDrawContext, e.X, e.Y);
                Redraw();
            }
            else
            {
                DrawContextGLPers dc = mDrawContext as DrawContextGLPers;

                if (DownButton == MouseButtons.Middle)
                {
                    Vector3d t = new Vector3d(e.X, e.Y, 0);

                    Vector2 prev = default;

                    prev.X = (float)PrevMousePos.X;
                    prev.Y = (float)PrevMousePos.Y;

                    Vector2 current = default;

                    current.X = (float)t.X;
                    current.Y = (float)t.Y;

                    if (CadKeyboard.IsCtrlKeyDown())
                    {
                        //MoveCamera(dc, prev, current);
                        PanCamera(dc, prev, current);
                    }
                    else
                    {
                        dc.RotateEyePoint(prev, current);
                    }

                    Redraw();

                    PrevMousePos = t;
                }
                else
                {
                    mController.Mouse.MouseMove(mDrawContext, e.X, e.Y);
                    Redraw();
                }
            }
        }
Example #4
0
        private void OnLoad(object sender, EventArgs e)
        {
            GL.ClearColor(Color4.Black);
            GL.Enable(EnableCap.DepthTest);

            mDrawContextOrtho = new DrawContextGLOrtho(this);
            mDrawContextOrtho.SetupTools(SettingsHolder.Settings.DrawMode);

            mDrawContextPers = new DrawContextGLPers(this);
            mDrawContextPers.SetupTools(SettingsHolder.Settings.DrawMode);

            mDrawContext = mDrawContextOrtho;

            mDrawContextOrtho.PushToViewAction = PushToFront;
            mDrawContextPers.PushToViewAction  = PushToFront;

            SwapBuffers();
        }
Example #5
0
        public override DrawContext CreatePrinterContext(CadSize2D pageSize, CadSize2D deviceSize)
        {
            DrawContextGL dc = new DrawContextGLPers();

            dc.CopyProjectionMetrics(this);
            dc.WorldScale = WorldScale;

            dc.CopyCamera(this);
            dc.SetViewSize(deviceSize.Width, deviceSize.Height);

            Vector3d org = default;

            org.X = deviceSize.Width / 2.0;
            org.Y = deviceSize.Height / 2.0;

            dc.SetViewOrg(org);

            dc.UnitPerMilli = deviceSize.Width / pageSize.Width;

            return(dc);
        }