Aviatrix3D
2.1.0

org.j3d.renderer.aviatrix3d.loader.dem
Class DEMLoader

java.lang.Object
  extended by org.j3d.renderer.aviatrix3d.loader.dem.DEMLoader
All Implemented Interfaces:
org.j3d.loaders.HeightMapSource, AVLoader

public class DEMLoader
extends java.lang.Object
implements AVLoader, org.j3d.loaders.HeightMapSource

Loader for the USGS DEM file format.

The mesh produced is, by default, triangle strip arrays. The X axis represents East-West and the Z-axis represents North-South. +X is east, -Z is North. Texture coordinates are generated for the extents based on a single 0-1 scale for the width of the object.

The loader produces a single mesh that represents the file's contents. No further processing is performed in the current implementation to break the points into smaller tiles or use multi-resolution terrain structures.

DEM models do not contain layers or anything else other than the raw geometry. All the model list and map methods will return empty collections.

Version:
$Revision: 1.3 $
Author:
Justin Couch

Field Summary
 
Fields inherited from interface org.j3d.renderer.aviatrix3d.loader.AVLoader
BACKGROUNDS, FOGS, GEOMETRY, LAYERS, LIGHTS, LOAD_ALL, RUNTIMES, VIEWPOINTS
 
Constructor Summary
DEMLoader()
          Construct a new default loader with no flags set
 
Method Summary
 float[] getGridStep()
          Fetch information about the real-world stepping sizes that this grid uses.
 float[][] getHeights()
          Return the height map created for the last stream parsed.
 int getLoadFlags()
          Get the current set collection of load flags.
 org.j3d.loaders.dem.DEMTypeARecord getTypeARecord()
          Get the header used to describe the last stream parsed.
 org.j3d.loaders.dem.DEMTypeBRecord[] getTypeBRecords()
          Fetch all of the type B records that were registered in this file.
 org.j3d.loaders.dem.DEMTypeCRecord getTypeCRecord()
          Get the type C record from the file.
 boolean isInternalModelKept()
          Check to see whether the loader should be currently keeping the internal model.
 void keepInternalModel(boolean enable)
          Define whether this loader should also keep around it's internal representation of the file format, if it has one.
 AVModel load(java.io.File file)
          Load a model from the given file.
 AVModel load(java.io.InputStream stream)
          Load a model from the given input stream.
 AVModel load(java.net.URL url)
          Load a model from the given URL.
 void setLoadFlags(int flags)
          Set the flags for which parts of the file that should be loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DEMLoader

public DEMLoader()
Construct a new default loader with no flags set

Method Detail

load

public AVModel load(java.net.URL url)
             throws java.io.IOException
Load a model from the given URL.

Specified by:
load in interface AVLoader
Parameters:
url - The url to load the model from
Returns:
A representation of the model at the URL
Throws:
java.io.IOException - something went wrong while reading the file

load

public AVModel load(java.io.InputStream stream)
             throws java.io.IOException
Load a model from the given input stream. If the file format would prefer to use a Reader interface, then use the InputStreamReader to convert this stream to the desired type. The caller will be responsible for closing down the stream at the end of this process.

Specified by:
load in interface AVLoader
Parameters:
stream - The stream to load the model from
Returns:
A representation of the model from the stream contents
Throws:
java.io.IOException - something went wrong while reading the file

load

public AVModel load(java.io.File file)
             throws java.io.IOException
Load a model from the given file.

Specified by:
load in interface AVLoader
Parameters:
file - The file instance to load the model from
Returns:
A representation of the model in the file
Throws:
java.io.IOException - something went wrong while reading the file

setLoadFlags

public void setLoadFlags(int flags)
Set the flags for which parts of the file that should be loaded. The flags are bit-fields, so can be bitwise OR'd together.

Specified by:
setLoadFlags in interface AVLoader
Parameters:
flags - The collection of flags to use

getLoadFlags

public int getLoadFlags()
Get the current set collection of load flags.

Specified by:
getLoadFlags in interface AVLoader
Returns:
A bitmask of flags that are currently set

keepInternalModel

public void keepInternalModel(boolean enable)
Define whether this loader should also keep around it's internal representation of the file format, if it has one. If kept, this can be retrieved through the AVModel.getRawModel() method and cast to the appropriate class type.

Specified by:
keepInternalModel in interface AVLoader
Parameters:
enable - true to enable keeping the raw model, false otherwise

isInternalModelKept

public boolean isInternalModelKept()
Check to see whether the loader should be currently keeping the internal model.

Specified by:
isInternalModelKept in interface AVLoader
Returns:
true when the internal model should be kept

getHeights

public float[][] getHeights()
Return the height map created for the last stream parsed. If no stream has been parsed yet, this will return null.

Specified by:
getHeights in interface org.j3d.loaders.HeightMapSource
Returns:
The array of heights in [row][column] order or null

getGridStep

public float[] getGridStep()
Fetch information about the real-world stepping sizes that this grid uses.

Specified by:
getGridStep in interface org.j3d.loaders.HeightMapSource
Returns:
The stepping information for width and depth

getTypeARecord

public org.j3d.loaders.dem.DEMTypeARecord getTypeARecord()
Get the header used to describe the last stream parsed. If no stream has been parsed yet, this will return null.

Returns:
The header for the last read stream or null

getTypeBRecords

public org.j3d.loaders.dem.DEMTypeBRecord[] getTypeBRecords()
Fetch all of the type B records that were registered in this file. Will probably contain more than one record and is always non-null. The records will be in the order they were read from the file.

Returns:
The list of all the Type B records parsed

getTypeCRecord

public org.j3d.loaders.dem.DEMTypeCRecord getTypeCRecord()
Get the type C record from the file. If none was provided, then this will return null.

Returns:
The type C record info or null

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org