spv.graphics
Interface GraphicsCanvas

All Superinterfaces:
java.awt.print.Printable
All Known Implementing Classes:
AbstractSensitiveCanvas, AnnotationCanvas, AxisCanvas, CursorCanvas, DataCanvas, FittingWCSSettingsCanvas, FrameCanvas, GraphicsCanvasDecorator, GridCanvas, LegendCanvas, MeasurementCanvas, PanCanvas, RangeCanvas, VelocityCanvas, WCSBoxCanvas, WCSSettingsCanvas

public interface GraphicsCanvas
extends java.awt.print.Printable

This interface is the basis of the Decorator design pattern used by all classes in this package that can add features and capabilities to a data plot.

On April 03, 2001 we added an explicit dependency with the Units class. This was necessary since most implementor classes were having to include an explicit dependency anyway, which led to excessive downcasting by user classes. This approach makes for leaner user code, at the expense of some dependency on a foreign class.

Version:
1.0 - 23Nov98, 1.1 - 20Jan99, 1.2 - 07Feb01
Author:
Ivo Busko (Space Telescope Science Institute)

Field Summary
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Method Summary
 void addToChart(javax.swing.JComponent component)
          Add yourself to the chart.
 void attachDataSet(DataSet ds)
          Associates a DataSet instance with the canvas.
 void attachRange(DataSet ds)
          Associates a DataSet instance with the canvas.
 void clearInternalReferences()
           
 void disableIntegrator()
          Disables the measurement gizmo.
 void enableIntegrator()
          Enables the integrator gizmo.
 void eraseMarkers()
          Erases all markers.
 void eraseMarkers(GraphicsMarker[] markers)
          Erases selected markers.
 java.util.Map getAnnotations()
          Gets a map of annotation objects.
 java.util.List getAnnotationSets()
          Gets the list of annotation sets.
 AxisType getAxisType()
          Gets the axis types.
 int getBottomBorder()
          Gets the bottom border.
 Viewport getCanvasViewport()
          Gets the canvas' current viewport.
 java.util.Vector getDataSets()
          Gets the instances of DataSet associated with this canvas.
 java.awt.Graphics2D getGraphics2D()
          Gets the current Graphics2D context where data is being plotted.
 IntegrationRegionSet getIntegrationRegions()
          Gets the integration regions.
 javax.swing.JComponent getJComponent()
          Gets the Swing JComponent where the plot lives.
 int getLeftBorder()
          Gets the left border.
 Logarithm getLogarithm()
          Gets the Logarithm object associated with this graphics canvas.
 java.lang.Object getOriginalObject()
          Gets the original object that gave rise to the plot.
 java.lang.String getOriginalObjectID()
          Gets the ID of the original object that gave rise to the plot.
 java.lang.Object getPlottableObject()
          Gets the plottable original object that gave rise to the plot.
 int getRightBorder()
          Gets the right border.
 java.awt.Cursor getSystemCursor()
          Gets the cursor.
 int getTopBorder()
          Gets the top border.
 WCSTransform getTransform()
          Gets the coordinate transform.
 Viewport getWCSViewport()
          Gets the current WCS viewport.
 Units getXUnits()
          Gets the X units.
 Units getYUnits()
          Gets the Y units.
 boolean ignoreCursorEvent()
          This is used to synchronize behavior in between canvases that use the same cursor event for different purposes.
 boolean isMeasurementEnabled()
          Checks if measurements are enabled.
 boolean isMouseClickEnabled()
          This is used to syncronize the actions between canvases that process mouse clicks.
 void plot()
          Re-computes everything necessary to plot.
 void print(java.awt.Graphics g)
          Prints the canvas.
 void removeAnnotation(Annotation annotation)
          Removes annotation instance from canvas.
 void reset()
          Resets the canvas to default WCS viewport.
 void reset2()
          Resets the canvas to WCS viewport adjusted to the central part of the data set.
 void setAnnotations(java.util.Map list)
          Sets a list of annotation objects.
 void setAnnotationSets(java.util.List sets)
          Sets a list of annotation sets.
 void setAxisType(AxisType at)
          Sets the axis types.
 void setBorders(int left, int right, int top, int bottom)
          Sets the borders around the canvas viewport.
 void setCursorDashPattern(java.lang.String dash)
          Sets cursor dash pattern.
 void setDecorator(GraphicsCanvas decorator)
          Stores the next level decorator of this canvas.
 void setIntegrationRegions(IntegrationRegionSet regions)
          Sets the integration regions to values specified in a list.
 void setLogarithm(Logarithm log)
          Sets a Logarithm object into this canvas.
 void setMarkers(GraphicsMarker[] markers, java.awt.Color color)
          Sets an array of GraphicsMarker objects.
 void setMinimumSizes(java.awt.Dimension size)
          Sets the canvas minimum size.
 void setOriginalObject(java.lang.Object origin)
          Sets the original object that gave rise to the plot.
 void setOriginalObjectGraphicsID(java.lang.String origin_gid)
          Sets the graphics ID of the original object that gave rise to the plot.
 void setOriginalObjectID(java.lang.String origin_id)
          Sets the ID of the original object that gave rise to the plot.
 void setPlottableObject(java.lang.Object plottable)
          Sets the original plottable object that gave rise to the plot.
 void setSizes(java.awt.Dimension size)
          Sets the canvas size.
 void setSystemCursor(java.awt.Cursor cursor)
          Sets the cursor.
 void setTitles(java.lang.String xtitle, java.lang.String ytitle)
          Sets the axis titles.
 void setWCSViewport(Viewport wcs)
          Sets the WCS viewport.
 void setXAutoLog(boolean auto_log)
          Sets the auto X log mode.
 void setXUnits(Units xunits)
          Sets the X units.
 void setYAutoLog(boolean auto_log)
          Sets the auto Y log mode.
 void setYUnits(Units yunits)
          Sets the Y units.
 void stopCursorObservation()
          Stops listening to the global cursor.
 void undoWCSViewport()
          Goes back to the previous WCS viewport.
 
