public final class PathPrimitive extends Primitive implements Iterable<PathPoint>, IDisposable
PolylinePrimitive
;
however, the PathPrimitive
was designed for the efficient addition/removal of points
to/from the front or back of the line.Constructor and Description |
---|
PathPrimitive()
Initializes a default path primitive.
|
PathPrimitive(int capacity)
Initializes a path primitive with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
addBack(PathPoint pathPoint)
Add a
PathPoint
to the back of the line. |
void |
addFront(PathPoint pathPoint)
Add a
PathPoint
to the front of the line. |
void |
addRangeToBack(Iterable<PathPoint> positions)
Add the range of
PathPoints
to the back of the line. |
void |
addRangeToFront(Iterable<PathPoint> positions)
Add the range of
PathPoints
to the front of the line. |
PathPoint |
back()
Access the
PathPoint
at the back of the line. |
void |
clear()
Removes all of the points.
|
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.
|
PathPoint |
front()
Access the
PathPoint
at the front of the line. |
PathPoint |
get(int index)
Returns the point at the given zero-based index.
|
int |
getCapacity()
Returns the capacity that was set during object construction.
|
boolean |
getCentralBodyClipped()
Gets whether the polyline will be clipped by the central body.
|
Color |
getColor()
The path primitive does not support the Color property.
|
int |
getCount()
Returns the number of points.
|
boolean |
getDisplayOutline()
Gets whether an outline is rendered around the line.
|
static float |
getMaximumWidthSupported()
Gets the maximum width, in pixels, supported by the video card.
|
static float |
getMinimumWidthSupported()
Gets the minimum width, in pixels, supported by the video card.
|
float |
getOutlineWidth()
Gets the width, in pixels, of the outline around the line.
|
boolean |
getPerItemPickingEnabled()
Gets whether individual line indices will be included in the
PickResults returned
from the Scene's Pick method. |
PolylineType |
getPolylineType()
Gets how the primitive interprets the positions.
|
float |
getTranslucency()
The path primitive does not support the Translucency property.
|
PathPrimitiveUpdatePolicy |
getUpdatePolicy()
Gets how the primitive will be updated based on the current animation time.
|
float |
getWidth()
Gets the line width, in pixels.
|
Iterator<PathPoint> |
iterator()
Returns an enumerator that iterates through the collection.
|
void |
removeAllAfter(int index)
Remove all points
after
index . |
void |
removeAllBefore(int index)
Remove all points
before
index . |
void |
removeBack()
Remove a
PathPoint
to the back of the line. |
void |
removeFront()
Remove a
PathPoint
to the front of the line. |
void |
setCentralBodyClipped(boolean value)
Sets whether the polyline will be clipped by the central body.
|
void |
setColor(Color value)
The path primitive does not support the Color property.
|
void |
setDisplayOutline(boolean value)
Sets whether an outline is rendered around the line.
|
void |
setOutlineWidth(float value)
Sets the width, in pixels, of the outline around the line.
|
void |
setPerItemPickingEnabled(boolean value)
Sets whether individual line indices will be included in the
PickResults returned
from the Scene's Pick method. |
void |
setPolylineType(PolylineType value)
Sets how the primitive interprets the positions.
|
void |
setTranslucency(float value)
The path primitive does not support the Translucency property.
|
void |
setUpdatePolicy(PathPrimitiveUpdatePolicy value)
Sets how the primitive will be updated based on the current animation time.
|
void |
setWidth(float value)
Sets the line width, in pixels.
|
dispose, getAutomaticallyComputeBoundingSphere, getBoundingSphere, getDisplay, getDisplayCondition, getReferenceFrame, getTag, setAutomaticallyComputeBoundingSphere, setBoundingSphere, setDisplay, setDisplayCondition, setReferenceFrame, setTag
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
close, dispose
public PathPrimitive()
PathPrimitive.PathPrimitive(int)
public PathPrimitive(int capacity)
After constructing the primitive, call a method such as
AddFront
or
AddBack
to provide it with positions.
The primitive's properties are initialized to the following values:
agi.foundation.graphics.primitive.AutomaticallyComputeBoundingSphere
: true
agi.foundation.graphics.primitive.BoundingSphere
: BoundingSphere.MaximumRadiusBoundingSphere
(get
)agi.foundation.graphics.primitive.Display
: true
agi.foundation.graphics.primitive.DisplayCondition
: null
agi.foundation.graphics.primitive.ReferenceFrame
: The earth's agi.foundation.celestial.earthcentralbody.FixedFrame
MaximumWidthSupported
: Video card dependentMinimumWidthSupported
: Video card dependentagi.foundation.graphics.pathprimitive.DisplayOutline
: falseagi.foundation.graphics.pathprimitive.OutlineWidth
: 1agi.foundation.graphics.pathprimitive.PerItemPickingEnabled
: falseagi.foundation.graphics.pathprimitive.PolylineType
: LineStrip
agi.foundation.graphics.pathprimitive.Width
: 1
Once the primitive is constructed, it must be added to
Primitives
(get
) before it will be rendered.
capacity
- Sets the initial capacity for the buffer containing positions. Setting the capacity
reserves memory so the addition of points is more efficient.ArgumentOutOfRangeException
- capacity
must be greater than or equal to 0.protected void finalize() throws Throwable
java.lang.Object
finalize
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 Object
Throwable
- the Exception
raised by this methodWeakReference
,
PhantomReference
public Color getColor()
Color
(get
) property on PathPoint
.getColor
in class Primitive
UnsupportedOperationException
- Always thrown by the path primitive.public void setColor(Color value)
Color
(get
) property on PathPoint
.setColor
in class Primitive
UnsupportedOperationException
- Always thrown by the path primitive.public float getTranslucency()
Translucency
(get
) property on PathPoint
.getTranslucency
in class Primitive
UnsupportedOperationException
- Always thrown by the path primitive.public void setTranslucency(float value)
Translucency
(get
) property on PathPoint
.setTranslucency
in class Primitive
UnsupportedOperationException
- Always thrown by the path primitive.public final int getCount()
public final int getCapacity()
PathPrimitive.PathPrimitive(int)
public PathPrimitiveUpdatePolicy getUpdatePolicy()
PathPrimitiveUpdatePolicy
,
Path Primitive topicpublic void setUpdatePolicy(PathPrimitiveUpdatePolicy value)
PathPrimitiveUpdatePolicy
,
Path Primitive topicpublic PolylineType getPolylineType()
public void setPolylineType(PolylineType value)
public float getWidth()
The width is defined in pixels so even if the camera moves very close or very far from the primitive, the width of the line on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check MinimumWidthSupported
and MaximumWidthSupported
. Regardless of
MinimumWidthSupported
, a width of 0
is
always allowed and effectively hides the primitive.MinimumWidthSupported
,
MaximumWidthSupported
public void setWidth(float value)
The width is defined in pixels so even if the camera moves very close or very far from the primitive, the width of the line on the screen does not change.
ArgumentOutOfRangeException
- Width is less than 0
.InsufficientVideoCardException
- Width is outside of the range supported by the video card. To verify
a width is supported, check MinimumWidthSupported
and MaximumWidthSupported
. Regardless of
MinimumWidthSupported
, a width of 0
is
always allowed and effectively hides the primitive.MinimumWidthSupported
,
MaximumWidthSupported
public static final float getMinimumWidthSupported()
Width
public static final float getMaximumWidthSupported()
Width
public final boolean getDisplayOutline()
Outlines are rendered with the OutlineWidth
property.
OutlineWidth
public final void setDisplayOutline(boolean value)
Outlines are rendered with the OutlineWidth
property.
OutlineWidth
public final float getOutlineWidth()
Similar to Width
, the outline width is defined
in pixels, so even if the camera moves very close or very far from the
primitive, the outline width on the screen does not change.
The total line width, in pixels, including the Width
and
outline width is clamped to MaximumWidthSupported
.
ArgumentOutOfRangeException
- OutlineWidth
is less than 0
.InsufficientVideoCardException
- OutlineWidth
is outside of the range supported by the video card. To verify
a width is supported, check MinimumWidthSupported
and MaximumWidthSupported
.Width
,
MinimumWidthSupported
,
MaximumWidthSupported
public final void setOutlineWidth(float value)
Similar to Width
, the outline width is defined
in pixels, so even if the camera moves very close or very far from the
primitive, the outline width on the screen does not change.
The total line width, in pixels, including the Width
and
outline width is clamped to MaximumWidthSupported
.
ArgumentOutOfRangeException
- OutlineWidth
is less than 0
.InsufficientVideoCardException
- OutlineWidth
is outside of the range supported by the video card. To verify
a width is supported, check MinimumWidthSupported
and MaximumWidthSupported
.Width
,
MinimumWidthSupported
,
MaximumWidthSupported
public final boolean getPerItemPickingEnabled()
PickResults
returned
from the Scene's
Pick
method. Each line
index that is picked will be returned as a BatchPrimitiveIndex
.public final void setPerItemPickingEnabled(boolean value)
PickResults
returned
from the Scene's
Pick
method. Each line
index that is picked will be returned as a BatchPrimitiveIndex
.public final boolean getCentralBodyClipped()
public final void setCentralBodyClipped(boolean value)
public PathPoint get(int index)
ArgumentOutOfRangeException
- index
is out of range. It must be between 0 and Count
- 1
.public Iterator<PathPoint> iterator()
public final void addFront(PathPoint pathPoint)
PathPoint
to the front of the line.pathPoint
- The point added to the front of the line.PathPrimitive.addBack(agi.foundation.graphics.PathPoint)
public final void addRangeToFront(Iterable<PathPoint> positions)
PathPoints
to the front of the line.positions
- The positions to add to the front of the path.PathPrimitive.addRangeToBack(java.lang.Iterable)
public final void addBack(PathPoint pathPoint)
PathPoint
to the back of the line.pathPoint
- The point added to the back of the line.PathPrimitive.addFront(agi.foundation.graphics.PathPoint)
public final void addRangeToBack(Iterable<PathPoint> positions)
PathPoints
to the back of the line.positions
- The positions to add to the back of the path.PathPrimitive.addRangeToFront(java.lang.Iterable)
public final void removeFront()
PathPoint
to the front of the line.PathPrimitive.removeBack()
public final void removeAllBefore(int index)
index
.index
- The index at which to stop removing points.ArgumentOutOfRangeException
- The index
is less than 0 or greater than the size of the path.PathPrimitive.removeAllAfter(int)
public final void removeBack()
PathPoint
to the back of the line.PathPrimitive.removeFront()
public final void removeAllAfter(int index)
index
.index
- The index at which any points after will be removed.ArgumentOutOfRangeException
- The index
is less than 0 or greater than the size of the path.PathPrimitive.removeAllBefore(int)
public final PathPoint front()
PathPoint
at the front of the line.PathPoint
at the front of the line.IllegalStateException
- The path primitive does not contain any positions.public final PathPoint back()
PathPoint
at the back of the line.PathPoint
at the back of the line.IllegalStateException
- The path primitive does not contain any positions.public final void clear()
Even though this method will remove all of the points, the memory reserved will not be altered.
Capacity (get)