public class CombineContext extends java.lang.Object implements Disposable
ShapeCombiner
. The parameters used by shapes and by
the controller are as follows: a globe, a minimum resolution in radians, a region of interest, and a GLU tessellator.
The globe is used by shapes that define geometry relative to a globe. The resolution is used to filter shape detail
and compute geometry for resolution independent shapes. Shape geometry outside of the region of interest may be
ignored, clipped, or simplified at the discretion of the shape.
CombineContext initializes its GLU tessellator according to the conventions for Combinable shapes. See the Combinable
interface documentation for information on drawing Combinable contours.
The complex set of contours computed as a result of drawing shapes into the tessellator are collected in the
context's contour list. This list may be accessed by calling getContours().Modifier and Type | Class and Description |
---|---|
protected static class |
CombineContext.TessCallbackAdapter
Implementation of GLUtessellatorCallback that forwards GLU tessellator callbacks to protected methods on
CombineContext.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<Sector> |
boundingSectors
The shape bounding sectors associated with this context.
|
protected ContourList |
contours
The list of contours representing the result of a boolean operation on one or more Combinable shapes.
|
protected java.util.ArrayList<LatLon> |
currentContour
The vertices of the current contour currently being assembled.
|
protected Globe |
globe
The globe associated with the context.
|
protected boolean |
isBoundingSectorMode
Indicates whether this context is currently operating in bounding sector mode.
|
protected double |
resolution
A minimum resolution in radians used to filter shape detail and compute resolution independent geometry.
|
protected Sector |
sector
A geographic sector indicating the context's region of interest.
|
protected GLUtessellator |
tess
The GLU tessellator used to draw shape contours.
|
Constructor and Description |
---|
CombineContext(Globe globe,
double resolution)
Creates a new combine context with the specified globe, resolution, and the default region of interest.
|
Modifier and Type | Method and Description |
---|---|
void |
addBoundingSector(Sector sector)
Adds the specified geographic sector to this context's list of shape bounding sectors.
|
void |
addContour(java.lang.Iterable<? extends LatLon> contour)
Adds the specified iterable to this context's list of contours.
|
void |
dispose()
Releases the releases GLU tessellator resources associated with this context.
|
java.util.List<Sector> |
getBoundingSectors()
Returns the shape bounding sectors associated with this context.
|
ContourList |
getContours()
Returns the list of contours representing the result of a boolean operation on one or more Combinable shapes.
|
Globe |
getGlobe()
Returns the globe associated with this context.
|
double |
getResolution()
Returns the context's minimum resolution in radians.
|
Sector |
getSector()
Returns the context's region of interest as a geographic sector.
|
GLUtessellator |
getTessellator()
Returns the GLU tessellator used to draw shape contours.
|
boolean |
isBoundingSectorMode()
Indicates whether this context is currently operating in bounding sector mode.
|
void |
removeAllBoundingSectors()
Removes all entries from this context's list of shape bounding sectors.
|
void |
removeAllContours()
Removes all entries from this context's list of contours.
|
void |
setBoundingSectorMode(boolean tf)
Specifies whether this context is currently operating in bounding sector mode.
|
void |
setGlobe(Globe globe)
Specifies the globe associated with this context.
|
void |
setResolution(double resolution)
Specifies the context's minimum resolution in radians.
|
void |
setSector(Sector sector)
Specifies the context's region of interest as a geographic sector.
|
protected void |
tessBegin(int type) |
protected void |
tessCombine(double[] coords,
java.lang.Object[] vertexData,
float[] weight,
java.lang.Object[] outData) |
protected void |
tessEnd() |
protected void |
tessError(int errno) |
protected void |
tessVertex(java.lang.Object vertexData) |
protected java.util.ArrayList<Sector> boundingSectors
protected ContourList contours
protected java.util.ArrayList<LatLon> currentContour
protected Globe globe
protected boolean isBoundingSectorMode
protected double resolution
protected Sector sector
protected GLUtessellator tess
public CombineContext(Globe globe, double resolution)
globe
- the globe to associate with this context. Shape geometry defined relative to a globe must use
this globe to compute that geometry.resolution
- the minimum resolution, in radians. Used to filter shape detail and compute geometry for
resolution independent shapes.java.lang.IllegalArgumentException
- if the globe is null.public void addBoundingSector(Sector sector)
sector
- the sector to add.java.lang.IllegalArgumentException
- if the sector is null.public void addContour(java.lang.Iterable<? extends LatLon> contour)
contour
- the contour to add.java.lang.IllegalArgumentException
- if the contour is null.public void dispose()
dispose
in interface Disposable
public java.util.List<Sector> getBoundingSectors()
isBoundingSectorMode()
public ContourList getContours()
public Globe getGlobe()
public double getResolution()
public Sector getSector()
public GLUtessellator getTessellator()
Combinable
interface
documentation for information on drawing Combinable contours. The complex set of contours computed as a result of
drawing shapes into the tessellator are collected in the context's contour list. This list may be accessed by
calling getContours().public boolean isBoundingSectorMode()
public void removeAllBoundingSectors()
public void removeAllContours()
public void setBoundingSectorMode(boolean tf)
tf
- true to set the context is bounding sector mode, otherwise false.public void setGlobe(Globe globe)
globe
- the globe to associate with this context.java.lang.IllegalArgumentException
- if the globe is null.public void setResolution(double resolution)
resolution
- the minimum resolution, in radians.public void setSector(Sector sector)
sector
- a geographic sector indicating the context's region of interest.java.lang.IllegalArgumentException
- if the sector is null.protected void tessBegin(int type)
protected void tessCombine(double[] coords, java.lang.Object[] vertexData, float[] weight, java.lang.Object[] outData)
protected void tessEnd()
protected void tessError(int errno)
protected void tessVertex(java.lang.Object vertexData)