visad
Class DisplayImpl

java.lang.Object
  extended by visad.ActionImpl
      extended by visad.DisplayImpl
All Implemented Interfaces:
Runnable, EventListener, Action, Display, LocalDisplay, ThingChangedListener
Direct Known Subclasses:
DisplayImplJ2D, DisplayImplJ3D

public abstract class DisplayImpl
extends ActionImpl
implements LocalDisplay

DisplayImpl is the abstract VisAD superclass for display implementations. It is runnable.

DisplayImpl is not Serializable and should not be copied between JVMs.


Nested Class Summary
 class DisplayImpl.Syncher
          Class used to ensure that all linked Data have been transformed and rendered, used by getImage()
 
Field Summary
 
Fields inherited from class visad.ActionImpl
TRACE_STACK, TRACE_TIME
 
Fields inherited from interface visad.Display
AdjustProjectionSeam, Alpha, Animation, Blue, CacheAppearances, CMY, ColorMode, components3c, components3s, componentscmy, componentscyl, componentsflow1, componentsflow1s, componentsflow2, componentsflow2s, componentshsv, componentsrgb, componentsso, CurvedSize, Cyan, CylAzimuth, CylRadius, CylZAxis, DisplayCMYCoordSys, DisplayCMYTuple, DisplayCylindricalCoordSys, DisplayFlow1SphericalCoordSys, DisplayFlow1SphericalTuple, DisplayFlow1Tuple, DisplayFlow2SphericalCoordSys, DisplayFlow2SphericalTuple, DisplayFlow2Tuple, DisplayHSVCoordSys, DisplayHSVTuple, DisplayRealArray, DisplayRGBTuple, DisplaySpatialCartesianTuple, DisplaySpatialCylindricalTuple, DisplaySpatialOffsetTuple, DisplaySpatialSphericalTuple, DisplaySphericalCoordSys, Flow1Azimuth, Flow1Elevation, Flow1Radial, Flow1X, Flow1Y, Flow1Z, Flow2Azimuth, Flow2Elevation, Flow2Radial, Flow2X, Flow2Y, Flow2Z, Green, HSV, Hue, IsoContour, Latitude, LineStyle, LineWidth, List, Longitude, Magenta, MergeGeometries, MissingTransparent, PointMode, PointSize, PolygonMode, PolygonOffset, PolygonOffsetFactor, Radius, Red, RGB, RGBA, Saturation, SelectRange, SelectValue, Shape, ShapeScale, Text, Texture3DMode, TextureEnable, Value, XAxis, XAxisOffset, YAxis, YAxisOffset, Yellow, ZAxis, ZAxisOffset
 
Constructor Summary
DisplayImpl(RemoteDisplay rmtDpy, DisplayRenderer renderer)
          construct a DisplayImpl collaborating with the given RemoteDisplay, and with the given DisplayRenderer
DisplayImpl(String name, DisplayRenderer renderer)
          construct a DisplayImpl with given name and DisplayRenderer
 
Method Summary
 void addActivityHandler(ActivityHandler ah)
          Add a busy/idle activity handler.
 void addControl(Control control)
          add a Control to this DisplayImpl
 void addDataSourceListener(RemoteSourceListener listener)
          Deprecated.  
 void addDisplayListener(DisplayListener listener)
          add a DisplayListener
 void addMap(ScalarMap map)
          add a ScalarMap to this Display, assuming a local source
 void addMap(ScalarMap map, int remoteId)
          add a ScalarMap to this Display
 void addMessageListener(MessageListener listener)
          Forward messages to the specified listener
 void addReference(DataReference ref, ConstantMap[] constant_maps)
          Link a reference to this Display.
 void addReference(ThingReference ref)
          Link a reference to this Display.
 void addReferences(DataRenderer renderer, DataReference ref)
          Link a reference to this Display using a non-default renderer.
 void addReferences(DataRenderer renderer, DataReference[] refs)
          Link references to this display using a non-default renderer.
 void addReferences(DataRenderer renderer, DataReference[] refs, ConstantMap[][] constant_maps)
          Link references to this display using the non-default renderer.
 void addReferences(DataRenderer renderer, DataReference ref, ConstantMap[] constant_maps)
          Link a reference to this Display using a non-default renderer.
 void addRemoteSourceListener(RemoteSourceListener listener)
          Inform listener of changes in the availability of remote data/collaboration sources.
 void addRendererSourceListener(RendererSourceListener listener)
          Inform listener of deleted DataRenderers.
 void addSlave(RemoteSlaveDisplay display)
          link a slave display to this
 boolean checkTicks()
          over-ride ActionImpl.checkTicks() to always return true, since DisplayImpl always runs doAction to find out if any linked Data needs to be re-transformed
 void clearMaps()
          remove all ScalarMaps linked this display;
 void connectionFailed(DataRenderer renderer, DataDisplayLink link)
          Notify this Display that a connection to a remote server has failed
 void controlChanged()
          trigger possible re-transform of linked Data used by Controls to notify this DisplayImpl that they have changed
