NASA World Wind

gov.nasa.worldwind.render
Interface SurfaceShape

All Superinterfaces:
AVList, MeasurableArea, MeasurableLength, PreRenderable, Renderable, Restorable, SurfaceObject
All Known Implementing Classes:
AbstractSurfaceShape, SectorSelector.RegionShape, SurfaceCircle, SurfaceConcaveShape, SurfaceEllipse, SurfacePolygon, SurfacePolyline, SurfaceQuad, SurfaceSector, SurfaceSquare

public interface SurfaceShape
extends SurfaceObject, PreRenderable, Renderable, Restorable, MeasurableArea, MeasurableLength

The SurfaceShape is a common interface for surface conforming shapes such as polygon, sector, ellipse, and quadrilateral. SurfaceShapes implement the PreRenderable and Renderable interfaces, so a surface shape may be aggregated within any layer or within some arbitrary rendering code. While SurfaceShapes may be rendered on an individual basis, they are designed to be aggregated with other SurfaceShapes in a SurfaceShapeLayer. By letting SurfaceShapeLayer handle a collection of shapes in bulk, the shapes share a common set of system resources, which will increse the scalability of rendering a large number of shapes.

Most implementations of SurfaceShape will require that PreRenderable.preRender(DrawContext) is called before Renderable.render(DrawContext), and that preRender is called at the appropriate stage in the current rendering cycle. Furthermore, most implementations will be designed such that calling preRender will lock in the visual attributes of the shape for any subsequent calls to render, until the next time preRender is called.

An instance of SurfaceShape is also a SurfaceObject, which allows SurfaceShape to be used anywhere that a SurfaceObject is accepted. Most importantly, this means that a SurfaceShape does not need to be rendered by calling preRender and render. Instead, a SurfaceShape may be rendered as input to TiledSurfaceObjectRenderer.

See Also:
SurfaceShapeLayer

Method Summary
 double getArea(Globe globe, boolean terrainConformant)
          Returns the shapes's area in square meters.
 ShapeAttributes getAttributes()
          Returns the rendering attributes associated with this SurfaceShape.
 Iterable<? extends LatLon> getLocations(Globe globe)
          Returns the shape's locations as they appear on the specified globe.
 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 getTexelsPerEdgeInterval()
          Returns the number of texels per shape edge interval.
 void setAttributes(ShapeAttributes attributes)
          Sets the rendering attributes associated with this SurfaceShape.
 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.
 
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getLastModifiedTime, getSectors, isVisible, renderToRegion, 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
 
Methods inherited from interface gov.nasa.worldwind.render.PreRenderable
preRender
 
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
 
Methods inherited from interface gov.nasa.worldwind.Restorable
getRestorableState, restoreState
 
Methods inherited from interface gov.nasa.worldwind.geom.MeasurableArea
getArea, getHeight, getPerimeter, getWidth
 
Methods inherited from interface gov.nasa.worldwind.geom.MeasurableLength
getLength
 

Method Detail

getArea

double getArea(Globe globe,
               boolean terrainConformant)
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.

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.
Throws:
IllegalArgumentException - if globe is null.

getAttributes

ShapeAttributes getAttributes()
Returns the rendering attributes associated with this SurfaceShape.

Returns:
this shape's rendering attributes.

getLocations

Iterable<? extends LatLon> getLocations(Globe globe)
Returns the shape's locations as they appear on the specified globe.

Parameters:
globe - the globe the shape is related to.
Returns:
the shapes locations on the globe.
Throws:
IllegalArgumentException - if globe is null.

getMinAndMaxEdgeIntervals

int[] getMinAndMaxEdgeIntervals()
Returns the minimum and maximum number of interpolated intervals that may be added to each shape edge.

Returns:
array of two elements, the first element is minEdgeIntervals, the second element is maxEdgeIntervals.
See Also:
setMinAndMaxEdgeIntervals(int, int)

getPathType

String getPathType()
Returns the path type used to interpolate between locations on this SurfaceShape.

Returns:
path interpolation type.

getTexelsPerEdgeInterval

double getTexelsPerEdgeInterval()
Returns the number of texels per shape edge interval.

Returns:
texels per shape edge interval.
See Also:
setTexelsPerEdgeInterval(double)

setAttributes

void setAttributes(ShapeAttributes attributes)
Sets the rendering attributes associated with this SurfaceShape.

Parameters:
attributes - this shapes new rendering attributes.
Throws:
IllegalArgumentException - if attributes is null.

setMinAndMaxEdgeIntervals

void setMinAndMaxEdgeIntervals(int minEdgeIntervals,
                               int maxEdgeIntervals)
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.

Parameters:
minEdgeIntervals - the minimum number of interpolated edge intervals.
maxEdgeIntervals - the maximum number of interpolated edge intervals.
Throws:
IllegalArgumentException - if either of minEdgeIntervals or maxEdgeIntervals is less than or equal to zero.
See Also:
setTexelsPerEdgeInterval(double)

setPathType

void setPathType(String pathType)
Sets the path type used to interpolate between locations on this SurfaceShape. This should be one of
  • gov.nasa.worldwind.avlist.AVKey.GREAT_CIRCLE
  • gov.nasa.worldwind.avlist.AVKey.LINEAR
  • gov.nasa.worldwind.avlist.AVKey.LOXODROME
  • gov.nasa.worldwind.avlist.AVKey.RHUMB

Parameters:
pathType - path interpolation type.
Throws:
IllegalArgumentException - if pathType is null.

setTexelsPerEdgeInterval

void setTexelsPerEdgeInterval(double texelsPerEdgeInterval)
Sets the number of texels per shape edge interval. This value controls how many interpolated intervals will be 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 will simply be 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 setMinAndMaxEdgeIntervals(int, int).

Parameters:
texelsPerEdgeInterval - the size, in texels, of each interpolated edge interval.
Throws:
IllegalArgumentException - if texelsPerEdgeInterval is less than or equal to zero.
See Also:
setMinAndMaxEdgeIntervals(int, int)

NASA World Wind

Hosted by docs.bugaco.com