Class ElevationGridGenerator
java.lang.Object
org.web3d.vrml.renderer.common.nodes.geospatial.ElevationGridGenerator
A generator that takes a set of height values as a grid and turns it into
geometry suitable for local graphics projections.
Points are defined in the height arrays in width first order. Normals, are always smooth blended.
Alan: There are some cases where texture generation is not complete. Especially in regards to 3D textures.
This class originally came from the j3d.org ElevationGridGenerator, but has been mostly gutted and special cased for the needs of this system.
- Version:
- $Revision: 1.7 $
- Author:
- Justin Couch
-
Constructor Summary
ConstructorsConstructorDescriptionElevationGridGenerator
(double w, double d, int wPnts, int dPnts, float yScale, double[] heights) Construct a customized terrain according to the full set of configurable data. -
Method Summary
Modifier and TypeMethodDescriptionvoid
generate
(org.j3d.geom.GeometryData data, org.opengis.referencing.operation.MathTransform transform, double[] gridOrigin, double[] localOrigin, boolean indexed, double creaseAngle) Generate a new set of geometry items based on the passed data.void
generateIndexedQuads
(org.j3d.geom.GeometryData data, org.opengis.referencing.operation.MathTransform transform, double[] gridOrigin, double[] localOrigin, boolean indexed, double creaseAngle, double[] vertex) Generate indexed quads.int
getVertexCount
(boolean indexed) Get the number of vertices that this generator will create for the shape given in the definition based on the current width and height information.void
setDimensions
(double w, double d, int wPnts, int dPnts) Change the dimensions of the cone to be generated.void
setTerrainDetail
(double[] heights) Set the details of the terrain height to use a flat array of values.
-
Constructor Details
-
ElevationGridGenerator
public ElevationGridGenerator(double w, double d, int wPnts, int dPnts, float yScale, double[] heights) Construct a customized terrain according to the full set of configurable data.- Parameters:
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depthyScale
- y axix scalarheights
- The array of height values to use- Throws:
IllegalArgumentException
- One of the points were <= 1 or the dimensions are non-positive
-
-
Method Details
-
setDimensions
public void setDimensions(double w, double d, int wPnts, int dPnts) Change the dimensions of the cone to be generated. Calling this will make the points be re-calculated next time you ask for geometry or normals.- Parameters:
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depth- Throws:
IllegalArgumentException
- One of the points were <= 1 or the dimensions are non-positive
-
setTerrainDetail
public void setTerrainDetail(double[] heights) Set the details of the terrain height to use a flat array of values.- Parameters:
heights
- The array of height values to use
-
getVertexCount
public int getVertexCount(boolean indexed) Get the number of vertices that this generator will create for the shape given in the definition based on the current width and height information.- Parameters:
indexed
- True if this is to be indexed triangle strips, false otherwise- Returns:
- The vertex count for the object
- Throws:
org.j3d.geom.UnsupportedTypeException
- The generator cannot handle the type of geometry you have requested.
-
generate
public void generate(org.j3d.geom.GeometryData data, org.opengis.referencing.operation.MathTransform transform, double[] gridOrigin, double[] localOrigin, boolean indexed, double creaseAngle) throws org.j3d.geom.InvalidArraySizeException, org.opengis.referencing.operation.TransformException Generate a new set of geometry items based on the passed data. If the data does not contain the right minimum array lengths an exception will be generated. If the array reference is null, this will create arrays of the correct length and assign them to the return value.- Parameters:
data
- The data to base the calculations ontransform
- The geodetic transformation neededgridOrigin
- The location of the SW corner of the gridlocalOrigin
- an origin offset if needed. Null if notindexed
- True if this is to be indexed triangle strips, false otherwisecreaseAngle
- angle over which we want to create separate normals rather than smoothed normals- Throws:
org.j3d.geom.InvalidArraySizeException
- The array is not big enough to contain the requested geometryorg.opengis.referencing.operation.TransformException
-
generateIndexedQuads
public void generateIndexedQuads(org.j3d.geom.GeometryData data, org.opengis.referencing.operation.MathTransform transform, double[] gridOrigin, double[] localOrigin, boolean indexed, double creaseAngle, double[] vertex) throws org.j3d.geom.InvalidArraySizeException, org.opengis.referencing.operation.TransformException Generate indexed quads.- Parameters:
data
- The data to base the calculations ontransform
- The geodetic transformation neededgridOrigin
- The location of the SW corner of the gridlocalOrigin
- an origin offset if needed. Null if notindexed
- True if this is to be indexed triangle strips, false otherwisecreaseAngle
- angle over which we want to create separate normals rather than smoothed normalsvertex
-- Throws:
org.j3d.geom.InvalidArraySizeException
- The array is not big enough to contain the requested geometryorg.opengis.referencing.operation.TransformException
-