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 CameraPlane
cameraPlane
private java.awt.image.BufferedImage
offscreenImage
-
Constructor Summary
Constructors Constructor Description Equirectangular()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkAndModifyVisibleRectSize(java.awt.Image image, ImageDisplay.VisRect visibleRect)
Check and modify the visible rect size to appropriate dimensionsvoid
componentResized(java.awt.event.ComponentEvent e)
ImageDisplay.VisRect
getDefaultVisibleRectangle(java.awt.Component component, java.awt.Image image)
Get the default visible rectangle for the projectionjava.awt.Image
getMaxImageSize(ImageDisplay imageDisplay, java.awt.Image image)
Get the maximum image size that can be displayedVector3D
getRotation()
Get the current rotation in the image viewerjava.util.Set<Projections>
getSupportedProjections()
Get the supported projections for the image viewervoid
mouseDragged(java.awt.Point from, java.awt.Point to, ImageDisplay.VisRect currentVisibleRect)
Indicate that the mouse has been dragged to a pointvoid
paintImage(java.awt.Graphics g, java.awt.image.BufferedImage image, java.awt.Rectangle target, java.awt.Rectangle visibleRect)
Paint the imageprivate CameraPlane
updateCameraPlane(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:IImageViewer
Get the supported projections for the image viewer- Specified by:
getSupportedProjections
in 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:IImageViewer
Paint the image- Specified by:
paintImage
in 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:IImageViewer
Get the default visible rectangle for the projection- Specified by:
getDefaultVisibleRectangle
in 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:IImageViewer
Get the current rotation in the image viewer- Specified by:
getRotation
in interfaceIImageViewer
- Returns:
- The rotation
-
componentResized
public void componentResized(java.awt.event.ComponentEvent e)
- Specified by:
componentResized
in interfacejava.awt.event.ComponentListener
- Overrides:
componentResized
in 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:IImageViewer
Indicate that the mouse has been dragged to a point- Specified by:
mouseDragged
in 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:IImageViewer
Check and modify the visible rect size to appropriate dimensions- Specified by:
checkAndModifyVisibleRectSize
in 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:IImageViewer
Get the maximum image size that can be displayed- Specified by:
getMaxImageSize
in interfaceIImageViewer
- Parameters:
imageDisplay
- The image displayimage
- The image- Returns:
- The maximum image size (may be the original image passed in)
-
-