Class Equirectangular
- java.lang.Object
-
- java.awt.event.ComponentAdapter
-
- org.openstreetmap.josm.gui.layer.geoimage.viewers.projections.Equirectangular
-
- All Implemented Interfaces:
java.awt.event.ComponentListener,java.util.EventListener,IImageViewer
public class Equirectangular extends java.awt.event.ComponentAdapter implements IImageViewer
A class for showing 360 images that use the equirectangular projection- Since:
- 18246
-
-
Field Summary
Fields Modifier and Type Field Description private CameraPlanecameraPlaneprivate java.awt.image.BufferedImageoffscreenImage
-
Constructor Summary
Constructors Constructor Description Equirectangular()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckAndModifyVisibleRectSize(java.awt.Image image, ImageDisplay.VisRect visibleRect)Check and modify the visible rect size to appropriate dimensionsvoidcomponentResized(java.awt.event.ComponentEvent e)ImageDisplay.VisRectgetDefaultVisibleRectangle(java.awt.Component component, java.awt.Image image)Get the default visible rectangle for the projectionjava.awt.ImagegetMaxImageSize(ImageDisplay imageDisplay, java.awt.Image image)Get the maximum image size that can be displayedVector3DgetRotation()Get the current rotation in the image viewerjava.util.Set<Projections>getSupportedProjections()Get the supported projections for the image viewervoidmouseDragged(java.awt.Point from, java.awt.Point to, ImageDisplay.VisRect currentVisibleRect)Indicate that the mouse has been dragged to a pointvoidpaintImage(java.awt.Graphics g, java.awt.image.BufferedImage image, java.awt.Rectangle target, java.awt.Rectangle visibleRect)Paint the imageprivate CameraPlaneupdateCameraPlane(int width, int height)Update the current camera plane-
Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentMoved, componentShown
-
-
-
-
Field Detail
-
cameraPlane
@Nullable private volatile CameraPlane cameraPlane
-
offscreenImage
private volatile java.awt.image.BufferedImage offscreenImage
-
-
Constructor Detail
-
Equirectangular
public Equirectangular()
-
-
Method Detail
-
getSupportedProjections
public java.util.Set<Projections> getSupportedProjections()
Description copied from interface:IImageViewerGet the supported projections for the image viewer- Specified by:
getSupportedProjectionsin interfaceIImageViewer- Returns:
- The projections supported. Typically, only one.
-
paintImage
public void paintImage(java.awt.Graphics g, java.awt.image.BufferedImage image, java.awt.Rectangle target, java.awt.Rectangle visibleRect)
Description copied from interface:IImageViewerPaint the image- Specified by:
paintImagein interfaceIImageViewer- Parameters:
g- The graphics to paint onimage- The image to painttarget- The target areavisibleRect- The visible rectangle
-
getDefaultVisibleRectangle
public ImageDisplay.VisRect getDefaultVisibleRectangle(java.awt.Component component, java.awt.Image image)
Description copied from interface:IImageViewerGet the default visible rectangle for the projection- Specified by:
getDefaultVisibleRectanglein interfaceIImageViewer- Parameters:
component- The component the image will be displayed inimage- The image that will be shown- Returns:
- The default visible rectangle
-
getRotation
public Vector3D getRotation()
Description copied from interface:IImageViewerGet the current rotation in the image viewer- Specified by:
getRotationin interfaceIImageViewer- Returns:
- The rotation
-
componentResized
public void componentResized(java.awt.event.ComponentEvent e)
- Specified by:
componentResizedin interfacejava.awt.event.ComponentListener- Overrides:
componentResizedin classjava.awt.event.ComponentAdapter
-
updateCameraPlane
@Nonnull private CameraPlane updateCameraPlane(int width, int height)
Update the current camera plane- Parameters:
width- The width to useheight- The height to use
-
mouseDragged
public void mouseDragged(java.awt.Point from, java.awt.Point to, ImageDisplay.VisRect currentVisibleRect)
Description copied from interface:IImageViewerIndicate that the mouse has been dragged to a point- Specified by:
mouseDraggedin interfaceIImageViewer- Parameters:
from- The point the mouse was dragged fromto- The point the mouse has been dragged tocurrentVisibleRect- The currently visible rectangle (this is updated by the default implementation)
-
checkAndModifyVisibleRectSize
public void checkAndModifyVisibleRectSize(java.awt.Image image, ImageDisplay.VisRect visibleRect)
Description copied from interface:IImageViewerCheck and modify the visible rect size to appropriate dimensions- Specified by:
checkAndModifyVisibleRectSizein interfaceIImageViewer- Parameters:
image- The image to use for checkingvisibleRect- the visible rectangle to update
-
getMaxImageSize
public java.awt.Image getMaxImageSize(ImageDisplay imageDisplay, java.awt.Image image)
Description copied from interface:IImageViewerGet the maximum image size that can be displayed- Specified by:
getMaxImageSizein interfaceIImageViewer- Parameters:
imageDisplay- The image displayimage- The image- Returns:
- The maximum image size (may be the original image passed in)
-
-