Renderer
Class Toy

java.lang.Object
  |
  +--Renderer.Toy

public class Toy
extends java.lang.Object

Defines a Toy in a Sandbox, which is the graphical counterpart to an Object in the Reasoner. It maintains a set of properties (position, dimensions, attitude, etc.) that are based on the Reasoner output but tailored for graphical rendering.

Version:
Created 17 February 2003
Author:
Dan Tappan
See Also:
Sandbox, Attitude, Dimensions, Position

Field Summary
private  Attitude m_attitude
           
private  javax.media.j3d.BranchGroup m_branch_group
           
private  Dimensions m_dimensions
           
private  java.util.Hashtable m_metaoverlays
           
private  ModelTemplate m_model
           
private  java.lang.String m_name
           
private  Position m_position
           
private  javax.media.j3d.TransformGroup m_transform_group_front_oriented_metaoverlays
           
private  javax.media.j3d.TransformGroup m_transform_group_north_oriented_metaoverlays
           
private  javax.media.j3d.TransformGroup m_transform_group_toy
           
 
Constructor Summary
Toy(java.lang.String toy_name, java.lang.String model_name, ModelLibrary model_library, boolean is_wireframe, float transparency, javax.vecmath.Color3f override_color, int instantiation_key)
          Creates a new toy.
 
Method Summary
 void addMetaOverlay(MetaOverlay metaoverlay)
          Adds a MetaOverlay to this toy.
 void addMetaOverlay(MetaOverlayPair metaoverlay_pair)
          Adds a MetaOverlayPair, which is a convenience wrapper around a pair of MetaOverlays.
 Attitude getAttitude()
          Returns the attitude of this toy.
 javax.media.j3d.BranchGroup getBranchGroup()
          Returns the Java3D branch group containing all the graphical components of this toy.
 Dimensions getDimensions()
          Returns the dimensions of this toy.
 MetaOverlay getMetaOverlay(java.lang.String name)
          Returns a metaoverlay associated with this toy.
 int getMetaOverlayCount()
          Returns the number of metaoverlays associated with this toy.
 java.util.Enumeration getMetaOverlayNames()
          Returns the name of the of metaoverlays associated with this toy.
 ModelTemplate getModelTemplate()
          Returns the model template defining this toy in the model library.
 java.lang.String getName()
          Returns the name of this toy.
 Position getPosition()
          Returns the position of this toy.
 java.lang.String toHTMLString()
          Returns an indented HTML string representation of this object to be displayed by the Representation Viewer.
 java.lang.String toString()
          Returns a string representation of this object.
 void update()
          Updates the graphical components of this toy after its position, attitude, and/or dimensions are changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_name

private java.lang.String m_name

m_position

private Position m_position

m_dimensions

private Dimensions m_dimensions

m_attitude

private Attitude m_attitude

m_branch_group

private javax.media.j3d.BranchGroup m_branch_group

m_transform_group_toy

private javax.media.j3d.TransformGroup m_transform_group_toy

m_transform_group_front_oriented_metaoverlays

private javax.media.j3d.TransformGroup m_transform_group_front_oriented_metaoverlays

m_transform_group_north_oriented_metaoverlays

private javax.media.j3d.TransformGroup m_transform_group_north_oriented_metaoverlays

m_metaoverlays

private java.util.Hashtable m_metaoverlays

m_model

private ModelTemplate m_model
Constructor Detail

Toy

public Toy(java.lang.String toy_name,
           java.lang.String model_name,
           ModelLibrary model_library,
           boolean is_wireframe,
           float transparency,
           javax.vecmath.Color3f override_color,
           int instantiation_key)
    throws java.lang.Exception
Creates a new toy. This is intended to be called from Sandbox only.

Parameters:
toy_name - - the name of this toy
model_name - - the name of the model to render for this toy
model_library - - the model library
is_wireframe - - whether the model will be rendered in wireframe
transparency - - the transparency at which the model will be rendered
override_color - - the optional color overriding the defined color of this model; otherwise null
instantiation_key - - the "secret code" to prevent unintentional uses of this constructor
Throws:
java.lang.Exception - - if this constructor is called from an unapproved location
See Also:
Sandbox
Method Detail

addMetaOverlay

public void addMetaOverlay(MetaOverlay metaoverlay)
                    throws java.lang.Exception
Adds a MetaOverlay to this toy.

Parameters:
metaoverlay - - the metaoverlay
Throws:
java.lang.Exception - - if a metaoverlay with the same name is already associated with this toy

addMetaOverlay

public void addMetaOverlay(MetaOverlayPair metaoverlay_pair)
                    throws java.lang.Exception
Adds a MetaOverlayPair, which is a convenience wrapper around a pair of MetaOverlays.

Parameters:
metaoverlay_pair - - the metaoverlay pair
Throws:
java.lang.Exception - - if either metaoverlay could not be added

getAttitude

public Attitude getAttitude()
Returns the attitude of this toy.

Returns:
the attitude

getBranchGroup

public javax.media.j3d.BranchGroup getBranchGroup()
Returns the Java3D branch group containing all the graphical components of this toy.

Returns:
the branch group

getDimensions

public Dimensions getDimensions()
Returns the dimensions of this toy.

Returns:
the dimensions

getMetaOverlay

public MetaOverlay getMetaOverlay(java.lang.String name)
                           throws java.lang.Exception
Returns a metaoverlay associated with this toy.

Parameters:
name - - the metaoverlay name
Returns:
the metaoverlay
Throws:
java.lang.Exception - - if the metaoverlay is not associated with this toy

getMetaOverlayCount

public int getMetaOverlayCount()
Returns the number of metaoverlays associated with this toy.

Returns:
the count

getMetaOverlayNames

public java.util.Enumeration getMetaOverlayNames()
Returns the name of the of metaoverlays associated with this toy.

Returns:
the string list

getModelTemplate

public ModelTemplate getModelTemplate()
Returns the model template defining this toy in the model library.

Returns:
the model template

getName

public java.lang.String getName()
Returns the name of this toy.

Returns:
the name

getPosition

public Position getPosition()
Returns the position of this toy.

Returns:
the position

toHTMLString

public java.lang.String toHTMLString()
Returns an indented HTML string representation of this object to be displayed by the Representation Viewer.

Returns:
the String representation
See Also:
RepresentationViewer

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
the String representation
See Also:
Support.toPrettyString(java.lang.String)

update

public void update()
Updates the graphical components of this toy after its position, attitude, and/or dimensions are changed.