Class ImageViewerDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.openstreetmap.josm.gui.dialogs.ToggleDialog
-
- org.openstreetmap.josm.gui.layer.geoimage.ImageViewerDialog
-
- All Implemented Interfaces:
AWTEventListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,ImageData.ImageDataUpdateListener
,Helpful
,LayerManager.LayerChangeListener
,MainLayerManager.ActiveLayerChangeListener
,ShowHideButtonListener
,PreferenceChangedListener
,Destroyable
public final class ImageViewerDialog extends ToggleDialog implements LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener, ImageData.ImageDataUpdateListener
Dialog to view and manipulate geo-tagged images from aGeoImageLayer
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ImageViewerDialog.ImageAction
private class
ImageViewerDialog.ImageCenterViewAction
private class
ImageViewerDialog.ImageCollapseAction
private class
ImageViewerDialog.ImageCopyPathAction
private class
ImageViewerDialog.ImageFirstAction
private class
ImageViewerDialog.ImageLastAction
private class
ImageViewerDialog.ImageNextAction
private class
ImageViewerDialog.ImageOpenExternalAction
private class
ImageViewerDialog.ImagePreviousAction
private class
ImageViewerDialog.ImageRememberAction
This class exists to remember the last entry, and go back if clicked again when it would not otherwise be enabledprivate class
ImageViewerDialog.ImageRemoveAction
private class
ImageViewerDialog.ImageRemoveFromDiskAction
private class
ImageViewerDialog.ImageZoomAction
private static interface
ImageViewerDialog.SerializableUnaryOperator<I>
This literally exists to silence sonarlint complaints.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
ToggleDialog.ButtonHidingType, ToggleDialog.TitleBar, ToggleDialog.ToggleDialogAction
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
button, buttonHiding, detachedDialog, dialogsPanel, isCollapsed, isDocked, isShowing, name, preferenceClass, preferencePrefix, PROP_DYNAMIC_BUTTONS, titleBar, toggleAction, windowMenuItem
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ImageViewerDialog()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
Called whenever the active or edit layer changed.private void
build()
private void
cancelLoadingImage()
private static JButton
createButton(AbstractAction action, Dimension buttonDim)
(package private) static void
createInstance()
private static JButton
createNavigationButton(AbstractAction action, Dimension buttonDim)
void
destroy()
Called when the object has been destroyed.void
displayImage(ImageData ignoredData, ImageEntry entry)
Displays a single image for the given layer.void
displayImage(IImageEntry<?> entry)
Displays a single image for the given layer.void
displayImages(List<IImageEntry<?>> entries)
Displays images for the given layer.void
displayImages(ImageData ignoredData, List<IImageEntry<?>> entries)
Deprecated.UsedisplayImages(List)
(The data param is no longer used)protected boolean
dockWhenClosingDetachedDlg()
When an image is closed, really close it and do not pop up the side dialog.static IImageEntry<?>
getCurrentImage()
Returns the currently displayed image.static ImageViewerDialog
getInstance()
Replies the unique instance of this dialogVector3D
getRotation(IImageEntry<?> entry)
Returns the rotation of the currently displayed image.boolean
hasImage()
Returns whether an image is currently displayedvoid
imageDataUpdated(ImageData data)
Called when the data changestatic boolean
isCenterView()
Returns whether the center view is currently active.private static boolean
isFirstImageSelected(List<IImageEntry<?>> data)
private static boolean
isLastImageSelected(List<IImageEntry<?>> data)
void
layerAdded(LayerManager.LayerAddEvent e)
Notifies this listener that a layer has been added.void
layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Notifies this listener that the order of layers was changed.void
layerRemoving(LayerManager.LayerRemoveEvent e)
Notifies this listener that a layer was just removed.private void
registerOnLayer(Layer layer)
void
selectedImageChanged(ImageData data)
Called when the selection changestatic boolean
setCentreEnabled(boolean value)
Enables (or disables) the "Center view" button.void
setNextEnabled(boolean value)
Enables (or disables) the "Next" button.void
setPreviousEnabled(boolean value)
Enables (or disables) the "Previous" button.private void
showLayer(Layer newLayer)
protected void
stateChanged()
primitive stateChangedListener for subclassesprivate void
updateButtonsNonNullEntry(IImageEntry<?> entry, boolean imageChanged)
Update the image viewer buttons for the new entryprivate void
updateButtonsNullEntry(List<IImageEntry<?>> entries)
Update buttons for null entry-
Methods inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
buttonHidden, buttonShown, clearButtonActions, closeDetachedDialog, collapse, createLayout, createLayout, detach, dock, eventDispatched, expand, getButton, getDefaultDetachedSize, getLastHeight, getName, getPreferencePrefix, getPreferredHeight, getToggleAction, helpTopic, hideDialog, hideNotify, isDialogInCollapsedView, isDialogInDefaultView, isDialogShowing, preferenceChanged, registerInWindowMenu, rememberHeight, setButton, setContentVisible, setDialogsPanel, setIsButtonHiding, setIsCollapsed, setIsDocked, setIsShowing, setTitle, showDialog, showNotify, toggleButtonHook, toString, unfurlDialog
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
GEOIMAGE_FILLER
private static final String GEOIMAGE_FILLER
-
DIALOG_FOLDER
private static final String DIALOG_FOLDER
- See Also:
- Constant Field Values
-
imageryFilterSettings
private final ImageryFilterSettings imageryFilterSettings
-
imageZoomAction
private final ImageViewerDialog.ImageZoomAction imageZoomAction
-
imageCenterViewAction
private final ImageViewerDialog.ImageCenterViewAction imageCenterViewAction
-
imageNextAction
private final ImageViewerDialog.ImageNextAction imageNextAction
-
imageRemoveAction
private final ImageViewerDialog.ImageRemoveAction imageRemoveAction
-
imageRemoveFromDiskAction
private final ImageViewerDialog.ImageRemoveFromDiskAction imageRemoveFromDiskAction
-
imagePreviousAction
private final ImageViewerDialog.ImagePreviousAction imagePreviousAction
-
imageCollapseAction
private final ImageViewerDialog.ImageCollapseAction imageCollapseAction
-
imageFirstAction
private final ImageViewerDialog.ImageFirstAction imageFirstAction
-
imageLastAction
private final ImageViewerDialog.ImageLastAction imageLastAction
-
imageCopyPathAction
private final ImageViewerDialog.ImageCopyPathAction imageCopyPathAction
-
imageOpenExternalAction
private final ImageViewerDialog.ImageOpenExternalAction imageOpenExternalAction
-
visibilityAction
private final LayerVisibilityAction visibilityAction
-
imgDisplay
private final ImageDisplay imgDisplay
-
imgLoadingFuture
private Future<?> imgLoadingFuture
-
centerView
private boolean centerView
-
dialog
private static volatile ImageViewerDialog dialog
-
collapseButtonClicked
private boolean collapseButtonClicked
-
btnPrevious
private JButton btnPrevious
-
btnCollapse
private JButton btnCollapse
-
btnCopyPath
private JButton btnCopyPath
-
btnOpenExternal
private JButton btnOpenExternal
-
btnDeleteFromDisk
private JButton btnDeleteFromDisk
-
tbCentre
private JToggleButton tbCentre
-
currentEntry
private transient IImageEntry<? extends IImageEntry<?>> currentEntry
-
-
Constructor Detail
-
ImageViewerDialog
private ImageViewerDialog()
-
-
Method Detail
-
createInstance
static void createInstance()
-
getInstance
public static ImageViewerDialog getInstance()
Replies the unique instance of this dialog- Returns:
- the unique instance
-
createButton
private static JButton createButton(AbstractAction action, Dimension buttonDim)
-
createNavigationButton
private static JButton createNavigationButton(AbstractAction action, Dimension buttonDim)
-
build
private void build()
-
destroy
public void destroy()
Description copied from interface:Destroyable
Called when the object has been destroyed.- Specified by:
destroy
in interfaceDestroyable
- Overrides:
destroy
in classToggleDialog
-
setPreviousEnabled
public void setPreviousEnabled(boolean value)
Enables (or disables) the "Previous" button.- Parameters:
value
-true
to enable the button,false
otherwise
-
setNextEnabled
public void setNextEnabled(boolean value)
Enables (or disables) the "Next" button.- Parameters:
value
-true
to enable the button,false
otherwise
-
setCentreEnabled
public static boolean setCentreEnabled(boolean value)
Enables (or disables) the "Center view" button.- Parameters:
value
-true
to enable the button,false
otherwise- Returns:
- the old enabled value. Can be used to restore the original enable state
-
displayImage
public void displayImage(ImageData ignoredData, ImageEntry entry)
Displays a single image for the given layer.- Parameters:
ignoredData
- the image dataentry
- image entry- See Also:
displayImages(java.util.List<org.openstreetmap.josm.data.imagery.street_level.IImageEntry<?>>)
-
displayImage
public void displayImage(IImageEntry<?> entry)
Displays a single image for the given layer.- Parameters:
entry
- image entry- See Also:
displayImages(java.util.List<org.openstreetmap.josm.data.imagery.street_level.IImageEntry<?>>)
-
displayImages
public void displayImages(List<IImageEntry<?>> entries)
Displays images for the given layer.- Parameters:
entries
- image entries- Since:
- 18246
-
updateButtonsNullEntry
private void updateButtonsNullEntry(List<IImageEntry<?>> entries)
Update buttons for null entry- Parameters:
entries
-true
if multiple images are selected
-
updateButtonsNonNullEntry
private void updateButtonsNonNullEntry(IImageEntry<?> entry, boolean imageChanged)
Update the image viewer buttons for the new entry- Parameters:
entry
- The new entryimageChanged
-true
if it is not the same image as the previous image.
-
displayImages
@Deprecated public void displayImages(ImageData ignoredData, List<IImageEntry<?>> entries)
Deprecated.UsedisplayImages(List)
(The data param is no longer used)Displays images for the given layer.- Parameters:
ignoredData
- the image data (unused, may benull
)entries
- image entries- Since:
- 18246 (signature)
-
isLastImageSelected
private static boolean isLastImageSelected(List<IImageEntry<?>> data)
-
isFirstImageSelected
private static boolean isFirstImageSelected(List<IImageEntry<?>> data)
-
dockWhenClosingDetachedDlg
protected boolean dockWhenClosingDetachedDlg()
When an image is closed, really close it and do not pop up the side dialog.- Overrides:
dockWhenClosingDetachedDlg
in classToggleDialog
-
stateChanged
protected void stateChanged()
Description copied from class:ToggleDialog
primitive stateChangedListener for subclasses- Overrides:
stateChanged
in classToggleDialog
-
hasImage
public boolean hasImage()
Returns whether an image is currently displayed- Returns:
- If image is currently displayed
-
getCurrentImage
public static IImageEntry<?> getCurrentImage()
Returns the currently displayed image.- Returns:
- Currently displayed image or
null
- Since:
- 18246 (signature)
-
getRotation
public Vector3D getRotation(IImageEntry<?> entry)
Returns the rotation of the currently displayed image.- Parameters:
entry
- The entry to get the rotation for. May benull
.- Returns:
- the rotation of the currently displayed image, or
null
- Since:
- 18263
-
isCenterView
public static boolean isCenterView()
Returns whether the center view is currently active.- Returns:
true
if the center view is active,false
otherwise- Since:
- 9416
-
layerAdded
public void layerAdded(LayerManager.LayerAddEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAdded
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The new added layer event
-
layerRemoving
public void layerRemoving(LayerManager.LayerRemoveEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies this listener that a layer was just removed.Listeners are called in the EDT thread after the layer was removed. Use
LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)
to remove more layers. You should not do blocking or long-running tasks in this method.- Specified by:
layerRemoving
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The layer to be removed (as event)
-
layerOrderChanged
public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Description copied from interface:LayerManager.LayerChangeListener
Notifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChanged
in interfaceLayerManager.LayerChangeListener
- Parameters:
e
- The order change event.
-
activeOrEditLayerChanged
public void activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
Description copied from interface:MainLayerManager.ActiveLayerChangeListener
Called whenever the active or edit layer changed.You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
- Specified by:
activeOrEditLayerChanged
in interfaceMainLayerManager.ActiveLayerChangeListener
- Parameters:
e
- The change event.
-
registerOnLayer
private void registerOnLayer(Layer layer)
-
cancelLoadingImage
private void cancelLoadingImage()
-
selectedImageChanged
public void selectedImageChanged(ImageData data)
Description copied from interface:ImageData.ImageDataUpdateListener
Called when the selection change- Specified by:
selectedImageChanged
in interfaceImageData.ImageDataUpdateListener
- Parameters:
data
- the image data
-
imageDataUpdated
public void imageDataUpdated(ImageData data)
Description copied from interface:ImageData.ImageDataUpdateListener
Called when the data change- Specified by:
imageDataUpdated
in interfaceImageData.ImageDataUpdateListener
- Parameters:
data
- the image data
-
-