static void delay(int millis)
          Deprecated. Use new visad.util.Delay(millis) instead.
 void destroy()
          destroy this display: clear all references to objects (so they can be garbage collected), stop all Threads and remove all links
 void disableEvent(int id)
          Disables reporting of a DisplayEvent of a given type when it occurs in this display.
 void doAction()
          Check if any Data need re-transform, and if so, do it.
 void enableEvent(int id)
          Enables reporting of a DisplayEvent of a given type when it occurs in this display.
 boolean equals(Object obj)
          test for equality between this and the given Object given their complexity, its reasonable that DisplayImpl objects are only equal to themselves
protected  void finalize()
           
 int getAPI()
          Return the API used for this display
 Component getComponent()
          return the java.awt.Component (e.g., JPanel or AppletPanel) this Display uses; returns null for an offscreen Display
 int getConnectionID(RemoteDisplay rmtDpy)
          Return the ID used to identify the collaborative connection to the specified remote display.
 Vector getConstantMapVector()
           
 Control getControl(Class c)
          get a linked Control with the given Class; only called for Control objects associated with 'single' DisplayRealTypes
 Control getControl(Class c, int inst)
          get ordinal instance of linked Control object of the specified class
 Vector getControls(Class c)
          get all linked Control objects of the specified Class
 Vector getControlVector()
          Deprecated. - DisplayImpl shouldn't expose itself at this level
protected abstract  DisplayRenderer getDefaultDisplayRenderer()
           
 DisplayMonitor getDisplayMonitor()
           
 DisplayRenderer getDisplayRenderer()
          return the DisplayRenderer associated with this Display
 DisplayRealType getDisplayScalar(int index)
          get the DisplayRealType with the given index
 int getDisplayScalarCount()
           
 int getDisplayScalarIndex(DisplayRealType dreal)
          get the index for the given DisplayRealType
 DisplaySync getDisplaySync()
           
abstract  GraphicsModeControl getGraphicsModeControl()
          return the GraphicsModeControl associated with this Display
 BufferedImage getImage()
          get a BufferedImage of this Display, without synchronizing (assume the application has made sure Data have been transformed and rendered)
 BufferedImage getImage(boolean sync)
          get a BufferedImage of this Display
 Vector getMapVector()
          return a Vector of the ScalarMap-s associated with this Display
 MouseBehavior getMouseBehavior()
           
 int getNumberOfControls()
           
 Printable getPrintable()
          Return the Printable object to be used by a PrinterJob.
abstract  ProjectionControl getProjectionControl()
          return the ProjectionControl associated with this Display
 Vector getRenderers()
          Returns the list of DataRenderer-s.
 Vector getRendererVector()
          Returns a clone of the list of DataRenderer-s.
 ScalarType getScalar(int index)
          get the ScalarType with the given index
 int getScalarCount()
           
 int getScalarIndex(ScalarType real)
          get the index for the given ScalarType
 int getValueArrayLength()
           
 int[] getValueToMap()
           
 int[] getValueToScalar()
           
 Container getWidgetPanel()
          get a GUI component containing this Display's Control widgets; create the widgets as necessary
 boolean hasSlaves()
           
 boolean isDestroyed()
          has this display been destroyed
 boolean isEventEnabled(int id)
           
 void lostCollabConnection(int id)
          Inform RemoteSourceListeners that the specified collaborative connection has been lost.
 double[] make_matrix(double rotx, double roty, double rotz, double scale, double transx, double transy, double transz)
          make projection matrix from given arguments
 double[] multiply_matrix(double[] a, double[] b)
          multiply matrices
 void notifyListeners(DisplayEvent evt)
          Notify this instance's DisplayListeners.
 void notifyListeners(int id, int x, int y)
          Notify this instance's DisplayListeners.
