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

Class ncsa.horizon.viewer.PosTrackerViewer

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

public class PosTrackerViewer
extends Viewer
implements Cloneable
A Viewer that displays the current position under the mouse.

This Viewer contains a display area of a configurable size and below it a region for displaying the current coordinate position. When the mouse is placed within the display area, the position beneath the mouse is displayed at the bottom of the viewer. Moving the mouse updates the position display in real time.

This class is meant to serve as an example of how to implement a Viewer, a Viewable, and related coordinate classes.


Variable Index

 o coordSys
 o data
 o defautlDisplayHeight
default height of display area if not specified in constructor
 o defautlDisplayWidth
default width of display area if not specified in constructor
 o display
 o newViewable
 o pixelMap
 o positionDisplay
 o slice
 o sliceSize
 o view
 o xCoordPos
 o xDataPos
 o xLabel
 o yCoordPos
 o yDataPos
 o yLabel

Constructor Index

 o PosTrackerViewer()
create a viewer with no Viewable to display
 o PosTrackerViewer(int, int)
create a viewer with a given display size

Method Index

 o addViewable(Viewable)
replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
 o clone()
produce a copy of this viewer.
 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 getDisplaySize()
return the size of the display area
 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 mouseMove(Event, int, int)
 o preferredSize()
 o reshape(int, int, int, int)
resize the viewer so that the display area takes up as much of the available space as possible.
 o setDisplaySize(Dimension)
set the size of the display area
 o setDisplaySize(int, int)
set the size of the display area
 o setPixelMap(Slice, Rectangle)
set the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the current Viewable
 o updatePixelMap()
update the ImageDisplayMap object, pixtrans (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updatePixelMap(Slice, Rectangle)
update the ImageDisplayMap object, pixtrans (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updatePosDisplay(int, int)
update the position display for a given display pixel

Variables

 o data
  protected Viewable data
 o slice
  protected Slice slice
 o pixelMap
  protected ImageDisplayMap pixelMap
 o coordSys
  protected CoordinateSystem coordSys
 o view
  protected Image view
 o sliceSize
  protected Dimension sliceSize
 o display
  protected ImageCanvas display
 o xDataPos
  protected Label xDataPos
 o yDataPos
  protected Label yDataPos
 o xLabel
  protected Label xLabel
 o yLabel
  protected Label yLabel
 o xCoordPos
  protected Label xCoordPos
 o yCoordPos
  protected Label yCoordPos
 o positionDisplay
  protected Panel positionDisplay
 o newViewable
  protected boolean newViewable
 o defautlDisplayWidth
  public final static int defautlDisplayWidth
default width of display area if not specified in constructor
 o defautlDisplayHeight
  public final static int defautlDisplayHeight
default height of display area if not specified in constructor

Constructors

 o PosTrackerViewer
  public PosTrackerViewer()
create a viewer with no Viewable to display
 o PosTrackerViewer
  public PosTrackerViewer(int width,
                          int height)
create a viewer with a given display size
Parameters:
width - width of the display area

Methods

 o addViewable
  public synchronized void addViewable(Viewable data)
replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
Overrides:
addViewable in class Viewer
 o getViewable
  public synchronized Viewable getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
Overrides:
getViewable in class Viewer
 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 displaySlice
  public synchronized void displaySlice(Slice sl)
display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
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()
return the size of the display area
Overrides:
getDisplaySize in class Viewer
 o setDisplaySize
  public synchronized void setDisplaySize(int width,
                                          int height)
set the size of the display area
 o setDisplaySize
  public void setDisplaySize(Dimension sz)
set the size of the display area
 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
resize the viewer so that the display area takes up as much of the available space as possible.
Overrides:
reshape in class Component
 o mouseMove
  public boolean mouseMove(Event event,
                           int x,
                           int y)
Overrides:
mouseMove in class Component
 o preferredSize
  public Dimension preferredSize()
Overrides:
preferredSize in class Container
 o setPixelMap
  protected synchronized void setPixelMap(Slice dataSlice,
                                          Rectangle displayRegion)
set the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the current Viewable
Parameters:
dataSlice - the slice to be displayed; if null, do not change the slice
displayRegion - the region of the display being used; if null, assume that as much of the display as possible will be used (unless dataSlice is also null, in which case, nothing is changed).
 o updatePixelMap
  protected synchronized void updatePixelMap(Slice dataSlice,
                                             Rectangle displayRegion)
update the ImageDisplayMap object, pixtrans (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
Parameters:
dataSlice - the slice to be displayed; if null, do not change the slice
displayRegion - the region of the display being used; if null, assume that as much of the display as possible will be used (unless dataSlice is also null, in which case, nothing is changed).
 o updatePixelMap
  protected synchronized void updatePixelMap()
update the ImageDisplayMap object, pixtrans (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updatePosDisplay
  protected void updatePosDisplay(int x,
                                  int y)
update the position display for a given display pixel
 o clone
  public Object clone()
produce a copy of this viewer.
Overrides:
clone in class Viewer

All Packages  Class Hierarchy  This Package  Previous  Next  Index