public ParametersGridRegular(int cellCountX, int cellCountY, Coord2d origin, Coord2d topRight)
        {
            CellCountX = cellCountX;
            CellCountY = cellCountY;

            SetExtent(origin, topRight);
        }
 protected void Rotate(Coord2d move, bool updateView)
 {
     foreach (Chart c in _targets)
     {
         c.View.Rotate(move, DEFAULT_UPDATE_VIEW);
     }
     fireControllerEvent(ControllerType.ROTATE, move);
 }
 public override void Register(Chart chart)
 {
     base.Register(chart);
     _prevMouse = Coord2d.ORIGIN;
     chart.Canvas.addMouseListener(this);
     chart.Canvas.addMouseMotionListener(this);
     chart.Canvas.addMouseWheelListener(this);
 }
Beispiel #4
0
        public void Rotate(Coord2d move, bool updateView)
        {
            Coord3d eye = this.ViewPoint;

            eye.x -= move.x;
            eye.y += move.y;
            setViewPoint(eye, updateView);
            //fireControllerEvent(ControllerType.ROTATE, eye);
        }
 public ParametersGridRegular()
 {
     Origin = new Coord2d(0, 0);
     TopRight = new Coord2d(1, 1);
     DeltaX = 1;
     DeltaY = 1;
     CellCountX = 1;
     CellCountY = 1;
 }
Beispiel #6
0
 public void Run()
 {
     _move = new Coord2d(_step, 0);
     while ((_process != null))
     {
         try {
             Rotate(_move);
             System.Threading.Thread.Sleep(_sleep);
         } catch (System.Threading.ThreadInterruptedException ex) {
             _process = null;
         }
     }
 }
        public ParametersGridRegular(int cellCountX, int cellCountY, Coord2d origin, double deltaX, double deltaY)
        {
            CellCountX = cellCountX;
            CellCountY = cellCountY;

            DeltaX = deltaX;
            DeltaY = deltaY;

            Origin = origin;
            TopRight = new Coord2d(origin.Value1 + cellCountX * deltaX, origin.Value2 + cellCountY * deltaY);

            Contract.Requires(TopRight.Value1 > Origin.Value1, "_topRight.Value1 > _origin.Value1");
            Contract.Requires(TopRight.Value2 > Origin.Value2, "_topRight.Value2 > _origin.Value2");
        }
        //Public Sub MouseDragged(sender As Object, e As System.Windows.Forms.MouseEventArgs) Implements Events.Mouse.IMouseMotionListener.MouseDragged
        //  ' Never raised by Winfo
        //End Sub

        public void MouseMoved(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button != System.Windows.Forms.MouseButtons.None)
            {
                Coord2d mouse = new Coord2d(e.X, e.Y);
                // Rotate
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    Coord2d move = mouse.substract(_prevMouse).divide(100);
                    Rotate(move);
                }
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    Coord2d move = mouse.substract(_prevMouse);
                    if (move.y != 0)
                    {
                        Shift((float)(move.y / 250));
                    }
                }
                _prevMouse = mouse;
            }
        }
 protected void Rotate(Coord2d move)
 {
     Rotate(move, DEFAULT_UPDATE_VIEW);
 }
Beispiel #10
0
        public void UpdateCamera(ViewPort viewport, BoundingBox3d boundsScaled, float sceneRadiusScaled)
        {
            Coord3d target = _center.multiply(_scaling);
            Coord3d eye    = default(Coord3d);

            _viewpoint.z = sceneRadiusScaled * 2;
            // maintain a reasonnable distance to the scene for viewing it
            switch (_viewmode)
            {
            case Modes.ViewPositionMode.FREE:
                eye = _viewpoint.cartesian().@add(target);
                break;

            case Modes.ViewPositionMode.TOP:
                eye   = _viewpoint;
                eye.x = -PI_div2;
                // on x
                eye.y = PI_div2;
                // on top
                eye = eye.cartesian().@add(target);
                break;

            case Modes.ViewPositionMode.PROFILE:
                eye   = _viewpoint;
                eye.y = 0;
                eye   = eye.cartesian().@add(target);
                break;

            default:
                throw new Exception("Unsupported viewmode : " + _viewmode);
            }
            Coord3d up = default(Coord3d);

            if (Math.Abs(_viewpoint.y) == PI_div2)
            {
                // handle up vector
                Coord2d direction = new Coord2d(_viewpoint.x, _viewpoint.y).cartesian();
                if (_viewpoint.y > 0)
                {
                    // on top
                    up = new Coord3d(-direction.x, -direction.y, 0);
                }
                else
                {
                    up = new Coord3d(direction.x, direction.y, 0);
                }
                // handle "on-top" events
                if (!_wasOnTopAtLastRendering)
                {
                    _wasOnTopAtLastRendering = true;
                    fireViewOnTopEvent(true);
                }
            }
            else
            {
                // handle up vector
                up = new Coord3d(0, 0, 1);
                // handle "on-top" events
                if (_wasOnTopAtLastRendering)
                {
                    _wasOnTopAtLastRendering = false;
                    fireViewOnTopEvent(false);
                }
            }
            // Apply camera settings
            _cam.Target = target;
            _cam.Up     = up;
            _cam.Eye    = eye;
            // Set rendering volume
            if (_viewmode == Modes.ViewPositionMode.TOP)
            {
                _cam.RenderingSphereRadius = (float)(Math.Max(boundsScaled.xmax - boundsScaled.xmin, boundsScaled.ymax - boundsScaled.ymin) / 2);
                // correctCameraPositionForIncludingTextLabels(viewport) ' quite experimental !
            }
            else
            {
                _cam.RenderingSphereRadius = sceneRadiusScaled;
            }
            // Setup camera (i.e. projection matrix)
            //cam.setViewPort(canvas.getRendererWidth(),
            // canvas.getRendererHeight(), left, right);
            _cam.SetViewPort(viewport);
            _cam.shoot(_cameraMode);
        }
Beispiel #11
0
 public void Rotate(Coord2d move)
 {
     Rotate(move, true);
 }
 public AbstractTextRenderer()
 {
     defScreenOffset = new Coord2d();
     defSceneOffset  = new Coord3d();
 }
        public void SetExtent(Coord2d origin, Coord2d topRight)
        {
            Contract.Requires(topRight.Value1 > origin.Value1, "topRight.Value1 > origin.Value1");
            Contract.Requires(topRight.Value2 > origin.Value2, "topRight.Value2 > origin.Value2");

            Origin = origin;
            TopRight = topRight;

            DeltaX = (TopRight.Value1 - Origin.Value1) / (double)CellCountX;
            DeltaY = (TopRight.Value2 - Origin.Value2) / (double)CellCountY;
        }