j3d.org Code

org.j3d.terrain
Class AbstractStaticTerrainData

java.lang.Object
  extended by org.j3d.terrain.AbstractTerrainData
      extended by org.j3d.terrain.AbstractStaticTerrainData
All Implemented Interfaces:
StaticTerrainData, TerrainData, HeightDataSource
Direct Known Subclasses:
HeightMapTerrainData

public abstract class AbstractStaticTerrainData
extends AbstractTerrainData
implements StaticTerrainData

An abstract representation of the base functionality for a TerrainData implementation.

This class provides a lot of the common functionality that all implementations will require. Good to save you typing.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Field Summary
protected  int gridDepth
          The depth of the terrain in grid points.
protected  int gridWidth
          The width of the terrain in grid points.
protected  java.awt.image.BufferedImage texture
          The texture object that is loaded for this instance.
 
Fields inherited from class org.j3d.terrain.AbstractTerrainData
colorAvailable, gridStepX, gridStepY, textureAvailable
 
Fields inherited from interface org.j3d.terrain.TerrainData
FREEFORM_DATA, STATIC_DATA, TILED_DATA
 
Constructor Summary
protected AbstractStaticTerrainData()
          Create a new instance.of this data class with all flags set to false.
 
Method Summary
 int getGridDepth()
          Get the depth (number of points on the X axis) of the grid.
 int getGridWidth()
          Get the width (number of points on the Y axis) of the grid.
 java.awt.image.BufferedImage getTexture()
          Fetch the BufferedImage that is used to cover the entire terrain.
 void setTexture(java.awt.image.BufferedImage tex)
          Set the texture object that can be used with this terrain instance.
 
Methods inherited from class org.j3d.terrain.AbstractTerrainData
getGridXStep, getGridYStep, getSourceDataType, hasColor, hasTexture
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.terrain.TerrainData
getCoordinate, getCoordinate, getCoordinateWithColor, getCoordinateWithTexture, getGridXStep, getGridYStep, getHeightFromGrid, getSourceDataType, hasColor, hasTexture
 
Methods inherited from interface org.j3d.ui.navigation.HeightDataSource
getHeight
 

Field Detail

texture

protected java.awt.image.BufferedImage texture
The texture object that is loaded for this instance.


gridWidth

protected int gridWidth
The width of the terrain in grid points. (Y coordinate)


gridDepth

protected int gridDepth
The depth of the terrain in grid points. (X coordinate)

Constructor Detail

AbstractStaticTerrainData

protected AbstractStaticTerrainData()
Create a new instance.of this data class with all flags set to false.

Method Detail

getTexture

public java.awt.image.BufferedImage getTexture()
Fetch the BufferedImage that is used to cover the entire terrain. If no texture is used, then return null. Assumes a single large texture for the entire terrain.

Specified by:
getTexture in interface StaticTerrainData
Returns:
The texture instance to use or null

getGridWidth

public int getGridWidth()
Get the width (number of points on the Y axis) of the grid.

Specified by:
getGridWidth in interface StaticTerrainData
Returns:
The number of points in the width if the grid

getGridDepth

public int getGridDepth()
Get the depth (number of points on the X axis) of the grid.

Specified by:
getGridDepth in interface StaticTerrainData
Returns:
The number of points in the depth of the grid

setTexture

public void setTexture(java.awt.image.BufferedImage tex)
Set the texture object that can be used with this terrain instance. Passing a value of null will remove the currently set texture.

Parameters:
tex - The texture instance to use or null to clear

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org