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 TypeMethodDescriptionboolean
boolean
boolean
containsInModel
(Coordinate p0, Coordinate p1) Gets a PrecisionModel corresponding to the grid size.double
double
double
getScale()
double
int
Gets the magnitude (power of 10) for the basic grid size.boolean
intersectsInModel
(Coordinate p0, Coordinate p1) boolean
double
toModel
(double viewDist) Converts a distance in the view to a distance in the model.toModelCoordinate
(Point2D viewPt) double
toView
(double modelDist) Converts a distance in the model to a distance in the view.toView
(Coordinate modelCoordinate) void
transform
(Coordinate modelCoordinate, Point2D point) Transforms aCoordinate
into a Java2DPoint
.void
void
Zoom to a point, ensuring that the zoom point remains in the same screen location.void
void
zoomPan
(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:PointTransformation
Transforms aCoordinate
into a Java2DPoint
.- Specified by:
transform
in 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()
-