NASA World Wind

gov.nasa.worldwind.render
Class AbstractSurfaceShape

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.AbstractSurfaceObject
              extended by gov.nasa.worldwind.render.AbstractSurfaceShape
All Implemented Interfaces:
AVList, MessageListener, ExtentHolder, MeasurableArea, MeasurableLength, Movable, Highlightable, OrderedRenderable, PreRenderable, Renderable, SurfaceObject, SurfaceShape, Restorable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
SurfaceEllipse, SurfacePolygon, SurfacePolyline, SurfacePolylines, SurfaceQuad, SurfaceSector

public abstract class AbstractSurfaceShape
extends AbstractSurfaceObject
implements SurfaceShape, Movable

Common superclass for surface conforming shapes such as SurfacePolygon, SurfacePolyline, SurfaceEllipse, SurfaceQuad, and SurfaceSector.

SurfaceShapes have separate attributes for normal display and highlighted display. If no attributes are specified, default attributes are used. See DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, and DEFAULT_HIGHLIGHT_MATERIAL.

AbstractSurfaceShape extends from AbstractSurfaceObject, and therefore inherits AbstractSurfaceObject's batch rendering capabilities.


Nested Class Summary
protected static class AbstractSurfaceShape.GeometryKey
           
protected static class AbstractSurfaceShape.SurfaceShapeStateKey
          Represents a surface shapes's current state.
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey
 
Field Summary
protected  ShapeAttributes activeAttrs
           
protected  List<List<LatLon>> activeGeometry
           
protected  List<List<LatLon>> activeOutlineGeometry
           
protected  AreaMeasurer areaMeasurer
           
protected  long areaMeasurerLastModifiedTime
           
protected static Material DEFAULT_HIGHLIGHT_MATERIAL
          The default highlight color.
protected static Material DEFAULT_INTERIOR_MATERIAL
          The default interior color.
protected static int DEFAULT_MAX_EDGE_INTERVALS
          The default maximum number of shape edge intervals.
protected static int DEFAULT_MIN_EDGE_INTERVALS
          The default minimum number of shape edge intervals.
protected static Material DEFAULT_OUTLINE_MATERIAL
          The default outline color.
protected static String DEFAULT_PATH_TYPE
          The default path type.
protected static int DEFAULT_TEXELS_PER_EDGE_INTERVAL
          The default number of texels per shape edge interval.
protected static ShapeAttributes defaultAttrs
          The attributes used if attributes are not specified.
protected  Map<Object,AbstractSurfaceObject.CacheEntry> geometryCache
           
protected  ShapeAttributes highlightAttrs
           
protected  boolean highlighted
           
protected  int maxEdgeIntervals
           
protected  int minEdgeIntervals
           
protected  ShapeAttributes normalAttrs
           
protected  String pathType
           
protected  Map<Object,AbstractSurfaceObject.CacheEntry> sectorCache
           
protected  OGLStackHandler stackHandler
           
protected  double texelsPerEdgeInterval
           
protected  WWTexture texture
           
protected static FloatBuffer vertexBuffer
           
 
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, pickTiles, uniqueId, visible
 
Constructor Summary
AbstractSurfaceShape()
          Constructs a new surface shape with the default attributes.
AbstractSurfaceShape(ShapeAttributes normalAttrs)
          Constructs a new surface shape with the specified normal (as opposed to highlight) attributes.
 
Method Summary
protected  void addIntermediateLocations(LatLon a, LatLon b, double edgeIntervalsPerDegree, List<LatLon> locations)
           
protected  void applyInteriorState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)
           
protected  void applyInteriorTextureState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)
           
protected  void applyModelviewTransform(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  void applyOutlineState(DrawContext dc, ShapeAttributes attributes)
           
protected  void beginDrawing(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  boolean canContainPole()
          Indicates whether the shape is a closed polygon that can enclose a pole, or an open path that cannot.
protected  void clearCaches()
          Clears this SurfaceObject's internal extent cache.
protected  double computeEdgeIntervalsPerDegree(SurfaceTileDrawContext sdc)
           
protected  List<Sector> computeSectors(DrawContext dc)
          Computes the bounding sectors for the shape.
protected  List<Sector> computeSectors(Globe globe)
          Computes the bounding sectors for the shape.
protected  String containsPole(Iterable<? extends LatLon> locations)
          Determine if a list of geographic locations encloses either the North or South pole.
protected  ShapeAttributes createActiveAttributes()
           
protected abstract  List<List<LatLon>> createGeometry(Globe globe, SurfaceTileDrawContext sdc)
           
protected  Object createGeometryKey(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  List<LatLon> cutAlongDateLine(List<LatLon> locations, String pole, Globe globe)
          Divide a list of locations that encloses a pole along the international date line.
protected  void determineActiveAttributes()
          Determines which attributes -- normal, highlight or default -- to use each frame.
protected  void determineActiveGeometry(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  void doDrawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected abstract  void doMoveTo(Position oldReferencePosition, Position newReferencePosition)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  Integer doTessellateInterior(DrawContext dc)
           
protected  void drawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
          Causes the SurfaceObject to render itself to the specified region in geographic coordinates.
protected  void drawInterior(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  void drawOutline(DrawContext dc, SurfaceTileDrawContext sdc)
           
protected  void endDrawing(DrawContext dc)
           
 void export(String mimeType, Object output)
          Export the Polygon.
protected  void exportAsKML(Object output)
           
protected  void generateIntermediateLocations(Iterable<? extends LatLon> iterable, double edgeIntervalsPerDegree, boolean makeClosedPath, List<LatLon> locations)
           
protected  ShapeAttributes getActiveAttributes()
           
protected  List<List<LatLon>> getActiveGeometry()
           
 double getArea(Globe globe)
          Returns the object's area in square meters.
 double getArea(Globe globe, boolean terrainConformant)
          Returns the shapes's area in square meters.
 ShapeAttributes getAttributes()
          Returns the surface shape's normal (as opposed to highlight) attributes.
protected  List<List<LatLon>> getCachedGeometry(DrawContext dc, SurfaceTileDrawContext sdc)
           
 Extent getExtent(Globe globe, double verticalExaggeration)
          Returns this SurfaceShape's enclosing volume as an Extent in model coordinates, given a specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration().
 double getHeight(Globe globe)
          Returns the latitudanl length of the object in meters.
 ShapeAttributes getHighlightAttributes()
          Returns the surface shape's highlight attributes.
protected  WWTexture getInteriorTexture()
           
 double getLength(Globe globe)
          Returns the object's length in meters.
 int[] getMinAndMaxEdgeIntervals()
          Returns the minimum and maximum number of interpolated intervals that may be added to each shape edge.
 String getPathType()
          Returns the path type used to interpolate between locations on this SurfaceShape.
 double getPerimeter(Globe globe)
          Returns the length of the object's perimeter in meters.
abstract  Position getReferencePosition()
          A position associated with the object that indicates its aggregate geographic position.
 String getRestorableState()
          Returns an XML document string describing the object's state.
 List<Sector> getSectors(DrawContext dc)
          Returns a List of Sector instances that bound the surface object on the specified DrawContext.
 Object getStateKey(DrawContext dc)
          Returns an object that uniquely identifies the surface object's state on the specified draw context.
 double getTexelsPerEdgeInterval()
          Returns the number of texels per shape edge interval.
 double getWidth(Globe globe)
          Returns the longitudinal length of the object in meters.
protected  void handleUnsuccessfulInteriorTessellation(DrawContext dc)
           
protected  LatLon intersectionWithMeridian(LatLon p1, LatLon p2, Angle meridian, Globe globe)
          Determine where a line between two positions crosses a given meridian.
 String isExportFormatSupported(String format)
          Does this object support a certain export format?
 boolean isHighlighted()
          Indicates whether to highlight the surface shape.
protected static boolean isSectorEmpty(Sector sector)
           
protected  void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
          Restores state values from previous versions of the SurfaceShape state XML.
protected  void makeOrderedPreRenderable(DrawContext dc)
          Overridden to determine the shape's active attributes during preRendering, prior to building the shape's pickable representation and the SceneController's composite representation.
 void move(Position position)
          Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
 void moveTo(Position position)
          Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
protected  void onShapeChanged()
           
protected  String pathTypeFromString(String s)
           
protected  List<List<LatLon>> repeatAroundDateline(List<LatLon> locations)
          Returns a list containing two copies of the specified list of locations crossing the dateline: one that extends across the -180 longitude boundary and one that extends across the +180 longitude boundary.
 void restoreState(String stateInXml)
          Restores the object's state to what is described in the specified XML document string.
 void setAttributes(ShapeAttributes normalAttrs)
          Specifies the surface shape's normal (as opposed to highlight) attributes.
 void setHighlightAttributes(ShapeAttributes highlightAttrs)
          Specifies the surface shape's highlight attributes.
 void setHighlighted(boolean highlighted)
          Specifies whether the surface shape is highlighted.
 void setMinAndMaxEdgeIntervals(int minEdgeIntervals, int maxEdgeIntervals)
          Sets the minimum and maximum number of interpolated intervals that may be added to each shape edge.
 void setPathType(String pathType)
          Sets the path type used to interpolate between locations on this SurfaceShape.
 void setTexelsPerEdgeInterval(double texelsPerEdgeInterval)
          Sets the number of texels per shape edge interval.
protected  AreaMeasurer setupAreaMeasurer(Globe globe)
           
protected  Integer tessellateInterior(DrawContext dc)
           
protected  Integer tessellateInteriorVertices(GLUtessellator tess)
           
 
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
buildPickRepresentation, computeExtent, computeExtent, createPickedObject, createPickTileBuilder, drawBoundingSectors, drawOrderedRenderable, drawPickRepresentation, getDelegateOwner, getDistanceFromEye, getExtent, getUniqueId, intersectsFrustum, intersectsPickFrustum, intersectsVisibleSector, isDrawBoundingSectors, isEnableBatchPicking, isVisible, makeOrderedRenderable, nextUniqueId, pick, pickBatched, pickOrderedRenderable, preRender, render, setDelegateOwner, setDrawBoundingSectors, setEnableBatchPicking, setVisible, updateModifiedTime
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
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.render.SurfaceShape
getLocations
 
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getDelegateOwner, getDistanceFromEye, getExtent, isVisible, pick, preRender, render, setDelegateOwner, setVisible
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

activeAttrs

protected ShapeAttributes activeAttrs

activeGeometry

protected List<List<LatLon>> activeGeometry

activeOutlineGeometry

protected List<List<LatLon>> activeOutlineGeometry

areaMeasurer

protected AreaMeasurer areaMeasurer

areaMeasurerLastModifiedTime

protected long areaMeasurerLastModifiedTime

DEFAULT_HIGHLIGHT_MATERIAL

protected static final Material DEFAULT_HIGHLIGHT_MATERIAL
The default highlight color.


DEFAULT_INTERIOR_MATERIAL

protected static final Material DEFAULT_INTERIOR_MATERIAL
The default interior color.


DEFAULT_MAX_EDGE_INTERVALS

protected static final int DEFAULT_MAX_EDGE_INTERVALS
The default maximum number of shape edge intervals.

See Also:
Constant Field Values

DEFAULT_MIN_EDGE_INTERVALS

protected static final int DEFAULT_MIN_EDGE_INTERVALS
The default minimum number of shape edge intervals.

See Also:
Constant Field Values

DEFAULT_OUTLINE_MATERIAL

protected static final Material DEFAULT_OUTLINE_MATERIAL
The default outline color.


DEFAULT_PATH_TYPE

protected static final String DEFAULT_PATH_TYPE
The default path type.

See Also:
Constant Field Values

DEFAULT_TEXELS_PER_EDGE_INTERVAL

protected static final int DEFAULT_TEXELS_PER_EDGE_INTERVAL
The default number of texels per shape edge interval.

See Also:
Constant Field Values

defaultAttrs

protected static final ShapeAttributes defaultAttrs
The attributes used if attributes are not specified.


geometryCache

protected Map<Object,AbstractSurfaceObject.CacheEntry> geometryCache

highlightAttrs

protected ShapeAttributes highlightAttrs

highlighted

protected boolean highlighted

maxEdgeIntervals

protected int maxEdgeIntervals

minEdgeIntervals

protected int minEdgeIntervals

normalAttrs

protected ShapeAttributes normalAttrs

pathType

protected String pathType

sectorCache

protected Map<Object,AbstractSurfaceObject.CacheEntry> sectorCache

stackHandler

protected OGLStackHandler stackHandler

texelsPerEdgeInterval

protected double texelsPerEdgeInterval

texture

protected WWTexture texture

vertexBuffer

protected static FloatBuffer vertexBuffer
Constructor Detail

AbstractSurfaceShape

public AbstractSurfaceShape()
Constructs a new surface shape with the default attributes.


AbstractSurfaceShape

public AbstractSurfaceShape(ShapeAttributes normalAttrs)
Constructs a new surface shape with the specified normal (as opposed to highlight) attributes. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.

Parameters:
normalAttrs - the normal attributes. May be null, in which case default attributes are used.
Method Detail

addIntermediateLocations

protected void addIntermediateLocations(LatLon a,
                                        LatLon b,
                                        double edgeIntervalsPerDegree,
                                        List<LatLon> locations)

applyInteriorState

protected void applyInteriorState(DrawContext dc,
                                  SurfaceTileDrawContext sdc,
                                  ShapeAttributes attributes,
                                  WWTexture texture,
                                  LatLon refLocation)

applyInteriorTextureState

protected void applyInteriorTextureState(DrawContext dc,
                                         SurfaceTileDrawContext sdc,
                                         ShapeAttributes attributes,
                                         WWTexture texture,
                                         LatLon refLocation)

applyModelviewTransform

protected void applyModelviewTransform(DrawContext dc,
                                       SurfaceTileDrawContext sdc)

applyOutlineState

protected void applyOutlineState(DrawContext dc,
                                 ShapeAttributes attributes)

beginDrawing

protected void beginDrawing(DrawContext dc,
                            SurfaceTileDrawContext sdc)

canContainPole

protected boolean canContainPole()
Indicates whether the shape is a closed polygon that can enclose a pole, or an open path that cannot. This makes a difference when computing the bounding sector for a shape. For example, consider the positions (-100, 85), (0, 80), (100, 80). If these positions are treated as a closed polygon (a triangle over the North Pole) then the bounding sector is 80 to 90 lat, -180 to 180 lon. But if they are treated as an open path (a line wrapping partway around the pole) then the bounding sector is 80 to 85 lat, -100 to 100 lon.

Returns:
True if the shape is a closed polygon that can contain a pole, or false if it is treated as an open path that cannot contain a pole.

clearCaches

protected void clearCaches()
Clears this SurfaceObject's internal extent cache.

Overridden to clear this SurfaceShape's internal sector and geometry caches.

Overrides:
clearCaches in class AbstractSurfaceObject

computeEdgeIntervalsPerDegree

protected double computeEdgeIntervalsPerDegree(SurfaceTileDrawContext sdc)

computeSectors

protected List<Sector> computeSectors(DrawContext dc)
Computes the bounding sectors for the shape. There will be more than one if the shape crosses the date line, but does not enclose a pole.

Parameters:
dc - Current draw context.
Returns:
Bounding sectors for the shape.

computeSectors

protected List<Sector> computeSectors(Globe globe)
Computes the bounding sectors for the shape. There will be more than one if the shape crosses the date line, but does not enclose a pole.

Parameters:
globe - Current globe.
Returns:
Bounding sectors for the shape.

containsPole

protected String containsPole(Iterable<? extends LatLon> locations)
Determine if a list of geographic locations encloses either the North or South pole. The list is treated as a closed loop. (If the first and last positions are not equal the loop will be closed for purposes of this computation.)

Parameters:
locations - Locations to test.
Returns:
AVKey.NORTH if the North Pole is enclosed, AVKey.SOUTH if the South Pole is enclosed, or null if neither pole is enclosed. Always returns null if canContainPole() returns false.

createActiveAttributes

protected ShapeAttributes createActiveAttributes()

createGeometry

protected abstract List<List<LatLon>> createGeometry(Globe globe,
                                                     SurfaceTileDrawContext sdc)

createGeometryKey

protected Object createGeometryKey(DrawContext dc,
                                   SurfaceTileDrawContext sdc)

cutAlongDateLine

protected List<LatLon> cutAlongDateLine(List<LatLon> locations,
                                        String pole,
                                        Globe globe)
Divide a list of locations that encloses a pole along the international date line. This method determines where the locations cross the date line, and inserts locations to the pole, and then back to the intersection position. This allows the shape to be "unrolled" when projected in a lat-lon projection.

Parameters:
locations - Locations to cut at date line. This list is not modified.
pole - Pole contained by locations, either AVKey.NORTH or AVKey.SOUTH.
globe - Current globe.
Returns:
New location list with locations added to correctly handle date line intersection.

determineActiveAttributes

protected void determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.


determineActiveGeometry

protected void determineActiveGeometry(DrawContext dc,
                                       SurfaceTileDrawContext sdc)

doDrawGeographic

protected void doDrawGeographic(DrawContext dc,
                                SurfaceTileDrawContext sdc)

doGetRestorableState

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

doMoveTo

protected abstract void doMoveTo(Position oldReferencePosition,
                                 Position newReferencePosition)

doRestoreState

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

doTessellateInterior

protected Integer doTessellateInterior(DrawContext dc)

drawGeographic

protected void drawGeographic(DrawContext dc,
                              SurfaceTileDrawContext sdc)
Description copied from class: AbstractSurfaceObject
Causes the SurfaceObject to render itself to the specified region in geographic coordinates. The specified viewport denotes the geographic region and its corresponding screen viewport.

Specified by:
drawGeographic in class AbstractSurfaceObject
Parameters:
dc - the current draw context.
sdc - the context containing a geographic region and screen viewport corresponding to a surface tile.

drawInterior

protected void drawInterior(DrawContext dc,
                            SurfaceTileDrawContext sdc)

drawOutline

protected void drawOutline(DrawContext dc,
                           SurfaceTileDrawContext sdc)

endDrawing

protected void endDrawing(DrawContext dc)

export

public void export(String mimeType,
                   Object output)
            throws IOException,
                   UnsupportedOperationException
Export the Polygon. The output object will receive the exported data. The type of this object depends on the export format. The formats and object types supported by this class are:

 Format                                         Supported output object types
 ================================================================================
 KML (application/vnd.google-earth.kml+xml)     java.io.Writer
                                                java.io.OutputStream
                                                javax.xml.stream.XMLStreamWriter
 

Parameters:
mimeType - MIME type of desired export format.
output - An object that will receive the exported data. The type of this object depends on the export format (see above).
Throws:
IOException - If an exception occurs writing to the output object.
UnsupportedOperationException - if the format is not supported by this object, or if the output argument is not of a supported type.

exportAsKML

protected void exportAsKML(Object output)
                    throws IOException,
                           XMLStreamException
Throws:
IOException
XMLStreamException

generateIntermediateLocations

protected void generateIntermediateLocations(Iterable<? extends LatLon> iterable,
                                             double edgeIntervalsPerDegree,
                                             boolean makeClosedPath,
                                             List<LatLon> locations)

getActiveAttributes

protected ShapeAttributes getActiveAttributes()

getActiveGeometry

protected List<List<LatLon>> getActiveGeometry()

getArea

public double getArea(Globe globe)
Description copied from interface: MeasurableArea
Returns the object's area in square meters. If the object conforms to terrain, the area returned is the surface area of the terrain, including its hillsides and other undulations.

Specified by:
getArea in interface MeasurableArea
Parameters:
globe - The globe the object is related to.
Returns:
the object's area in square meters. Returns -1 if the object does not form an area due to an insufficient number of vertices or any other condition.

getArea

public double getArea(Globe globe,
                      boolean terrainConformant)
Description copied from interface: SurfaceShape
Returns the shapes's area in square meters. If terrainConformant is true, the area returned is the surface area of the terrain, including its hillsides and other undulations.

Specified by:
getArea in interface SurfaceShape
Parameters:
globe - the globe the shape is related to.
terrainConformant - whether or not the returned area should treat the shape as conforming to the terrain.
Returns:
the shape's area in square meters. Returns -1 if the object does not form an area due to an insufficient number of vertices or any other condition.

getAttributes

public ShapeAttributes getAttributes()
Returns the surface shape's normal (as opposed to highlight) attributes. Modifying the contents of the returned reference causes this shape's appearance to change accordingly.

Specified by:
getAttributes in interface SurfaceShape
Returns:
the surface shape's normal attributes. May be null.

getCachedGeometry

protected List<List<LatLon>> getCachedGeometry(DrawContext dc,
                                               SurfaceTileDrawContext sdc)

getExtent

public Extent getExtent(Globe globe,
                        double verticalExaggeration)
Returns this SurfaceShape's enclosing volume as an Extent in model coordinates, given a specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration().

Specified by:
getExtent in interface ExtentHolder
Parameters:
globe - the Globe this SurfaceShape is related to.
verticalExaggeration - the vertical exaggeration of the scene containing this SurfaceShape.
Returns:
this SurfaceShape's Extent in model coordinates.
Throws:
IllegalArgumentException - if the Globe is null.

getHeight

public double getHeight(Globe globe)
Description copied from interface: MeasurableArea
Returns the latitudanl length of the object in meters. The length is the distance from the objects south-most point to its east-most position.

Specified by:
getHeight in interface MeasurableArea
Parameters:
globe - The globe the object is related to.
Returns:
the height of the object in meters.

getHighlightAttributes

public ShapeAttributes getHighlightAttributes()
Returns the surface shape's highlight attributes. Modifying the contents of the returned reference causes this shape's appearance to change accordingly.

Specified by:
getHighlightAttributes in interface SurfaceShape
Returns:
the surface shape's highlight attributes. May be null.

getInteriorTexture

protected WWTexture getInteriorTexture()

getLength

public double getLength(Globe globe)
Description copied from interface: MeasurableLength
Returns the object's length in meters. If the object conforms to terrain, the length is that along the terrain, including its hillsides and other undulations.

Specified by:
getLength in interface MeasurableLength
Parameters:
globe - The globe the object is related to.
Returns:
the object's length in meters.

getMinAndMaxEdgeIntervals

public int[] getMinAndMaxEdgeIntervals()
Description copied from interface: SurfaceShape
Returns the minimum and maximum number of interpolated intervals that may be added to each shape edge.

Specified by:
getMinAndMaxEdgeIntervals in interface SurfaceShape
Returns:
array of two elements, the first element is minEdgeIntervals, the second element is maxEdgeIntervals.
See Also:
SurfaceShape.setMinAndMaxEdgeIntervals(int, int)

getPathType

public String getPathType()
Description copied from interface: SurfaceShape
Returns the path type used to interpolate between locations on this SurfaceShape.

Specified by:
getPathType in interface SurfaceShape
Returns:
path interpolation type.

getPerimeter

public double getPerimeter(Globe globe)
Description copied from interface: MeasurableArea
Returns the length of the object's perimeter in meters. If the object conforms to terrain, the perimeter is that along the terrain, including its hillsides and other undulations.

Specified by:
getPerimeter in interface MeasurableArea
Parameters:
globe - The globe the object is related to.
Returns:
the object's perimeter in meters. Returns -1 if the object does not form an area due to an insufficient number of vertices or any other condition.

getReferencePosition

public abstract Position getReferencePosition()
Description copied from interface: Movable
A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.

Specified by:
getReferencePosition in interface Movable
Returns:
the object's reference position, or null if no reference position is available.

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.

getSectors

public List<Sector> getSectors(DrawContext dc)
Description copied from interface: SurfaceObject
Returns a List of Sector instances that bound the surface object on the specified DrawContext.

Specified by:
getSectors in interface SurfaceObject
Parameters:
dc - the DrawContext the surface object is related to.
Returns:
the surface object's bounding Sectors.

getStateKey

public Object getStateKey(DrawContext dc)
Returns an object that uniquely identifies the surface object's state on the specified draw context. This object is guaranteed to be globally unique; an equality test with a state key from another always returns false.

The returned state key is constructed the SurfaceShape's unique ID, last modified time, and its active attributes. The returned state key has no dependency on the Globe. Subclasses that depend on the Globe should return a state key that include the globe's state key.

Specified by:
getStateKey in interface SurfaceObject
Overrides:
getStateKey in class AbstractSurfaceObject
Parameters:
dc - the draw context the state key relates to.
Returns:
an object representing surface object's current state.

getTexelsPerEdgeInterval

public double getTexelsPerEdgeInterval()
Description copied from interface: SurfaceShape
Returns the number of texels per shape edge interval.

Specified by:
getTexelsPerEdgeInterval in interface SurfaceShape
Returns:
texels per shape edge interval.
See Also:
SurfaceShape.setTexelsPerEdgeInterval(double)

getWidth

public double getWidth(Globe globe)
Description copied from interface: MeasurableArea
Returns the longitudinal length of the object in meters. The length is the distance from the object's west-most point to its east-most. If the object is terrain conforming then the

Specified by:
getWidth in interface MeasurableArea
Parameters:
globe - The globe the object is related to.
Returns:
the width of the object in meters.

handleUnsuccessfulInteriorTessellation

protected void handleUnsuccessfulInteriorTessellation(DrawContext dc)

intersectionWithMeridian

protected LatLon intersectionWithMeridian(LatLon p1,
                                          LatLon p2,
                                          Angle meridian,
                                          Globe globe)
Determine where a line between two positions crosses a given meridian. The intersection test is performed by intersecting a line in Cartesian space between the two positions with a plane through the meridian. Thus, it is most suitable for working with positions that are fairly close together as the calculation does not take into account great circle or rhumb paths.

Parameters:
p1 - First position.
p2 - Second position.
meridian - Longitude line to intersect with.
globe - Globe used to compute intersection.
Returns:
The intersection location along the meridian

isExportFormatSupported

public String isExportFormatSupported(String format)
Does this object support a certain export format?

Parameters:
format - Mime type for the export format.
Returns:
One of Exportable.FORMAT_SUPPORTED, Exportable.FORMAT_NOT_SUPPORTED, or Exportable.FORMAT_PARTIALLY_SUPPORTED.
See Also:
export(String, Object)

isHighlighted

public boolean isHighlighted()
Indicates whether to highlight the surface shape.

Specified by:
isHighlighted in interface Highlightable
Specified by:
isHighlighted in interface SurfaceShape
Returns:
true if highlighted, otherwise false.
See Also:
SurfaceShape.setHighlighted(boolean), SurfaceShape.setHighlightAttributes(ShapeAttributes)

isSectorEmpty

protected static boolean isSectorEmpty(Sector sector)

legacyRestoreState

protected void legacyRestoreState(RestorableSupport rs,
                                  RestorableSupport.StateObject context)
Restores state values from previous versions of the SurfaceShape state XML. These values are stored or named differently than the current implementation. Those values which have not changed are ignored here, and will restored in doRestoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject).

Parameters:
rs - RestorableSupport object which contains the state value properties.
context - active context in the RestorableSupport to read state from.

makeOrderedPreRenderable

protected void makeOrderedPreRenderable(DrawContext dc)
Overridden to determine the shape's active attributes during preRendering, prior to building the shape's pickable representation and the SceneController's composite representation.

Overrides:
makeOrderedPreRenderable in class AbstractSurfaceObject
Parameters:
dc - the current draw context.

move

public void move(Position position)
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:
position - the latitude and longitude to add to the shape's reference position.

moveTo

public 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.

onShapeChanged

protected void onShapeChanged()

pathTypeFromString

protected String pathTypeFromString(String s)

repeatAroundDateline

protected List<List<LatLon>> repeatAroundDateline(List<LatLon> locations)
Returns a list containing two copies of the specified list of locations crossing the dateline: one that extends across the -180 longitude boundary and one that extends across the +180 longitude boundary. If the list of locations does not cross the dateline this returns a list containing a copy of the original list.

Parameters:
locations - Locations to repeat. This is list not modified.
Returns:
A list containing two new location lists, one copy for either side of the date line.

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.

setAttributes

public void setAttributes(ShapeAttributes normalAttrs)
Specifies the surface shape's normal (as opposed to highlight) attributes. Modifying the attribute reference after calling setAttributes() causes this shape's appearance to change accordingly.

Specified by:
setAttributes in interface SurfaceShape
Parameters:
normalAttrs - the normal attributes. May be null, in which case default attributes are used.

setHighlightAttributes

public void setHighlightAttributes(ShapeAttributes highlightAttrs)
Specifies the surface shape's highlight attributes. Modifying the attribute reference after calling setHighlightAttributes() causes this shape's appearance to change accordingly.

Specified by:
setHighlightAttributes in interface SurfaceShape
Parameters:
highlightAttrs - the highlight attributes. May be null, in which case default attributes are used.

setHighlighted

public void setHighlighted(boolean highlighted)
Specifies whether the surface shape is highlighted.

Specified by:
setHighlighted in interface Highlightable
Specified by:
setHighlighted in interface SurfaceShape
Parameters:
highlighted - true to highlight the surface shape, otherwise false. The default value is false.
See Also:
SurfaceShape.setHighlightAttributes(ShapeAttributes)

setMinAndMaxEdgeIntervals

public void setMinAndMaxEdgeIntervals(int minEdgeIntervals,
                                      int maxEdgeIntervals)
Description copied from interface: SurfaceShape
Sets the minimum and maximum number of interpolated intervals that may be added to each shape edge. The minimum and maximum values may be 0, or any positive integer. Note that Setting either of minEdgeIntervals or maxEdgeIntervals too large may adversely impact surface shape rendering performance.

Specified by:
setMinAndMaxEdgeIntervals in interface SurfaceShape
Parameters:
minEdgeIntervals - the minimum number of interpolated edge intervals.
maxEdgeIntervals - the maximum number of interpolated edge intervals.
See Also:
SurfaceShape.setTexelsPerEdgeInterval(double)

setPathType

public void setPathType(String pathType)
Description copied from interface: SurfaceShape
Sets the path type used to interpolate between locations on this SurfaceShape. This should be one of

Specified by:
setPathType in interface SurfaceShape
Parameters:
pathType - path interpolation type.

setTexelsPerEdgeInterval

public void setTexelsPerEdgeInterval(double texelsPerEdgeInterval)
Description copied from interface: SurfaceShape
Sets the number of texels per shape edge interval. This value controls how many interpolated intervals are added to each shape edge, depending on size of the original edge in texels. Each shape is responsible for defining what an edge is, though for most shapes it is defined as the edge between implicit or caller-specified shape locations. The number of interpolated intervals is limited by the values set in a call to SurfaceShape.setMinAndMaxEdgeIntervals(int, int).

Specified by:
setTexelsPerEdgeInterval in interface SurfaceShape
Parameters:
texelsPerEdgeInterval - the size, in texels, of each interpolated edge interval.
See Also:
SurfaceShape.setMinAndMaxEdgeIntervals(int, int)

setupAreaMeasurer

protected AreaMeasurer setupAreaMeasurer(Globe globe)

tessellateInterior

protected Integer tessellateInterior(DrawContext dc)

tessellateInteriorVertices

protected Integer tessellateInteriorVertices(GLUtessellator tess)

NASA World Wind