Methods inherited from interface java.awt.print.Printable
print
 

Method Detail

plot

void plot()
Re-computes everything necessary to plot.


print

void print(java.awt.Graphics g)
Prints the canvas. This method is used internally by all decorators to consolidate the drawing operations into a single Graphics context.

Parameters:
g - the Graphics context where to print

setOriginalObject

void setOriginalObject(java.lang.Object origin)
Sets the original object that gave rise to the plot. This is used to provide callback services based on graphics cursor requests.

Parameters:
origin - the object that gave rise to the plot

setPlottableObject

void setPlottableObject(java.lang.Object plottable)
Sets the original plottable object that gave rise to the plot.

Parameters:
plottable - the plottable object that gave rise to the plot

setOriginalObjectID

void setOriginalObjectID(java.lang.String origin_id)
Sets the ID of the original object that gave rise to the plot. This is used to provide more fine grained object identification.

Parameters:
origin_id - the ID of the object that gave rise to the plot

setOriginalObjectGraphicsID

void setOriginalObjectGraphicsID(java.lang.String origin_gid)
Sets the graphics ID of the original object that gave rise to the plot. The is used to provide a string that ultimately is going to be drawn on screen for human identification purposes.

Parameters:
origin_gid - the graphics ID of the object that gave rise to the plot

getOriginalObject

java.lang.Object getOriginalObject()
Gets the original object that gave rise to the plot.

Returns:
the object that gave rise to the plot

getPlottableObject

java.lang.Object getPlottableObject()
Gets the plottable original object that gave rise to the plot.

Returns:
the plottable object that gave rise to the plot

getOriginalObjectID

java.lang.String getOriginalObjectID()
Gets the ID of the original object that gave rise to the plot.

Returns:
the ID of the object that gave rise to the plot

setDecorator

void setDecorator(GraphicsCanvas decorator)
Stores the next level decorator of this canvas.

Parameters:
decorator - the decorator

attachDataSet

void attachDataSet(DataSet ds)
Associates a DataSet instance with the canvas. Data sets are plotted by attaching them to the plot canvas.

Parameters:
ds - the data set to be attached

getDataSets

java.util.Vector getDataSets()
Gets the instances of DataSet associated with this canvas.

Returns:
the instances of DataSet associated with this canvas

attachRange

void attachRange(DataSet ds)
Associates a DataSet instance with the canvas. The data sets associated with the canvas by this method get plotted using a different model. They are meant to depict data ranges in the independent variable.

Parameters:
ds - the data set to be attached

getLogarithm

Logarithm getLogarithm()
Gets the Logarithm object associated with this graphics canvas.

Returns:
the Logarithm object associated with this graphics canvas

setLogarithm

void setLogarithm(Logarithm log)
Sets a Logarithm object into this canvas. The logarithm object is used to perform conversions between log and linear WCS spaces.

Parameters:
log - a Logarithm object

setSizes

void setSizes(java.awt.Dimension size)
Sets the canvas size.

Parameters:
size - the canvas size

setMinimumSizes

void setMinimumSizes(java.awt.Dimension size)
Sets the canvas minimum size.

Parameters:
size - the canvas minimum size

reset

void reset()
Resets the canvas to default WCS viewport.


reset2

void reset2()
Resets the canvas to WCS viewport adjusted to the central part of the data set.


isMouseClickEnabled

boolean isMouseClickEnabled()
This is used to syncronize the actions between canvases that process mouse clicks.

Returns:
false if other canvases can't be allowed to process mouse clicks

stopCursorObservation

void stopCursorObservation()
Stops listening to the global cursor.


ignoreCursorEvent

boolean ignoreCursorEvent()
This is used to synchronize behavior in between canvases that use the same cursor event for different purposes.

Returns:
true if other canvases should ignore cursor events

getGraphics2D

