Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.display3d
Class Display3D

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      sim.display3d.Display3D

All Implemented Interfaces:
  java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, Steppable

    public class Display3D

extends javax.swing.JPanel
implements Steppable

Display3D holds, displays, and manipulates 3D Portrayal objects, allowing the user to scale them, rotate them, translate them, magnify them, change how often they're updated, take snapshots, and generate Quicktime movies. Display3D is Steppable, and each time it is stepped it updates and redisplays itself. Display3D also handles double-click events, routing them to the underlying portrayals as inspector requests.

Display3D's constructor takes a height and width, which is the height and width of the underlying display area (not including the button bar at-top). Display3D can be placed in a JFrame; indeed it provides a convenience function to sprout its own JFrame with the method createFrame(). You can put Display3D in your own JFrame if you like, but you should try to call Display3D.quit() when the frame is disposed.

The viewing area is by default set to roughly encapsulate a 2 by 2 by 2 cube centered at the origin. The user's eye is on the positive Z axis outside of the cube area and is looking down the negative Z axis.

Display3D can have both SimplePortrayal3Ds and FieldPortrayal3Ds attached. Once the Portrayals are attached, the you can transform them (rotate, scale, translate, etc.) all together as one scene via a Global Model Transform. Various Display3D functions are provided to manipulate this Transform (such as rotate(...)). Java3Ders in-the-know can also provide the actual Transform3D if they're feeling lucky.

Display3D provides the optional ability for the user to show axes and a backdrop. Axes are in the X, Y, and Z directions for one unit in length, and are added to the scene after the Global Model Transform has been applied. Thus if you've used the Global Model Transform to scale down your simulation into the space of a 2 by 2 by 2 cube centered at the origin, for example, the axes will just touch the edges of the cube. The backdrop is an optional feature that the programmer must add. You can provide either a spherical backdrop which rotates with the world (like a star field) or a flat backdrop which is always behind the environment and which fills the window exactly. Spherical backdrops can be wrapped with images (use a spherical projection) or -- for the daring Java3Ders -- Apperance objects. Flat backdrops can have images or flat colors.

### Display3D and Java3D

Display3D uses Java3D to do its magic. Java3D is a sophisticated scene graph library, but we have done our best to hide this from you if you don't wish to know anything about how Java3D works. For those experienced in Java3D, we describe here the top-level scene graph used by the Display3D.

The Unverse is a SimpleUnverse called universe, the top BranchGraph is root, and the Canvas3D is a special subclass (CapturingCanvas3D) called canvas. A CapturingCanvas3D contains some additional machinery to make possible snapshots and movies. If you wish to add some scene graph material outside of Portrayal3Ds, and you don't want it to be transformed by the Global Model Transform, nor do you want it to be auto-spinnable, hanging it off of root is a good location. Note that even so, the user will be able to rotate, zoom, magnify, and translate the world with the mouse, and that includes this extra scene graph material.

Hanging off of root are two pairs of TransformGroups and RotationInterpolators responsible for auto-spinning the scene graph and a spherical backdrop (a Background object, if one exists), respectively. Auto-spinning happens in concert in these two TransformGroups, so the backdrop will always appear to be auto-spinning with the scene graph.

One of these TransformGroups (autoSpinTransformGroup) is public and holds the scene graph. The other TransformGroup is private. autoSpinTransformGroup is a good place to hang extra scene graph stuff you wish to add, if you don't want that stuff to be transformed along with the Portrayal3Ds, but you'd like it to be auto-spun along with the Portrayal3Ds.

Hanging off of autoSpinTransformGroup are two items: a private Switch which turns on and off the optional axes and backdrop; and globalModelTransformGroup, the TransformGroup responsible for transforming all of the Portrayals in the scene according to the global model transform. Additionally, globalModelTransformGroup is a good place to hang extra scene graph stuff you wish to add that you want to be transformed by the global model transform along with the rest of the Portrayal3Ds.

