Renderer
Class MetaOverlay

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

public class MetaOverlay
extends java.lang.Object

Handles the myriad forms of graphical objects that can be associated with a Toy. A MetaOverlay is not technically part of a toy. Rather it is a graphical presentation of some part of the information that defines the toy. For example, a Region is a named zone somewhere around an object/toy. This information is important in reasoning and elsewhere but has no visual component. To help show how it contributes, it can be shown as a special object that does whatever its toy does (i.e., in attitude, position, and typically dimensions).

Many built-in overlays are available and can be enabled just by adding them to a toy:

Any combination of Regions can be added. It is also possible to treat other Java3D objects as metaoverlays.

Version:
Created 24 February 2003
Author:
Dan Tappan
See Also:
MetaOverlayPair, Region

Field Summary
private  boolean ANTIALIAS_ENABLED
           
private  float BASE_Y
           
private  float CELL_SUBDIVISION_OFFSET
           
private  float m_bounding_cylinder
           
private  javax.media.j3d.Appearance m_overlay_appearance
           
private  java.lang.String m_overlay_name
           
private  javax.media.j3d.Node m_overlay_node
           
private  Region m_region
           
private  float m_region_horizon
           
private static java.lang.String[] OVERLAY_NAMES
           
static int OVERLAY_PAIR_TYPE_PLANE_DIRECTIONAL
           
static int OVERLAY_PAIR_TYPE_PLANE_LATERAL
           
static int OVERLAY_PAIR_TYPE_PLANE_LONGITUDINAL
           
static int OVERLAY_PAIR_TYPE_SHELL
           
static int OVERLAY_TYPE_AXIS_DIRECTIONAL
           
static int OVERLAY_TYPE_AXIS_LATERAL
           
static int OVERLAY_TYPE_AXIS_LONGITUDINAL
           
static int OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL
           
static int OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME
           
static int OVERLAY_TYPE_PLANE_LATERAL_FILL
           
static int OVERLAY_TYPE_PLANE_LATERAL_FRAME
           
static int OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL
           
static int OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME
           
static int OVERLAY_TYPE_SHELL_FILL
           
static int OVERLAY_TYPE_SHELL_FRAME
           
private  float REGION_TRANSPARENCY
           
private  float TOPOLOGY_HEIGHT_FACTOR
           
private  float TOY_EXTENT_FACTOR
           
 
Constructor Summary
MetaOverlay(int overlay_type, boolean is_special)
          Creates a new overlay of an axis, plane, or shell.
MetaOverlay(int overlay_type, boolean is_special, Toy toy)
          Creates a new overlay of an axis, plane, or shell.
MetaOverlay(java.lang.String name, javax.media.j3d.BranchGroup branch, javax.media.j3d.Appearance appearance, Toy toy)
          Creates a new overlay based on an existing Java3D branch group.
MetaOverlay(java.lang.String name, Region region, javax.vecmath.Color3f color, boolean is_frame_otherwise_fill, boolean show_topology, Toy toy)
          Creates a new overlay based on a Region.
 
Method Summary
private  javax.media.j3d.BranchGroup createAxis(int axis, boolean is_coned)
          Creates an overlay of the axis of a geometric plane.
private  javax.media.j3d.BranchGroup createBranch(javax.media.j3d.BranchGroup branch, javax.media.j3d.Appearance appearance)
          Creates a Java3D branch group based on an existing branch group.
private  javax.media.j3d.BranchGroup createBranch(int overlay_type, boolean is_special)
          Creates a Java3D branch group based on an overlay type.
private  javax.media.j3d.BranchGroup createOverlay(javax.media.j3d.BranchGroup branch)
          Creates an overlay based on an existing Java3D branch group.
private  javax.media.j3d.BranchGroup createPlane(int overlay_type)
          Creates a single geometric plane, either framed or filled.
private  javax.media.j3d.BranchGroup createProjection(java.util.ArrayList polygon_list)
          Builds a projection based on a list of polygons built with setCell.
private  javax.media.j3d.BranchGroup createRegion(Region region, javax.vecmath.Color3f color, boolean is_frame_otherwise_fill, boolean show_topology)
          Creates the graphical rendering that corresponds to the definition in a Region.
private  javax.media.j3d.BranchGroup createShell(int overlay_type, boolean is_back_culled)
          Creates the graphical rendering of a shell around the outside surface of a projection.
 java.lang.String getName()
          Returns the name of this overlay.
protected  javax.media.j3d.Node getNode()
          Returns the Java3D Node of this overlay.
 boolean getVisible()
          Returns whether this overlay is visible.
 boolean isFrontOriented()
          Gets the region orientation, which forces the first sector always to point toward either the front of the object this metaoverlay is associated with or toward north.
