Class Viewport
java.lang.Object
org.locationtech.jtstest.testbuilder.ui.Viewport
- All Implemented Interfaces:
PointTransformation
Maintains the information associated with mapping
the model view to the screen
- Author:
- Martin Davis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleancontainsInModel(Coordinate p0, Coordinate p1) Gets a PrecisionModel corresponding to the grid size.doubledoubledoublegetScale()doubleintGets the magnitude (power of 10) for the basic grid size.booleanintersectsInModel(Coordinate p0, Coordinate p1) booleandoubletoModel(double viewDist) Converts a distance in the view to a distance in the model.toModelCoordinate(Point2D viewPt) doubletoView(double modelDist) Converts a distance in the model to a distance in the view.toView(Coordinate modelCoordinate) voidtransform(Coordinate modelCoordinate, Point2D point) Transforms aCoordinateinto a Java2DPoint.voidvoidZoom to a point, ensuring that the zoom point remains in the same screen location.voidvoidzoomPan(double dx, double dy) void
-
Constructor Details
-
Viewport
-
-
Method Details
-
getModelEnv
-
getViewEnv
-
getScale
public double getScale() -
getScaleFormat
-
intersectsInModel
-
intersectsInModel
-
toModel
-
toModelCoordinate
-
transform
Description copied from interface:PointTransformationTransforms aCoordinateinto a Java2DPoint.- Specified by:
transformin interfacePointTransformation- Parameters:
modelCoordinate- the source Coordinatepoint- the destination Point
-
toView
-
toView
-
toView
-
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
-
getModelToViewTransform
-
zoomToInitialExtent
public void zoomToInitialExtent() -
zoom
-
zoomPan
public void zoomPan(double dx, double dy) -
zoom
Zoom to a point, ensuring that the zoom point remains in the same screen location.- Parameters:
zoomPt-zoomFactor-
-
getLowerLeftCornerInModel
-
getHeightInView
public double getHeightInView() -
getWidthInView
public double getWidthInView() -
containsInModel
-
containsInModel
-
contains
-
gridMagnitudeModel
public int gridMagnitudeModel()Gets the magnitude (power of 10) for the basic grid size.- Returns:
- the magnitude
-
getGridPrecisionModel
Gets a PrecisionModel corresponding to the grid size.- Returns:
- the precision model
-
getGridSizeModel
public double getGridSizeModel()
-