java.awt.Graphics2D getGraphics2D()
Gets the current Graphics2D context where data is being plotted.

Returns:
the current Graphics2D context, or null if the component wasn't painted yet.

addToChart

void addToChart(javax.swing.JComponent component)
Add yourself to the chart.

Parameters:
component - the chart to be added to

getJComponent

javax.swing.JComponent getJComponent()
Gets the Swing JComponent where the plot lives.

Returns:
the Swing component where the plot lives

getSystemCursor

java.awt.Cursor getSystemCursor()
Gets the cursor.

Returns:
the cursor

setSystemCursor

void setSystemCursor(java.awt.Cursor cursor)
Sets the cursor.

Parameters:
cursor - the cursor

setCursorDashPattern

void setCursorDashPattern(java.lang.String dash)
Sets cursor dash pattern.

Parameters:
dash - the dash pattern

setWCSViewport

void setWCSViewport(Viewport wcs)
Sets the WCS viewport.

Parameters:
wcs - the WCS viewport

undoWCSViewport

void undoWCSViewport()
Goes back to the previous WCS viewport.


getWCSViewport

Viewport getWCSViewport()
Gets the current WCS viewport.

Returns:
the current WCS viewport, or null if no data is attached to this canvas.

setXAutoLog

void setXAutoLog(boolean auto_log)
Sets the auto X log mode.

Parameters:
auto_log - the auto log mode

setYAutoLog

void setYAutoLog(boolean auto_log)
Sets the auto Y log mode.

Parameters:
auto_log - the auto log mode

setAxisType

void setAxisType(AxisType at)
Sets the axis types.

Parameters:
at - the axis type

getAxisType

AxisType getAxisType()
Gets the axis types.

Returns:
the axis type

getCanvasViewport

Viewport getCanvasViewport()
Gets the canvas' current viewport.

Returns:
the canvas' current viewport, or null if the canvas size is not defined yet.

getTransform

WCSTransform getTransform()
Gets the coordinate transform.

Returns:
the coordinate transform, or null if the canvas size is not defined.

getAnnotations

java.util.Map getAnnotations()
Gets a map of annotation objects.

Returns:
the map of annotation objects

setAnnotations

void setAnnotations(java.util.Map list)
Sets a list of annotation objects.

Parameters:
list - the list of annotation objects

removeAnnotation

void removeAnnotation(Annotation annotation)
Removes annotation instance from canvas.

Parameters:
annotation - the instance to be removed

getAnnotationSets

java.util.List getAnnotationSets()
Gets the list of annotation sets.

Returns:
the list of annotation sets

setAnnotationSets

void setAnnotationSets(java.util.List sets)
Sets a list of annotation sets.

Parameters:
sets - the list of annotation sets

setBorders

void setBorders(int left,
                int right,
                int top,
                int bottom)
Sets the borders around the canvas viewport.

Parameters:
left - the left border
right - the right border
top - the top border
bottom - the bottom border

setTitles

void setTitles(java.lang.String xtitle,
               java.lang.String ytitle)
Sets the axis titles.

Parameters:
xtitle - the tite for the X axis
ytitle - the tite for the Y axis

getLeftBorder

int getLeftBorder()
Gets the left border.

Returns:
the left border

getRightBorder

int getRightBorder()
Gets the right border.

Returns:
the left border

getTopBorder

int getTopBorder()
Gets the top border.

Returns:
the left border

getBottomBorder

int getBottomBorder()
Gets the bottom border.

Returns:
the bottom border

getXUnits

Units getXUnits()
Gets the X units.

Returns:
the X units

getYUnits

Units getYUnits()
Gets the Y units.

Returns:
the Y units

setXUnits

void setXUnits(Units xunits)
Sets the X units.

Parameters:
xunits - the X units

setYUnits

void setYUnits(Units yunits)
Sets the Y units.

Parameters:
yunits - the Y units

enableIntegrator

void enableIntegrator()
Enables the integrator gizmo.


disableIntegrator

void disableIntegrator()
Disables the measurement gizmo.


isMeasurementEnabled

boolean isMeasurementEnabled()
Checks if measurements are enabled.

Returns:
true if measurements are enabled

setIntegrationRegions

void setIntegrationRegions(IntegrationRegionSet regions)
Sets the integration regions to values specified in a list.

Parameters:
regions - the region parameters

getIntegrationRegions

IntegrationRegionSet getIntegrationRegions()
Gets the integration regions.

Returns:
the integration regions.

setMarkers

void setMarkers(GraphicsMarker[] markers,
                java.awt.Color color)
Sets an array of GraphicsMarker objects.

Parameters:
markers - the array of GraphicsMarker objects
color - the color to paint the markers

eraseMarkers

void eraseMarkers()
Erases all markers.


eraseMarkers

void eraseMarkers(GraphicsMarker[] markers)
Erases selected markers.

Parameters:
markers - the markers to be erased

clearInternalReferences

void clearInternalReferences()