Class ncsa.horizon.viewer.BasicSelectionViewer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.viewer.BasicSelectionViewer

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ncsa.horizon.viewer.Viewer
                                   |
                                   +----ncsa.horizon.viewer.SelectionViewer
                                           |
                                           +----ncsa.horizon.viewer.BasicSelectionViewer

public class BasicSelectionViewer
extends SelectionViewer
implements Cloneable
This Viewer provides a basic implementation of the methods needed for a SelectionViewer.

Programmer's are encouraged to inspect this code for examples of how to implement the various Viewer methods.


Variable Index

 o coord
CoordinateSystem object for converting between data pixels and world coordinates
 o drawBox
a flag that is true if the last selected box should be drawn
 o drawLine
a flag that is true if the last selected line should be drawn
 o drawPixel
a flag that is true if the last selected pixel should be drawn
 o image
the last image extracted from the current viewable
 o mode
the current display mode (FIT, CENTER, TRUNCATE, or SCALE)
 o newViewable
a flag that is true if a new viewable has been attached
 o pixtrx
ImageDataOrigin object for converting between display pixels and data pixels
 o pref_size
the preferred size of this Panel
 o selbox
the last selected display rectangle
 o selline
the last selected display line
 o selpix
the last selected display pixel
 o SIZE_IMAGE_CENTER
Trim the image to the Viewer size (centered)
 o SIZE_IMAGE_FIT
Fit the image to the Viewer size (default)
 o SIZE_IMAGE_SCALE
Scale the image to the Viewer size (centered)
 o SIZE_IMAGE_TRUNCATE
Trim the image to the Viewer size (centered)
 o slice
the last slice requested from the current viewable
 o viewable
the current viewable

Constructor Index

 o BasicSelectionViewer()
create a BasicSelectionViewer of default preferred size;
 o BasicSelectionViewer(Dimension)
create a BasicSelectionViewer of specified preferred size;
 o BasicSelectionViewer(int, int)
create a BasicSelectionViewer of specified preferred size;

Method Index

 o addViewable(Viewable)
This method adds a reference to a viewable object.
 o clone()
Create a clone of this Viewer Panel.
 o displaySlice()
Display a default slice of the current Viewable.
 o displaySlice(Slice)
Display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
 o getBoxSelection()
get the current selected display box.
 o getDisplaySize()
This method returns the size of the region that displays a Viewable
 o getLineSelection()
get the current selected display Line.
 o getPixelSelection()
get the current selected display pixel.
 o getSliceSelection()
return the current selected Slice, or null if there is no current Viewable;
 o getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
 o getViewSlice()
return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
 o getVoxelSelection()
return the current selected Voxel, or null if there is no current Viewable.
 o imageUpdate(Image, int, int, int, int, int)
This implementation simple issues a repaint() when an image has become available.
 o mouseDown(Event, int, int)
process selection request
 o mouseDrag(Event, int, int)
process a box selection request
 o paint(Graphics)
This implementationm simply calls the update() method.
 o preferredSize()
return the preferred size of this Viewer Panel
 o setBoxSelection(int, int, int, int)
set the current selected display box.
 o setLineSelection(int, int, int, int)
set the current selected display line.
 o setMode(int)
Set the display mode for sizing or trimming the viewable image.
 o setPixelSelection(int, int)
set the current selected display pixel.
 o setSliceSelection(Volume)
set the current selected Slice to the given Volume as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
 o setVoxelSelection(Voxel)
set the current selected Voxel to the one given as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
 o update(Graphics)
Redraw current slice/viewable.

Variables

 o SIZE_IMAGE_FIT
  public final static int SIZE_IMAGE_FIT
Fit the image to the Viewer size (default)
 o SIZE_IMAGE_CENTER
  public final static int SIZE_IMAGE_CENTER
Trim the image to the Viewer size (centered)
 o SIZE_IMAGE_TRUNCATE
  public final static int SIZE_IMAGE_TRUNCATE
Trim the image to the Viewer size (centered)
 o SIZE_IMAGE_SCALE
  public final static int SIZE_IMAGE_SCALE
Scale the image to the Viewer size (centered)
 o drawPixel
  public boolean drawPixel
a flag that is true if the last selected pixel should be drawn
 o drawBox
  public boolean drawBox
a flag that is true if the last selected box should be drawn
 o drawLine
  public boolean drawLine
a flag that is true if the last selected line should be drawn
 o viewable
  protected Viewable viewable
the current viewable
 o mode
  protected int mode
the current display mode (FIT, CENTER, TRUNCATE, or SCALE)
 o image
  protected Image image
the last image extracted from the current viewable
 o slice
  protected Slice slice
the last slice requested from the current viewable
 o pref_size
  protected Dimension pref_size
the preferred size of this Panel
 o pixtrx
  protected ImageDataOrigin pixtrx
ImageDataOrigin object for converting between display pixels and data pixels
 o coord
  protected CoordinateSystem coord
CoordinateSystem object for converting between data pixels and world coordinates
 o selpix
  protected Point selpix
the last selected display pixel
 o selbox
  protected Rectangle selbox
the last selected display rectangle
 o selline
  protected Rectangle selline