private  void setAppearance(javax.media.j3d.PolygonAttributes polygon_attributes, javax.media.j3d.LineAttributes line_attributes, javax.media.j3d.TransparencyAttributes transparency_attributes, javax.media.j3d.ColoringAttributes coloring_attributes)
          Sets the global appearance parameters for this overlay.
private  void setCell(java.util.ArrayList polygon_list, float region_ring, float region_sector, float topology_elevation)
          Adds one two-dimensional point to a list of polygons that will be rendered as a set of region cells.
private  void setCell(java.util.ArrayList polygon_list, int region_ring, int region_sector)
          Adds one two-dimensional point to a list of polygons that will be rendered as a set of region cells.
 void setVisible(boolean is_visible)
          Sets whether this overlay is visible.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OVERLAY_TYPE_AXIS_LATERAL

public static final int OVERLAY_TYPE_AXIS_LATERAL
See Also:
Constant Field Values

OVERLAY_TYPE_AXIS_LONGITUDINAL

public static final int OVERLAY_TYPE_AXIS_LONGITUDINAL
See Also:
Constant Field Values

OVERLAY_TYPE_AXIS_DIRECTIONAL

public static final int OVERLAY_TYPE_AXIS_DIRECTIONAL
See Also:
Constant Field Values

OVERLAY_TYPE_PLANE_LATERAL_FRAME

public static final int OVERLAY_TYPE_PLANE_LATERAL_FRAME
See Also:
Constant Field Values

OVERLAY_TYPE_PLANE_LATERAL_FILL

public static final int OVERLAY_TYPE_PLANE_LATERAL_FILL
See Also:
Constant Field Values

OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME

public static final int OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME
See Also:
Constant Field Values

OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL

public static final int OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL
See Also:
Constant Field Values

OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME

public static final int OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME
See Also:
Constant Field Values

OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL

public static final int OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL
See Also:
Constant Field Values

OVERLAY_TYPE_SHELL_FRAME

public static final int OVERLAY_TYPE_SHELL_FRAME
See Also:
Constant Field Values

OVERLAY_TYPE_SHELL_FILL

public static final int OVERLAY_TYPE_SHELL_FILL
See Also:
Constant Field Values

OVERLAY_PAIR_TYPE_PLANE_LATERAL

public static final int OVERLAY_PAIR_TYPE_PLANE_LATERAL
See Also:
Constant Field Values

OVERLAY_PAIR_TYPE_PLANE_LONGITUDINAL

public static final int OVERLAY_PAIR_TYPE_PLANE_LONGITUDINAL
See Also:
Constant Field Values

OVERLAY_PAIR_TYPE_PLANE_DIRECTIONAL

public static final int OVERLAY_PAIR_TYPE_PLANE_DIRECTIONAL
See Also:
Constant Field Values

OVERLAY_PAIR_TYPE_SHELL

public static final int OVERLAY_PAIR_TYPE_SHELL
See Also:
Constant Field Values

OVERLAY_NAMES

private static final java.lang.String[] OVERLAY_NAMES

REGION_TRANSPARENCY

private final float REGION_TRANSPARENCY
See Also:
Constant Field Values

ANTIALIAS_ENABLED

private final boolean ANTIALIAS_ENABLED
See Also:
Constant Field Values

m_overlay_name

private java.lang.String m_overlay_name

m_overlay_node

private javax.media.j3d.Node m_overlay_node

m_overlay_appearance

private javax.media.j3d.Appearance m_overlay_appearance

BASE_Y

private final float BASE_Y
See Also:
Constant Field Values

CELL_SUBDIVISION_OFFSET

private final float CELL_SUBDIVISION_OFFSET
See Also:
Constant Field Values

TOPOLOGY_HEIGHT_FACTOR

private final float TOPOLOGY_HEIGHT_FACTOR
See Also:
Constant Field Values

TOY_EXTENT_FACTOR

private final float TOY_EXTENT_FACTOR
See Also:
Constant Field Values

m_region_horizon

private float m_region_horizon

m_bounding_cylinder

private float m_bounding_cylinder

m_region

private Region m_region
Constructor Detail

MetaOverlay

public MetaOverlay(java.lang.String name,
                   Region region,
                   javax.vecmath.Color3f color,
                   boolean is_frame_otherwise_fill,
                   boolean show_topology,
                   Toy toy)
            throws java.lang.Exception
Creates a new overlay based on a Region.

Parameters:
name - - the name of the overlay
region - - the region defining the overlay
color - - the color of the overlay
is_frame_otherwise_fill - - whether the rendering is a frame or fill
show_topology - - whether the topology mesh should be displayed
toy - - the toy this overlay is associated with
Throws:
java.lang.Exception - - if the overlay cannot be created
See Also:
createRegion(Geometry.Region, javax.vecmath.Color3f, boolean, boolean)

