|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JPanel
|
+--Renderer.Sandbox
Defines the graphical equivalent of a "world" full of "objects." It is a three-dimensional, interactive container for any number toys. The user can fly around the sandbox, view its contents from any perspective, select toys to view their history through the system, etc.
A Sandbox resides in a Playground with any number of other Sandboxes. Each depicts a slightly different interpretation of the source-text description. They can be viewed independently or synchronized.
SandboxController,
Attitude,
ModelLibrary,
Position,
Toy,
Playground,
Serialized Form| Field Summary | |
private Toy |
m_active_toy
|
private SnapCanvas3D |
m_canvas
|
private ModelLibrary |
m_model_library
|
private MonteCarloRunSet |
m_monte_carlo_run_set
|
private java.lang.String |
m_name
|
private Playground |
m_playground
|
private javax.media.j3d.BranchGroup |
m_root_branch_group
|
private SandboxController |
m_sandbox_controller
|
private java.util.Hashtable |
m_toys
|
private com.sun.j3d.utils.universe.SimpleUniverse |
m_universe
|
private float |
WORLD_GRID_SPACING
|
private float |
WORLD_PEDESTAL_HEIGHT
|
private float |
WORLD_PEDESTAL_OFFSET
|
protected static float |
WORLD_PEDESTAL_RADIUS
|
| Fields inherited from class javax.swing.JPanel |
|
| 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.Container |
|
| 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 | |
Sandbox(java.lang.String name,
ModelLibrary model_library,
Playground playground,
MonteCarloRunSet monte_carlo_run_set,
boolean is_wireframe,
int instantiation_key)
Creates a new sandbox. |
|
| Method Summary | |
Toy |
addToy(java.lang.String toy_name,
java.lang.String model_name,
boolean is_wireframe,
float transparency,
javax.vecmath.Color3f override_color)
Creates and adds a toy to this sandbox. |
private javax.media.j3d.BranchGroup |
buildSandboxPedestal(boolean is_wireframe)
Builds the sandbox pedestal on which the entire "world" resides. |
void |
commit()
Commits the contents of this sandbox to remain static. |
MonteCarloRunSet |
getMonteCarloRunSet()
Returns the Monte Carlo run set defining the contents of this sandbox. |
java.lang.String |
getName()
Returns the name of this sandbox. |
Toy |
getToy(java.lang.String name)
Returns a toy. |
int |
getToyCount()
Returns the number of toys in this sandbox. |
java.util.Enumeration |
getToyNames()
Returns a list of the names of all toys in this sandbox. |
Attitude |
getViewerAttitude()
Returns the combined attitude of the field of view and the head of the viewer in this sandbox. |
Attitude |
getViewerFieldOfViewAttitude()
Returns the attitude of the field of view of the viewer in this sandbox. |
Attitude |
getViewerHeadAttitude()
Returns the attitude of the head of the viewer in this sandbox. |
Position |
getViewerPosition()
Returns the position of the viewer in this sandbox. |
protected void |
normalizeToyInteractively(int modifier_code,
int key_code)
Implements a semi-hardcoded editor to normalize the position, scaling, and dimensions of models within a standard frame. |
protected void |
processSelectionCallback(java.lang.String selection_identifier,
java.awt.event.MouseEvent event)
Handles a selection callback from the SandboxController in charge of this sandbox. |
protected void |
processSynchronizationCallback()
Handles a synchronization callback from the SandboxController in charge of this sandbox. |
void |
setSize(int width,
int height)
Sets the size of the panel on which the SnapCanvas3D is located. |
java.lang.String |
toString()
Returns a string representation of this object. |
void |
update()
Updates this sandbox and all Toys in it. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static float WORLD_PEDESTAL_RADIUS
private float WORLD_PEDESTAL_HEIGHT
private float WORLD_PEDESTAL_OFFSET
private float WORLD_GRID_SPACING
private java.lang.String m_name
private java.util.Hashtable m_toys
private javax.media.j3d.BranchGroup m_root_branch_group
private SnapCanvas3D m_canvas
private SandboxController m_sandbox_controller
private ModelLibrary m_model_library
private com.sun.j3d.utils.universe.SimpleUniverse m_universe
private Playground m_playground
private MonteCarloRunSet m_monte_carlo_run_set
private Toy m_active_toy
| Constructor Detail |
public Sandbox(java.lang.String name,
ModelLibrary model_library,
Playground playground,
MonteCarloRunSet monte_carlo_run_set,
boolean is_wireframe,
int instantiation_key)
throws java.lang.Exception
name - - the name of the sandbox, unique within the playground where it wil residemodel_library - - the system model libraryplayground - - the playground that will contain this sandboxmonte_carlo_run_set - - the Monte Carlo run set defining the contents of this sandboxis_wireframe - - whether this sandbox will be rendered in wireframeinstantiation_key - - the "secret code" to prevent unintentional uses of this constructor
java.lang.Exception - - if this constructor is called from an unapproved location| Method Detail |
public Toy addToy(java.lang.String toy_name,
java.lang.String model_name,
boolean is_wireframe,
float transparency,
javax.vecmath.Color3f override_color)
throws java.lang.Exception
toy_name - - the name of the toy, unique within this sandboxmodel_name - - the model name for the toy as defined in the ModelLibraryis_wireframe - - whether this toy should be rendered in wireframetransparency - - the transparency of this toyoverride_color - - the optional color overriding the defined color of this model; otherwise null
java.lang.Exception - - if a toy with the given name is already presentcommit(),
ModelLibraryprivate javax.media.j3d.BranchGroup buildSandboxPedestal(boolean is_wireframe)
is_wireframe - - whether the pedestal should be rendered in wireframe
public void commit()
addToy(java.lang.String, java.lang.String, boolean, float, javax.vecmath.Color3f)public MonteCarloRunSet getMonteCarloRunSet()
public java.lang.String getName()
getName in class java.awt.Componentpublic Toy getToy(java.lang.String name)
name - - the toy name
public int getToyCount()
public java.util.Enumeration getToyNames()
public Attitude getViewerAttitude()
This is a read-only composite of two attitudes, which are combined in SandboxController.
public Attitude getViewerFieldOfViewAttitude()
The return value may be modified to change the attitude. Call update() afterwards to reflect the changes.
update()public Attitude getViewerHeadAttitude()
The return value may be modified to change the attitude. Call update() afterwards to reflect the changes.
update()public Position getViewerPosition()
protected void normalizeToyInteractively(int modifier_code,
int key_code)
This is for development only.
modifier_code - - the key modifier for shift or non-shiftkey_code - - the key codeSandboxController.MODEL_EDIT_MODE
protected void processSelectionCallback(java.lang.String selection_identifier,
java.awt.event.MouseEvent event)
selection_identifier - - an identifier specifying what was clicked onevent - - the event that invoked this callbackprotected void processSynchronizationCallback()
public void setSize(int width,
int height)
setSize in class java.awt.Componentwidth - - the width in pixelsheight - - the height in pixelsSnapCanvas3Dpublic java.lang.String toString()
toString in class java.awt.ComponentSupport.toPrettyString(java.lang.String)public void update()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||