The globalModelTransformGroup in turn holds a private Switch which in turn holds the scene graph material supplied by each of the Portrayal3Ds in the scene. This Switch turns the Portrayals on and off according the layers menu choice the user makes on the button bar.

The LightSwitch, which resides in a BranchGrouop hanging of the ViewPlatform's TransformGroup node (where the camera is), holds two lights, a PointLight and an AmbientLight, which may be turned on or off by the user. You can change these lights if you like.

The right place to add scene graph material, or make other changes to the Java3D environment, is in the sceneGraphCreated() hook. This function is called for your benefit after the Display3D has created its scene graph material but just before the renderer has been started -- thus the graph is not yet online and is still modifiable.

If you add extra scene graph material to the Display3D outside of a Portrayal3D context, you should set it to be unpickable, or otherwise you will get errors when the user tries to select it from the scene (Display3D uses geometry-based picking for its object selection). The easiest way for you to do this to a given node is to call the utility function `sim.display3d.SimpleDisplay3D.clearPickableFlags(node)`

See Also:
  Serialized Form

Nested Class Summary
`class` | `Display3D.OptionPane3D`

Nested classes/interfaces inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes/interfaces inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes/interfaces inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes/interfaces inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`javax.media.j3d.TransformGroup` | `autoSpinTransformGroup` The TransformGroup which used to spin the underlying model.
`CapturingCanvas3D` | `canvas` The Java3D canvas holding the universe.
`java.lang.String` | `DEFAULT_PREFERENCES_KEY`
`javax.media.j3d.TransformGroup` | `globalModelTransformGroup` The TransformGroup which holds the switch holding the portrayal's scene graph models.
`javax.swing.Box` | `header` The component bar at the top of the Display3D.
`javax.swing.JToggleButton` | `layersbutton` The button which pops up the layers menu
`javax.swing.JButton` | `movieButton` The button which starts or stops a movie
`javax.swing.JButton` | `optionButton` The button which pops up the option pane
`Display3D.OptionPane3D` | `optionPane`
`javax.swing.JPopupMenu` | `popup` The popup layers menu
`javax.swing.JToggleButton` | `refreshbutton` The button which pops up the refresh menu
`javax.swing.JPopupMenu` | `refreshPopup` The field for scaling values
`javax.media.j3d.BranchGroup` | `root` The root scene graph node in the Java3D universe.
`NumberTextField` | `scaleField` The button which starts or stops a movie
`javax.swing.JComboBox` | `skipBox` The combo box for skipping frames
`NumberTextField` | `skipField` The field for skipping frames
`javax.swing.JFrame` | `skipFrame` The frame which holds the skip controls
`javax.swing.JButton` | `snapshotButton` The button which snaps a screenshot
`com.sun.j3d.utils.universe.SimpleUniverse` | `universe` The Java3D universe.
`javax.media.j3d.BranchGroup` | `viewRoot` An additional root scene graph node which is attached to the viewing transform of the universe, and thus stays in the same location regardless of the placement of the camera.

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`Display3D(double width, double height, GUIState simulation)` Creates a Display3D with the provided width and height for its portrayal region, attached to the provided simulation.
`Display3D(double width, double height, GUIState simulation, long interval)` Deprecated.

