com.c5corp.c5j3d
Class DEM3dAppearance

java.lang.Object
  extended by Shape3D
      extended by com.c5corp.c5j3d.DEM3d
          extended by com.c5corp.c5j3d.DEM3dAppearance

public class DEM3dAppearance
extends DEM3d

DEM3dAppearance extends DEM3d and creates a DEM3d object with an editable appearance. A significant feature is that a texture can be applied to the object. Furthermore, an object's texture will be automatically fit to the object's surface. If a texture is specified, the image used must have an equal width and height of 2^n pixels and should be no larger than 2048x2048 pixels.

DEM3dAppearance has been tested with 24k California DEMs, which are typically around 1 or 2 megabytes in size, and with textures derived from images up to 2048x2048 pixels in size. When testing the class' main program, it has required an allocation of 256 megabytes of memory (ex. from the command line: java -Xmx256M DEM3d ___.dem ___.gif/.jpg/.png).

Since:
2.0
Author:
donated to version 2.0 Brandon Stow

Field Summary
protected  Appearance appearance
          The central j3d object encapsulated by DEM3dAppearance
 
Fields inherited from class com.c5corp.c5j3d.DEM3d
indexedQuadArray
 
Constructor Summary
DEM3dAppearance(DemTable demTable)
          Constructs a DEM3dAppearance object from a DemTable.
DEM3dAppearance(DemTable demTable, java.awt.image.BufferedImage bufferedImage)
          Constructs a DEM3dAppearance object with a texture from a DemTable.
DEM3dAppearance(DemTable demTable, float objectWidth, float objectBreadth, float objectHeight)
          Constructs a DEM3dAppearance object with specified dimensions from a DemTable
DEM3dAppearance(DemTable demTable, float objectWidth, float objectBreadth, float objectHeight, java.awt.image.BufferedImage bufferedImage)
          Constructs a DEM3dAppearance object with a texture and specified dimensions from a DemTable
 
Method Summary
 java.awt.image.BufferedImage getTexture()
          Returns the object's texture.
 Color4f getTextureBlendColor()
          returns the color for the blend texture mode.
static void main(java.lang.String[] args)
          Renders an example 3D object from a DEM file and applies an image as a texture.
 void setPolygonMode(int polygonMode)
          Sets the polygon mode for the object.
 void setTextureBlendColor(Color4f blendColor)
          Sets the color for the blend texture mode if there is a texture applied.
 void setTextureMode(int textureMode)
          Sets the texture mode for the object if there is a texture applied.
 
Methods inherited from class com.c5corp.c5j3d.DEM3d
getBreadth, getDemTable, getHeight, getHighElevationColor, getLowElevationColor, getName, getNECorner, getNWCorner, getSECorner, getSWCorner, getUTMAngle, getWidth, setColoringScheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appearance

protected Appearance appearance
The central j3d object encapsulated by DEM3dAppearance

Constructor Detail

DEM3dAppearance

public DEM3dAppearance(DemTable demTable)
Constructs a DEM3dAppearance object from a DemTable.

Parameters:
demTable - the DemTable object

DEM3dAppearance

public DEM3dAppearance(DemTable demTable,
                       java.awt.image.BufferedImage bufferedImage)
Constructs a DEM3dAppearance object with a texture from a DemTable.

Parameters:
demTable - the DemTable object
bufferedImage - the object's texture

DEM3dAppearance

public DEM3dAppearance(DemTable demTable,
                       float objectWidth,
                       float objectBreadth,
                       float objectHeight)
Constructs a DEM3dAppearance object with specified dimensions from a DemTable

Parameters:
demTable - the DemTable object
objectWidth - the object's width
objectBreadth - the object's breadth
objectHeight - the object's height

DEM3dAppearance

public DEM3dAppearance(DemTable demTable,
                       float objectWidth,
                       float objectBreadth,
                       float objectHeight,
                       java.awt.image.BufferedImage bufferedImage)
Constructs a DEM3dAppearance object with a texture and specified dimensions from a DemTable

Parameters:
demTable - the DemTable object
objectWidth - the object's width
objectBreadth - the object's breadth
objectHeight - the object's height
bufferedImage - the object's texture
Method Detail

getTexture

public java.awt.image.BufferedImage getTexture()
Returns the object's texture.


setPolygonMode

public void setPolygonMode(int polygonMode)
Sets the polygon mode for the object. The object's polygon mode is writable so this can be set after the object has been rendered.

Parameters:
polygonMode - the mode in which the object's polygons are displayed. Possible parameters are PolygonAttributes.POLYGON_FILL (or 2), PolygonAttributes.POLYGON_LINE (or 1), and PolygonAttributes.POLYGON_POINT (or 0). This is initially set to fill.

setTextureBlendColor

public void setTextureBlendColor(Color4f blendColor)
Sets the color for the blend texture mode if there is a texture applied. The object's blend color is writable so this can be set after the object has been rendered.

Parameters:
blendColor - the color for the blend texture mode. This is initially set to black.

getTextureBlendColor

public Color4f getTextureBlendColor()
returns the color for the blend texture mode.


setTextureMode

public void setTextureMode(int textureMode)
Sets the texture mode for the object if there is a texture applied. The object's texture mode is writable so this can be set after the object has been rendered.

Parameters:
textureMode - the mode in which the texture is displayed. Possible parameters are TextureAttributes.MODULATE (or 2), TextureAttributes.DECAL (or 3), TextureAttributes.BLEND (or 4), and TextureAttributes.REPLACE (or 5). This is initially set to modulate.

main

public static void main(java.lang.String[] args)
Renders an example 3D object from a DEM file and applies an image as a texture. (The image must be of a Java supported format, have a width and height of 2^n pixels, and should be no larger than 2048x2048 pixels. The program demonstrates the capability to change the object's appearance in real-time. To run using a 24k DEM and GIF, JPEG, or PNG image: java -Xmx256M DEM3d ___.dem ___.gif/.jpg/.png