static void printStack(String message)
          print a stack dump with the given message
 void reAutoScale()
          request auto-scaling of ScalarMap ranges the next time Data are transformed into scene graph elements
 void reDisplayAll()
          request all linked Data to be re-transformed into scene graph elements
 void removeActivityHandler(ActivityHandler ah)
          Remove a busy/idle activity handler.
 void removeAllReferences()
          remove all links to DataReferences.
 void removeAllSlaves()
          remove all links to slave displays
 void removeDataSourceListener(RemoteSourceListener listener)
          Deprecated.  
 void removeDisplayListener(DisplayListener listener)
          remove a DisplayListener
 void removeMap(ScalarMap map)
          remove a ScalarMap from this Display, assuming a local source
 void removeMap(ScalarMap map, int remoteId)
          remove a ScalarMap from this Display
 void removeMessageListener(MessageListener listener)
          Remove listener from the message list.
 void removeReference(ThingReference ref)
          remove link to ref, which must be a local DataReferenceImpl; if ref was added as part of a DataReference array passed to addReferences(), remove links to all of them
 void removeRemoteSourceListener(RemoteSourceListener listener)
          Remove listener from the remote source notification list.
 void removeRendererSourceListener(RendererSourceListener listener)
          Remove listener from the DataRenderer deletion list.
 void removeSlave(RemoteSlaveDisplay display)
          remove a link between a slave display and this
 void replaceReference(RemoteDisplay rDpy, DataReference ref, ConstantMap[] constant_maps)
          Replace remote reference with local reference.
 void replaceReference(RemoteDisplay rDpy, ThingReference ref)
          Replace remote reference with local reference.
 void replaceReferences(RemoteDisplay rDpy, DataRenderer renderer, DataReference ref)
          Replace remote reference with local reference using non-default renderer.
 void replaceReferences(RemoteDisplay rDpy, DataRenderer renderer, DataReference[] refs)
          Replace remote references with local references.
 void replaceReferences(RemoteDisplay rDpy, DataRenderer renderer, DataReference[] refs, ConstantMap[][] constant_maps)
          Replace remote references with local references.
 void replaceReferences(RemoteDisplay rDpy, DataRenderer renderer, DataReference ref, ConstantMap[] constant_maps)
          Replace remote reference with local reference using non-default renderer.
 void sendMessage(MessageEvent msg)
          Send a message to all MessageListeners.
 void setAlwaysAutoScale(boolean a)
          if auto is true, re-apply auto-scaling of ScalarMap ranges every time Display is triggered
 void setComponent(Component c)
          set the java.awt.Component this DisplayImpl uses
 void setMouseBehavior(MouseBehavior m)
          set given MouseBehavior
protected  void syncRemoteData(RemoteDisplay rmtDpy)
          copy Data from RemoteDisplay to this
 String toString()
           
 String toString(String pre)
           
 void updateBusyStatus()
          Indicate to activity monitor that the Display is busy.
 void updateSlaves(BufferedImage img)
          update all linked slave displays with the given image
 void updateSlaves(String message)
          update all linked slave display with the given message
 
Methods inherited from class visad.ActionImpl
disableAction, enableAction, findReference, getCurrentActionThread, getLinks, getName, getTaskCount, printPool, run, setEnabled, setName, setThreadPoolMaximum, stop, stopThreadPool, thingChanged, waitForTasks
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface visad.Action
getName
 
Methods inherited from interface visad.ThingChangedListener
thingChanged
 

Constructor Detail

DisplayImpl

public DisplayImpl(String name,
                   DisplayRenderer renderer)
            throws VisADException,
                   RemoteException
construct a DisplayImpl with given name and DisplayRenderer

Parameters:
name - String name for DisplayImpl (used for debugging)
renderer - DisplayRenderer that controls aspects of the display not specific to any particular Data
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

DisplayImpl

public DisplayImpl(RemoteDisplay rmtDpy,
                   DisplayRenderer renderer)
            throws VisADException,
                   RemoteException
construct a DisplayImpl collaborating with the given RemoteDisplay, and with the given DisplayRenderer

Parameters:
rmtDpy - RemoteDisplay to collaborate with
renderer - DisplayRenderer that controls aspects of the display not specific to any particular Data
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred
Method Detail

syncRemoteData

protected void syncRemoteData(RemoteDisplay rmtDpy)
                       throws VisADException,
                              RemoteException
copy Data from RemoteDisplay to this

Parameters:
rmtDpy - RemoteDisplay to get Data from
Throws:
RemoteException
VisADException

notifyListeners

public void notifyListeners(int id,
                            int x,
                            int y)
                     throws VisADException,
                            RemoteException
Notify this instance's DisplayListeners.

Parameters:
id - type of DisplayEvent that is to be sent
x - the horizontal x coordinate for the mouse location in the display component
y - the vertical y coordinate for the mouse location in the display component
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

notifyListeners

public void notifyListeners(DisplayEvent evt)
                     throws VisADException,
                            RemoteException
Notify this instance's DisplayListeners.

Parameters:
evt - The DisplayEvent to be passed to the DisplayListeners.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

addDisplayListener

public void addDisplayListener(DisplayListener listener)
add a DisplayListener

Specified by:
addDisplayListener in interface LocalDisplay
Parameters:
listener - DisplayListener to add

removeDisplayListener

public void removeDisplayListener(DisplayListener listener)
remove a DisplayListener

Specified by:
removeDisplayListener in interface LocalDisplay
Parameters:
listener - DisplayListener to remove

getComponent

public Component getComponent()
Description copied from interface: LocalDisplay
return the java.awt.Component (e.g., JPanel or AppletPanel) this Display uses; returns null for an offscreen Display

Specified by:
getComponent in interface LocalDisplay
Returns:
the java.awt.Component (e.g., JPanel or AppletPanel) this DisplayImpl uses; returns null for an offscreen DisplayImpl

setComponent

public void setComponent(Component c)
set the java.awt.Component this DisplayImpl uses

Parameters:
c - Component to set

reAutoScale

