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: 29307 $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Field Summary
 float[][] bbox
          The bbox of the fragment
 float error
          The geometric error.
 int id
          the id of the mesh fragment
static int SIZE
          Size of binary representation (in bytes).
 
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 final int SIZE
Size of binary representation (in bytes). NOTE: This is just the meta information of the patch, not the geometry data.

See Also:
Constant Field Values

id

public final int id
the id of the mesh fragment


bbox

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


error

public final float error
The geometric error.

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.


Copyright © 2011. All Rights Reserved.