Package javax.media.j3d

# Class CompressedGeometry

java.lang.Object
javax.media.j3d.SceneGraphObject
javax.media.j3d.NodeComponent
javax.media.j3d.Geometry
javax.media.j3d.CompressedGeometry

public class CompressedGeometry extends Geometry
Deprecated.
As of Java 3D version 1.4.
The compressed geometry object is used to store geometry in a compressed format. Using compressed geometry may increase the speed objects can be sent over the network. Note that the geometry will be decompressed in memory, so the application will not see any memory savings.

Compressed geometry may be passed to this CompressedGeometry object in one of two ways: by copying the data into this object using the existing constructor, or by passing a reference to the data.

- By Copying: The existing CompressedGeometry constructor copies the buffer of compressed geometry data into this CompressedGeometry object. This is appropriate for many applications, and allows Java 3D to verify the data once and then not worry about it again.
- By Reference: A new constructor and set of methods in Java 3D version 1.2 allows compressed geometry data to be accessed by reference, directly from the user's array. To use this feature, you need to construct a CompressedGeometry object with the `byReference` flag set to `true`. In this mode, a reference to the input data is saved, but the data itself is not necessarily copied. Note that the compressed geometry header is still copied into this compressed geometry object. Data referenced by a CompressedGeometry object must not be modified after the CompressedGeometry object is constructed. Applications must exercise care not to violate this rule. If any referenced compressed geometry data is modified after construction, the results are undefined.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ALLOW_COUNT_READ`
Deprecated.
Specifies that this CompressedGeometry object allows reading its byte count information.
`static final int`
`ALLOW_GEOMETRY_READ`
Deprecated.
Specifies that this CompressedGeometry object allows reading its geometry data component information.
`static final int`
`ALLOW_HEADER_READ`
Deprecated.
Specifies that this CompressedGeometry object allows reading its header information.
`static final int`
`ALLOW_REF_DATA_READ`
Deprecated.
Specifies that this CompressedGeometry allows reading the geometry data reference information for this object.

### Fields inherited from class javax.media.j3d.Geometry

`ALLOW_INTERSECT`

## Constructor Summary

Constructors
Constructor
Description
`CompressedGeometry(CompressedGeometryHeader hdr, byte[] compressedGeometry)`
Deprecated.
Creates a new CompressedGeometry NodeComponent by copying the specified compressed geometry data into this object.
`CompressedGeometry(CompressedGeometryHeader hdr, byte[] compressedGeometry, boolean byReference)`
Deprecated.
Creates a new CompressedGeometry NodeComponent.
`CompressedGeometry(CompressedGeometryHeader hdr, J3DBuffer compressedGeometry)`
Deprecated.
This constructor is not implemented.

## Method Summary

Modifier and Type
Method
Description
`NodeComponent`
`cloneNodeComponent()`
Deprecated.
replaced with cloneNodeComponent(boolean forceDuplicate)
`Shape3D[]`
`decompress()`
Deprecated.
Decompresses the compressed geometry.
`int`
`getByteCount()`
Deprecated.
Returns the size, in bytes, of the compressed geometry buffer.
`void`
`getCompressedGeometry(byte[] compressedGeometry)`
Deprecated.
Retrieves the compressed geometry associated with the CompressedGeometry NodeComponent object.
`J3DBuffer`
`getCompressedGeometryBuffer()`
Deprecated.
Gets the compressed geometry data buffer reference, which is always null since NIO buffers are not supported for CompressedGeometry objects.
`void`
`getCompressedGeometryHeader(CompressedGeometryHeader hdr)`
Deprecated.
Copies the compressed geometry header from the CompressedGeometry NodeComponent into the passed in parameter.
`byte[]`
`getCompressedGeometryRef()`
Deprecated.
Gets the compressed geometry data reference.
`boolean`
`isByReference()`
Deprecated.
Retrieves the data access mode for this CompressedGeometry object.

### Methods inherited from class javax.media.j3d.NodeComponent

`cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree`

### Methods inherited from class javax.media.j3d.SceneGraphObject

`clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### ALLOW_COUNT_READ

public static final int ALLOW_COUNT_READ
Deprecated.
Specifies that this CompressedGeometry object allows reading its byte count information.

See Also:
  - Constant Field Values

### ALLOW_HEADER_READ

public static final int ALLOW_HEADER_READ
Deprecated.
Specifies that this CompressedGeometry object allows reading its header information.

See Also:
  - Constant Field Values

### ALLOW_GEOMETRY_READ

public static final int ALLOW_GEOMETRY_READ
Deprecated.
Specifies that this CompressedGeometry object allows reading its geometry data component information.

See Also:
  - Constant Field Values

### ALLOW_REF_DATA_READ

public static final int ALLOW_REF_DATA_READ
Deprecated.
Specifies that this CompressedGeometry allows reading the geometry data reference information for this object. This is only used in by-reference geometry mode.

Since:
  Java 3D 1.2
See Also:
  - Constant Field Values

## Constructor Details

### CompressedGeometry

public CompressedGeometry(CompressedGeometryHeader hdr, byte[] compressedGeometry)
Deprecated.
Creates a new CompressedGeometry NodeComponent by copying the specified compressed geometry data into this object. If the version number of compressed geometry, as specified by the CompressedGeometryHeader, is incompatible with the supported version of compressed geometry in the current version of Java 3D, then the compressed geometry object will not be rendered.

Parameters:
  `hdr` - the compressed geometry header. This is copied into the CompressedGeometry NodeComponent.
  `compressedGeometry` - the compressed geometry data. The geometry must conform to the format described in Appendix B of the Java 3D API Specification.
Throws:
  `IllegalArgumentException` - if a problem is detected with the header
See Also:
  - `CompressedGeometryHeader`
  - `Canvas3D.queryProperties()`

### CompressedGeometry

public CompressedGeometry(CompressedGeometryHeader hdr, byte[] compressedGeometry, boolean byReference)
Deprecated.
Creates a new CompressedGeometry NodeComponent. The specified compressed geometry data is either copied into this object or is accessed by reference. If the version number of compressed geometry, as specified by the CompressedGeometryHeader, is incompatible with the supported version of compressed geometry in the current version of Java 3D, the compressed geometry object will not be rendered.

Parameters:
  `hdr` - the compressed geometry header. This is copied into the CompressedGeometry NodeComponent.
  `compressedGeometry` - the compressed geometry data. The geometry must conform to the format described in Appendix B of the Java 3D API Specification.
  `byReference` - a flag that indicates whether the data is copied into this compressed geometry object or is accessed by reference.
Throws:
  `IllegalArgumentException` - if a problem is detected with the header
Since:
  Java 3D 1.2
See Also:
  - `CompressedGeometryHeader`
  - `Canvas3D.queryProperties()`

### CompressedGeometry

public CompressedGeometry(CompressedGeometryHeader hdr, J3DBuffer compressedGeometry)
Deprecated.
This constructor is not implemented.

Throws:
  `UnsupportedOperationException` - this constructor is not implemented
Since:
  Java 3D 1.3

## Method Details

### getByteCount

public int getByteCount()
Deprecated.
Returns the size, in bytes, of the compressed geometry buffer. The size of the compressed geometry header is not included.

Returns:
  the size, in bytes, of the compressed geometry buffer.
Throws:
  `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### getCompressedGeometryHeader

public void getCompressedGeometryHeader(CompressedGeometryHeader hdr)
Deprecated.
Copies the compressed geometry header from the CompressedGeometry NodeComponent into the passed in parameter.

Parameters:
  `hdr` - the CompressedGeometryHeader object into which to copy the CompressedGeometry NodeComponent's header; the offset field may differ from that which was originally specified if a copy of the original compressed geometry byte array was created.
Throws:
  `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
  - `CompressedGeometryHeader`

### getCompressedGeometry

public void getCompressedGeometry(byte[] compressedGeometry)
Deprecated.
Retrieves the compressed geometry associated with the CompressedGeometry NodeComponent object. Copies the compressed geometry from the CompressedGeometry node into the given array. The array must be large enough to hold all of the bytes. The individual array elements must be allocated by the caller.

Parameters:
  `compressedGeometry` - the array into which to copy the compressed geometry.
Throws:
  `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph
  `IllegalStateException` - if the data access mode for this object is by-reference.
  `ArrayIndexOutOfBoundsException` - if compressedGeometry byte array is not large enough to receive the compressed geometry

### decompress

public Shape3D[] decompress()
Deprecated.
Decompresses the compressed geometry. Returns an array of Shape nodes containing the decompressed geometry objects, or null if the version number of the compressed geometry is incompatible with the decompressor in the current version of Java 3D.

Returns:
  an array of Shape nodes containing the geometry decompressed from this CompressedGeometry NodeComponent object, or null if its version is incompatible
Throws:
  `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### isByReference

public boolean isByReference()
Deprecated.
Retrieves the data access mode for this CompressedGeometry object.

Returns:
  `true` if the data access mode for this CompressedGeometry object is by-reference; `false` if the data access mode is by-copying.
Since:
  Java 3D 1.2

### getCompressedGeometryRef

public byte[] getCompressedGeometryRef()
Deprecated.
Gets the compressed geometry data reference.

Returns:
  the current compressed geometry data reference.
Throws:
  `IllegalStateException` - if the data access mode for this object is not by-reference.
  `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
  Java 3D 1.2

### getCompressedGeometryBuffer

public J3DBuffer getCompressedGeometryBuffer()
Deprecated.
Gets the compressed geometry data buffer reference, which is always null since NIO buffers are not supported for CompressedGeometry objects.

Returns:
  null
Throws:
  `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
  Java 3D 1.3

### cloneNodeComponent

public NodeComponent cloneNodeComponent()
Deprecated.
replaced with cloneNodeComponent(boolean forceDuplicate)

Overrides:
  `cloneNodeComponent` in class `NodeComponent`