|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.j3d.SceneGraphObject | +--javax.media.j3d.Node | +--javax.media.j3d.Leaf | +--javax.media.j3d.Shape3D | +--ElevationSegment
ElevationSegment is a specialization of Shape3d. It creates a 3D map of terrain data using an interleaved triangle strip array. Terrain data is passed into ElevationSegment as a two dimensional array of elevations. These are converted into a series of triangle strips to represent their geometry.
Field Summary | |
private static int |
COLOR_OFFSET
|
private static int |
COORD_OFFSET
|
private int |
dColumns
number of columns of vertex data stored |
private float |
deltaX
meters between columns of data |
private float |
deltaZ
meters between rows of data |
private int |
dRows
number of rows of vertex data stored |
private static int |
FLOATSPERVERTEX
|
GroundCoordinates |
groundCoordinates
ground coordinates for the model, contains the lat/long of the four corners in arc seconds |
private static javax.vecmath.Color3f |
matColor
|
private static int |
NORMAL_OFFSET
|
private InterleavedTriangleStripArray |
tStrip
|
private float[] |
vertexData
|
private float |
xStart
first column logical coordinate |
private float |
zStart
first row logical coordinate |
Fields inherited from class javax.media.j3d.Shape3D |
ALLOW_APPEARANCE_OVERRIDE_READ, ALLOW_APPEARANCE_OVERRIDE_WRITE, ALLOW_APPEARANCE_READ, ALLOW_APPEARANCE_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE, ALLOW_GEOMETRY_READ, ALLOW_GEOMETRY_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_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING |
Fields inherited from class javax.media.j3d.SceneGraphObject |
|
Constructor Summary | |
ElevationSegment(int[][] elevations,
int startRow,
int startColumn,
int stopRow,
int stopColumn,
int minEl,
int maxEl,
GroundCoordinates gc,
float exageration,
float lowX,
float highX,
float lowZ,
float highZ,
int resolution)
Constructor is reponsible for setting up the appearance/material, computing the triangle strip values (colors, normals, coordinates) stored in vertexData, then creating the actual JAVA 3D geometry. |
Method Summary | |
float |
getElevationAt(float x,
float z)
Fetches the elevation at a particular location on the terrain map given the x,z coordinates. |
void |
setColor(int i,
int elevation,
int minElevation,
int maxElevation)
store color data into vertex data array, compute color based on the elevation's distance between min and max elevations |
void |
setCoordinate(int[][] elevations,
int i,
int row,
int col,
int startRow,
int startColumn,
float exageration)
store coordinate data into vertex data array |
private void |
setupAppearance()
setup the material properties and coloring attributes |
void |
stitchRight(ElevationSegment other)
stitch right of this segment to left of other segment, stitching consists of averaging the normals on the common boundary vertices between segments. |
void |
stitchTop(ElevationSegment other)
stitch top of this segment to bottom of other segment, stitching consists of averaging the normals on the common boundary vertices between segments. |
Methods inherited from class javax.media.j3d.Shape3D |
addGeometry, cloneNode, duplicateNode, getAllGeometries, getAppearance, getAppearanceOverrideEnable, getBounds, getCollisionBounds, getGeometry, getGeometry, insertGeometry, intersect, intersect, numGeometries, removeGeometry, setAppearance, setAppearanceOverrideEnable, setCollisionBounds, setGeometry, setGeometry |
Methods inherited from class javax.media.j3d.Node |
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable |
Methods inherited from class javax.media.j3d.SceneGraphObject |
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData, updateNodeReferences |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public GroundCoordinates groundCoordinates
private int dRows
private int dColumns
private float deltaX
private float deltaZ
private float xStart
private float zStart
private static final int FLOATSPERVERTEX
private static final int COLOR_OFFSET
private static final int NORMAL_OFFSET
private static final int COORD_OFFSET
private float[] vertexData
private static javax.vecmath.Color3f matColor
private InterleavedTriangleStripArray tStrip
Constructor Detail |
public ElevationSegment(int[][] elevations, int startRow, int startColumn, int stopRow, int stopColumn, int minEl, int maxEl, GroundCoordinates gc, float exageration, float lowX, float highX, float lowZ, float highZ, int resolution)
elevations
- two dimensional array of terrain elevation data in metersstartRow
- first row of data to use from elevationsstartColumn
- first column of data to use from elevationsstopRow
- last row of data to use from elevationsstopColumn
- last column of data to use from elevationsminEl
- minimum elevation in elevationsmaxEl
- maximum elevation in elevationsgc
- latitude, longitude of the corners of this segmentexageration
- amount to exagerate(multiply) elevations bylowX
- starting x coordinate in metershighX
- stopping x coordinate in meterslowZ
- starting z coordinate in metershighZ
- stopping z coordinate in metersresolution
- number of rows/columns of elevation data to skip when mapping. A resolution
of 1 implies mapping every elevation point, a resolution of 10 implies mapping every 10th point.Method Detail |
private void setupAppearance()
public void setCoordinate(int[][] elevations, int i, int row, int col, int startRow, int startColumn, float exageration)
elevations
- array of elevationsi
- index into vertexData to store coordinaterow
- elevation rowcol
- elevation columnstartRow
- first row used in elevationsexageration
- elevation exageration factorpublic void setColor(int i, int elevation, int minElevation, int maxElevation)
i
- index into vertexData to store coordinateelevation
- vertex elevation (no exageration)minElevation
- minimum elevation in modelmaxElevation
- maximum elevation in modelpublic void stitchRight(ElevationSegment other)
other
- reference to the segment to the right of this onepublic void stitchTop(ElevationSegment other)
other
- reference to the segment to the right of this onepublic float getElevationAt(float x, float z)
x
- x coordinatez
- z coordinate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |