NASA World Wind

gov.nasa.worldwind.render
Class ConformingShape

java.lang.Object
  extended by gov.nasa.worldwind.render.ConformingShape
All Implemented Interfaces:
Disposable, MeasurableArea, MeasurableLength, Movable, Renderable, Restorable
Direct Known Subclasses:
ConformingEllipse, ConformingPolygon

public abstract class ConformingShape
extends Object
implements Renderable, Disposable, Movable, Restorable, MeasurableArea, MeasurableLength

The design of the class hierarchy for which this class is the base was derived in part from that of the class hierarchy rooted by SurfaceShape. The major implementation difference is that instances of this class extract portions of the current tessellation to render the interior of shapes. There is somewhat of a performance penalty for this.

For the most part, any SurfaceXxx class can be replaced by the corresponding ConformingXxx class, and all other usage (method names and prototypes) will be the same. The only exceptions are:

  1. class ConformingShape is abstract. Any direct construction of a SurfaceShape object can be replaced by an instance of ConformingPolygon using the same actual parameters
  2. SurfaceEllipse is replaced by ConformingEllipticalPolygon and ConformingCircularPolygon since they are actually implemented by generating polygons. The constructor (and other methods) for the corresponding classes are identical.
  3. "New" classes ConformingEllipse and ConformingCircle are used to create shapes that always have an elliptical or circular shape. These shapes are created without an "int intervals" parameter and are always rendered as ellipses or circles mapped onto the terrain.


Nested Class Summary
protected static class ConformingShape.CacheKey
           
 
Field Summary
protected  Color borderColor
           
protected  double borderWidth
           
protected static String CONFORMINGSHAPE_CACHE_KEY
           
protected static String CONFORMINGSHAPE_CACHE_NAME
           
protected  boolean drawBorder
           
protected  boolean drawInterior
           
protected  Color fillColor
           
 
Constructor Summary
ConformingShape()
           
ConformingShape(Color fillColor, Color borderColor)
           
 
Method Summary
 void dispose()
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
 Color getBorderColor()
           
 double getBorderWidth()
           
 Paint getInteriorColor()
           
abstract  Position getReferencePosition()
           
 String getRestorableState()
          Returns an XML document string describing the object’s state.
protected static int getUniqueSerialNumber()
           
 boolean getUseFrustumCull()
           
protected abstract  void invalidateCache()
           
 boolean isAntiAlias()
           
 boolean isDrawBorder()
           
 boolean isDrawInterior()
           
protected  boolean isExpired(DrawContext dc)
           
 void move(Position delta)
          Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
abstract  void moveTo(Position position)
          Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
 void render(DrawContext dc)
          Causes this Renderable to render itself using the DrawContext provided.
protected abstract  void renderBoundary(DrawContext dc, GL gl, boolean knownToBeVisible)
           
protected abstract  boolean renderInterior(DrawContext dc, GL gl)
           
 void restoreState(String stateInXml)
          Restores the object’s state to what is described in the specified XML document string.
 void setAntiAlias(boolean antiAlias)
           
 void setBorderColor(Color borderColor)
           
 void setBorderWidth(double borderWidth)
           
 void setDrawBorder(boolean drawBorder)
           
 void setDrawInterior(boolean drawInterior)
           
 void setInteriorColor(Color interiorColor)
           
 void setUseFrustumCull(boolean c)
           
protected static long sizeInBytesOf(ArrayList<SectorGeometry.ExtractedShapeDescription> esdL)
           
protected  void updateExpiryCriteria(DrawContext dc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.geom.MeasurableArea
getArea, getHeight, getPerimeter, getWidth
 
Methods inherited from interface gov.nasa.worldwind.geom.MeasurableLength
getLength
 

Field Detail

borderColor

protected Color borderColor

borderWidth

protected double borderWidth

CONFORMINGSHAPE_CACHE_KEY

protected static final String CONFORMINGSHAPE_CACHE_KEY

CONFORMINGSHAPE_CACHE_NAME

protected static final String CONFORMINGSHAPE_CACHE_NAME
See Also:
Constant Field Values

drawBorder

protected boolean drawBorder

drawInterior

protected boolean drawInterior

fillColor

protected Color fillColor
Constructor Detail

ConformingShape

public ConformingShape()

ConformingShape

public ConformingShape(Color fillColor,
                       Color borderColor)
Method Detail

dispose

public void dispose()
Specified by:
dispose in interface Disposable

doGetRestorableState

protected void doGetRestorableState(RestorableSupport rs,
                                    RestorableSupport.StateObject context)

doRestoreState

protected void doRestoreState(RestorableSupport rs,
                              RestorableSupport.StateObject context)

getBorderColor

public Color getBorderColor()

getBorderWidth

public double getBorderWidth()

getInteriorColor

public Paint getInteriorColor()

getReferencePosition

public abstract Position getReferencePosition()
Specified by:
getReferencePosition in interface Movable

getRestorableState

public String getRestorableState()
Description copied from interface: Restorable
Returns an XML document string describing the object’s state. This state can be restored later by calling restoreState and passing the XML document.

Specified by:
getRestorableState in interface Restorable
Returns:
an XML document string describing the object's state.

getUniqueSerialNumber

protected static int getUniqueSerialNumber()

getUseFrustumCull

public boolean getUseFrustumCull()

invalidateCache

protected abstract void invalidateCache()

isAntiAlias

public boolean isAntiAlias()

isDrawBorder

public boolean isDrawBorder()

isDrawInterior

public boolean isDrawInterior()

isExpired

protected boolean isExpired(DrawContext dc)

move

public void move(Position delta)
Description copied from interface: Movable
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.

Specified by:
move in interface Movable
Parameters:
delta - the latitude and longitude to add to the shape's reference position.

moveTo

public abstract void moveTo(Position position)
Description copied from interface: Movable
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.

Specified by:
moveTo in interface Movable
Parameters:
position - the new position of the shape's reference position.

render

public void render(DrawContext dc)
Description copied from interface: Renderable
Causes this Renderable to render itself using the DrawContext provided. The DrawContext provides the elevation model, openGl instance, globe and other information required for drawing. It is recommended that the DrawContext is non-null as most implementations do not support null DrawContexts.

Specified by:
render in interface Renderable
Parameters:
dc - the DrawContext to be used
See Also:
DrawContext

renderBoundary

protected abstract void renderBoundary(DrawContext dc,
                                       GL gl,
                                       boolean knownToBeVisible)

renderInterior

protected abstract boolean renderInterior(DrawContext dc,
                                          GL gl)

restoreState

public void restoreState(String stateInXml)
Description copied from interface: Restorable
Restores the object’s state to what is described in the specified XML document string.

Specified by:
restoreState in interface Restorable
Parameters:
stateInXml - an XML document string describing an object's state.

setAntiAlias

public void setAntiAlias(boolean antiAlias)

setBorderColor

public void setBorderColor(Color borderColor)

setBorderWidth

public void setBorderWidth(double borderWidth)

setDrawBorder

public void setDrawBorder(boolean drawBorder)

setDrawInterior

public void setDrawInterior(boolean drawInterior)

setInteriorColor

public void setInteriorColor(Color interiorColor)

setUseFrustumCull

public void setUseFrustumCull(boolean c)

sizeInBytesOf

protected static long sizeInBytesOf(ArrayList<SectorGeometry.ExtractedShapeDescription> esdL)

updateExpiryCriteria

protected void updateExpiryCriteria(DrawContext dc)

NASA World Wind