deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.rendering.r3d.multiresolution
Class MeshFragment

java.lang.Object
  extended by org.deegree.rendering.r3d.multiresolution.MeshFragment
All Implemented Interfaces:
Comparable<MeshFragment>

public class MeshFragment
extends Object
implements Comparable<MeshFragment>

Encapsulates the bounding box and approximation error for a fragment of a MultiresolutionMesh and provides access to the actual geometry data.

Version:
$Revision$
Author:
Markus Schneider, last edited by: $Author$

Field Summary
 float[][] bbox
          The bbox of the frament
 float error
          The geometric error.
 int id
          the id of the mesh fragment
static int SIZE
          Size of binary representation (in bytes).
 
Constructor Summary
MeshFragment(int id, ByteBuffer buffer, MeshFragmentDataReader patchReader)
           
 
Method Summary
 boolean canAllocateEnoughMemory()
           
 int compareTo(MeshFragment o)
           
 long getLastByteOffset()
           
 long getOffset()
           
 MeshFragmentData loadData()
          Retrieves the actual geometry data of the MeshFragment.
 int size()
           
static void store(ByteBuffer target, float[][] bbox, float error, long blobPosition, int length)
          Save this fragment to the given byte buffer.
static void store(ByteBuffer target, float minX, float minY, float minZ, float maxX, float maxY, float maxZ, float error, long blobPosition, int length)
          Save this fragment to the given ByteBuffer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE

public static int SIZE
Size of binary representation (in bytes). NOTE: This is just the meta information of the patch, not the geometry data.


id

public final int id
the id of the mesh fragment


bbox

public final float[][] bbox
The bbox of the frament


error

public final float error
The geometric error.

Constructor Detail

MeshFragment

MeshFragment(int id,
             ByteBuffer buffer,
             MeshFragmentDataReader patchReader)
Method Detail

getOffset

public long getOffset()
Returns:
offset of in the file.

getLastByteOffset

public long getLastByteOffset()
Returns:
the last byte position.

loadData

public MeshFragmentData loadData()
                          throws IOException
Retrieves the actual geometry data of the MeshFragment.

NOTE: Calling this method usually involves I/O and memory allocation operations and the caller should probably incorporate caching mechanisms to reduce the number of calls.

Returns:
the actual geometry data of the fragment
Throws:
IOException

store

public static void store(ByteBuffer target,
                         float minX,
                         float minY,
                         float minZ,
                         float maxX,
                         float maxY,
                         float maxZ,
                         float error,
                         long blobPosition,
                         int length)
Save this fragment to the given ByteBuffer.

Parameters:
target -
minX -
minY -
minZ -
maxX -
maxY -
maxZ -
error -
blobPosition -
length -

store

public static void store(ByteBuffer target,
                         float[][] bbox,
                         float error,
                         long blobPosition,
                         int length)
Save this fragment to the given byte buffer.

Parameters:
target -
bbox -
error -
blobPosition -
length -

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(MeshFragment o)
Specified by:
compareTo in interface Comparable<MeshFragment>

size

public int size()
Returns:
the size in bytes of this mesh fragment

canAllocateEnoughMemory

public boolean canAllocateEnoughMemory()
Returns:
true if the used direct buffer pool can allocate enough direct memory for the given data.

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>