Package evo.search.view.render
Class Transformation
- java.lang.Object
-
- evo.search.view.render.Transformation
-
public class Transformation extends Object
The canvas rendering transformation. Holds a scale and the offset.
-
-
Constructor Summary
Constructors Constructor Description Transformation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AffineTransform
getAffineTransformation()
ComponentListener
getComponentListener(Component c)
Get the resize component listener.MouseListener
getMouseListener()
Get the mouse press listener.MouseMotionListener
getMouseMotionListener(Canvas canvas)
Get the mouse dragging listener.MouseWheelListener
getMouseWheelListener(Component c)
Get the mouse zoom listener.Point2D
getOffset()
The transformation offset vector.double
getScale()
The transformation scaling factor.Point2D
revert(Point2D point)
Revert a transformedPoint2D
on the canvas.void
setOffset(Point2D offset)
The transformation offset vector.void
setScale(double scale)
The transformation scaling factor.Line2D
transform(Line2D line)
Transform aLine2D
.Point2D
transform(Point2D point)
Transform aPoint2D
.
-
-
-
Method Detail
-
revert
public Point2D revert(Point2D point)
Revert a transformedPoint2D
on the canvas.- Parameters:
point
- transformed point on the canvas- Returns:
- reverted point of inverted transformation
-
transform
public Point2D transform(Point2D point)
Transform aPoint2D
.- Parameters:
point
- point to transform- Returns:
- transformed point
-
transform
public Line2D transform(Line2D line)
Transform aLine2D
.- Parameters:
line
- line to transform- Returns:
- transformed line
-
getAffineTransformation
public AffineTransform getAffineTransformation()
- Returns:
- Affine transformation from the internal
Transformation
.
-
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.
-
-