edu.d.umn.geometry
Class ElevationModel

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Group
              extended by javax.media.j3d.BranchGroup
                  extended by edu.d.umn.geometry.ElevationModel
All Implemented Interfaces:
ElevationModelInterface

public class ElevationModel
extends javax.media.j3d.BranchGroup
implements ElevationModelInterface

ElevationModel is a specialization of a BranchGroup that holds Java3D geometry objects representing a terrain map. The map is divided into segments each segment contains a Level-of-Detail switch containing the geometry for the segment in three levels of detail. This allows for faster drawing and navigation of the model as a whole.

See Also:
LODSegment

Field Summary
protected  float deltaCol
          space in meters between each column of elevation data
protected  float deltaRow
          space in meters between each row of elevation data
 float east_X
          maximum X coordinate
 float exageration
          Factor each elevation reading is multiplied by when drawing the model.
protected  ElevationFile file
          The ElevationFile that holds the data.
 GroundCoordinates groundCoordinates
          GroundCoordinates for the model, contains the lat/long of the four corners in arc seconds
protected  int maxElevation
          maximum elevation in meters
protected  int minElevation
          minimum elevation in meters
 java.lang.String name
          geographic name or title of the data
 float north_Z
          minimum Z coordinate
static int SECONDS_PER_SEGMENT
          number of seconds high/wide of each segment is
protected  LODSegment[][] segments
          two dimensional array of segments comprising the model data
 float south_Z
          maximum Z coordinate, note, positive Z axis is in the south due to Java3D
 float west_X
          minimum X coordinate
 
Fields inherited from class javax.media.j3d.BranchGroup
ALLOW_DETACH
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
protected ElevationModel()
          Empty constructor.
  ElevationModel(java.lang.String aFileName, StatusWindow stat)
          Sets up and compiles the ElevationModel.
 
Method Summary
 void changeExageration(float amount)
          Change the exageration of the model.
protected  void createLODSegments(StatusWindow stat)
          Initializes the LODSegment array to a number of columns and rows based on the GroundCoordinates length and width in seconds and the SECONDS_PER_SEGMENT.
 float getElevationAt(float x, float z)
          Fetches the elevation at a particular location on the terrain map given the x,z coordinates.
 float getMaxElevation()
          retrieve the model maximum elevation, adjusted by the elevation exageration
 float getMinElevation()
          retrieve the model minimum elevation, adjusted by the elevation exageration
 float getModelLength()
          retrieve the model length, distance in meters from west to east
 float getModelWidth()
          retrieve the model width, distance in meters from south to north
 float getQuadResolution()
          Retrieve the resolution of the dem.
 LODSegment getSegment(int col, int row)
          Returns an LODSegment located at [row][col]
 void recalcNormals()
          Recalculates the normal values so that the lighting effects change when the elevation exageration change.
 void setColor(java.awt.Color color)
          Changes the color of the model.
 void setTexture(javax.media.j3d.Texture2D tex)
          Change the texture of the model.
 
Methods inherited from class javax.media.j3d.BranchGroup
cloneNode, compile, detach, pickAll, pickAll, pickAllSorted, pickAllSorted, pickAny, pickAny, pickClosest, pickClosest
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, insertChild, moveTo, numChildren, removeAllChildren, removeChild, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

groundCoordinates

public GroundCoordinates groundCoordinates
GroundCoordinates for the model, contains the lat/long of the four corners in arc seconds


west_X

public float west_X
minimum X coordinate


east_X

public float east_X
maximum X coordinate


south_Z

public float south_Z
maximum Z coordinate, note, positive Z axis is in the south due to Java3D


north_Z

public float north_Z
minimum Z coordinate


SECONDS_PER_SEGMENT

public static final int SECONDS_PER_SEGMENT
number of seconds high/wide of each segment is

See Also:
Constant Field Values

deltaRow

protected float deltaRow
space in meters between each row of elevation data


deltaCol

protected float deltaCol
space in meters between each column of elevation data


exageration

public float exageration
Factor each elevation reading is multiplied by when drawing the model. Makes elevation differences stand out


minElevation

protected int minElevation
minimum elevation in meters


maxElevation

protected int maxElevation
maximum elevation in meters


name

public java.lang.String name
geographic name or title of the data


segments

protected LODSegment[][] segments
two dimensional array of segments comprising the model data


file

protected ElevationFile file
The ElevationFile that holds the data.

Constructor Detail

ElevationModel

protected ElevationModel()
Empty constructor.


ElevationModel

public ElevationModel(java.lang.String aFileName,
                      StatusWindow stat)
               throws java.io.IOException
Sets up and compiles the ElevationModel.

Parameters:
aFileName - full name of the file to use.
stat - Reference to the status window to display loading status.
Throws:
java.io.IOException - Thrown if the file does not exist.
Method Detail

createLODSegments

protected void createLODSegments(StatusWindow stat)
Initializes the LODSegment array to a number of columns and rows based on the GroundCoordinates length and width in seconds and the SECONDS_PER_SEGMENT. Also stitches together the top and right sides to create a smooth mesh.


getElevationAt

public float getElevationAt(float x,
                            float z)
Fetches the elevation at a particular location on the terrain map given the x,z coordinates. X,Z coordinates represent the distance in meters from the center of the terrain image

Specified by:
getElevationAt in interface ElevationModelInterface
Parameters:
x - x coordinate
z - z coordinate
Returns:
the elevation (y coordinate) in meters (adjusted for exageration)

getModelLength

public float getModelLength()
retrieve the model length, distance in meters from west to east

Specified by:
getModelLength in interface ElevationModelInterface
Returns:
the length in meters

getModelWidth

public float getModelWidth()
retrieve the model width, distance in meters from south to north

Specified by:
getModelWidth in interface ElevationModelInterface
Returns:
the width in meters

getMaxElevation

public float getMaxElevation()
retrieve the model maximum elevation, adjusted by the elevation exageration

Specified by:
getMaxElevation in interface ElevationModelInterface
Returns:
the adjusted maximum elevation in meters

getMinElevation

public float getMinElevation()
retrieve the model minimum elevation, adjusted by the elevation exageration

Specified by:
getMinElevation in interface ElevationModelInterface
Returns:
the adjusted minimum elevation in meters

setTexture

public void setTexture(javax.media.j3d.Texture2D tex)
Change the texture of the model.

Parameters:
tex - The Texture2D to change to.

changeExageration

public void changeExageration(float amount)
Change the exageration of the model.

Parameters:
amount - The amount to change the exageration to.

getSegment

public LODSegment getSegment(int col,
                             int row)
Returns an LODSegment located at [row][col]

Parameters:
col - the column of the LODSegment
row - the row of the LODSegment
Returns:
An LODSegment located at [row][col]

getQuadResolution

public float getQuadResolution()
Retrieve the resolution of the dem. Typically will be 24k for an SDTS transfer.

Returns:
The resolution of the quad data.

recalcNormals

public void recalcNormals()
Recalculates the normal values so that the lighting effects change when the elevation exageration change.


setColor

public void setColor(java.awt.Color color)
Changes the color of the model.

Parameters:
color - Desired color to change to.