public interface Combinable
ShapeCombiner
. When combine is called, the Combinable draws its contours
using the GLU tessellator attached to the provided CombineContext. When the CombineContext is in bounding sector
mode, the Combinable adds its geographic bounding sector to the CombineContext's bounding sector list.
public class CombinableSector implements Combinable
{
protected Sector sector = Sector.fromDegrees(-10, 10, -10, 10);
public void combine(CombineContext cc)
{
if (cc.isBoundingSectorMode())
this.combineBounds(cc);
else
this.combineContours(cc);
}
protected void combineBounds(CombineContext cc)
{
cc.addBoundingSector(this.sector);
}
protected void combineContours(CombineContext cc)
{
if (!cc.getSector().intersects(this.sector))
return; // the sector does not intersect the context's region of interest
this.doCombineContours(cc);
}
protected void doCombineContours(CombineContext cc)
{
GLUtessellator tess = cc.getTessellator();
try
{
GLU.gluTessBeginContour(tess);
for (LatLon location : this.sector) // counter clockwise iteration of the sector's four corners
{
double[] vertex = {location.longitude.degrees, location.latitude.degrees, 0};
GLU.gluTessVertex(tess, vertex, 0, vertex); // longitude,latitude,0 -> x,y,z
}
}
finally
{
GLU.gluTessEndContour(tess);
}
}
}
CombineContext
,
ShapeCombiner
Modifier and Type | Method and Description |
---|---|
void |
combine(CombineContext cc)
Causes this Combinable to draw its contours using the GLU tessellator attached to the provided CombineContext.
|
void combine(CombineContext cc)
cc
- the CombineContext to be used.java.lang.IllegalArgumentException
- if the CombineContext is null.CombineContext