Class Transformation


  • public class Transformation
    extends Object
    The canvas rendering transformation. Holds a scale and the offset.
    • Constructor Detail

      • Transformation

        public Transformation()
    • Method Detail

      • revert

        public Point2D revert​(Point2D point)
        Revert a transformed Point2D on the canvas.
        Parameters:
        point - transformed point on the canvas
        Returns:
        reverted point of inverted transformation
      • transform

        public Point2D transform​(Point2D point)
        Transform a Point2D.
        Parameters:
        point - point to transform
        Returns:
        transformed point
      • transform

        public Line2D transform​(Line2D line)
        Transform a Line2D.
        Parameters:
        line - line to transform
        Returns:
        transformed line
      • getMouseListener

        public MouseListener getMouseListener()
        Get the mouse press listener.
        Returns:
        the mouse listener for the mouse press event
      • getMouseMotionListener

        public MouseMotionListener getMouseMotionListener​(Canvas canvas)
        Get the mouse dragging listener.
        Parameters:
        canvas - canvas being repainted
        Returns:
        the mouse listener for the drag event
      • getMouseWheelListener

        public MouseWheelListener getMouseWheelListener​(Component c)
        Get the mouse zoom listener.
        Parameters:
        c - component being repainted
        Returns:
        the mouse listener for the scroll event
      • getComponentListener

        public ComponentListener getComponentListener​(Component c)
        Get the resize component listener.
        Parameters:
        c - component being repainted
        Returns:
        the component listener for the resize event
      • getOffset

        public Point2D getOffset()
        The transformation offset vector.
      • setOffset

        public void setOffset​(Point2D offset)
        The transformation offset vector.
      • getScale

        public double getScale()
        The transformation scaling factor.
      • setScale

        public void setScale​(double scale)
        The transformation scaling factor.