    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.

##

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

##

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

##

addViewable(Viewable)
  replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
clone()
  produce a copy of this viewer.
displaySlice()
  display a default slice of the current Viewable
displaySlice(Slice)
  display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
getDisplaySize()
  return the size of the display area
getViewable()
  Return a reference to the current Viewable object, or null if none are attached to this Viewer.
getViewSlice()
  return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
mouseMove(Event, int, int)
preferredSize()
reshape(int, int, int, int)
  resize the viewer so that the display area takes up as much of the available space as possible.
setDisplaySize(Dimension)
  set the size of the display area
setDisplaySize(int, int)
  set the size of the display area
setPixelMap(Slice, Rectangle)
  set the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the current Viewable
updatePixelMap()
  update the ImageDisplayMap object, pixtrans (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
updatePixelMap(Slice, Rectangle)
  update the ImageDisplayMap object, pixtrans (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
updatePosDisplay(int, int)
  update the position display for a given display pixel

##

data

      protected Viewable data

slice

      protected Slice slice

pixelMap

      protected ImageDisplayMap pixelMap

coordSys

      protected CoordinateSystem coordSys

view

      protected Image view

sliceSize

      protected Dimension sliceSize

display

      protected ImageCanvas display

xDataPos

      protected Label xDataPos

yDataPos

      protected Label yDataPos

xLabel

      protected Label xLabel

yLabel

      protected Label yLabel

xCoordPos

      protected Label xCoordPos

yCoordPos

      protected Label yCoordPos

positionDisplay

      protected Panel positionDisplay

newViewable

      protected boolean newViewable

defautlDisplayWidth

      public final static int defautlDisplayWidth

  default width of display area if not specified in constructor

defautlDisplayHeight

      public final static int defautlDisplayHeight

  default height of display area if not specified in constructor

##

PosTrackerViewer

      public PosTrackerViewer()

  create a viewer with no Viewable to display

PosTrackerViewer

      public PosTrackerViewer(int width,
                              int height)

  create a viewer with a given display size
  Parameters:
    width - width of the display area

##

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

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

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

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

displaySlice

      public void displaySlice()

  display a default slice of the current Viewable
  Overrides:
    displaySlice in class Viewer

getDisplaySize

      public Dimension getDisplaySize()

  return the size of the display area
  Overrides:
    getDisplaySize in class Viewer

setDisplaySize

      public synchronized void setDisplaySize(int width,
                                              int height)

  set the size of the display area

setDisplaySize

      public void setDisplaySize(Dimension sz)

  set the size of the display area

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

mouseMove

      public boolean mouseMove(Event event,
                               int x,
                               int y)

Overrides:
  mouseMove in class Component

preferredSize

      public Dimension preferredSize()

Overrides:
  preferredSize in class Container

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).

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).

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.

updatePosDisplay

      protected void updatePosDisplay(int x,
                                      int y)

  update the position display for a given display pixel

clone

      public Object clone()

  produce a copy of this viewer.
  Overrides:
    clone in class Viewer

    All Packages  Class Hierarchy  This Package  Previous  Next  Index