Method Summary
`void` | `attach(Inspector inspector, java.lang.String name)` A convenience function: creates a popup menu item of the given name which, when selected, will display the given inspector in the Console.
`void` | `attach(Portrayal3D portrayal, java.lang.String name)` Attaches a portrayal to the Display3D, along with the provided human-readable name for the portrayal.
`void` | `attach(Portrayal3D portrayal, java.lang.String name, boolean visible)` Attaches a portrayal to the Display3D, along with the provided human-readable name for the portrayal.
`void` | `clearBackdrop()` Clears any backdrop presently being used in the scene, turns off the backdrop checkbox, and disables the backdrop checkbox.
`void` | `clearSelections()`
`javax.swing.JFrame` | `createFrame()` Creates a frame holding the Display3D.
`void` | `createSceneGraph()` Recreates the entire scene graph, including the universe, root, and canvas3d.
`void` | `destroySceneGraph()` Eliminates the existing scene graph.
`java.util.ArrayList` | `detatchAll()` Detatches all portrayals from the Display3D.
`protected void` | `finalize()` Quits the Display3D.
`java.awt.Frame` | `getFrame()` Returns the frame holding this Component.
`java.lang.String` | `getPreferencesKey()`
`double` | `getScale()` Returns the value of the scale (magnification).
`SelectionBehavior` | `getSelectionBehavior()`
`GUIState` | `getSimulation()`
`ToolTipBehavior` | `getToolTipBehavior()`
`javax.media.j3d.Transform3D` | `getTransform()` Returns a copy of the current global model transform.
`void` | `paintComponent(java.awt.Graphics g)` Updates the scene graph
`void` | `performSelection(Bag locationWrappers)`
`void` | `performSelection(LocationWrapper wrapper)`
`void` | `quit()` Quits the Display3D.
`void` | `reset()` Resets the Display3D so it reschedules itself.
`void` | `resetTransform()` Resets the global model transform to its default value (identity).
`void` | `rotateX(double degrees)` Modifies the global model transform by rotating along the current X axis the provided number of degrees.
`void` | `rotateY(double degrees)` Modifies the global model transform by rotating along the current Y axis the provided number of degrees.
`void` | `rotateZ(double degrees)` Modifies the global model transform by rotating along the current Z axis the provided number of degrees.
`void` | `scale(double value)` Modifies the global model transform by uniformly scaling it in all directions by the provided amount.
`void` | `scale(double sx, double sy, double sz)` Modifies the internal transform by scaling it in a nonuniform fashion.
`protected void` | `sceneGraphCreated()` A hook for people who want to modify the scene graph just after it's been created (when the user pressed the start button usually; or if the user dynamicallly attaches or detaches portrayals) but before the root has been attached to the universe and before the canvas has started rendering.
`void` | `setBackdrop(javax.media.j3d.Appearance appearance)` Sets a general appearance for a spherical backdrop, turns on the backdrop checkbox, and enables the backdrop checkbox.
`void` | `setBackdrop(java.awt.Color color)` Sets the color for a flat backdrop, turns on the backdrop checkbox, and enables the backdrop checkbox.
`void` | `setBackdrop(java.awt.Image image, boolean spherical)` Sets the image for a backdrop (spherical or flat), turns on the backdrop checkbox, and enables the backdrop checkbox
`void` | `setPreferencesKey(java.lang.String s)` If you have more than one Display3D in your simulation and you want them to have different preferences, set each to a different key value.
`void` | `setScale(double val)` Changes the value of the scale (magnification).
`void` | `setSelectsAll(boolean selection, boolean inspection)` Sets whether mouse-clicking results in selecting all picked elements (true) or just the closest one (false).
`void` | `setShowsAmbientLight(boolean value)`
`void` | `setShowsAxes(boolean value)`
`void` | `setShowsBackdrop(boolean value)`
`void` | `setShowsSpotlight(boolean value)`
`void` | `setTransform(javax.media.j3d.Transform3D transform)` Sets the Display3D's global model transform.
`boolean` | `shouldUpdate()` Returns whether it's time to update.
`void` | `startMovie()` Starts a Quicktime movie on the given Display3D.
`void` | `step(SimState state)` Steps the Display3D in the GUIState schedule.
`void` | `stopMovie()` Stops a Quicktime movie and cleans up, flushing the remaining frames out to disk.
`void` | `takeSnapshot()` Takes a snapshot of the Display3D's currently displayed simulation.
`void` | `takeSnapshot(java.io.File file)` Takes a snapshot of the Display3D's currently displayed simulation.
`void` | `transform(javax.media.j3d.Transform3D transform)` Changes the global model transform of the FieldPortrayal3D by appending to it the provided transform operation.
`void` | `translate(double dx, double dy, double dz)` Modifies the global model transform by translating in the provided x, y, and z amounts.
`void` | `updateSceneGraph(boolean waitForRenderer)` Updates the scene graph to reflect changes in the simulation.

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_PREFERENCES_KEY

    public java.lang.String DEFAULT_PREFERENCES_KEY

