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.PointTransformation
Transforms a sourceCoordinate
from a strategy to a AWTPoint2D
considering a canvas offsetVector2D
and 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 double
INITIAL_SCALE
static double
MAX_SCALE
static double
MIN_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.Vector2D
getBoundarySize()
org.locationtech.jts.math.Vector2D
getOffset()
javafx.beans.property.ObjectProperty<org.locationtech.jts.math.Vector2D>
getOffsetProperty()
The offset translates the source coordinates additive intransform(Coordinate)
.double
getScale()
javafx.beans.property.DoubleProperty
getScaleProperty()
The scale translates the source coordinates multiplicative intransform(Coordinate)
.org.locationtech.jts.geom.Coordinate
revert(double x, double y)
org.locationtech.jts.geom.Coordinate
revert(org.locationtech.jts.geom.Coordinate src)
double
revertX(double x)
double
revertY(double y)
void
scaleOffset(double gamma, org.locationtech.jts.math.Vector2D point)
Scale the offset relative keeping a point as scaling source.void
scaleRelative(double gamma, org.locationtech.jts.math.Vector2D point)
Scales the canvas and keeps a certain point centered.void
setBoundarySize(org.locationtech.jts.math.Vector2D boundarySize)
void
setOffset(org.locationtech.jts.math.Vector2D offset)
void
setScale(double scale)
org.locationtech.jts.geom.Coordinate
transform(org.locationtech.jts.geom.Coordinate src)
Transform method betweenCoordinate
s.void
transform(org.locationtech.jts.geom.Coordinate src, java.awt.geom.Point2D dest)
Main transform method necessary for extendingPointTransformation
.double
transformX(double x)
double
transformY(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:
transform
in 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 betweenCoordinate
s.- 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()
-
-