the last selected display line
 o newViewable
  protected boolean newViewable
a flag that is true if a new viewable has been attached

Constructors

 o BasicSelectionViewer
  public BasicSelectionViewer()
create a BasicSelectionViewer of default preferred size;
 o BasicSelectionViewer
  public BasicSelectionViewer(Dimension size)
create a BasicSelectionViewer of specified preferred size;
 o BasicSelectionViewer
  public BasicSelectionViewer(int width,
                              int height)
create a BasicSelectionViewer of specified preferred size;

Methods

 o addViewable
  public void addViewable(Viewable dataset)
This method adds a reference to a viewable object.
Parameters:
image - the Viewable object to be added
Overrides:
addViewable in class Viewer
 o getViewable
  public Viewable getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
Returns:
The current Viewable object; null if none present.
Overrides:
getViewable in class Viewer
 o displaySlice
  public void displaySlice(Slice sl)
Display a slice from the current Viewable data, or do nothing if the current Viewable is not set. A null slice means display the default slice.
Overrides:
displaySlice in class Viewer
 o displaySlice
  public void displaySlice()
Display a default slice of the current Viewable.
Overrides:
displaySlice in class Viewer
 o getDisplaySize
  public Dimension getDisplaySize()
This method returns the size of the region that displays a Viewable
Returns:
Dimension of the compoonent
Overrides:
getDisplaySize in class Viewer
See Also:
Dimension, size()
 o clone
  public Object clone() throws CloneNotSupportedException
Create a clone of this Viewer Panel.
Returns:
A clone of this object.
Throws: CloneNotSupportedException
not thrown if called as a BasicSelectionViewer
Overrides:
clone in class Viewer
 o imageUpdate
  public boolean imageUpdate(Image img,
                             int flags,
                             int x,
                             int y,
                             int w,
                             int h)
This implementation simple issues a repaint() when an image has become available.
Overrides:
imageUpdate in class Component
 o getViewSlice
  public Slice getViewSlice()
return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
Overrides:
getViewSlice in class Viewer
 o setPixelSelection
  public void setPixelSelection(int x,
                                int y)
set the current selected display pixel. The location is measured in real display (i.e. screen) pixels relative to the upper left hand corner.
Overrides:
setPixelSelection in class SelectionViewer
 o setBoxSelection
  public void setBoxSelection(int x1,
                              int y1,
                              int x2,
                              int y2)
set the current selected display box. The locations are measured in real display (i.e. screen) pixels relative to the upper left hand corner.
Parameters:
x1,y1 - the location of one vertex of the selected box
x2,y2 - the location of the vertex of the selected box opposite to the one given by x1,y1
Overrides:
setBoxSelection in class SelectionViewer
 o setLineSelection
  public void setLineSelection(int x1,
                               int y1,
                               int x2,
                               int y2)
set the current selected display line. The locations are measured in real display (i.e. screen) pixels relative to the upper left hand corner.
Parameters:
x1,y1 - the location of the start of the line
x2,y2 - the location of the end of the line
Overrides:
setLineSelection in class SelectionViewer
 o getPixelSelection
  public Point getPixelSelection()
get the current selected display pixel.
Overrides:
getPixelSelection in class SelectionViewer
 o getBoxSelection
  public Rectangle getBoxSelection()
get the current selected display box.
Overrides:
getBoxSelection in class SelectionViewer
 o getLineSelection
  public Rectangle getLineSelection()
get the current selected display Line.
Overrides:
getLineSelection in class SelectionViewer
 o getVoxelSelection
  public Voxel getVoxelSelection()
return the current selected Voxel, or null if there is no current Viewable.
Overrides:
getVoxelSelection in class SelectionViewer
 o setVoxelSelection
  public synchronized void setVoxelSelection(Voxel vox)
set the current selected Voxel to the one given as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
Overrides:
setVoxelSelection in class SelectionViewer
 o getSliceSelection
  public Slice getSliceSelection()
return the current selected Slice, or null if there is no current Viewable;
Overrides:
getSliceSelection in class SelectionViewer
 o setSliceSelection
  public synchronized void setSliceSelection(Volume vol)
set the current selected Slice to the given Volume as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
Overrides:
setSliceSelection in class SelectionViewer
 o setMode
  public void setMode(int _mode)
Set the display mode for sizing or trimming the viewable image.
Parameters:
_mode - The mode to use. Valid modes are SIZE_IMAGE_FIT, SIZE_IMAGE_CENTER, and SIZE_IMAGE_TRUNCATE.
 o preferredSize
  public Dimension preferredSize()
return the preferred size of this Viewer Panel
Overrides:
preferredSize in class Container
 o update
  public void update(Graphics g)
Redraw current slice/viewable.
Overrides:
update in class Component
 o paint
  public void paint(Graphics g)
This implementationm simply calls the update() method.
Parameters:
g - The graphics context to paint.
Overrides:
paint in class Component
 o mouseDown
  public boolean mouseDown(Event evt,
                           int x,
                           int y)
process selection request
Overrides:
mouseDown in class Component
 o mouseDrag
  public boolean mouseDrag(Event evt,
                           int x,
                           int y)
process a box selection request
Overrides:
mouseDrag in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index