### header

    public javax.swing.Box header

  The component bar at the top of the Display3D.

### movieButton

    public javax.swing.JButton movieButton

  The button which starts or stops a movie

### snapshotButton

    public javax.swing.JButton snapshotButton

  The button which snaps a screenshot

### optionButton

    public javax.swing.JButton optionButton

  The button which pops up the option pane

### refreshPopup

    public javax.swing.JPopupMenu refreshPopup

  The field for scaling values

### refreshbutton

    public javax.swing.JToggleButton refreshbutton

  The button which pops up the refresh menu

### scaleField

    public NumberTextField scaleField

  The button which starts or stops a movie

### skipField

    public NumberTextField skipField

  The field for skipping frames

### skipBox

    public javax.swing.JComboBox skipBox

  The combo box for skipping frames

### skipFrame

    public javax.swing.JFrame skipFrame

  The frame which holds the skip controls

### canvas

    public CapturingCanvas3D canvas

  The Java3D canvas holding the universe. A good time to fool around with this is in the sceneGraphCreated() hook.

### universe

    public com.sun.j3d.utils.universe.SimpleUniverse universe

  The Java3D universe. Created (and recreated) by createSceneGraph. A good time to fool around with this is in the sceneGraphCreated() hook.

### root

    public javax.media.j3d.BranchGroup root

  The root scene graph node in the Java3D universe. Created (and recreated) by createSceneGraph. This is a good place to hang things you don't want auto-rotated nor transformed by the Display3D. Hang things off of here in the sceneGraphCreated() hook.

### viewRoot

    public javax.media.j3d.BranchGroup viewRoot

  An additional root scene graph node which is attached to the viewing transform of the universe, and thus stays in the same location regardless of the placement of the camera.

### popup

    public javax.swing.JPopupMenu popup

  The popup layers menu

### layersbutton

    public javax.swing.JToggleButton layersbutton

  The button which pops up the layers menu

### globalModelTransformGroup

    public javax.media.j3d.TransformGroup globalModelTransformGroup

  The TransformGroup which holds the switch holding the portrayal's scene graph models. A good time to fool around with this is in the sceneGraphCreated() hook. This is a good place to hang stuff which you want to get rotated AND transformed along with the scene graph.

### autoSpinTransformGroup

    public javax.media.j3d.TransformGroup autoSpinTransformGroup

  The TransformGroup which used to spin the underlying model. This is a good place to hang stuff which you want to get rotated along with the models in the scene graph, but DON'T want transformed along with the scene graph.

### optionPane

    public Display3D.OptionPane3D optionPane

Constructor Detail

### Display3D

    public Display3D(double width,
                     double height,
                     GUIState simulation,
                     long interval)

  Deprecated.

  Creates a Display3D with the provided width and height for its portrayal region, attached to the provided simulation. The interval is ignored.

### Display3D

    public Display3D(double width,
                     double height,
                     GUIState simulation)

  Creates a Display3D with the provided width and height for its portrayal region, attached to the provided simulation.

Method Detail

### setPreferencesKey

    public void setPreferencesKey(java.lang.String s)

  If you have more than one Display3D in your simulation and you want them to have different preferences, set each to a different key value. The default value is DEFAULT_PREFERENCES_KEY. You may not have a key which ends in a forward slash (/) when trimmed Key may be set to null (the default).

### getPreferencesKey

    public java.lang.String getPreferencesKey()

### createFrame

    public javax.swing.JFrame createFrame()

  Creates a frame holding the Display3D. This is the best method to create the frame, rather than making a frame and putting the Display3D in it. Various bug fixes are provided in the JFrame which is returned by createFrame().

