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 voidaddListener(ViewportListener l)org.locationtech.jts.geom.EnvelopefullExtent()org.locationtech.jts.geom.EnvelopegetEnvelopeInModelCoordinates()Java2DConvertergetJava2DConverter()AffineTransformgetModelToViewTransform()Point2DgetOriginInModelCoordinates()LayerViewPanelgetPanel()doublegetScale()ZoomHistorygetZoomHistory()voidinitialize(double newScale, Point2D newViewOriginAsPerceivedByModel)Set both values but repaint once.static AffineTransformmodelToViewTransform(double scale, Point2D viewOriginAsPerceivedByModel, double panelHeight)voidremoveListener(ViewportListener l)org.locationtech.jts.geom.CoordinatetoModelCoordinate(Point2D viewPoint)org.locationtech.jts.geom.EnvelopetoModelEnvelope(double x1, double x2, double y1, double y2)Point2DtoModelPoint(Point2D viewPoint)Point2DtoViewPoint(Point2D modelPoint)Point2DtoViewPoint(org.locationtech.jts.geom.Coordinate modelCoordinate)CollectiontoViewPoints(Collection modelCoordinates)Rectangle2DtoViewRectangle(org.locationtech.jts.geom.Envelope envelope)voidupdate()voidzoom(Point2D centreOfNewViewAsPerceivedByOldView, double widthOfNewViewAsPerceivedByOldView, double heightOfNewViewAsPerceivedByOldView)Of widthOfNewViewAsPerceivedByOldView and heightOfNewViewAsPerceivedByOldView, this method will choose the one producing the least zoom.voidzoom(org.locationtech.jts.geom.Envelope modelEnvelope)voidzoomToFullExtent()voidzoomToViewPoint(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:
toViewPointin 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
-
-