public void reAutoScale()
request auto-scaling of ScalarMap ranges the next time Data are transformed into scene graph elements


setAlwaysAutoScale

public void setAlwaysAutoScale(boolean a)
if auto is true, re-apply auto-scaling of ScalarMap ranges every time Display is triggered

Parameters:
a - flag indicating whether to always re-apply auto-scaling

reDisplayAll

public void reDisplayAll()
request all linked Data to be re-transformed into scene graph elements


addSlave

public void addSlave(RemoteSlaveDisplay display)
link a slave display to this

Specified by:
addSlave in interface Display
Parameters:
display - RemoteSlaveDisplay to link

removeSlave

public void removeSlave(RemoteSlaveDisplay display)
remove a link between a slave display and this

Specified by:
removeSlave in interface Display
Parameters:
display - RemoteSlaveDisplay to remove

removeAllSlaves

public void removeAllSlaves()
remove all links to slave displays

Specified by:
removeAllSlaves in interface Display

hasSlaves

public boolean hasSlaves()
Specified by:
hasSlaves in interface Display
Returns:
flag indicating whether there are any slave displays linked to this display

updateSlaves

public void updateSlaves(BufferedImage img)
update all linked slave displays with the given image

Parameters:
img - BufferedImage to send to all linked slave displays

updateSlaves

public void updateSlaves(String message)
update all linked slave display with the given message

Parameters:
message - String to send to all linked slave displays

enableEvent

public void enableEvent(int id)
Enables reporting of a DisplayEvent of a given type when it occurs in this display.

Parameters:
id - DisplayEvent type to enable. Valid types are:
  • DisplayEvent.FRAME_DONE
  • DisplayEvent.TRANSFORM_DONE
  • DisplayEvent.MOUSE_PRESSED
  • DisplayEvent.MOUSE_PRESSED_LEFT
  • DisplayEvent.MOUSE_PRESSED_CENTER
  • DisplayEvent.MOUSE_PRESSED_RIGHT
  • DisplayEvent.MOUSE_RELEASED_LEFT
  • DisplayEvent.MOUSE_RELEASED_CENTER
  • DisplayEvent.MOUSE_RELEASED_RIGHT
  • DisplayEvent.MAP_ADDED
  • DisplayEvent.MAPS_CLEARED
  • DisplayEvent.REFERENCE_ADDED
  • DisplayEvent.REFERENCE_REMOVED
  • DisplayEvent.DESTROYED
  • DisplayEvent.KEY_PRESSED
  • DisplayEvent.KEY_RELEASED
  • DisplayEvent.MOUSE_DRAGGED
  • DisplayEvent.MOUSE_ENTERED
  • DisplayEvent.MOUSE_EXITED
  • DisplayEvent.MOUSE_MOVED
  • DisplayEvent.WAIT_ON
  • DisplayEvent.WAIT_OFF
  • DisplayEvent.MAP_REMOVED
  • DisplayEvent.COMPONENT_RESIZED

disableEvent

public void disableEvent(int id)
Disables reporting of a DisplayEvent of a given type when it occurs in this display.

Parameters:
id - DisplayEvent type to disable. Valid types are:
  • DisplayEvent.FRAME_DONE
  • DisplayEvent.TRANSFORM_DONE
  • DisplayEvent.MOUSE_PRESSED
  • DisplayEvent.MOUSE_PRESSED_LEFT
  • DisplayEvent.MOUSE_PRESSED_CENTER
  • DisplayEvent.MOUSE_PRESSED_RIGHT
  • DisplayEvent.MOUSE_RELEASED_LEFT
  • DisplayEvent.MOUSE_RELEASED_CENTER
  • DisplayEvent.MOUSE_RELEASED_RIGHT
  • DisplayEvent.MAP_ADDED
  • DisplayEvent.MAPS_CLEARED
  • DisplayEvent.REFERENCE_ADDED
  • DisplayEvent.REFERENCE_REMOVED
  • DisplayEvent.DESTROYED
  • DisplayEvent.KEY_PRESSED
  • DisplayEvent.KEY_RELEASED
  • DisplayEvent.MOUSE_DRAGGED
  • DisplayEvent.MOUSE_ENTERED
  • DisplayEvent.MOUSE_EXITED
  • DisplayEvent.MOUSE_MOVED
  • DisplayEvent.WAIT_ON
  • DisplayEvent.WAIT_OFF
  • DisplayEvent.MAP_REMOVED
  • DisplayEvent.COMPONENT_RESIZED

isEventEnabled

public boolean isEventEnabled(int id)
Parameters:
id - DisplayEvent type
Returns:
flag indicating whether a DisplayEvent of a given type is eported when it occurs in this display.

addReference

public void addReference(ThingReference ref)
                  throws VisADException,
                         RemoteException
Link a reference to this Display. This method may only be invoked after all links to ScalarMaps have been made.