MetaOverlay

public MetaOverlay(int overlay_type,
                   boolean is_special)
            throws java.lang.Exception
Creates a new overlay of an axis, plane, or shell.

Parameters:
overlay_type - - the overlay type
is_special - - for overlay_type=OVERLAY_PAIR_TYPE_SHELL, whether the shell will be back-culled; for overlay_type=OVERLAY_PAIR_TYPE_PLANE_?, whether the axes will have cones; otherwise this is ignored
Throws:
java.lang.Exception - - if the overlay cannot be created
See Also:
createBranch(javax.media.j3d.BranchGroup, javax.media.j3d.Appearance), OVERLAY_TYPE_AXIS_LATERAL, OVERLAY_TYPE_AXIS_DIRECTIONAL, OVERLAY_TYPE_AXIS_LONGITUDINAL, OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME, OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL, OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME, OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL, OVERLAY_TYPE_PLANE_LATERAL_FRAME, OVERLAY_TYPE_PLANE_LATERAL_FILL, OVERLAY_TYPE_SHELL_FRAME, OVERLAY_TYPE_SHELL_FILL

MetaOverlay

public MetaOverlay(int overlay_type,
                   boolean is_special,
                   Toy toy)
            throws java.lang.Exception
Creates a new overlay of an axis, plane, or shell.

Parameters:
overlay_type - - the overlay type
is_special - - for overlay_type=OVERLAY_PAIR_TYPE_SHELL, whether the shell will be back-culled; for overlay_type=OVERLAY_PAIR_TYPE_PLANE_?, whether the axes will have cones; otherwise this is ignored
toy - - the toy this overlay is associated with
Throws:
java.lang.Exception - - if the overlay cannot be created
See Also:
createBranch(javax.media.j3d.BranchGroup, javax.media.j3d.Appearance), OVERLAY_TYPE_AXIS_LATERAL, OVERLAY_TYPE_AXIS_DIRECTIONAL, OVERLAY_TYPE_AXIS_LONGITUDINAL, OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME, OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL, OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME, OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL, OVERLAY_TYPE_PLANE_LATERAL_FRAME, OVERLAY_TYPE_PLANE_LATERAL_FILL, OVERLAY_TYPE_SHELL_FRAME, OVERLAY_TYPE_SHELL_FILL

MetaOverlay

public MetaOverlay(java.lang.String name,
                   javax.media.j3d.BranchGroup branch,
                   javax.media.j3d.Appearance appearance,
                   Toy toy)
            throws java.lang.Exception
Creates a new overlay based on an existing Java3D branch group.

Parameters:
name - - the name of the overlay
branch - - the branch group
appearance - - the appearance of the branch group
toy - - the toy this overlay is associated with
Throws:
java.lang.Exception - - if the overlay cannot be created
See Also:
createBranch(javax.media.j3d.BranchGroup, javax.media.j3d.Appearance)
Method Detail

createAxis

private javax.media.j3d.BranchGroup createAxis(int axis,
                                               boolean is_coned)
                                        throws java.lang.Exception
Creates an overlay of the axis of a geometric plane.

Parameters:
axis - - the axis
is_coned - - whether a directional cone should be rendered at the tip
Returns:
the Java3D branch group
Throws:
java.lang.Exception - - if the axis is invalid
See Also:
OVERLAY_TYPE_AXIS_LATERAL, OVERLAY_TYPE_AXIS_DIRECTIONAL, OVERLAY_TYPE_AXIS_LONGITUDINAL

createBranch

private javax.media.j3d.BranchGroup createBranch(javax.media.j3d.BranchGroup branch,
                                                 javax.media.j3d.Appearance appearance)
Creates a Java3D branch group based on an existing branch group.

Parameters:
branch - - the branch group
appearance - - the appearance of the branch group
Returns:
the new branch group

createBranch

private javax.media.j3d.BranchGroup createBranch(int overlay_type,
                                                 boolean is_special)
                                          throws java.lang.Exception
Creates a Java3D branch group based on an overlay type.

Parameters:
overlay_type - - the overlay type
is_special - - for overlay_type=OVERLAY_PAIR_TYPE_SHELL, whether the shell will be back-culled; for overlay_type=OVERLAY_PAIR_TYPE_PLANE_?, whether the axes will have cones; otherwise this is ignored
Returns:
the Java3D branch group
Throws:
java.lang.Exception - - if the overlay type is invalid
See Also:
OVERLAY_TYPE_AXIS_LATERAL, OVERLAY_TYPE_AXIS_DIRECTIONAL, OVERLAY_TYPE_AXIS_LONGITUDINAL, OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME, OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL, OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME, OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL, OVERLAY_TYPE_PLANE_LATERAL_FRAME, OVERLAY_TYPE_PLANE_LATERAL_FILL, OVERLAY_TYPE_SHELL_FRAME, OVERLAY_TYPE_SHELL_FILL

