org.opensourcephysics.drawing3d.java3d
Class Java3dDrawingPanel3D

java.lang.Object
  extended by org.opensourcephysics.drawing3d.java3d.Java3dDrawingPanel3D
All Implemented Interfaces:
Renderable, ImplementingPanel

public class Java3dDrawingPanel3D
extends java.lang.Object
implements ImplementingPanel

Title: Java3dDrawingPanel3D

Description: The Java3D implementation of a DrawingPanel3D.

Version:
August 2009
Author:
Carlos Jara Bravo, Francisco Esquembre, Glenn Ford

Field Summary
 org.opensourcephysics.drawing3d.java3d.Java3dDrawingPanel3D.RenderCanvas canvas
          The Canvas3D created for communication with Java3D
 
Constructor Summary
Java3dDrawingPanel3D(DrawingPanel3D _panel)
          Default constructor for a DrawingPanel3D.
 
Method Summary
 void cameraChanged(int change)
          This will be called by the camera whenever it changes.
 void forceRefresh()
          Tells the implementing panel that a change makes its current view obsolete.
 java.awt.Component getComponent()
          Returns the actual Swing component
 double getScreenRatio()
          Find a good graphics configuration.
 boolean GetUpdateModel()
           
 void hintChanged(int hintThatChanged)
           
 void mouseDragged(java.awt.event.MouseEvent evt)
           
 java.awt.image.BufferedImage render()
          Renders a representation of the object onscreen.
 java.awt.image.BufferedImage render(java.awt.image.BufferedImage image)
          Renders a representation of the object onto an image.
 void setFastRedraw(boolean fast)
          Sets a flags to redraw as fast as possible.
 void setLightEnabled(boolean _state)
           
 void setMessage(java.lang.String msg)
          Shows a message in a yellow text box in the lower right hand corner.
 void setMessage(java.lang.String msg, int location)
          Shows a message in a yellow text box.
 void SetUpdateModel(boolean _state)
           
 void update()
          Updates the panel immediately For instance, when the min-max value change
 void visualizationChanged(int _change)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvas

public org.opensourcephysics.drawing3d.java3d.Java3dDrawingPanel3D.RenderCanvas canvas
The Canvas3D created for communication with Java3D

Constructor Detail

Java3dDrawingPanel3D

public Java3dDrawingPanel3D(DrawingPanel3D _panel)
Default constructor for a DrawingPanel3D. It initializes necessary variables and sets the preferred size to 300x300 and preferred min/max to -1, 1, -1, 1, -1, 1

Method Detail

getScreenRatio

public double getScreenRatio()
Find a good graphics configuration. private final static GraphicsConfiguration getPreferredConfiguration() { GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D(); String stereo; // Check if the user has set the Java 3D stereo option. // Getting the system properties causes appletviewer to fail with a stereo = (String) java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { public Object run() { return System.getProperty("j3d.stereo"); } }); // update template based on properties. if (stereo != null) { if (stereo.equals("REQUIRED")) template.setStereo(GraphicsConfigTemplate.REQUIRED); //$NON-NLS-1$ else if (stereo.equals("PREFERRED")) template.setStereo(GraphicsConfigTemplate.PREFERRED); //$NON-NLS-1$ } // Return the GraphicsConfiguration that best fits our needs. return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration( template ); }


getComponent

public java.awt.Component getComponent()
Description copied from interface: ImplementingPanel
Returns the actual Swing component

Specified by:
getComponent in interface ImplementingPanel
Returns:
java.awt.Component

forceRefresh

public void forceRefresh()
Description copied from interface: ImplementingPanel
Tells the implementing panel that a change makes its current view obsolete. For instance, when the min-max value change. But the update needs not be immediate.

Specified by:
forceRefresh in interface ImplementingPanel

update

public void update()
Description copied from interface: ImplementingPanel
Updates the panel immediately For instance, when the min-max value change

Specified by:
update in interface ImplementingPanel

setFastRedraw

public void setFastRedraw(boolean fast)
Description copied from interface: ImplementingPanel
Sets a flags to redraw as fast as possible. Typically during an interaction

Specified by:
setFastRedraw in interface ImplementingPanel

cameraChanged

public void cameraChanged(int change)
Description copied from interface: ImplementingPanel
This will be called by the camera whenever it changes.

Specified by:
cameraChanged in interface ImplementingPanel
See Also:
Camera

setMessage

public void setMessage(java.lang.String msg)
Description copied from interface: ImplementingPanel
Shows a message in a yellow text box in the lower right hand corner.

Specified by:
setMessage in interface ImplementingPanel

setMessage

public void setMessage(java.lang.String msg,
                       int location)
Description copied from interface: ImplementingPanel
Shows a message in a yellow text box. The location must be one of the following:
  • BOTTOM_LEFT;
  • BOTTOM_RIGHT;
  • TOP_RIGHT;
  • TOP_LEFT;

Specified by:
setMessage in interface ImplementingPanel

render

public java.awt.image.BufferedImage render()
Description copied from interface: Renderable
Renders a representation of the object onscreen.

Specified by:
render in interface Renderable

render

public java.awt.image.BufferedImage render(java.awt.image.BufferedImage image)
Description copied from interface: Renderable
Renders a representation of the object onto an image.

Specified by:
render in interface Renderable
Parameters:
image - This parameter is ignored in the Java3D implementation
Returns:
Returns the BufferedImage holding the last frame drawn to the Canvas3D

hintChanged

public void hintChanged(int hintThatChanged)

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)

visualizationChanged

public void visualizationChanged(int _change)
Specified by:
visualizationChanged in interface ImplementingPanel

setLightEnabled

public void setLightEnabled(boolean _state)

SetUpdateModel

public void SetUpdateModel(boolean _state)

GetUpdateModel

public boolean GetUpdateModel()