Specified by:
addReference in interface Action
Overrides:
addReference in class ActionImpl
Parameters:
ref - data reference
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
ActionImpl.thingChanged(ThingChangedEvent), ThingReference.addThingChangedListener(ThingChangedListener, long)

replaceReference

public void replaceReference(RemoteDisplay rDpy,
                             ThingReference ref)
                      throws VisADException,
                             RemoteException
Replace remote reference with local reference.

Parameters:
rDpy - Remote display.
ref - Local reference which will replace the previous reference.
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
addReference(visad.ThingReference)

addReference

public void addReference(DataReference ref,
                         ConstantMap[] constant_maps)
                  throws VisADException,
                         RemoteException
Link a reference to this Display. ref must be a local DataReferenceImpl. The ConstantMap array applies only to the rendering reference.

Specified by:
addReference in interface Display
Parameters:
ref - data reference
constant_maps - array of ConstantMaps associated with the data reference
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
Section 6.1 of the Developer's Guide

replaceReference

public void replaceReference(RemoteDisplay rDpy,
                             DataReference ref,
                             ConstantMap[] constant_maps)
                      throws VisADException,
                             RemoteException
Replace remote reference with local reference.

Parameters:
rDpy - Remote display.
ref - Local reference which will replace the previous reference.
constant_maps - array of ConstantMaps associated with the data reference
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
addReference(visad.DataReference, visad.ConstantMap[])

addReferences

public void addReferences(DataRenderer renderer,
                          DataReference ref)
                   throws VisADException,
                          RemoteException
Link a reference to this Display using a non-default renderer. ref must be a local DataReferenceImpl. This is a method of DisplayImpl and RemoteDisplayImpl rather than Display

Parameters:
renderer - logic to render this data
ref - data reference
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
Section 6.1 of the Developer's Guide

replaceReferences

public void replaceReferences(RemoteDisplay rDpy,
                              DataRenderer renderer,
                              DataReference ref)
                       throws VisADException,
                              RemoteException
Replace remote reference with local reference using non-default renderer.

Parameters:
rDpy - Remote display.
renderer - logic to render this data
ref - Local reference which will replace the previous reference.
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
addReferences(visad.DataRenderer, visad.DataReference)

addReferences

public void addReferences(DataRenderer renderer,
                          DataReference ref,
                          ConstantMap[] constant_maps)
                   throws VisADException,
                          RemoteException
Link a reference to this Display using a non-default renderer. ref must be a local DataReferenceImpl. This is a method of DisplayImpl and RemoteDisplayImpl rather than Display

Specified by:
addReferences in interface Display
Parameters:
renderer - logic to render this data
ref - data reference
constant_maps - array of ConstantMaps associated with the data reference
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
Section 6.1 of the Developer's Guide

replaceReferences

public void replaceReferences(RemoteDisplay rDpy,
                              DataRenderer renderer,
                              DataReference ref,
                              ConstantMap[] constant_maps)
                       throws VisADException,
                              RemoteException
Replace remote reference with local reference using non-default renderer.

Parameters:
rDpy - Remote display.
renderer - logic to render this data
ref - Local reference which will replace the previous reference.
constant_maps - array of ConstantMaps associated with the data reference
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data reference to the remote display.
See Also:
addReferences(visad.DataRenderer, visad.DataReference, visad.ConstantMap[])

addReferences

public void addReferences(DataRenderer renderer,
                          DataReference[] refs)
                   throws VisADException,
                          RemoteException
Link references to this display using a non-default renderer. refs must be local DataReferenceImpls. This is a method of DisplayImpl and RemoteDisplayImpl rather than Display

Parameters:
renderer - logic to render this data
refs - array of data references
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data references to the remote display.
See Also:
Section 6.1 of the Developer's Guide

replaceReferences

public void replaceReferences(RemoteDisplay rDpy,
                              DataRenderer renderer,
                              DataReference[] refs)
                       throws VisADException,
                              RemoteException
Replace remote references with local references.

Parameters:
rDpy - Remote display.
renderer - logic to render this data
refs - array of local data references
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data references to the remote display.
See Also:
addReferences(visad.DataRenderer, visad.DataReference[])

addReferences

public void addReferences(DataRenderer renderer,
                          DataReference[] refs,
                          ConstantMap[][] constant_maps)
                   throws VisADException,
                          RemoteException
Link references to this display using the non-default renderer. refs must be local DataReferenceImpls. The maps[i] array applies only to rendering refs[i]. This is a method of DisplayImpl and RemoteDisplayImpl rather than Display

Specified by:
addReferences in interface LocalDisplay
Parameters:
renderer - logic to render this data
refs - array of data references
constant_maps - array of ConstantMaps associated with data references
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data references to the remote display.
See Also:
Section 6.1 of the Developer's Guide

replaceReferences

public void replaceReferences(RemoteDisplay rDpy,
                              DataRenderer renderer,
                              DataReference[] refs,
                              ConstantMap[][] constant_maps)
                       throws VisADException,
                              RemoteException
