Top Description Fields Constructors Methods
com.jogamp.graph.geom

public Class Outline

extends Object
implements Comparable<Outline>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Imports
java.util.ArrayList, jogamp.graph.geom.plane.AffineTransform, com.jogamp.graph.geom.Vertex, com.jogamp.graph.curve.OutlineShape, .Region, com.jogamp.opengl.math.FloatUtil, .VectorUtil, com.jogamp.opengl.math.geom.AABBox

Define a single continuous stroke by control vertices. The vertices define the shape of the region defined by this outline. The Outline can contain a list of off-curve and on-curve vertices which define curved regions.

Note

An outline should be closed to be rendered as a region.

See Also
OutlineShape, Region

Field Summary

Modifier and TypeField and Description
private final AABBox
private boolean
private boolean
private ArrayList<Vertex>

Constructor Summary

AccessConstructor and Description
public
Outline()

Create an outline defined by control vertices.

public
Outline(final Outline src)

Copy ctor

Method Summary

Modifier and TypeMethod and Description
public final void
addVertex(final Vertex
Vertex to be added
vertex
)

Appends a vertex to the outline loop/strip.

public final void
addVertex(final int
of the added Vertex
position
,
final Vertex
Vertex object to be added
vertex
)

Insert the Vertex element at the given position to the outline loop/strip.

public final int
compareTo(final Outline
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compare two outline's Bounding Box size.
public boolean

Returns:

true if obj is an Outline, not null, equals bounds and equal vertices in the same order
equals
(final Object
the Object to compare this Outline with
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public final AABBox
public final Vertex
public final Vertex
getVertex(final int index)

public final int
public int
getVertexIndex(final Vertex vertex)

public final ArrayList<Vertex>
public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public final boolean
public final boolean
public final Vertex
removeVertex(final int
of the to be removed Vertex
position
)

Removes the Vertex element at the given position.

public final boolean

Returns:

true if closing performed, otherwise false for NOP
setClosed
(final boolean
if true, a clone of the first vertex will be appended, otherwise a clone of the last vertex will be prepended.
closeTail
)

Ensure this outline is closed.

public final void
setVertex(final int
of the replaced Vertex
position
,
final Vertex
replacement Vertex object
vertex
)

Replaces the Vertex element at the given position.

public final void
setVertices(final ArrayList<Vertex>
the new outline loop/strip
vertices
)

Use the given outline loop/strip.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public final Outline
transform(final AffineTransform t, final Vertex.Factory<? extends Vertex> vertexFactory)

Return a transformed instance with all vertices are copied and transformed.

private final void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

bboxback to summary
private final AABBox bbox
closedback to summary
private boolean closed
dirtyBBoxback to summary
private boolean dirtyBBox
verticesback to summary
private ArrayList<Vertex> vertices

Constructor Detail

Outlineback to summary
public Outline()

Create an outline defined by control vertices. An outline can contain off Curve vertices which define curved regions in the outline.

Outlineback to summary
public Outline(final Outline src)

Copy ctor

Method Detail

addVertexback to summary
public final void addVertex(final Vertex vertex) throws NullPointerException

Appends a vertex to the outline loop/strip.

Parameters
vertex:Vertex

Vertex to be added

Exceptions
NullPointerException:
if the Vertex element is null
addVertexback to summary
public final void addVertex(final int position, final Vertex vertex) throws NullPointerException, IndexOutOfBoundsException

Insert the Vertex element at the given position to the outline loop/strip.

Parameters
position:int

of the added Vertex

vertex:Vertex

Vertex object to be added

Exceptions
NullPointerException:
if the Vertex element is null
IndexOutOfBoundsException:
if position is out of range (position < 0 || position > getVertexNumber())
compareToback to summary
public final int compareTo(final Outline other)

Implements java.lang.Comparable.compareTo.

Compare two outline's Bounding Box size.

Parameters
other:Outline

Doc from java.lang.Comparable.compareTo.

the object to be compared.

Returns:int

Doc from java.lang.Comparable.compareTo.

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
See Also
AABBox#getSize(), java.lang.Comparable#compareTo(java.lang.Object)
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the Object to compare this Outline with

Returns:boolean

true if obj is an Outline, not null, equals bounds and equal vertices in the same order

Annotations
@Override
getBoundsback to summary
public final AABBox getBounds()
getLastVertexback to summary
public final Vertex getLastVertex()
getVertexback to summary
public final Vertex getVertex(final int index)
getVertexCountback to summary
public final int getVertexCount()
getVertexIndexback to summary
public int getVertexIndex(final Vertex vertex)
getVerticesback to summary
public final ArrayList<Vertex> getVertices()
hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isClosedback to summary
public final boolean isClosed()
isEmptyback to summary
public final boolean isEmpty()
removeVertexback to summary
public final Vertex removeVertex(final int position) throws IndexOutOfBoundsException

Removes the Vertex element at the given position.

Sets the bounding box dirty, hence a next call to getBounds() will validate it.

Parameters
position:int

of the to be removed Vertex

Exceptions
IndexOutOfBoundsException:
if position is out of range (position < 0 || position >= getVertexNumber())
setClosedback to summary
public final boolean setClosed(final boolean closeTail)

Ensure this outline is closed.

Checks whether the last vertex equals to the first. If not equal, it either appends a clone of the first vertex or prepends a clone of the last vertex, depending on closeTail.

Parameters
closeTail:boolean

if true, a clone of the first vertex will be appended, otherwise a clone of the last vertex will be prepended.

Returns:boolean

true if closing performed, otherwise false for NOP

setVertexback to summary
public final void setVertex(final int position, final Vertex vertex) throws NullPointerException, IndexOutOfBoundsException

Replaces the Vertex element at the given position.

Sets the bounding box dirty, hence a next call to getBounds() will validate it.

Parameters
position:int

of the replaced Vertex

vertex:Vertex

replacement Vertex object

Exceptions
NullPointerException:
if the Outline element is null
IndexOutOfBoundsException:
if position is out of range (position < 0 || position >= getVertexNumber())
setVerticesback to summary
public final void setVertices(final ArrayList<Vertex> vertices)

Use the given outline loop/strip.

Validates the bounding box.

Parameters
vertices:ArrayList<Vertex>

the new outline loop/strip

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
transformback to summary
public final Outline transform(final AffineTransform t, final Vertex.Factory<? extends Vertex> vertexFactory)

Return a transformed instance with all vertices are copied and transformed.

validateBoundingBoxback to summary
private final void validateBoundingBox()