jsky.image.graphics.gui
Class FITSGraphics

java.lang.Object
  extended by jsky.image.graphics.gui.FITSGraphics

public class FITSGraphics
extends java.lang.Object

This class allows you to save the current image graphics to a FITS binary table and reload it again later.

Version:
$Revision: 1.1 $
Author:
Allan Brighton

Field Summary
protected  CanvasDraw canvasDraw
          User interface object managing a list of graphics objects.
protected  DivaImageGraphics graphics
          Object managing image graphics
protected  DivaMainImageDisplay imageDisplay
          The target image display.
protected  diva.canvas.interactor.SelectionInteractor interactor
          Handles selections for graphics objects.
protected static int[] PATTERNS
          Maps a skycat pattern (pat0..15) index to CanvasDraw composite index
 
Constructor Summary
FITSGraphics(DivaMainImageDisplay imageDisplay)
          Initialize with the image display object.
 
Method Summary
 void deleteHDU(java.lang.String extName)
          Delete the table HDU with the given name, if found.
protected  java.awt.Color getColor(java.lang.String s)
          Return a color for the given name
protected  java.lang.String getColorName(java.awt.Color c)
          Return the name of the given color
protected  java.awt.Composite getComposite(java.lang.String s)
          Return a composite for the given composite string as defined in CanvasDraw (0%,100%).
protected  java.lang.String getCompositeName(java.awt.Composite composite)
          Return the name corresponding to the given composite.
protected  java.lang.String getConfig(java.awt.Paint fill, java.awt.Paint outline, int lineWidth, java.awt.Composite composite)
          Return a Tcl formatted list of Tk canvas item style configuration options and values for the given arguments.
protected  java.lang.String getConfig(java.lang.String text, java.awt.Font font, java.awt.Paint fill)
          Return a Tcl formatted list of Tk canvas item style configuration options and values for the given arguments.
protected  java.lang.String getCoords(java.awt.geom.Point2D.Double p)
          Return a Tcl formatted list of two image coordinate values for the given screen coordinate point.
protected  java.lang.String getCoords(java.awt.Shape shape)
          Return a Tcl formatted list of image coordinate values for the given screen coordinate shape.
protected  double[] getCoords(java.lang.String[] coords)
          Convert the given String formatted image coords to doubles in screen coords and return the new array.
protected  java.awt.Font getFont(java.lang.String s)
          Return a font for the given name
protected  java.awt.Composite getStipple(java.lang.String s)
          Return a composite for the given skycat stipple name (pat0..pat15)
protected  java.lang.String getType(java.awt.Shape shape)
          Return the Tk canvas item type name corresponding to the given shape.
 void loadGraphicsFromImage(java.lang.String extName)
          If a binary table with the given name is found in the current image, load the previously saved image graphics from it.
 void loadGraphicsFromImage(nom.tam.fits.TableHDU hdu)
          Load previously saved graphics from the given FITS binary table.
 void saveGraphicsWithImage(java.lang.String extName)
          Save the current image graphics to a binary FITS table with the given name in the current image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageDisplay

protected DivaMainImageDisplay imageDisplay
The target image display.


graphics

protected DivaImageGraphics graphics
Object managing image graphics


canvasDraw

protected CanvasDraw canvasDraw
User interface object managing a list of graphics objects.


interactor

protected diva.canvas.interactor.SelectionInteractor interactor
Handles selections for graphics objects.


PATTERNS

protected static final int[] PATTERNS
Maps a skycat pattern (pat0..15) index to CanvasDraw composite index

Constructor Detail

FITSGraphics

public FITSGraphics(DivaMainImageDisplay imageDisplay)
Initialize with the image display object.

Parameters:
imageDisplay - used to access the JCanvas and DivaImageGraphics objects
Method Detail

saveGraphicsWithImage

public void saveGraphicsWithImage(java.lang.String extName)
                           throws nom.tam.fits.FitsException
Save the current image graphics to a binary FITS table with the given name in the current image.

Throws:
nom.tam.fits.FitsException

loadGraphicsFromImage

public void loadGraphicsFromImage(java.lang.String extName)
If a binary table with the given name is found in the current image, load the previously saved image graphics from it.


loadGraphicsFromImage

public void loadGraphicsFromImage(nom.tam.fits.TableHDU hdu)
                           throws nom.tam.fits.FitsException
Load previously saved graphics from the given FITS binary table.

Throws:
nom.tam.fits.FitsException

deleteHDU

public void deleteHDU(java.lang.String extName)
Delete the table HDU with the given name, if found.


getCoords

protected double[] getCoords(java.lang.String[] coords)
Convert the given String formatted image coords to doubles in screen coords and return the new array.


getColor

protected java.awt.Color getColor(java.lang.String s)
Return a color for the given name


getColorName

protected java.lang.String getColorName(java.awt.Color c)
Return the name of the given color


getFont

protected java.awt.Font getFont(java.lang.String s)
Return a font for the given name


getStipple

protected java.awt.Composite getStipple(java.lang.String s)
Return a composite for the given skycat stipple name (pat0..pat15)


getComposite

protected java.awt.Composite getComposite(java.lang.String s)
Return a composite for the given composite string as defined in CanvasDraw (0%,100%).


getCompositeName

protected java.lang.String getCompositeName(java.awt.Composite composite)
Return the name corresponding to the given composite.


getType

protected java.lang.String getType(java.awt.Shape shape)
Return the Tk canvas item type name corresponding to the given shape.


getCoords

protected java.lang.String getCoords(java.awt.Shape shape)
Return a Tcl formatted list of image coordinate values for the given screen coordinate shape.


getCoords

protected java.lang.String getCoords(java.awt.geom.Point2D.Double p)
Return a Tcl formatted list of two image coordinate values for the given screen coordinate point.


getConfig

protected java.lang.String getConfig(java.awt.Paint fill,
                                     java.awt.Paint outline,
                                     int lineWidth,
                                     java.awt.Composite composite)
Return a Tcl formatted list of Tk canvas item style configuration options and values for the given arguments.

Example "{-fill red} {-outline black} {-width 2} {-composite 20%}"

Note: the return value is Tk canvas "style", but may contain other options, such as -composite.


getConfig

protected java.lang.String getConfig(java.lang.String text,
                                     java.awt.Font font,
                                     java.awt.Paint fill)
Return a Tcl formatted list of Tk canvas item style configuration options and values for the given arguments.

Example "{-text {some text}} {-font Dialog-italic-14} {-fill white}"