Replace remote references with local references.

Specified by:
replaceReferences in interface LocalDisplay
Parameters:
rDpy - Remote display.
renderer - logic to render this data
refs - array of data references
constant_maps - array of ConstantMaps associated with data references.
Throws:
VisADException - if there was a problem with one or more parameters.
RemoteException - if there was a problem adding the data references to the remote display.
See Also:
addReferences(visad.DataRenderer, visad.DataReference[], visad.ConstantMap[][])

removeReference

public void removeReference(ThingReference ref)
                     throws VisADException,
                            RemoteException
remove link to ref, which must be a local DataReferenceImpl; if ref was added as part of a DataReference array passed to addReferences(), remove links to all of them

Specified by:
removeReference in interface Action
Overrides:
removeReference in class ActionImpl
Parameters:
ref - ThingReference to remove
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

removeAllReferences

public void removeAllReferences()
                         throws VisADException,
                                RemoteException
remove all links to DataReferences.

Specified by:
removeAllReferences in interface Action
Overrides:
removeAllReferences in class ActionImpl
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

controlChanged

public void controlChanged()
trigger possible re-transform of linked Data used by Controls to notify this DisplayImpl that they have changed


checkTicks

public boolean checkTicks()
over-ride ActionImpl.checkTicks() to always return true, since DisplayImpl always runs doAction to find out if any linked Data needs to be re-transformed

Overrides:
checkTicks in class ActionImpl
Returns:
true

isDestroyed

public boolean isDestroyed()
has this display been destroyed

Returns:
has this display been destroyed

destroy

public void destroy()
             throws VisADException,
                    RemoteException
destroy this display: clear all references to objects (so they can be garbage collected), stop all Threads and remove all links

Specified by:
destroy in interface Display
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

doAction

public void doAction()
              throws VisADException,
                     RemoteException
Check if any Data need re-transform, and if so, do it. Check if auto-scaling is needed for any ScalarMaps, and if so, do it. This method does the real work of DisplayImpl.

Specified by:
doAction in class ActionImpl
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

getDefaultDisplayRenderer

protected abstract DisplayRenderer getDefaultDisplayRenderer()
Returns:
the default DisplayRenderer for this DisplayImpl

getDisplayRenderer

public DisplayRenderer getDisplayRenderer()
Description copied from interface: LocalDisplay
return the DisplayRenderer associated with this Display

Specified by:
getDisplayRenderer in interface LocalDisplay
Returns:
the DisplayRenderer associated with this DisplayImpl

getRendererVector

public Vector getRendererVector()
Returns a clone of the list of DataRenderer-s. A clone is returned to avoid concurrent access problems by the Display thread.

Specified by:
getRendererVector in interface LocalDisplay
Returns:
A clone of the list of DataRenderer-s.
See Also:
getRenderers()

getDisplayScalarCount

public int getDisplayScalarCount()
Returns:
the number of DisplayRealTypes in ScalarMaps linked to this DisplayImpl

getDisplayScalar

public DisplayRealType getDisplayScalar(int index)
get the DisplayRealType with the given index

Parameters:
index - index into Vector of DisplayRealTypes
Returns:
the indexed DisplayRealType

getDisplayScalarIndex

public int getDisplayScalarIndex(DisplayRealType dreal)
get the index for the given DisplayRealType

Parameters:
dreal - DisplayRealType to search for
Returns:
the index of dreal in Vector of DisplayRealTypes

getScalarCount

public int getScalarCount()
Returns:
the number of ScalarTypes in ScalarMaps linked to this DisplayImpl

getScalar

public ScalarType getScalar(int index)
get the ScalarType with the given index

Parameters:
index - index into Vector of ScalarTypes
Returns:
the indexed ScalarType

getScalarIndex

public int getScalarIndex(ScalarType real)
                   throws RemoteException
get the index for the given ScalarType

Parameters:
real - ScalarType to search for
Returns:
the index of real in Vector of ScalarTypes
Throws:
RemoteException - an RMI error occurred

addMap

public void addMap(ScalarMap map)
            throws VisADException,
                   RemoteException
add a ScalarMap to this Display, assuming a local source

Specified by:
addMap in interface Display
Parameters:
map - ScalarMap to add
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

addMap

public void addMap(ScalarMap map,
                   int remoteId)
            throws VisADException,
                   RemoteException
add a ScalarMap to this Display

Parameters:
map - ScalarMap to add
remoteId - remote source for collab, or VisADEvent.LOCAL_SOURCE
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

removeMap

public void removeMap(ScalarMap map)
               throws VisADException,
                      RemoteException
remove a ScalarMap from this Display, assuming a local source

Specified by:
removeMap in interface Display
Parameters:
map - ScalarMap to remove
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

removeMap

public void removeMap(ScalarMap map,
                      int remoteId)
               throws VisADException,
                      RemoteException
remove a ScalarMap from this Display

Parameters:
map - ScalarMap to add
remoteId - remote source for collab, or VisADEvent.LOCAL_SOURCE
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

