public final class ModelPrimitive extends Primitive implements IDisposable
| Constructor and Description |
|---|
ModelPrimitive()
Initializes a default model primitive.
|
ModelPrimitive(String uri)
For convenience.
|
ModelPrimitive(String uri,
ModelUpAxis upAxis)
For convenience.
|
ModelPrimitive(URI uri)
Initializes a model primitive with the specified
uri. |
ModelPrimitive(URI uri,
ModelUpAxis upAxis)
Initializes a model primitive with the specified
uri and up axis. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
dispose(boolean disposing) |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
ModelArticulationCollection |
getArticulations()
Gets the model's articulations.
|
UnitQuaternion |
getOrientation()
Gets the model's orientation.
|
Cartesian |
getPosition()
Gets the position of the model.
|
double |
getScale()
Gets the linear scale used to increase or decrease the size of the rendered model.
|
float |
getTranslucency()
Gets the primitive's translucency.
|
URI |
getUri()
Gets the URI of the file used to load the file.
|
void |
load(String uri)
For convenience.
|
void |
load(String uri,
ModelUpAxis upAxis)
For convenience.
|
void |
load(URI uri)
|
void |
load(URI uri,
ModelUpAxis upAxis)
|
void |
setOrientation(UnitQuaternion quaternion)
Sets the model's orientation.
|
void |
setPosition(Cartesian position)
Sets the position of the model.
|
void |
setPositionCartographic(CentralBody centralBody,
Cartographic position)
For convenience.
|
void |
setScale(double value)
Sets the linear scale used to increase or decrease the size of the rendered model.
|
void |
setTranslucency(float value)
Sets the primitive's translucency.
|
dispose, getAutomaticallyComputeBoundingSphere, getBoundingSphere, getColor, getDisplay, getDisplayCondition, getReferenceFrame, getTag, setAutomaticallyComputeBoundingSphere, setBoundingSphere, setColor, setDisplay, setDisplayCondition, setReferenceFrame, setTagclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, disposepublic ModelPrimitive()
After constructing the primitive, call ModelPrimitive.load(java.net.URI)
to load a model file and set Position, Orientation,
and Scale to place, orientate, and size the model in the 3D scene.
The primitive's properties are initialized to the following values:
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere: trueagi.foundation.graphics.primitive.BoundingSphere: BoundingSphere.MaximumRadiusBoundingSphere (get)agi.foundation.graphics.primitive.Color: Whiteagi.foundation.graphics.primitive.Display: trueagi.foundation.graphics.primitive.DisplayCondition: nullagi.foundation.graphics.primitive.ReferenceFrame: The earth's agi.foundation.celestial.earthcentralbody.FixedFrameagi.foundation.graphics.primitive.Translucency: 0Articulations: nullOrientation: [1, 0, 0, 0]Position: Cartesian.ZeroScale: 1Uri: null
Once the primitive is constructed, it must be added to
Primitives (get) before it will be rendered.
ModelPrimitive.ModelPrimitive(java.net.URI).,
ModelPrimitive.load(java.net.URI).,
Position,
Orientation,
Scale,
Video Streams on Models topicpublic ModelPrimitive(URI uri)
uri.
After constructing the primitive, set Position, Orientation,
and Scale to place, orientate, and size the model in the 3D scene.
If the model includes articulations, they can be accessed using Articulations.
The primitive's properties are initialized to the following values:
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere: trueagi.foundation.graphics.primitive.BoundingSphere: BoundingSphere.MaximumRadiusBoundingSphere (get)agi.foundation.graphics.primitive.Color: Whiteagi.foundation.graphics.primitive.Display: trueagi.foundation.graphics.primitive.DisplayCondition: nullagi.foundation.graphics.primitive.ReferenceFrame: The earth's agi.foundation.celestial.earthcentralbody.FixedFrameagi.foundation.graphics.primitive.Translucency: 0Articulations: null if the model does not include articulationsOrientation: [1, 0, 0, 0]Position: Cartesian.ZeroScale: 1Uri: uri
Once the primitive is constructed, it must be added to
Primitives (get) before it will be rendered.
uri - The URI of the model file to load.UncheckedFileNotFoundException - Could not find or access uri.ArgumentException - Only file URIs are supported at this time. uri must start with file:///.ModelPrimitive.load(java.net.URI).public ModelPrimitive(String uri)
See
ModelPrimitive.ModelPrimitive(java.net.URI).
for a full discussion.
uri - The path to the model file.ModelPrimitive.ModelPrimitive(java.net.URI).public ModelPrimitive(URI uri, ModelUpAxis upAxis)
uri and up axis.
After constructing the primitive, set Position, Orientation,
and Scale to place, orientate, and size the model in the 3D scene.
If the model includes articulations, they can be accessed using Articulations.
The primitive's properties are initialized to the following values:
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere: trueagi.foundation.graphics.primitive.BoundingSphere: BoundingSphere.MaximumRadiusBoundingSphere (get)agi.foundation.graphics.primitive.Color: Whiteagi.foundation.graphics.primitive.Display: trueagi.foundation.graphics.primitive.DisplayCondition: nullagi.foundation.graphics.primitive.ReferenceFrame: The earth's agi.foundation.celestial.earthcentralbody.FixedFrameagi.foundation.graphics.primitive.Translucency: 0Articulations: null if the model does not include articulationsOrientation: [1, 0, 0, 0]Position: Cartesian.ZeroScale: 1Uri: uri
Once the primitive is constructed, it must be added to
Primitives (get) before it will be rendered.
uri - The URI of the model file to load.upAxis - The axis representing the up direction of the model file.UncheckedFileNotFoundException - Could not find or access uri.ArgumentException - Only file URIs are supported at this time. uri must start with file:///.ArgumentException - Only MDL models can have their up axis specified.ModelPrimitive.load(java.net.URI).public ModelPrimitive(String uri, ModelUpAxis upAxis)
See
ModelPrimitive.ModelPrimitive(java.net.URI, ModelUpAxis).
for a full discussion.
uri - The path to the model file.upAxis - The axis representing the up direction of the model file.ModelPrimitive.ModelPrimitive(java.net.URI).protected void finalize()
throws Throwable
java.lang.Objectfinalize method to dispose of
system resources or to perform other cleanup.
The general contract of finalize is that it is invoked
if and when the Java™ virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize method may take any action, including
making this object available again to other threads; the usual purpose
of finalize, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize method of class Object performs no
special action; it simply returns normally. Subclasses of
Object may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize in class ObjectThrowable - the Exception raised by this methodWeakReference,
PhantomReferencepublic float getTranslucency()
0.getTranslucency in class PrimitiveArgumentOutOfRangeException - Translucency must be 0 for the model primitive.public void setTranslucency(float value)
0.setTranslucency in class PrimitiveArgumentOutOfRangeException - Translucency must be 0 for the model primitive.public final URI getUri()
ModelPrimitive.load(java.net.URI).public final double getScale()
A Scale of 1 renders the model using its actual size. Values less than 1
decrease the size of the rendered model and values greater than 1
increase the size of the rendered model.
If the model's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true when setting Scale, the Radius of the model's
agi.foundation.graphics.primitive.BoundingSphere
is set to fit around the model. Otherwise, it is the caller's
responsibility to update the model's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the model.
ArgumentOutOfRangeException - Scale is less than 0.public final void setScale(double value)
A Scale of 1 renders the model using its actual size. Values less than 1
decrease the size of the rendered model and values greater than 1
increase the size of the rendered model.
If the model's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true when setting Scale, the Radius of the model's
agi.foundation.graphics.primitive.BoundingSphere
is set to fit around the model. Otherwise, it is the caller's
responsibility to update the model's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the model.
ArgumentOutOfRangeException - Scale is less than 0.public final Cartesian getPosition()
ReferenceFrame.
If the model's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true when setting the model's position, the Center of the model's
agi.foundation.graphics.primitive.BoundingSphere
is set to the new position. Otherwise, it is the caller's
responsibility to update the model's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the model.
SetPositionCartographicpublic final void setPosition(Cartesian position)
ReferenceFrame.
If the model's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true when setting the model's position, the Center of the model's
agi.foundation.graphics.primitive.BoundingSphere
is set to the new position. Otherwise, it is the caller's
responsibility to update the model's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the model.
SetPositionCartographicpublic final UnitQuaternion getOrientation()
ReferenceFrame.public final void setOrientation(UnitQuaternion quaternion)
ReferenceFrame.public final ModelArticulationCollection getArticulations()
Articulations may be null if the model doesn't contain any articulations.public final void load(URI uri)
uri.
If the model includes articulations, they can be accessed using Articulations.
If the model's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true, agi.foundation.graphics.primitive.BoundingSphere
is set to fit around the model. Otherwise, it is the caller's
responsibility to update the model's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the model.
Loading a new model does not change the model's Position,
Orientation, or Scale.
uri - The URI of the model file to load.UncheckedFileNotFoundException - Could not find or access uri.ArgumentException - Only file URIs are supported at this time. uri must start with file:///.public final void load(String uri)
ModelPrimitive.load(java.net.URI)
for a full discussion.uri - The path to the model file.ModelPrimitive.load(java.net.URI).public final void load(URI uri, ModelUpAxis upAxis)
uri and upAxis.
If the model includes articulations, they can be accessed using Articulations.
If the model's
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
property is true, agi.foundation.graphics.primitive.BoundingSphere
is set to fit around the model. Otherwise, it is the caller's
responsibility to update the model's
agi.foundation.graphics.primitive.BoundingSphere
to a sphere that encompasses the model.
Loading a new model does not change the model's Position,
Orientation, or Scale.
uri - The URI of the model file to load.upAxis - The axis representing the up direction of the model file.UncheckedFileNotFoundException - Could not find or access uri.ArgumentException - Only file URIs are supported at this time. uri must start with file:///.ArgumentException - Only MDL models can have their up axis specified.public final void load(String uri, ModelUpAxis upAxis)
ModelPrimitive.load(java.net.URI)
for a full discussion.uri - The path to the model file.upAxis - The axis representing the up direction of the model file.ModelPrimitive.load(java.net.URI).public final void setPositionCartographic(CentralBody centralBody, Cartographic position)
Cartographic
position of the model.
Longitude and latitude are in radians, and altitude is in meters.
This also sets Position.
centralBody
is used to convert the position to
Cartesian.
See Position for a full discussion.
centralBody - The central body the positions are defined on.position - The new Cartographic position of the model.ArgumentNullException - centralBody is null.IllegalStateException - The primitive's ReferenceFrame (get)
is not equal to centralBody fixed frame.Position