jsky.image.graphics.gui
Class FITSGraphics

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

public class FITSGraphics
extends Object

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

Version:
$Revision: 1.8 $
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  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(String extName)
          Delete the table HDU with the given name, if found.
protected  Color getColor(String s)
          Return a color for the given name
protected  String getColorName(Color c)
          Return the name of the given color
protected  Composite getComposite(String s)
          Return a composite for the given composite string as defined in CanvasDraw (0%,100%).
protected  String getCompositeName(Composite composite)
          Return the name corresponding to the given composite.
protected  String getConfig(Paint fill, Paint outline, int lineWidth, Composite composite)
          Return a Tcl formatted list of Tk canvas item style configuration options and values for the given arguments.
protected  String getConfig(String text, Font font, Paint fill)
          Return a Tcl formatted list of Tk canvas item style configuration options and values for the given arguments.
protected  String getCoords(Point2D.Double p)
          Return a Tcl formatted list of two image coordinate values for the given screen coordinate point.
protected  String getCoords(Shape shape)
          Return a Tcl formatted list of image coordinate values for the given screen coordinate shape.
protected  double[] getCoords(String[] coords)
          Convert the given String formatted image coords to doubles in screen coords and return the new array.
protected  Font getFont(String s)
          Return a font for the given name
protected  Composite getStipple(String s)
          Return a composite for the given skycat stipple name (pat0..pat15)
protected  String getType(Shape shape)
          Return the Tk canvas item type name corresponding to the given shape.
 void loadGraphicsFromImage(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(TableHDU hdu)
          Load previously saved graphics from the given FITS binary table.
 void saveGraphicsWithImage(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 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(String extName)
                           throws FitsException
Save the current image graphics to a binary FITS table with the given name in the current image.

Throws:
FitsException

loadGraphicsFromImage

public void loadGraphicsFromImage(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(TableHDU hdu)
                           throws FitsException
Load previously saved graphics from the given FITS binary table.

Throws:
FitsException

deleteHDU

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


getCoords

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


getColor

protected Color getColor(String s)
Return a color for the given name


getColorName

protected String getColorName(Color c)
Return the name of the given color


getFont

protected Font getFont(String s)
Return a font for the given name


getStipple

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


getComposite

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


getCompositeName

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


getType

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


getCoords

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


getCoords

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


getConfig

protected String getConfig(Paint fill,
                           Paint outline,
                           int lineWidth,
                           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 String getConfig(String text,
                           Font font,
                           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}"



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.