clearMaps

public void clearMaps()
               throws VisADException,
                      RemoteException
remove all ScalarMaps linked this display;

Specified by:
clearMaps in interface Display
Throws:
VisADException - a VisAD error occurred
RemoteException - an RMI error occurred

getMapVector

public Vector getMapVector()
Description copied from interface: LocalDisplay
return a Vector of the ScalarMap-s associated with this Display

Specified by:
getMapVector in interface LocalDisplay
Returns:
clone of Vector of ScalarMaps linked to this DisplayImpl (doesn't include ConstantMaps)

getConstantMapVector

public Vector getConstantMapVector()
Specified by:
getConstantMapVector in interface Display
Returns:
clone of Vector of ConstantMaps linked to this DisplayImpl

getConnectionID

public int getConnectionID(RemoteDisplay rmtDpy)
                    throws RemoteException
Return the ID used to identify the collaborative connection to the specified remote display.

WARNING! Due to limitations in the Java RMI implementation, this only works with an exact copy of the RemoteDisplay used to create the collaboration link.

Parameters:
rmtDpy - the specified remote display.
Returns:
DisplayMonitor.UNKNOWN_LISTENER_ID if not found; otherwise, returns the ID.
Throws:
RemoteException - an RMI error occurred

addControl

public void addControl(Control control)
add a Control to this DisplayImpl

Parameters:
control - Control to add

getControl

public Control getControl(Class c)
get a linked Control with the given Class; only called for Control objects associated with 'single' DisplayRealTypes

Specified by:
getControl in interface LocalDisplay
Parameters:
c - sub-Class of Control to search for
Returns:
linked Control with Class c, or null

getControl

public Control getControl(Class c,
                          int inst)
get ordinal instance of linked Control object of the specified class

Specified by:
getControl in interface LocalDisplay
Parameters:
c - sub-Class of Control to search for
inst - ordinal instance number
Returns:
linked Control with Class c, or null

getControls

public Vector getControls(Class c)
get all linked Control objects of the specified Class

Specified by:
getControls in interface LocalDisplay
Parameters:
c - sub-Class of Control to search for
Returns:
Vector of linked Controls with Class c

getNumberOfControls

public int getNumberOfControls()
Returns:
the total number of controls used by this display

getControlVector

public Vector getControlVector()
Deprecated. - DisplayImpl shouldn't expose itself at this level

Returns:
clone of Vector of Controls linked to this DisplayImpl

getWidgetPanel

public Container getWidgetPanel()
get a GUI component containing this Display's Control widgets; create the widgets as necessary

Specified by:
getWidgetPanel in interface LocalDisplay
Returns:
Container of widget panel

getValueArrayLength

public int getValueArrayLength()
Returns:
length of valueArray passed to ShadowType.doTransform()

getValueToScalar

public int[] getValueToScalar()
Returns:
int[] array mapping from valueArray indices to ScalarType Vector indices

getValueToMap

public int[] getValueToMap()
Returns:
int[] array mapping from valueArray indices to ScalarMap Vector indices

getProjectionControl

public abstract ProjectionControl getProjectionControl()
Description copied from interface: LocalDisplay
return the ProjectionControl associated with this Display

Specified by:
getProjectionControl in interface LocalDisplay
Returns:
the ProjectionControl associated with this DisplayImpl

getGraphicsModeControl

public abstract GraphicsModeControl getGraphicsModeControl()
Description copied from interface: LocalDisplay
return the GraphicsModeControl associated with this Display

Specified by:
getGraphicsModeControl in interface LocalDisplay
Returns:
the GraphicsModeControl associated with this DisplayImpl

delay

public static void delay(int millis)
Deprecated. Use new visad.util.Delay(millis) instead.

wait for millis milliseconds

Parameters:
millis - number of milliseconds to wait

printStack

public static void printStack(String message)
print a stack dump with the given message

Parameters:
message - String to print with stack dump

equals

public boolean equals(Object obj)
test for equality between this and the given Object given their complexity, its reasonable that DisplayImpl objects are only equal to themselves

Overrides:
equals in class Object
Parameters:
obj - Object to test for equality with this
Returns:
flag indicating whether this is equal to obj

getRenderers

public Vector getRenderers()
Returns the list of DataRenderer-s. NOTE: The actual list is returned rather than a copy. If a copy is desired, then use getRendererVector().

Specified by:
getRenderers in interface LocalDisplay
Returns:
The list of DataRenderer-s.
See Also:
getRendererVector()

getAPI

public int getAPI()
           throws VisADException
Return the API used for this display

Returns:
the mode being used (UNKNOWN, JPANEL, APPLETFRAME, OFFSCREEN, TRANSFORM_ONLY)
Throws:
VisADException

getDisplayMonitor

public DisplayMonitor getDisplayMonitor()
Returns:
the DisplayMonitor associated with this Display.

getDisplaySync

public DisplaySync getDisplaySync()
Returns:
the DisplaySync associated with this Display.

setMouseBehavior

public void setMouseBehavior(MouseBehavior m)
set given MouseBehavior

Parameters:
m - MouseBehavior to set

getMouseBehavior

public MouseBehavior getMouseBehavior()
Returns:
the MouseBehavior used for this Display

make_matrix

public double[] make_matrix(double rotx,
                            double roty,
                            double rotz,
                            double scale,
                            double transx,
                            double transy,
                            double transz)
make projection matrix from given arguments

Specified by:
make_matrix in interface LocalDisplay
Parameters:
rotx - rotation about x axis
roty - rotation about y axis
rotz - rotation about z axis
scale - linear scale factor
transx - translation along x axis
transy - translation along y axis
transz - translation along z axis
Returns:
projection matrix

multiply_matrix

public double[] multiply_matrix(double[] a,
                                double[] b)
multiply matrices

Specified by:
multiply_matrix in interface LocalDisplay
Parameters:
a - first operand matrix
b - second operand matrix
Returns:
product matrix

getImage

public BufferedImage getImage()
get a BufferedImage of this Display, without synchronizing (assume the application has made sure Data have been transformed and rendered)

Specified by:
getImage in interface LocalDisplay
Returns:
a captured image of this Display

getImage

public BufferedImage getImage(boolean sync)
get a BufferedImage of this Display

Parameters:
sync - if true, ensure that all linked Data have been transformed and rendered
Returns:
a captured image of this Display

toString

public String toString()
Overrides:
toString in class Object
Returns:
a String representation of this Display

toString

public String toString(String pre)
Parameters:
pre - String added to start of each line
Returns:
a String representation of this Display indented by pre (a string of blanks)

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getPrintable

public Printable getPrintable()
Return the Printable object to be used by a PrinterJob. This can be used as follows:
    PrinterJob printJob = PrinterJob.getPrinterJob();
    PageFormat pf = printJob.defaultPage();
    printJob.setPrintable(display.getPrintable(), pf);
    if (printJob.printDialog()) {
        try {
            printJob.print();
        }
        catch (Exception pe) {
            pe.printStackTrace();
        }
    }
 

Returns:
printable object

connectionFailed

public void connectionFailed(DataRenderer renderer,
                             DataDisplayLink link)
Notify this Display that a connection to a remote server has failed

Parameters:
renderer - DataRenderer with failure
link - DataDisplayLink with failure

addRendererSourceListener

public void addRendererSourceListener(RendererSourceListener listener)
Inform listener of deleted DataRenderers.

Parameters:
listener - Object to add.

removeRendererSourceListener

public void removeRendererSourceListener(RendererSourceListener listener)
Remove listener from the DataRenderer deletion list.

Parameters:
listener - Object to remove.

addDataSourceListener

public void addDataSourceListener(RemoteSourceListener listener)
Deprecated. 

Parameters:
listener -

removeDataSourceListener

public void removeDataSourceListener(RemoteSourceListener listener)
Deprecated. 

Parameters:
listener -

addRemoteSourceListener

public void addRemoteSourceListener(RemoteSourceListener listener)
Inform listener of changes in the availability of remote data/collaboration sources.

Parameters:
listener - Object to send change notifications.

removeRemoteSourceListener

public void removeRemoteSourceListener(RemoteSourceListener listener)
Remove listener from the remote source notification list.

Parameters:
listener - Object to be removed.

lostCollabConnection

public void lostCollabConnection(int id)
Inform RemoteSourceListeners that the specified collaborative connection has been lost.

WARNING! This should only be called from within the visad.collab package!

Parameters:
id - ID of lost connection.

addMessageListener

public void addMessageListener(MessageListener listener)
Forward messages to the specified listener

Specified by:
addMessageListener in interface LocalDisplay
Parameters:
listener - New message receiver.

removeMessageListener

public void removeMessageListener(MessageListener listener)
Remove listener from the message list.

Specified by:
removeMessageListener in interface LocalDisplay
Parameters:
listener - Object to remove.

sendMessage

public void sendMessage(MessageEvent msg)
                 throws RemoteException
Send a message to all MessageListeners.

Specified by:
sendMessage in interface Display
Parameters:
msg - Message being sent.
Throws:
RemoteException

addActivityHandler

public void addActivityHandler(ActivityHandler ah)
                        throws VisADException
Add a busy/idle activity handler.

Specified by:
addActivityHandler in interface LocalDisplay
Parameters:
ah - Activity handler.
Throws:
VisADException - If the handler couldn't be added.

removeActivityHandler

public void removeActivityHandler(ActivityHandler ah)
                           throws VisADException
Remove a busy/idle activity handler.

Specified by:
removeActivityHandler in interface LocalDisplay
Parameters:
ah - Activity handler.
Throws:
VisADException - If the handler couldn't be removed.

updateBusyStatus

public void updateBusyStatus()
Indicate to activity monitor that the Display is busy.