### getFrame

    public java.awt.Frame getFrame()

  Returns the frame holding this Component. If there is NO such frame, an error will be generated (probably a ClassCastException).

### reset

    public void reset()

  Resets the Display3D so it reschedules itself. This is useful when reusing the Display3D.

### attach

    public void attach(Portrayal3D portrayal,
                       java.lang.String name)

  Attaches a portrayal to the Display3D, along with the provided human-readable name for the portrayal. The portrayal will be transformed, along with similar attached portrayals, according to the Display3D's internal transform.

### attach

    public void attach(Portrayal3D portrayal,
                       java.lang.String name,
                       boolean visible)

  Attaches a portrayal to the Display3D, along with the provided human-readable name for the portrayal. The portrayal will be transformed, along with similar attached portrayals, according to the Display3D's internal transform. The portrayal may be attached initially visible or not visible.

### attach

    public void attach(Inspector inspector,
                       java.lang.String name)

  A convenience function: creates a popup menu item of the given name which, when selected, will display the given inspector in the Console. Used rarely, typically for per-field Inspectors.

### detatchAll

    public java.util.ArrayList detatchAll()

  Detatches all portrayals from the Display3D.

### getSimulation

    public GUIState getSimulation()

### clearBackdrop

    public void clearBackdrop()

  Clears any backdrop presently being used in the scene, turns off the backdrop checkbox, and disables the backdrop checkbox.

### setBackdrop

    public void setBackdrop(javax.media.j3d.Appearance appearance)

  Sets a general appearance for a spherical backdrop, turns on the backdrop checkbox, and enables the backdrop checkbox.

### setBackdrop

    public void setBackdrop(java.awt.Color color)

  Sets the color for a flat backdrop, turns on the backdrop checkbox, and enables the backdrop checkbox.

### setBackdrop

    public void setBackdrop(java.awt.Image image,
                            boolean spherical)

  Sets the image for a backdrop (spherical or flat), turns on the backdrop checkbox, and enables the backdrop checkbox

### setShowsAxes

    public void setShowsAxes(boolean value)

### setShowsBackdrop

    public void setShowsBackdrop(boolean value)

### setShowsSpotlight

    public void setShowsSpotlight(boolean value)

### setShowsAmbientLight

    public void setShowsAmbientLight(boolean value)

### getTransform

    public javax.media.j3d.Transform3D getTransform()

  Returns a copy of the current global model transform.

### setTransform

    public void setTransform(javax.media.j3d.Transform3D transform)

  Sets the Display3D's global model transform. This is a user-modifiable transform which should be used primarily to adjust the location all of the models together.

### transform

    public void transform(javax.media.j3d.Transform3D transform)

  Changes the global model transform of the FieldPortrayal3D by appending to it the provided transform operation.

### resetTransform

    public void resetTransform()

  Resets the global model transform to its default value (identity).

### rotateX

    public void rotateX(double degrees)

  Modifies the global model transform by rotating along the current X axis the provided number of degrees.

### rotateY

    public void rotateY(double degrees)

  Modifies the global model transform by rotating along the current Y axis the provided number of degrees.

### rotateZ

    public void rotateZ(double degrees)

  Modifies the global model transform by rotating along the current Z axis the provided number of degrees.

### translate

    public void translate(double dx,
                          double dy,
                          double dz)

  Modifies the global model transform by translating in the provided x, y, and z amounts.

### scale

    public void scale(double value)

  Modifies the global model transform by uniformly scaling it in all directions by the provided amount. Has nothing to do with the setScale(...) and getScale(...) methods.

### scale

    public void scale(double sx,
                      double sy,
                      double sz)

  Modifies the internal transform by scaling it in a nonuniform fashion. Note that this is less efficient than a uniform scale. Has nothing to do with the setScale(...) and getScale(...) methods.

