NASA World Wind

gov.nasa.worldwind.render
Class MultiResolutionPath

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.AbstractShape
              extended by gov.nasa.worldwind.render.Path
                  extended by gov.nasa.worldwind.render.MultiResolutionPath
All Implemented Interfaces:
AVList, MessageListener, Exportable, ExtentHolder, Movable, GeographicExtent, Highlightable, OrderedRenderable, Renderable, Restorable, WWObject, PropertyChangeListener, EventListener

public class MultiResolutionPath
extends Path

A Version of Path that provides level-of-detail. Positions in a Path are filtered based on a "skip count", the number of positions to skip between positions that are drawn. The skip-count algorithm can be replaced by the application. The default algorithm skips up to four positions, depending on the eye distance from the positions. Also, if the segment between any two positions is too small to be distinguished, it is not drawn. See makePositions(DrawContext, gov.nasa.worldwind.render.Path.PathData).


Nested Class Summary
protected static class MultiResolutionPath.MultiResolutionPathData
          Subclass of PathData that adds the capability to map which ordinal number corresponds to each rendered position.
static interface MultiResolutionPath.SkipCountComputer
          This interface provides the means for the application to specify the algorithm used to determine the number of specified positions skipped during path tessellation.
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.Path
Path.PathData, Path.PathPickSupport, Path.PickablePositions, Path.PositionColors
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
 
Field Summary
protected  MultiResolutionPath.SkipCountComputer skipCountComputer
          The default implementation of SkipCountComputer.
 
Fields inherited from class gov.nasa.worldwind.render.Path
DEFAULT_DRAW_POSITIONS_SCALE, DEFAULT_DRAW_POSITIONS_THRESHOLD, DEFAULT_INTERIOR_MATERIAL, DEFAULT_NUM_SUBSEGMENTS, DEFAULT_OUTLINE_MATERIAL, DEFAULT_PATH_TYPE, DEFAULT_TERRAIN_CONFORMANCE, drawVerticals, extrude, followTerrain, numPositions, numSubsegments, pathType, pickPositionColors, positionColors, positions, showPositions, showPositionsScale, showPositionsThreshold, SURFACE_PATH_DEPTH_OFFSET, terrainConformance
 
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, VBO_THRESHOLD, viewDistanceExpiration, visible
 
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
Constructor Summary
MultiResolutionPath(Iterable<? extends Position> positions)
          Creates a path with specified positions.
MultiResolutionPath(Position.PositionList positions)
          Creates a path with specified positions specified via a generic list.
 
Method Summary
protected  void addTessellatedPosition(Position pos, Color color, Integer ordinal, Path.PathData pathData)
          Adds a position to this path's tessellatedPositions list.
protected  AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
          Creates and returns a new cache entry specific to the subclass.
protected  Integer getOrdinal(int positionIndex)
          Returns the ordinal number corresponding to the position.
 MultiResolutionPath.SkipCountComputer getSkipCountComputer()
          Indicates the SkipCountComputer that is used to determine the number of specified positions skipped during path tessellation.
protected  void makePositions(DrawContext dc, Path.PathData pathData)
          

Overridden to skip positions from this Path's original positions list.

protected  void makeTessellatedPositions(DrawContext dc, Path.PathData pathData)
          Generates positions defining this path with path type and terrain-conforming properties applied.
 void setSkipCountComputer(MultiResolutionPath.SkipCountComputer computer)
          Specifies the SkipCountComputer that determines the number of specified positions skipped during path tessellation.
 
Methods inherited from class gov.nasa.worldwind.render.Path
addOrderedRenderable, addPickablePositions, appendTerrainPoint, computeAbsolutePoints, computeExtent, computeEyeDistance, computePath, computePointsRelativeToTerrain, computePositionCount, computeReferenceCenter, computeSegmentLength, determineActiveAttributes, doDrawInterior, doDrawInteriorVA, doDrawInteriorVBO, doDrawOrderedRenderable, doDrawOutline, doDrawOutlineVA, doDrawOutlineVBO, doExportAsKML, doMakeOrderedRenderable, drawPointsVA, drawPointsVBO, drawVerticalOutlineVA, drawVerticalOutlineVBO, fillVBO, getColor, getCurrentPathData, getDistanceMetric, getExtent, getNumSubsegments, getPathType, getPosition, getPositionColors, getPositions, getReferencePosition, getSector, getShowPositionsScale, getShowPositionsThreshold, getTerrainConformance, initialize, intersect, isDrawVerticals, isExtrude, isFollowTerrain, isOrderedRenderableValid, isSegmentVisible, isShowPositions, isSmall, isSurfacePath, makeSegment, move, moveTo, mustApplyLighting, mustApplyTexture, mustDrawInterior, mustRegenerateGeometry, prepareToDrawPoints, reset, resolvePickedPosition, setDrawVerticals, setExtrude, setFollowTerrain, setNumSubsegments, setPathType, setPositionColors, setPositions, setShowPositions, setShowPositionsScale, setShowPositionsThreshold, setTerrainConformance, shouldUseVBOs
 
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
beginDrawing, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, countTriangleVertices, createPickedObject, doGetRestorableState, doRestoreState, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isExportFormatSupported, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawOutline, pick, prepareToDrawInterior, prepareToDrawOutline, render, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible
 
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.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

skipCountComputer

protected MultiResolutionPath.SkipCountComputer skipCountComputer
The default implementation of SkipCountComputer. This implementation returns a value of 4 when the eye distance to the path is greater than 10e3, a value of 2 when the eye distance is greater than 1e3 meters but less then 10e3, and a value of 1 when the eye distance is less than 1e3.

Constructor Detail

MultiResolutionPath

public MultiResolutionPath(Iterable<? extends Position> positions)
Creates a path with specified positions. When the path is rendered, only path positions that are visually distinct for the current viewing state are considered. The path adjusts the positions it uses as the view state changes, using more of the specified positions as the eye point comes closer to the shape.

Note: If fewer than two positions are specified, no path is drawn.

Parameters:
positions - the path positions. This reference is retained by this shape; the positions are not copied. If any positions in the set change, Path.setPositions(Iterable) must be called to inform this shape of the change.
Throws:
IllegalArgumentException - if positions is null.

MultiResolutionPath

public MultiResolutionPath(Position.PositionList positions)
Creates a path with specified positions specified via a generic list. When the path is rendered, only path positions that are visually distinct for the current viewing state are considered. The path adjusts the positions it uses as the view state changes, using more of the specified positions as the eye point comes closer to the shape.

Note: If fewer than two positions are specified, no path is drawn.

Parameters:
positions - the path positions. This reference is retained by this shape; the positions are not copied. If any positions in the set change, Path.setPositions(Iterable) must be called to inform this shape of the change.
Throws:
IllegalArgumentException - if positions is null.
Method Detail

addTessellatedPosition

protected void addTessellatedPosition(Position pos,
                                      Color color,
                                      Integer ordinal,
                                      Path.PathData pathData)
Adds a position to this path's tessellatedPositions list. If the specified color is not null, this adds the color to this path's tessellatedColors list. If the specified ordinal is not null, this adds the position's index to the polePositions and positionPoints index buffers.

Overridden to create a mapping between the current tessellated position and the specified ordinal, if the ordinal is not null.

Overrides:
addTessellatedPosition in class Path
Parameters:
pos - the position to add.
color - the color corresponding to the position. May be null to indicate that the position has no associated color.
ordinal - the ordinal number corresponding to the position's location in the original position list. May be null to indicate that the position is not one of the originally specified positions.
pathData - the current globe-specific path data.

createCacheEntry

protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.

Overridden to return a new instance of MultiResolutionPathData.

Overrides:
createCacheEntry in class Path
Parameters:
dc - the current draw context.
Returns:
a data cache entry for the state in the specified draw context.

getOrdinal

protected Integer getOrdinal(int positionIndex)
Returns the ordinal number corresponding to the position. This returns null if the position index does not correspond to an original position.

Overridden to use the MultiResolutionPathData's positionOrdinals buffer to map the specified position index to its corresponding ordinal number.

Overrides:
getOrdinal in class Path
Parameters:
positionIndex - the position's index.
Returns:
the ordinal number corresponding to the specified position index.

getSkipCountComputer

public MultiResolutionPath.SkipCountComputer getSkipCountComputer()
Indicates the SkipCountComputer that is used to determine the number of specified positions skipped during path tessellation.

Returns:
the SkipCountComputer used during path tessellation.

makePositions

protected void makePositions(DrawContext dc,
                             Path.PathData pathData)

Overridden to skip positions from this Path's original positions list. Positions are skipped first according to this Path's skipCountComputer. The skipCountComputer determines how many positions this path skips between tessellated positions. Any positions remaining after this step are skipped if the segment they are part of is either very small or not visible.

Overrides:
makePositions in class Path

makeTessellatedPositions

protected void makeTessellatedPositions(DrawContext dc,
                                        Path.PathData pathData)
Generates positions defining this path with path type and terrain-conforming properties applied. Builds the path's tessellatedPositions and polePositions fields.

Overridden to initialize and build the PathData's positionOrdinals buffer.

Overrides:
makeTessellatedPositions in class Path
Parameters:
dc - the current draw context.
pathData - the current globe-specific path data.

setSkipCountComputer

public void setSkipCountComputer(MultiResolutionPath.SkipCountComputer computer)
Specifies the SkipCountComputer that determines the number of specified positions skipped during path tessellation.

Parameters:
computer - the SkipCountComputer to use during path tessellation.
Throws:
IllegalArgumentException - if the computer is null.

NASA World Wind