jsky.image.gui
Class DivaMainImageDisplay

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by diva.canvas.JCanvas
                  extended by jsky.image.gui.DivaGraphicsImageDisplay
                      extended by jsky.image.gui.DivaMainImageDisplay
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, BasicImageReadableProcessor, BasicImageDisplay, GraphicsImageDisplay, MainImageDisplay, GenericToolBarTarget
Direct Known Subclasses:
NavigatorImageDisplay

public class DivaMainImageDisplay
extends DivaGraphicsImageDisplay
implements MainImageDisplay

Implements the main image display window and provides methods to implement each of the menu items in the ImageDisplayMenuBar class.

Version:
$Revision: 1.4 $
Author:
Allan Brighton
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DivaMainImageDisplay()
          Default constructor.
DivaMainImageDisplay(java.awt.Component parent)
          Construct a DivaMainImageDisplay widget.
DivaMainImageDisplay(diva.canvas.GraphicsPane pane)
          Initialize with the given Diva GraphicsPane (contains the layers used to draw the image and graphcs.
DivaMainImageDisplay(diva.canvas.GraphicsPane pane, java.awt.Component parent)
          Construct a DivaMainImageDisplay widget.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          register to receive change events from this object whenever the image or cut levels are changed.
 void addHistoryMenuItems(javax.swing.JMenu menu)
          Add history items (for previously loaded images) to the given menu
protected  void addToHistory()
          Add the current URL to the history list
protected  void addToHistory(ImageHistoryItem historyItem)
          Add the given item to the history list, removing duplicates and keeping the list size to a maximum of 20.
 void back()
          Go back to the previous image in the history list
 void blankImage(double ra, double dec)
          Display a blank image with the given center coordinates (15' * 60 seconds/minutes).
 void checkExtensions(boolean show)
          If there are multiple images and/or tables in the image file, pop up a dialog to select the one to display.
protected  boolean checkSave()
          If the current image file has been modified (by adding or deleting a FITS extension, for example), ask the user to confirm saving it.
protected  void cleanupHistoryList()
          Remove any items in the history list for files that no longer exist.
protected  void cleanupImageCache()
          Remove any files from the image cache that are no longer in the history list.
 void clear()
          Clear the image display.
protected  void clearHistory()
          Add the current URL to the history list
 void close()
          Close the window
 void displayFITSTable(int hdu)
          Display the FITS table at the given HDU index (if supported).
 void dispose()
          Cleanup when the window is no longer needed.
protected  void downloadImageToTempFile(java.net.URL url)
          Download the given URL to a temporary file in a separate thread and then display the image file when done.
 void editColors()
          Pop up a dialog window for displaying and setting the image colors.
 void editCutLevels()
          Pop up a dialog window for displaying and setting the image cut levls.
 void exit()
          Exit the application (called from exit menu).
 boolean fileInHistoryList(java.io.File file)
          Return true if the given file is referenced in the history list.
protected  void fireChange(ImageChangeEvent e)
          Notify any listeners of a change in the image or cut levels.
 void forward()
          Go forward to the next image in the history list
 javax.swing.AbstractAction getBackAction()
          Return the action for "Back"
 WorldCoords getBasePos()
          Return the base or center position in world coordinates.
 CanvasDraw getCanvasDraw()
          Return the object that manages interactive drawing on the image
 javax.swing.AbstractAction getColorsAction()
           
 javax.swing.AbstractAction getCutLevelsAction()
           
 double[] getDefaultSearchMagRange()
          Return the default min and max magnitude values to use for catalog searches, or null if there is no default.
 double[] getDefaultSearchRadius(WorldCoords centerPos, boolean useImageSize)
          Return the default min and max search radius to use for catalog searches, in arcmin.
 javax.swing.JDesktopPane getDesktop()
          Return the JDesktopPane, if using internal frames, otherwise null
 java.lang.String getFilename()
          Return the image file name, if there is one.
 FITSGraphics getFitsGraphics()
          Return the object used to save graphics to a FITS table in the image and reload it again later.
 FITSHDUChooser getFitsHDUChooser()
          Return the panel for manipulating FITS extensions
 java.awt.Component getFitsHDUChooserFrame()
          Return the top level window (or internal frame) for manipulating FITS extensions
 java.awt.Component getFitsKeywordsFrame()
          Return the top level window (or internal frame) for viewing the FITS keywords.
 javax.swing.AbstractAction getForwAction()
          Return the action for "Forward"
 java.awt.Component getImageColorsFrame()
          Return the top level window (or internal frame) for manipulating image colormaps
 java.awt.Component getImageCutLevelsFrame()
          Return the top level windows (or internal frame) for setting cut levels
protected  ImageHistoryItem getImageHistoryItem(java.io.File file)
          Return the ImageHistoryItem from the history list, or null if not found.
 java.awt.Component getImagePropertiesFrame()
          Return the top level window (or internal frame) for viewing image properties
 int getMaxHistoryItems()
          Return the max number of items in the history list.
 java.lang.String getObjectName()
          Return the name of the object being displayed, if known, otherwise null.
 javax.swing.AbstractAction getOpenAction()
          Return the action for "Open"
 java.awt.Component getParentFrame()
          Return the top level parent frame (or internal frame) used to close the window
 java.awt.Component getPickObjectFrame()
          Return the top level window (or internal frame) for selecting image objects (stars, galaxies)
 PickObject getPickObjectPanel()
          Return the Pick Object panel, if initialized
 javax.swing.AbstractAction getPrintAction()
           
 javax.swing.AbstractAction getPrintPreviewAction()
           
 java.awt.Component getRootComponent()
          Return the top level parent frame (or internal frame) used to close the window
 javax.swing.AbstractAction getSaveAction()
           
 javax.swing.AbstractAction getSaveAsAction()
           
 java.lang.String getTitle()
          Return the frame's title.
 java.net.URL getURL()
          Return the image URL, if there is one.
protected  void initFITSImage(FITSImage fitsImage)
          Called after a new FITSImage object was created to do FITS specific initialization
protected  void initProgressPanel()
          Make the download progress panel if needed, and display it
 boolean isJAIImageType(java.lang.String filename)
          Return true if the given filename has a suffix that indicates that it is not a FITS file and is one of the standard JAI supported image types.
 boolean isMainWindow()
          Return true if this is the main application window (enables exit menu item)
 boolean isSaveNeeded()
          Return true if the image file has been modified and needs saving.
 boolean loadCachedImage(double ra, double dec)
          If an image was previously loaded in this session with a center near the given ra,dec coordinates, reload it, otherwise generate a blank image with the center at those coordinates (in J2000).
protected  void loadHistory()
          Try to load the history list from a file, and create an empty list if that fails.
protected  void loadImageFromURL(java.net.URL url)
          Load an image directly from the given URL in a separate thread, so the user can monitor progress and cancel it, if needed.
static javax.swing.JFileChooser makeImageFileChooser()
          Create and return a new file chooser to be used to select an image file to display.
protected  ImageHistoryItem makeImageHistoryItem()
          Make and return an ImageHistoryItem for the current image
protected  java.util.LinkedList mergeHistoryList()
          Merge the historyList with current serialized version (another instance may have written it since we read it last).
protected  void newImage(boolean before)
          This method is called before and after a new image is loaded, each time with a different argument.
 java.awt.Component newWindow()
          Open up another window like this one and return a reference to it.
 void open()
          Display a file chooser to select a filename to display
 void openURL()
          Display a dialog to enter a URL to display
 void paintImageAndGraphics(java.awt.Graphics2D g2D)
          Paint the image and graphics to the given graphics object (for save and print features)
protected  void pickedObject()
          Called when an object is selected in the Pick Object window.
 void pickObject()
          Pop up a dialog window to select objects (stars, galaxies) in the image
 void print()
          Pop up a dialog for printing the image.
 void printPreview()
          Display a preview of the what the printed image view will look like.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Stop receiving change events from this object.
 void save()
          Save any changes to the current image file.
 void saveAs()
          Pop up a dialog to ask the user for a file name, and then save the image to the selected file.
 void saveAs(java.lang.String filename)
          Save the current image to the given file, using an image format based on the file suffix, which should be one of ".fits", ".jpg", ".png", or ".tif".
 void saveGraphicsWithImage()
          Save the current image graphics to a binary FITS table in the current image
protected  void saveHistory(boolean merge)
          Save the current history list to a file.
 void setDesktop(javax.swing.JDesktopPane desktop)
          Set the JDesktopPane to use for top level windows, if using internal frames
protected  void setDownloadState(boolean downloading)
          Set the state of the menubar/toolbar actions
 void setFilename(java.lang.String fileOrUrl)
          Set the image file to display.
 void setFilename(java.lang.String fileOrUrl, java.net.URL url)
          Set the image file to display and use the given URL for the image history (the URL is used if the file is deleted).
 void setMaxHistoryItems(int n)
          Set the max number of items in the history list.
 void setOrigin(java.awt.geom.Point2D.Double origin)
          Set the origin of the image to display in canvas coordinates.
 void setParentFrame(java.awt.Component p)
          Set the top level parent frame (or internal frame) used to close the window
 void setSaveNeeded(boolean b)
          Set to true if the image file has been modified and needs saving.
 void setScale(float scale)
          Set the scale (zoom factor) for the image.
 void setTitle(java.lang.String s)
          Set the frame's basic title string.
 void setURL(java.net.URL url)
          Set the URL for the image to display.
protected  void updateEnabledStates()
          Update the enabled states of some menu/toolbar actions.
protected  void updateImage(javax.media.jai.PlanarImage im)
          This method updates the source image for this window, which is scaled to the correct magnification before displaying.
 void updateImageData()
          Update the display to show the contents of the currently loaded image file.
protected  void updateTitle()
          Set the frame's title.
 void viewFitsExtensions()
          Pop up a dialog window for displaying a table of the FITS extensions
 void viewFitsKeywords()
          Pop up a dialog window for displaying the FITS Keywords.
 void viewImageProperties()
          Pop up a dialog window for displaying the image properties.
 
Methods inherited from class jsky.image.gui.DivaGraphicsImageDisplay
addImageGraphicsHandler, centerImage, getAffineTransform, getCanvas, getCanvasGraphics, getCoordinateConverter, getDisplayImage, getFitsImage, getImage, getImageHeight, getImageProcessor, getImageWidth, getInterpolation, getOrigin, getPixelValue, getPixelValues, getScale, getScaleHints, getVisibleArea, getWCS, initWCS, isAutoCenterImage, isClear, isImmediateMode, isInitialized, isPrescaled, isWCS, main, makeCanvasGraphics, notifyGraphicsHandlers, paintLayer, removeImageGraphicsHandler, scale, scaleToFit, scaleToFit, setAutoCenterImage, setImage, setImage, setImageProcessor, setImmediateMode, setInterpolation, setPrescaled, setScaleHints, setWCS, transformGraphics, transformGraphics, updateImage
 
Methods inherited from class diva.canvas.JCanvas
getCanvasPane, getToolTipText, isFocusTraversable, paint, print, print, processMouseEvent, processMouseMotionEvent, repaint, setCanvasPane, setDoubleBuffered, setPreferredSize
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
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, transferFocusBackward, 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, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jsky.image.gui.GraphicsImageDisplay
getCanvasGraphics, getFitsImage, getPixelValue, getPixelValues, isClear
 
Methods inherited from interface jsky.image.gui.BasicImageDisplay
addImageGraphicsHandler, getCanvas, getCoordinateConverter, getDisplayImage, getImage, getImageHeight, getImageProcessor, getImageWidth, getInterpolation, getOrigin, getScale, getScaleHints, getVisibleArea, getWCS, isAutoCenterImage, isImmediateMode, isInitialized, isPrescaled, isWCS, removeImageGraphicsHandler, scaleToFit, setAutoCenterImage, setImage, setImageProcessor, setImmediateMode, setInterpolation, setPrescaled, setScaleHints, setWCS, updateImage
 

Constructor Detail

DivaMainImageDisplay

public DivaMainImageDisplay(diva.canvas.GraphicsPane pane)
Initialize with the given Diva GraphicsPane (contains the layers used to draw the image and graphcs. Note that you need to call setParentFrame() if you use this version.

Parameters:
pane - the Diva GraphicsPane to use (contains the layers used to display the image and graphics)

DivaMainImageDisplay

public DivaMainImageDisplay()
Default constructor. Note that you need to call setParentFrame() if you use this version).


DivaMainImageDisplay

public DivaMainImageDisplay(diva.canvas.GraphicsPane pane,
                            java.awt.Component parent)
Construct a DivaMainImageDisplay widget.

Parameters:
pane - the Diva GraphicsPane to use (contains the layers used to display the image and graphics)
parent - the top level parent frame (or internal frame) used to close the window

DivaMainImageDisplay

public DivaMainImageDisplay(java.awt.Component parent)
Construct a DivaMainImageDisplay widget.

Parameters:
parent - the top level parent frame (or internal frame) used to close the window
Method Detail

newWindow

public java.awt.Component newWindow()
Open up another window like this one and return a reference to it.

Note: derived classes should redefine this to return an instance of the correct class, which should be derived JFrame or JInternalFrame.


getCanvasDraw

public CanvasDraw getCanvasDraw()
Return the object that manages interactive drawing on the image


setFilename

public void setFilename(java.lang.String fileOrUrl)
Set the image file to display.

Specified by:
setFilename in interface MainImageDisplay

setFilename

public void setFilename(java.lang.String fileOrUrl,
                        java.net.URL url)
Set the image file to display and use the given URL for the image history (the URL is used if the file is deleted).

Specified by:
setFilename in interface MainImageDisplay

getFilename

public java.lang.String getFilename()
Return the image file name, if there is one.

Specified by:
getFilename in interface MainImageDisplay

isJAIImageType

public boolean isJAIImageType(java.lang.String filename)
Return true if the given filename has a suffix that indicates that it is not a FITS file and is one of the standard JAI supported image types.


clear

public void clear()
Clear the image display.

Specified by:
clear in interface GraphicsImageDisplay
Overrides:
clear in class DivaGraphicsImageDisplay

displayFITSTable

public void displayFITSTable(int hdu)
Display the FITS table at the given HDU index (if supported).

Specified by:
displayFITSTable in interface MainImageDisplay

getObjectName

public java.lang.String getObjectName()
Return the name of the object being displayed, if known, otherwise null.

Specified by:
getObjectName in interface MainImageDisplay

setURL

public void setURL(java.net.URL url)
Set the URL for the image to display. This method first tries to download the URL to a temporary file, since files can be displayed more efficiently. If that does not work, it tries to load the URL directly.

Specified by:
setURL in interface MainImageDisplay

getURL

public java.net.URL getURL()
Return the image URL, if there is one.

Specified by:
getURL in interface MainImageDisplay

initFITSImage

protected void initFITSImage(FITSImage fitsImage)
                      throws java.io.IOException,
                             nom.tam.fits.FitsException
Called after a new FITSImage object was created to do FITS specific initialization

Throws:
java.io.IOException
nom.tam.fits.FitsException

updateImageData

public void updateImageData()
Update the display to show the contents of the currently loaded image file.

Specified by:
updateImageData in interface MainImageDisplay

addToHistory

protected void addToHistory()
Add the current URL to the history list


addToHistory

protected void addToHistory(ImageHistoryItem historyItem)
Add the given item to the history list, removing duplicates and keeping the list size to a maximum of 20.


makeImageHistoryItem

protected ImageHistoryItem makeImageHistoryItem()
Make and return an ImageHistoryItem for the current image


getMaxHistoryItems

public int getMaxHistoryItems()
Return the max number of items in the history list.


setMaxHistoryItems

public void setMaxHistoryItems(int n)
Set the max number of items in the history list.


mergeHistoryList

protected java.util.LinkedList mergeHistoryList()
Merge the historyList with current serialized version (another instance may have written it since we read it last).


clearHistory

protected void clearHistory()
Add the current URL to the history list


saveHistory

protected void saveHistory(boolean merge)
Save the current history list to a file.

Parameters:
merge - if true, merge the list with the existing list on disk.

loadHistory

protected void loadHistory()
Try to load the history list from a file, and create an empty list if that fails.


cleanupHistoryList

protected void cleanupHistoryList()
Remove any items in the history list for files that no longer exist.


cleanupImageCache

protected void cleanupImageCache()
Remove any files from the image cache that are no longer in the history list.


fileInHistoryList

public boolean fileInHistoryList(java.io.File file)
Return true if the given file is referenced in the history list.


getImageHistoryItem

protected ImageHistoryItem getImageHistoryItem(java.io.File file)
Return the ImageHistoryItem from the history list, or null if not found.


initProgressPanel

protected void initProgressPanel()
Make the download progress panel if needed, and display it


loadImageFromURL

protected void loadImageFromURL(java.net.URL url)
Load an image directly from the given URL in a separate thread, so the user can monitor progress and cancel it, if needed.


downloadImageToTempFile

protected void downloadImageToTempFile(java.net.URL url)
Download the given URL to a temporary file in a separate thread and then display the image file when done.


setDownloadState

protected void setDownloadState(boolean downloading)
Set the state of the menubar/toolbar actions

Parameters:
downloading - set to true if an image is being downloaded

updateEnabledStates

protected void updateEnabledStates()
Update the enabled states of some menu/toolbar actions.


back

public void back()
Go back to the previous image in the history list


forward

public void forward()
Go forward to the next image in the history list


loadCachedImage

public boolean loadCachedImage(double ra,
                               double dec)
If an image was previously loaded in this session with a center near the given ra,dec coordinates, reload it, otherwise generate a blank image with the center at those coordinates (in J2000).

Parameters:
ra - the RA coordinate for the image (J2000)
dec - the Dec coordinate for the image (J2000)
Returns:
true if an image was loaded

addHistoryMenuItems

public void addHistoryMenuItems(javax.swing.JMenu menu)
Add history items (for previously loaded images) to the given menu


addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
register to receive change events from this object whenever the image or cut levels are changed.

Specified by:
addChangeListener in interface MainImageDisplay

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Stop receiving change events from this object.

Specified by:
removeChangeListener in interface MainImageDisplay

fireChange

protected void fireChange(ImageChangeEvent e)
Notify any listeners of a change in the image or cut levels.


isMainWindow

public boolean isMainWindow()
Return true if this is the main application window (enables exit menu item)


exit

public void exit()
Exit the application (called from exit menu).


newImage

protected void newImage(boolean before)
This method is called before and after a new image is loaded, each time with a different argument.

Overrides:
newImage in class DivaGraphicsImageDisplay
Parameters:
before - set to true before the image is loaded and false afterwards

updateImage

protected void updateImage(javax.media.jai.PlanarImage im)
This method updates the source image for this window, which is scaled to the correct magnification before displaying.

Overrides:
updateImage in class DivaGraphicsImageDisplay

setOrigin

public void setOrigin(java.awt.geom.Point2D.Double origin)
Set the origin of the image to display in canvas coordinates.

Specified by:
setOrigin in interface BasicImageDisplay
Overrides:
setOrigin in class DivaGraphicsImageDisplay

setScale

public void setScale(float scale)
Set the scale (zoom factor) for the image. This also adjusts the origin so that the center of the image remains about the same.

Specified by:
setScale in interface BasicImageDisplay
Overrides:
setScale in class DivaGraphicsImageDisplay

checkExtensions

public void checkExtensions(boolean show)
If there are multiple images and/or tables in the image file, pop up a dialog to select the one to display.

Parameters:
show - if true, always show the window, if there are any extensions, otherwise, just update the window if it is already showing or show it if the primary extension is empty.

saveGraphicsWithImage

public void saveGraphicsWithImage()
Save the current image graphics to a binary FITS table in the current image


close

public void close()
Close the window


dispose

public void dispose()
Cleanup when the window is no longer needed.


editCutLevels

public void editCutLevels()
Pop up a dialog window for displaying and setting the image cut levls.


editColors

public void editColors()
Pop up a dialog window for displaying and setting the image colors.


pickObject

public void pickObject()
Pop up a dialog window to select objects (stars, galaxies) in the image


pickedObject

protected void pickedObject()
Called when an object is selected in the Pick Object window.


viewFitsExtensions

public void viewFitsExtensions()
Pop up a dialog window for displaying a table of the FITS extensions


viewFitsKeywords

public void viewFitsKeywords()
Pop up a dialog window for displaying the FITS Keywords.


viewImageProperties

public void viewImageProperties()
Pop up a dialog window for displaying the image properties.


getDesktop

public javax.swing.JDesktopPane getDesktop()
Return the JDesktopPane, if using internal frames, otherwise null


setDesktop

public void setDesktop(javax.swing.JDesktopPane desktop)
Set the JDesktopPane to use for top level windows, if using internal frames


getRootComponent

public java.awt.Component getRootComponent()
Return the top level parent frame (or internal frame) used to close the window

Specified by:
getRootComponent in interface MainImageDisplay

open

public void open()
Display a file chooser to select a filename to display


makeImageFileChooser

public static javax.swing.JFileChooser makeImageFileChooser()
Create and return a new file chooser to be used to select an image file to display.


openURL

public void openURL()
Display a dialog to enter a URL to display


blankImage

public void blankImage(double ra,
                       double dec)
Display a blank image with the given center coordinates (15' * 60 seconds/minutes).

Specified by:
blankImage in interface GraphicsImageDisplay
Overrides:
blankImage in class DivaGraphicsImageDisplay
Parameters:
ra - RA center coordinate in deg J2000
dec - Dec center coordinate in deg J2000

setSaveNeeded

public void setSaveNeeded(boolean b)
Set to true if the image file has been modified and needs saving.

Specified by:
setSaveNeeded in interface MainImageDisplay

isSaveNeeded

public boolean isSaveNeeded()
Return true if the image file has been modified and needs saving.


checkSave

protected boolean checkSave()
If the current image file has been modified (by adding or deleting a FITS extension, for example), ask the user to confirm saving it.

Returns:
false if the user pressed Cancel when asked to save the file, otherwise true

save

public void save()
Save any changes to the current image file.


saveAs

public void saveAs()
Pop up a dialog to ask the user for a file name, and then save the image to the selected file.

Specified by:
saveAs in interface MainImageDisplay

saveAs

public void saveAs(java.lang.String filename)
Save the current image to the given file, using an image format based on the file suffix, which should be one of ".fits", ".jpg", ".png", or ".tif".

Specified by:
saveAs in interface MainImageDisplay

paintImageAndGraphics

public void paintImageAndGraphics(java.awt.Graphics2D g2D)
Paint the image and graphics to the given graphics object (for save and print features)

Specified by:
paintImageAndGraphics in interface MainImageDisplay

printPreview

public void printPreview()
Display a preview of the what the printed image view will look like.


print

public void print()
Pop up a dialog for printing the image.

Specified by:
print in interface MainImageDisplay

setTitle

public void setTitle(java.lang.String s)
Set the frame's basic title string. (Other info, the file name, etc. may still be appended).


getTitle

public java.lang.String getTitle()
Return the frame's title.


updateTitle

protected void updateTitle()
Set the frame's title.


getParentFrame

public java.awt.Component getParentFrame()
Return the top level parent frame (or internal frame) used to close the window


setParentFrame

public void setParentFrame(java.awt.Component p)
Set the top level parent frame (or internal frame) used to close the window


getOpenAction

public javax.swing.AbstractAction getOpenAction()
Description copied from interface: GenericToolBarTarget
Return the action for "Open"

Specified by:
getOpenAction in interface GenericToolBarTarget

getBackAction

public javax.swing.AbstractAction getBackAction()
Description copied from interface: GenericToolBarTarget
Return the action for "Back"

Specified by:
getBackAction in interface GenericToolBarTarget

getForwAction

public javax.swing.AbstractAction getForwAction()
Description copied from interface: GenericToolBarTarget
Return the action for "Forward"

Specified by:
getForwAction in interface GenericToolBarTarget

getColorsAction

public javax.swing.AbstractAction getColorsAction()

getCutLevelsAction

public javax.swing.AbstractAction getCutLevelsAction()

getSaveAction

public javax.swing.AbstractAction getSaveAction()

getSaveAsAction

public javax.swing.AbstractAction getSaveAsAction()

getPrintPreviewAction

public javax.swing.AbstractAction getPrintPreviewAction()

getPrintAction

public javax.swing.AbstractAction getPrintAction()

getImageCutLevelsFrame

public java.awt.Component getImageCutLevelsFrame()
Return the top level windows (or internal frame) for setting cut levels


getFitsKeywordsFrame

public java.awt.Component getFitsKeywordsFrame()
Return the top level window (or internal frame) for viewing the FITS keywords.


getImagePropertiesFrame

public java.awt.Component getImagePropertiesFrame()
Return the top level window (or internal frame) for viewing image properties


getImageColorsFrame

public java.awt.Component getImageColorsFrame()
Return the top level window (or internal frame) for manipulating image colormaps


getPickObjectFrame

public java.awt.Component getPickObjectFrame()
Return the top level window (or internal frame) for selecting image objects (stars, galaxies)


getPickObjectPanel

public PickObject getPickObjectPanel()
Return the Pick Object panel, if initialized


getFitsHDUChooserFrame

public java.awt.Component getFitsHDUChooserFrame()
Return the top level window (or internal frame) for manipulating FITS extensions


getFitsHDUChooser

public FITSHDUChooser getFitsHDUChooser()
Return the panel for manipulating FITS extensions


getFitsGraphics

public FITSGraphics getFitsGraphics()
Return the object used to save graphics to a FITS table in the image and reload it again later.


getBasePos

public WorldCoords getBasePos()
Return the base or center position in world coordinates. If there is no base position, this method returns the center point of the image. If the image does not support WCS, this method returns (0,0). The position returned here should be used as the base position for any catalog or image server requests.

Specified by:
getBasePos in interface MainImageDisplay

getDefaultSearchRadius

public double[] getDefaultSearchRadius(WorldCoords centerPos,
                                       boolean useImageSize)
Return the default min and max search radius to use for catalog searches, in arcmin.

Specified by:
getDefaultSearchRadius in interface MainImageDisplay
Parameters:
centerPos - the center position for the radius
useImageSize - if true, use the image size to get the search radius
Returns:
an array containing the min and max radius values

getDefaultSearchMagRange

public double[] getDefaultSearchMagRange()
Return the default min and max magnitude values to use for catalog searches, or null if there is no default.

Specified by:
getDefaultSearchMagRange in interface MainImageDisplay
Returns:
an array containing the min and max mag values