createOverlay

private javax.media.j3d.BranchGroup createOverlay(javax.media.j3d.BranchGroup branch)
Creates an overlay based on an existing Java3D branch group. This allows other metaobjects to be associated with a toy. Control over this type of overlay is the responsibility of whatever created it.

This feature is not currently in use and may not be up to date.

Returns:
the Java3D branch group of the overlay

createPlane

private javax.media.j3d.BranchGroup createPlane(int overlay_type)
                                         throws java.lang.Exception
Creates a single geometric plane, either framed or filled.

Parameters:
overlay_type - - the overlay type
Returns:
the Java3D branch group for the plane
Throws:
java.lang.Exception - - if the overlay type is invalid
See Also:
OVERLAY_TYPE_PLANE_LONGITUDINAL_FRAME, OVERLAY_TYPE_PLANE_LONGITUDINAL_FILL, OVERLAY_TYPE_PLANE_DIRECTIONAL_FRAME, OVERLAY_TYPE_PLANE_DIRECTIONAL_FILL, OVERLAY_TYPE_PLANE_LATERAL_FRAME, OVERLAY_TYPE_PLANE_LATERAL_FILL

createRegion

private javax.media.j3d.BranchGroup createRegion(Region region,
                                                 javax.vecmath.Color3f color,
                                                 boolean is_frame_otherwise_fill,
                                                 boolean show_topology)
                                          throws java.lang.Exception
Creates the graphical rendering that corresponds to the definition in a Region.

Parameters:
region - - the region
color - - the color of the region
is_frame_otherwise_fill - - whether the rendering is a frame or fill
Returns:
the Java3D branch group for the region
Throws:
java.lang.Exception - - if creation fails

createShell

private javax.media.j3d.BranchGroup createShell(int overlay_type,
                                                boolean is_back_culled)
                                         throws java.lang.Exception
Creates the graphical rendering of a shell around the outside surface of a projection.

Parameters:
overlay_type - - the overlay type
is_back_culled - - whether the back face of the shell is hidden
Returns:
the Java3D branch group for the shell
Throws:
java.lang.Exception - - if the overlay type is invalid
See Also:
OVERLAY_TYPE_SHELL_FRAME, OVERLAY_TYPE_SHELL_FILL

createProjection

private javax.media.j3d.BranchGroup createProjection(java.util.ArrayList polygon_list)
                                              throws java.lang.Exception
Builds a projection based on a list of polygons built with setCell.

Parameters:
polygon_list - - the polygon list of Point3f objects
Returns:
the Java3D branch group
Throws:
java.lang.Exception - - if creation fails
See Also:
setCell(java.util.ArrayList, int, int)

getName

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

Returns:
the name

getNode

protected javax.media.j3d.Node getNode()
Returns the Java3D Node of this overlay.

Returns:
the node

getVisible

public boolean getVisible()
Returns whether this overlay is visible.

Returns:
the visibility

isFrontOriented

public boolean isFrontOriented()
Gets the region orientation, which forces the first sector always to point toward either the front of the object this metaoverlay is associated with or toward north. This can return false only for a metaoverlay based on region.

Returns:
whether the orientation is front otherwise north

setAppearance

private void setAppearance(javax.media.j3d.PolygonAttributes polygon_attributes,
                           javax.media.j3d.LineAttributes line_attributes,
                           javax.media.j3d.TransparencyAttributes transparency_attributes,
                           javax.media.j3d.ColoringAttributes coloring_attributes)
Sets the global appearance parameters for this overlay.

Parameters:
polygon_attributes - - the polygon attributes
line_attributes - - the line attributes
transparency_attributes - - the transparency attributes
coloring_attributes - - the coloring attributes

setCell

private void setCell(java.util.ArrayList polygon_list,
                     int region_ring,
                     int region_sector)
Adds one two-dimensional point to a list of polygons that will be rendered as a set of region cells. Since this project now relies on a two-dimensional scheme, the vertical component is fixed.

Parameters:
polygon_list - - the polygons composed of cells built through calls here. This is an in/out parameter
region_ring - - the ring of the cell to add
region_sector - - the sector of the cell to add

setCell

private void setCell(java.util.ArrayList polygon_list,
                     float region_ring,
                     float region_sector,
                     float topology_elevation)
Adds one two-dimensional point to a list of polygons that will be rendered as a set of region cells.

Parameters:
polygon_list - - the polygons composed of cells built through calls here. This is an in/out parameter
topology_elevation - - the topology elevation

setVisible

public void setVisible(boolean is_visible)
Sets whether this overlay is visible.

Parameters:
is_visible - - the visibility

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)