Class Viewport
- java.lang.Object
-
- org.locationtech.jts.jump.workbench.ui.Viewport
-
- All Implemented Interfaces:
Java2DConverter.PointConverter
public class Viewport extends Object implements Java2DConverter.PointConverter
Controls the area on the model being viewed by a LayerViewPanel.
-
-
Constructor Summary
Constructors Constructor Description Viewport(LayerViewPanel panel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(ViewportListener l)
org.locationtech.jts.geom.Envelope
fullExtent()
org.locationtech.jts.geom.Envelope
getEnvelopeInModelCoordinates()
Java2DConverter
getJava2DConverter()
AffineTransform
getModelToViewTransform()
Point2D
getOriginInModelCoordinates()
LayerViewPanel
getPanel()
double
getScale()
ZoomHistory
getZoomHistory()
void
initialize(double newScale, Point2D newViewOriginAsPerceivedByModel)
Set both values but repaint once.static AffineTransform
modelToViewTransform(double scale, Point2D viewOriginAsPerceivedByModel, double panelHeight)
void
removeListener(ViewportListener l)
org.locationtech.jts.geom.Coordinate
toModelCoordinate(Point2D viewPoint)
org.locationtech.jts.geom.Envelope
toModelEnvelope(double x1, double x2, double y1, double y2)
Point2D
toModelPoint(Point2D viewPoint)
Point2D
toViewPoint(Point2D modelPoint)
Point2D
toViewPoint(org.locationtech.jts.geom.Coordinate modelCoordinate)
Collection
toViewPoints(Collection modelCoordinates)
Rectangle2D
toViewRectangle(org.locationtech.jts.geom.Envelope envelope)
void
update()
void
zoom(Point2D centreOfNewViewAsPerceivedByOldView, double widthOfNewViewAsPerceivedByOldView, double heightOfNewViewAsPerceivedByOldView)
Of widthOfNewViewAsPerceivedByOldView and heightOfNewViewAsPerceivedByOldView, this method will choose the one producing the least zoom.void
zoom(org.locationtech.jts.geom.Envelope modelEnvelope)
void
zoomToFullExtent()
void
zoomToViewPoint(Point2D centreOfNewViewAsPerceivedByOldView, double zoomFactor)
-
-
-
Constructor Detail
-
Viewport
public Viewport(LayerViewPanel panel)
-
-
Method Detail
-
getPanel
public LayerViewPanel getPanel()
-
addListener
public void addListener(ViewportListener l)
-
removeListener
public void removeListener(ViewportListener l)
-
getJava2DConverter
public Java2DConverter getJava2DConverter()
-
getZoomHistory
public ZoomHistory getZoomHistory()
-
update
public void update() throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
modelToViewTransform
public static AffineTransform modelToViewTransform(double scale, Point2D viewOriginAsPerceivedByModel, double panelHeight)
-
getScale
public double getScale()
-
initialize
public void initialize(double newScale, Point2D newViewOriginAsPerceivedByModel)
Set both values but repaint once.
-
getOriginInModelCoordinates
public Point2D getOriginInModelCoordinates()
-
zoom
public void zoom(Point2D centreOfNewViewAsPerceivedByOldView, double widthOfNewViewAsPerceivedByOldView, double heightOfNewViewAsPerceivedByOldView) throws NoninvertibleTransformException
Of widthOfNewViewAsPerceivedByOldView and heightOfNewViewAsPerceivedByOldView, this method will choose the one producing the least zoom.- Throws:
NoninvertibleTransformException
-
toModelPoint
public Point2D toModelPoint(Point2D viewPoint) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
toModelCoordinate
public org.locationtech.jts.geom.Coordinate toModelCoordinate(Point2D viewPoint) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
toViewPoint
public Point2D toViewPoint(Point2D modelPoint) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
toViewPoint
public Point2D toViewPoint(org.locationtech.jts.geom.Coordinate modelCoordinate) throws NoninvertibleTransformException
- Specified by:
toViewPoint
in interfaceJava2DConverter.PointConverter
- Throws:
NoninvertibleTransformException
-
toModelEnvelope
public org.locationtech.jts.geom.Envelope toModelEnvelope(double x1, double x2, double y1, double y2) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getModelToViewTransform
public AffineTransform getModelToViewTransform() throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getEnvelopeInModelCoordinates
public org.locationtech.jts.geom.Envelope getEnvelopeInModelCoordinates()
-
zoom
public void zoom(org.locationtech.jts.geom.Envelope modelEnvelope) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
zoomToFullExtent
public void zoomToFullExtent() throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
fullExtent
public org.locationtech.jts.geom.Envelope fullExtent()
-
zoomToViewPoint
public void zoomToViewPoint(Point2D centreOfNewViewAsPerceivedByOldView, double zoomFactor) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
toViewPoints
public Collection toViewPoints(Collection modelCoordinates) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
toViewRectangle
public Rectangle2D toViewRectangle(org.locationtech.jts.geom.Envelope envelope) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
-