Class PointTransformation

  • All Implemented Interfaces:
    org.locationtech.jts.awt.PointTransformation

    public class PointTransformation
    extends java.lang.Object
    implements org.locationtech.jts.awt.PointTransformation
    Transforms a source Coordinate from a strategy to a AWT Point2D considering a canvas offset Vector2D 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.
    • 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 in transform(Coordinate).
      double getScale()  
      javafx.beans.property.DoubleProperty getScaleProperty()
      The scale translates the source coordinates multiplicative in transform(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 between Coordinates.
      void transform​(org.locationtech.jts.geom.Coordinate src, java.awt.geom.Point2D dest)
      Main transform method necessary for extending PointTransformation.
      double transformX​(double x)  
      double transformY​(double y)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 extending PointTransformation.
        Specified by:
        transform in interface org.locationtech.jts.awt.PointTransformation
        Parameters:
        src - The original coordinate
        dest - 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 between Coordinates.
        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 scale
        point - 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 scale
        point - scaling source point
      • getScaleProperty

        public javafx.beans.property.DoubleProperty getScaleProperty()
        The scale translates the source coordinates multiplicative in transform(Coordinate).
      • getOffsetProperty

        public javafx.beans.property.ObjectProperty<org.locationtech.jts.math.Vector2D> getOffsetProperty()
        The offset translates the source coordinates additive in transform(Coordinate).
      • setBoundarySize

        public void setBoundarySize​(org.locationtech.jts.math.Vector2D boundarySize)
      • getBoundarySize

        public org.locationtech.jts.math.Vector2D getBoundarySize()