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 Summary
Constructors Constructor Description Viewport(GeometryEditPanel panel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Point2D p)booleancontainsInModel(Coordinate p)booleancontainsInModel(Coordinate p0, Coordinate p1)PrecisionModelgetGridPrecisionModel()Gets a PrecisionModel corresponding to the grid size.doublegetGridSizeModel()doublegetHeightInView()Point2DgetLowerLeftCornerInModel()EnvelopegetModelEnv()AffineTransformgetModelToViewTransform()doublegetScale()NumberFormatgetScaleFormat()EnvelopegetViewEnv()doublegetWidthInView()intgridMagnitudeModel()Gets the magnitude (power of 10) for the basic grid size.booleanintersectsInModel(Coordinate p0, Coordinate p1)booleanintersectsInModel(Envelope env)doubletoModel(double viewDist)Converts a distance in the view to a distance in the model.Point2DtoModel(Point2D viewPt)CoordinatetoModelCoordinate(Point2D viewPt)doubletoView(double modelDist)Converts a distance in the model to a distance in the view.Point2DtoView(Point2D modelPt)Point2DtoView(Point2D modelPt, Point2D viewPt)Point2DtoView(Coordinate modelCoordinate)voidtransform(Coordinate modelCoordinate, Point2D point)Transforms aCoordinateinto a Java2DPoint.voidupdate(Dimension viewSize)voidzoom(Point2D zoomPt, double zoomScale)Zoom to a point, ensuring that the zoom point remains in the same screen location.voidzoom(Envelope zoomEnv)voidzoomPan(double dx, double dy)voidzoomToInitialExtent()
-
-
-
Constructor Detail
-
Viewport
public Viewport(GeometryEditPanel panel)
-
-
Method Detail
-
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)
-
toModelCoordinate
public Coordinate toModelCoordinate(Point2D viewPt)
-
transform
public void transform(Coordinate modelCoordinate, Point2D point)
Description copied from interface:PointTransformationTransforms aCoordinateinto a Java2DPoint.- Specified by:
transformin interfacePointTransformation- Parameters:
modelCoordinate- the source Coordinatepoint- the destination Point
-
toView
public Point2D toView(Coordinate modelCoordinate)
-
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()
-
-