Package com.treasure.hunt.jts.awt
Class PointTransformation
- java.lang.Object
-
- com.treasure.hunt.jts.awt.PointTransformation
-
- All Implemented Interfaces:
org.locationtech.jts.awt.PointTransformation
public class PointTransformation extends java.lang.Object implements org.locationtech.jts.awt.PointTransformationTransforms a sourceCoordinatefrom a strategy to a AWTPoint2Dconsidering a canvas offsetVector2Dand a viewport scale. These are supplied by a scrolling event listener through zooming and dragging actions. Furthermore, it manages the bounding box representing the visual frame of the canvas inside the mathematical vector space. This boundary is used for certain rendering purposes.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleINITIAL_SCALEstatic doubleMAX_SCALEstatic doubleMIN_SCALE
-
Constructor Summary
Constructors Constructor Description PointTransformation()PointTransformation(javafx.beans.property.DoubleProperty scaleProperty, javafx.beans.property.ObjectProperty<org.locationtech.jts.math.Vector2D> offsetProperty, org.locationtech.jts.math.Vector2D boundarySize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.math.Vector2DgetBoundarySize()org.locationtech.jts.math.Vector2DgetOffset()javafx.beans.property.ObjectProperty<org.locationtech.jts.math.Vector2D>getOffsetProperty()The offset translates the source coordinates additive intransform(Coordinate).doublegetScale()javafx.beans.property.DoublePropertygetScaleProperty()The scale translates the source coordinates multiplicative intransform(Coordinate).org.locationtech.jts.geom.Coordinaterevert(double x, double y)org.locationtech.jts.geom.Coordinaterevert(org.locationtech.jts.geom.Coordinate src)doublerevertX(double x)doublerevertY(double y)voidscaleOffset(double gamma, org.locationtech.jts.math.Vector2D point)Scale the offset relative keeping a point as scaling source.voidscaleRelative(double gamma, org.locationtech.jts.math.Vector2D point)Scales the canvas and keeps a certain point centered.voidsetBoundarySize(org.locationtech.jts.math.Vector2D boundarySize)voidsetOffset(org.locationtech.jts.math.Vector2D offset)voidsetScale(double scale)org.locationtech.jts.geom.Coordinatetransform(org.locationtech.jts.geom.Coordinate src)Transform method betweenCoordinates.voidtransform(org.locationtech.jts.geom.Coordinate src, java.awt.geom.Point2D dest)Main transform method necessary for extendingPointTransformation.doubletransformX(double x)doubletransformY(double y)
-
-
-
Field Detail
-
INITIAL_SCALE
public static final double INITIAL_SCALE
- See Also:
- Constant Field Values
-
MIN_SCALE
public static final double MIN_SCALE
- See Also:
- Constant Field Values
-
MAX_SCALE
public static final double MAX_SCALE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PointTransformation
public PointTransformation(javafx.beans.property.DoubleProperty scaleProperty, javafx.beans.property.ObjectProperty<org.locationtech.jts.math.Vector2D> offsetProperty, org.locationtech.jts.math.Vector2D boundarySize)
-
PointTransformation
public PointTransformation()
-
-
Method Detail
-
transform
public void transform(org.locationtech.jts.geom.Coordinate src, java.awt.geom.Point2D dest)Main transform method necessary for extendingPointTransformation.- Specified by:
transformin interfaceorg.locationtech.jts.awt.PointTransformation- Parameters:
src- The original coordinatedest- The point that we want to transform
-
getScale
public double getScale()
-
setScale
public void setScale(double scale)
-
getOffset
public org.locationtech.jts.math.Vector2D getOffset()
-
setOffset
public void setOffset(org.locationtech.jts.math.Vector2D offset)
-
transform
public org.locationtech.jts.geom.Coordinate transform(org.locationtech.jts.geom.Coordinate src)
Transform method betweenCoordinates.- Parameters:
src- the coordinate we want to transform- Returns:
- transformed coordinate
-
transformX
public double transformX(double x)
-
transformY
public double transformY(double y)
-
revert
public org.locationtech.jts.geom.Coordinate revert(org.locationtech.jts.geom.Coordinate src)
-
revert
public org.locationtech.jts.geom.Coordinate revert(double x, double y)
-
revertX
public double revertX(double x)
-
revertY
public double revertY(double y)
-
scaleRelative
public void scaleRelative(double gamma, org.locationtech.jts.math.Vector2D point)Scales the canvas and keeps a certain point centered.- Parameters:
gamma- factor of new scalepoint- scaling source point
-
scaleOffset
public void scaleOffset(double gamma, org.locationtech.jts.math.Vector2D point)Scale the offset relative keeping a point as scaling source.- Parameters:
gamma- factor of new scalepoint- scaling source point
-
getScaleProperty
public javafx.beans.property.DoubleProperty getScaleProperty()
The scale translates the source coordinates multiplicative intransform(Coordinate).
-
getOffsetProperty
public javafx.beans.property.ObjectProperty<org.locationtech.jts.math.Vector2D> getOffsetProperty()
The offset translates the source coordinates additive intransform(Coordinate).
-
setBoundarySize
public void setBoundarySize(org.locationtech.jts.math.Vector2D boundarySize)
-
getBoundarySize
public org.locationtech.jts.math.Vector2D getBoundarySize()
-
-