### destroySceneGraph

    public void destroySceneGraph()

  Eliminates the existing scene graph. This ought to be called when starting a simulation prior to creating any new Portrayal3Ds. The reason is simple: if the Portrayal3Ds use shared geometry objects underneath, then creating them may create new shared geometry objects, which isn't permitted if there are existing shared geometry objects in a live scene graph. So destroy the scene graph, create the new objects, and recreate the scene graph, and you're set.

### createSceneGraph

    public void createSceneGraph()

  Recreates the entire scene graph, including the universe, root, and canvas3d. This is an expensive procedure and generally should only be called when starting a simulation (in GUIState's start() or load() methods). Just before the renderer is started and the scene goes online, the hook sceneGraphCreated() is called in case you'd like to add anything to the scene graph.

### sceneGraphCreated

    protected void sceneGraphCreated()

  A hook for people who want to modify the scene graph just after it's been created (when the user pressed the start button usually; or if the user dynamicallly attaches or detaches portrayals) but before the root has been attached to the universe and before the canvas has started rendering. Override this as you see fit. The default does nothing at all.

### setScale

    public void setScale(double val)

  Changes the value of the scale (magnification). Usually done by the user through changing the value of the Scale text field. This has nothing to do with the scale() method.

### getScale

    public double getScale()

  Returns the value of the scale (magnification). This has nothing to do with the scale() method.

### getSelectionBehavior

    public SelectionBehavior getSelectionBehavior()

### getToolTipBehavior

    public ToolTipBehavior getToolTipBehavior()

### setSelectsAll

    public void setSelectsAll(boolean selection,
                              boolean inspection)

  Sets whether mouse-clicking results in selecting all picked elements (true) or just the closest one (false). This can be done independently of selection and inspection. By default these values are both TRUE.

### paintComponent

    public void paintComponent(java.awt.Graphics g)

  Updates the scene graph

  Overrides:
    `paintComponent` in class `javax.swing.JComponent`

### shouldUpdate

    public boolean shouldUpdate()

  Returns whether it's time to update.

### step

    public void step(SimState state)

  Steps the Display3D in the GUIState schedule. Every interval steps, this results in updating the scen graph.

  Specified by:
    `step` in interface `Steppable`

### updateSceneGraph

    public void updateSceneGraph(boolean waitForRenderer)

  Updates the scene graph to reflect changes in the simulation. If waitForRenderer is true, we block until the renderer has finished producing the scene on-screen.

### takeSnapshot

    public void takeSnapshot(java.io.File file)
                      throws java.io.IOException

  Takes a snapshot of the Display3D's currently displayed simulation.

  Throws:
    `java.io.IOException`

### takeSnapshot

    public void takeSnapshot()

  Takes a snapshot of the Display3D's currently displayed simulation. Ought only be done from the main event loop.

### startMovie

    public void startMovie()

  Starts a Quicktime movie on the given Display3D. The size of the movie frame will be the size of the display at the time this method is called. This method ought to be called from the main event loop. Most of the default movie formats provided will result in a giagantic movie, which you can re-encode using something smarter (like the Animation or Sorenson codecs) to put to a reasonable size. On the Mac, Quicktime Pro will do this quite elegantly.

### stopMovie

    public void stopMovie()

  Stops a Quicktime movie and cleans up, flushing the remaining frames out to disk. This method ought to be called from the main event loop.

### quit

    public void quit()

  Quits the Display3D. Called by the Display3D's frame if the Display3D made the frame itself. Also called by finalize(). Otherwise you should call this method before destroying the Display3D.

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Quits the Display3D. Okay, so finalize is evil and we're not supposed to rely on it. We're not. But it's an additional cargo-cult programming measure just in case.

  Overrides:
    `finalize` in class `java.lang.Object`
  Throws:
    `java.lang.Throwable`

### performSelection

    public void performSelection(LocationWrapper wrapper)

### clearSelections

    public void clearSelections()

### performSelection

    public void performSelection(Bag locationWrappers)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD