Class Viewport

java.lang.Object
org.locationtech.jtstest.testbuilder.ui.Viewport
All Implemented Interfaces:
PointTransformation

public class Viewport extends Object implements PointTransformation
Maintains the information associated with mapping the model view to the screen
Author:
Martin Davis
  • Constructor Details

  • Method Details

    • getModelEnv

      public Envelope getModelEnv()
    • getViewEnv

      public Envelope getViewEnv()
    • getScale

      public double getScale()
    • getScaleFormat

      public NumberFormat getScaleFormat()
    • intersectsInModel

      public boolean intersectsInModel(Envelope env)
    • intersectsInModel

      public boolean intersectsInModel(Coordinate p0, Coordinate p1)
    • toModel

      public Point2D toModel(Point2D viewPt)
    • toModelCoordinate

      public Coordinate toModelCoordinate(Point2D viewPt)
    • transform

      public void transform(Coordinate modelCoordinate, Point2D point)
      Description copied from interface: PointTransformation
      Transforms a Coordinate into a Java2D Point.
      Specified by:
      transform in interface PointTransformation
      Parameters:
      modelCoordinate - the source Coordinate
      point - the destination Point
    • toView

      public Point2D toView(Coordinate modelCoordinate)
    • toView

      public Point2D toView(Point2D modelPt)
    • toView

      public Point2D toView(Point2D modelPt, Point2D viewPt)
    • toModel

      public double toModel(double viewDist)
      Converts a distance in the view to a distance in the model.
      Parameters:
      viewDist -
      Returns:
      the model distance
    • toView

      public double toView(double modelDist)
      Converts a distance in the model to a distance in the view.
      Parameters:
      modelDist -
      Returns:
      the view distance
    • update

      public void update(Dimension viewSize)
    • getModelToViewTransform

      public AffineTransform getModelToViewTransform()
    • zoomToInitialExtent

      public void zoomToInitialExtent()
    • zoom

      public void zoom(Envelope zoomEnv)
    • zoomPan

      public void zoomPan(double dx, double dy)
    • zoom

      public void zoom(Point2D zoomPt, double zoomScale)
      Zoom to a point, ensuring that the zoom point remains in the same screen location.
      Parameters:
      zoomPt -
      zoomFactor -
    • getLowerLeftCornerInModel

      public Point2D getLowerLeftCornerInModel()
    • getHeightInView

      public double getHeightInView()
    • getWidthInView

      public double getWidthInView()
    • containsInModel

      public boolean containsInModel(Coordinate p)
    • containsInModel

      public boolean containsInModel(Coordinate p0, Coordinate p1)
    • contains

      public boolean contains(Point2D p)
    • gridMagnitudeModel

      public int gridMagnitudeModel()
      Gets the magnitude (power of 10) for the basic grid size.
      Returns:
      the magnitude
    • getGridPrecisionModel

      public PrecisionModel getGridPrecisionModel()
      Gets a PrecisionModel corresponding to the grid size.
      Returns:
      the precision model
    • getGridSizeModel

      public double getGridSizeModel()