j3d.org Code

org.j3d.terrain
Class AbstractTerrainData

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

public abstract class AbstractTerrainData
extends java.lang.Object
implements TerrainData

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. Does not allow you to directly extend this class. It is provided for basic common functionality that is extended by the more derived versions.

Version:
$Revision: 1.3 $
Author:
Justin Couch

Field Summary
protected  boolean colorAvailable
          Flag indicating if colour data is available from this dataset.
protected  double gridStepX
          The real world distance between each X (width) grid position
protected  double gridStepY
          The real world distance between each Y (depth) grid position
protected  boolean textureAvailable
          Flag indicating if texture data is available from this dataset.
 
Fields inherited from interface org.j3d.terrain.TerrainData
FREEFORM_DATA, STATIC_DATA, TILED_DATA
 
Constructor Summary
protected AbstractTerrainData(int dataType)
          Create a new instance.of this data class with all flags set to false.
 
Method Summary
 double getGridXStep()
          Get the real world distance between consecutive X values in the grid.
 double getGridYStep()
          Get the real world distance between consecutive Y values in the grid.
 int getSourceDataType()
          Get the type of terrain data that we are dealing with.
 boolean hasColor()
          Check to see if this terrain data has per-vertex colours.
 boolean hasTexture()
          Check to see if this terrain data has any texturing at all - either tiled or simple.
 
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, getHeightFromGrid
 
Methods inherited from interface org.j3d.ui.navigation.HeightDataSource
getHeight
 

Field Detail

colorAvailable

protected boolean colorAvailable
Flag indicating if colour data is available from this dataset.


textureAvailable

protected boolean textureAvailable
Flag indicating if texture data is available from this dataset.


gridStepX

protected double gridStepX
The real world distance between each X (width) grid position


gridStepY

protected double gridStepY
The real world distance between each Y (depth) grid position

Constructor Detail

AbstractTerrainData

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

Parameters:
dataType - The type of data that this instance represents
Method Detail

getSourceDataType

public int getSourceDataType()
Get the type of terrain data that we are dealing with. One of the constant types are returned. More efficient way of dealing with multiple types than using instanceof

Specified by:
getSourceDataType in interface TerrainData
Returns:
The type of data that this instance represents

hasColor

public boolean hasColor()
Check to see if this terrain data has per-vertex colours. Colour may be used with or separately from the texture data. This allows you to use colours to modulate the texture information if desired. Note that if you provide per-vertex colour information here, you need to be careful with the appearance information that gets set if you provide a custom appearance generator implementation that comes with the renderer-specific versions of this class.

Specified by:
hasColor in interface TerrainData
Returns:
true If per-vertex color is available

hasTexture

public boolean hasTexture()
Check to see if this terrain data has any texturing at all - either tiled or simple.

Specified by:
hasTexture in interface TerrainData
Returns:
true If a texture(s) is available

getGridXStep

public double getGridXStep()
Get the real world distance between consecutive X values in the grid.

Specified by:
getGridXStep in interface TerrainData
Returns:
The distance between each step of the grid

getGridYStep

public double getGridYStep()
Get the real world distance between consecutive Y values in the grid.

Specified by:
getGridYStep in interface TerrainData
Returns:
The distance between each step of the grid

j3d.org Code

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