jsky.catalog
Class TablePlotSymbol

java.lang.Object
  extended by gnu.jel.DVMap
      extended by jsky.catalog.TablePlotSymbol
All Implemented Interfaces:
gnu.jel.DVResolver
Direct Known Subclasses:
SkycatPlotSymbol

public class TablePlotSymbol
extends gnu.jel.DVMap

Represents the contents of a catalog table plot symbol definition. Any number of plot symbols may be defined. For each row in a table query result, each symbol may be displayed in an image window at a position given by the row's coordinate columns. Each symbol's size, rotation angle, x/y ratio, and label may be calculated from table column values.

Version:
$Revision: 1.2 $
Author:
Allan Brighton

Field Summary
static int ARROW
           
static int CIRCLE
           
static java.lang.String[] COLOR_NAMES
           
static java.awt.Color[] COLORS
           
static int COMPASS
           
static int CROSS
           
static int DEFAULT_DEC_COL
          The default table column index containing the Dec world coordinate value
static double DEFAULT_EQUINOX
          The default equinox for RA and Dec
static int DEFAULT_RA_COL
          The default table column index containing the RA world coordinate value
static int DIAMOND
           
static int ELLIPSE
           
static int LINE
           
static int PLUS
           
static int SQUARE
           
static java.lang.String[] SYMBOLS
          valid symbols (keep in the same order as the constants above
static int TRIANGLE
           
 
Constructor Summary
TablePlotSymbol()
          Initialize an TablePlotSymbol with the default values.
TablePlotSymbol(TableQueryResult table, java.lang.String[] colNames, java.lang.String shapeName, java.lang.String fg, java.lang.String bg, java.lang.String ratio, java.lang.String angle, java.lang.String label, java.lang.String cond, java.lang.String size, java.lang.String units)
          Initialize a TablePlotSymbol from the given values.
TablePlotSymbol(TableQueryResult table, java.lang.String cols, java.lang.String symbol, java.lang.String expr)
          Parses the given fields from a plot symbol definition in Tcl list format and makes the values available via methods.
 
Method Summary
 java.lang.String getAngle()
          Return the symbol's rotation angle (may be an expression using column names)
 double getAngle(java.util.Vector rowVec)
          Return the symbol's rotation angle, evaluating the expression for the given row.
 java.awt.Color getBg()
          Return the symbol's background color
 java.awt.Shape getBoundingShape(java.awt.Shape shape)
          If this symbol type has an internal area, return the given shape, otherwise return the bounding box of the shape.
 int[] getColIndexes()
          Return the array of column indexes for column names
 java.lang.String[] getColNames()
          Return the array of column names used in the symbol expressions
 java.lang.String getColNamesList()
          Return a list of column names used in the symbol expressions in Tcl list format
 java.lang.String getColorName(java.awt.Color c)
          Return the Color name, given a Color object, if known, otherwise just "yellow", if not known.
 java.lang.String getCond()
          Return the condition under which the symbol will be plotted (may be an expression using column names)
 boolean getCond(java.util.Vector rowVec)
          Return the condition under which the symbol will be plotted, evaluating the expression for the given row.
 int getDecCol()
          Return the index of the center position Dec column
 java.lang.String getDescription()
          Return the symbol description, or null if not available
 double getDoubleProperty(java.lang.String name)
          Called by reflection for the DVMap interface to get the value of the named variable of type Double
 double getEquinox()
          Return the equinox of the RA and DEC columns
 java.awt.Color getFg()
          Return the symbol's foreground color (if no color is specified, use 2 colors: black and white)
 double getFloatProperty(java.lang.String name)
          Called by reflection for the DVMap interface to get the value of the named variable of type Float
 java.lang.String getLabel()
          Return the symbol's label (may be an expression using column names)
 java.lang.String getLabel(java.util.Vector rowVec)
          Return the symbol's label, evaluating the expression for the given row.
 java.lang.String getName()
          Return the display name of the symbol
 java.lang.Object getObjectProperty(java.lang.String name)
          Called by reflection for the DVMap interface to get the value of the named variable of type Object
static java.lang.String getPlotSymbolInfo(TablePlotSymbol[] symbols)
          Return a String in Tcl list format describing the given array of plot symbol objects.
 int getRaCol()
          Return the index of the center position RA column
 java.lang.String getRatio()
          Return the X/Y size ratio (stretching) (may be expression using column names)
 double getRatio(java.util.Vector rowVec)
          Return the symbol's ratio, evaluating the expression for the given row.
 RowCoordinates getRowCoordinates()
          Return an object storing the column indexes where RA and Dec are found
 int getShape()
          Return the symbol's shape as a constant (CIRCLE, ELLIPSE, etc...).
 java.lang.String getShapeName()
          Return the symbol shape name
 java.lang.String getSize()
          Return the symbol's size (may be an expression using column names)
 double getSize(java.util.Vector rowVec)
          Return the symbol's size, evaluating the size expression for the given row.
 java.lang.String getStringProperty(java.lang.String name)
          Called by reflection for the DVMap interface to get the value of the named variable of type String
 TableQueryResult getTable()
          Return the catalog table containing the data to be plotted
 java.lang.String getTypeName(java.lang.String name)
          Implements the DVMap interface
 java.lang.String getUnits()
          Return the units of the symbol size ("image" for image pixels, "deg equinox" for world coordinate degrees
static TablePlotSymbol[] parsePlotSymbolInfo(java.lang.String symbolInfo)
          Parse the plot symbol information in Tcl list format and return an array of objects describing it.
 void setAngle(java.lang.String angle)
          Return the symbol's rotation angle (may be an expression using column names)
 void setBg(java.awt.Color color)
          Set the symbol's background color
 void setBg(java.lang.String colorName)
          Set the symbol's background color
 void setColNames(java.lang.String[] colNames)
          Set the array of column names used in the symbol expressions
 void setCond(java.lang.String cond)
          Set the condition under which the symbol will be plotted (may be an expression using column names)
 void setDecCol(int decCol)
          Set the index of the center position Dec column (default 2)
 void setDescription(java.lang.String description)
          Set the symbol description
 void setEquinox(double equinox)
          Set the equinox of the RA and DEC columns (default 2000)
 void setFg(java.awt.Color color)
          Set the symbol's foreground color
 void setFg(java.lang.String colorName)
          Set the symbol's foreground color
 void setLabel(java.lang.String label)
          Set the symbol's label (may be an expression using column names)
 void setName(java.lang.String name)
          Set the display name of the symbol
 void setRaCol(int raCol)
          Set the index of the center position RA column (default 1)
 void setRatio(java.lang.String ratio)
          Return the X/Y size ratio (stretching) (may be expression using column names)
 void setShape(int shape)
          Set the symbol's shape as a constant (CIRCLE, ELLIPSE, etc...).
 void setShapeName(java.lang.String shapeName)
          Set the symbol shape name
 void setSize(java.lang.String size)
          Set the symbol's size (may be an expression using column names)
 void setTable(TableQueryResult table)
          Set the catalog table containing the data to be plotted
 void setUnits(java.lang.String units)
          Set the units of the symbol size ("image" for image pixels, "deg equinox" for world coordinate degrees
 
Methods inherited from class gnu.jel.DVMap
translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

SQUARE

public static final int SQUARE
See Also:
Constant Field Values

PLUS

public static final int PLUS
See Also:
Constant Field Values

CROSS

public static final int CROSS
See Also:
Constant Field Values

TRIANGLE

public static final int TRIANGLE
See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
See Also:
Constant Field Values

ELLIPSE

public static final int ELLIPSE
See Also:
Constant Field Values

COMPASS

public static final int COMPASS
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

ARROW

public static final int ARROW
See Also:
Constant Field Values

SYMBOLS

public static final java.lang.String[] SYMBOLS
valid symbols (keep in the same order as the constants above


COLOR_NAMES

public static final java.lang.String[] COLOR_NAMES

COLORS

public static final java.awt.Color[] COLORS

DEFAULT_RA_COL

public static final int DEFAULT_RA_COL
The default table column index containing the RA world coordinate value

See Also:
Constant Field Values

DEFAULT_DEC_COL

public static final int DEFAULT_DEC_COL
The default table column index containing the Dec world coordinate value

See Also:
Constant Field Values

DEFAULT_EQUINOX

public static final double DEFAULT_EQUINOX
The default equinox for RA and Dec

See Also:
Constant Field Values
Constructor Detail

TablePlotSymbol

public TablePlotSymbol()
Initialize an TablePlotSymbol with the default values.


TablePlotSymbol

public TablePlotSymbol(TableQueryResult table,
                       java.lang.String cols,
                       java.lang.String symbol,
                       java.lang.String expr)
Parses the given fields from a plot symbol definition in Tcl list format and makes the values available via methods. Default values are filled in where needed.

Parameters:
table - contains the table data and information
cols - a Tcl list of column names that may be used in symbol expressions
symbol - a Tcl list of the form {shape color ratio angle label condition}
expr - a Tcl list of the form {sizeExpr units}

TablePlotSymbol

public TablePlotSymbol(TableQueryResult table,
                       java.lang.String[] colNames,
                       java.lang.String shapeName,
                       java.lang.String fg,
                       java.lang.String bg,
                       java.lang.String ratio,
                       java.lang.String angle,
                       java.lang.String label,
                       java.lang.String cond,
                       java.lang.String size,
                       java.lang.String units)
Initialize a TablePlotSymbol from the given values.

Parameters:
table - contains the table data and information
colNames - an array of column headings used as variables
shapeName - the name of the plot symbol shape
fg - the name of the foreground color of the plot symbol
bg - the name of the background color of the plot symbol
ratio - the x/y ratio expression (stretch)
angle - the angle expression
label - the label expression
cond - the condition expression
size - the symbol size expression
units - the units of the symbol size
Method Detail

parsePlotSymbolInfo

public static TablePlotSymbol[] parsePlotSymbolInfo(java.lang.String symbolInfo)
Parse the plot symbol information in Tcl list format and return an array of objects describing it. Each symbol description needs to be in Tcl list format {colList shapeInfo sizeInfo}, with each symbol description separated by a colon ":".

Parameters:
symbolInfo - plot symbol description
Returns:
an array of TablePlotSymbol objects, one for each plot symbol defined.

getPlotSymbolInfo

public static java.lang.String getPlotSymbolInfo(TablePlotSymbol[] symbols)
Return a String in Tcl list format describing the given array of plot symbol objects.

Parameters:
symbols - an array of objects describing table plot symbols
Returns:
a string where each symbol description is in Tcl list format {colList shapeInfo sizeInfo}, with each symbol description separated by a colon ":".

getRowCoordinates

public RowCoordinates getRowCoordinates()
Return an object storing the column indexes where RA and Dec are found


setName

public void setName(java.lang.String name)
Set the display name of the symbol


getName

public java.lang.String getName()
Return the display name of the symbol


setDescription

public void setDescription(java.lang.String description)
Set the symbol description


getDescription

public java.lang.String getDescription()
Return the symbol description, or null if not available


getColorName

public java.lang.String getColorName(java.awt.Color c)
Return the Color name, given a Color object, if known, otherwise just "yellow", if not known.


setTable

public void setTable(TableQueryResult table)
Set the catalog table containing the data to be plotted


getTable

public TableQueryResult getTable()
Return the catalog table containing the data to be plotted


getRaCol

public int getRaCol()
Return the index of the center position RA column


setRaCol

public void setRaCol(int raCol)
Set the index of the center position RA column (default 1)


getDecCol

public int getDecCol()
Return the index of the center position Dec column


setDecCol

public void setDecCol(int decCol)
Set the index of the center position Dec column (default 2)


getEquinox

public double getEquinox()
Return the equinox of the RA and DEC columns


setEquinox

public void setEquinox(double equinox)
Set the equinox of the RA and DEC columns (default 2000)


setColNames

public void setColNames(java.lang.String[] colNames)
Set the array of column names used in the symbol expressions


getColNames

public java.lang.String[] getColNames()
Return the array of column names used in the symbol expressions


getColIndexes

public int[] getColIndexes()
Return the array of column indexes for column names


getColNamesList

public java.lang.String getColNamesList()
Return a list of column names used in the symbol expressions in Tcl list format


setShape

public void setShape(int shape)
Set the symbol's shape as a constant (CIRCLE, ELLIPSE, etc...).


getShape

public int getShape()
Return the symbol's shape as a constant (CIRCLE, ELLIPSE, etc...). (Note: this method could return a Shape object, but the coordinates are different for each row).


setShapeName

public void setShapeName(java.lang.String shapeName)
Set the symbol shape name


getShapeName

public java.lang.String getShapeName()
Return the symbol shape name


getBoundingShape

public java.awt.Shape getBoundingShape(java.awt.Shape shape)
If this symbol type has an internal area, return the given shape, otherwise return the bounding box of the shape.


setFg

public void setFg(java.lang.String colorName)
Set the symbol's foreground color


setFg

public void setFg(java.awt.Color color)
Set the symbol's foreground color


getFg

public java.awt.Color getFg()
Return the symbol's foreground color (if no color is specified, use 2 colors: black and white)


setBg

public void setBg(java.lang.String colorName)
Set the symbol's background color


setBg

public void setBg(java.awt.Color color)
Set the symbol's background color


getBg

public java.awt.Color getBg()
Return the symbol's background color


setRatio

public void setRatio(java.lang.String ratio)
Return the X/Y size ratio (stretching) (may be expression using column names)


getRatio

public java.lang.String getRatio()
Return the X/Y size ratio (stretching) (may be expression using column names)


getRatio

public double getRatio(java.util.Vector rowVec)
Return the symbol's ratio, evaluating the expression for the given row.


setAngle

public void setAngle(java.lang.String angle)
Return the symbol's rotation angle (may be an expression using column names)


getAngle

public java.lang.String getAngle()
Return the symbol's rotation angle (may be an expression using column names)


getAngle

public double getAngle(java.util.Vector rowVec)
Return the symbol's rotation angle, evaluating the expression for the given row.


setLabel

public void setLabel(java.lang.String label)
Set the symbol's label (may be an expression using column names)


getLabel

public java.lang.String getLabel()
Return the symbol's label (may be an expression using column names)


getLabel

public java.lang.String getLabel(java.util.Vector rowVec)
Return the symbol's label, evaluating the expression for the given row.


setCond

public void setCond(java.lang.String cond)
Set the condition under which the symbol will be plotted (may be an expression using column names)


getCond

public java.lang.String getCond()
Return the condition under which the symbol will be plotted (may be an expression using column names)


getCond

public boolean getCond(java.util.Vector rowVec)
Return the condition under which the symbol will be plotted, evaluating the expression for the given row.


setSize

public void setSize(java.lang.String size)
Set the symbol's size (may be an expression using column names)


getSize

public java.lang.String getSize()
Return the symbol's size (may be an expression using column names)


getSize

public double getSize(java.util.Vector rowVec)
Return the symbol's size, evaluating the size expression for the given row.


setUnits

public void setUnits(java.lang.String units)
Set the units of the symbol size ("image" for image pixels, "deg equinox" for world coordinate degrees


getUnits

public java.lang.String getUnits()
Return the units of the symbol size ("image" for image pixels, "deg equinox" for world coordinate degrees


getTypeName

public java.lang.String getTypeName(java.lang.String name)
Implements the DVMap interface


getFloatProperty

public double getFloatProperty(java.lang.String name)
Called by reflection for the DVMap interface to get the value of the named variable of type Float


getDoubleProperty

public double getDoubleProperty(java.lang.String name)
Called by reflection for the DVMap interface to get the value of the named variable of type Double


getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
Called by reflection for the DVMap interface to get the value of the named variable of type String


getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String name)
Called by reflection for the DVMap interface to get the value of the named variable of type Object