public class Path extends AbstractShape
AVKey.GREAT_CIRCLE
. It can also conform to the underlying terrain. A curtain may be formed by
extruding the path to the ground.
Altitudes within the path's positions are interpreted according to the path's altitude mode. If the altitude mode is
WorldWind.ABSOLUTE
, the altitudes are considered as height above the ellipsoid. If the altitude mode is
WorldWind.RELATIVE_TO_GROUND
, the altitudes are added to the elevation of the terrain at the position. If the
altitude mode is WorldWind.CLAMP_TO_GROUND
the altitudes are ignored.
Between the specified positions the path is drawn along a curve specified by the path's path type, either AVKey.GREAT_CIRCLE
, AVKey.RHUMB_LINE
or AVKey.LINEAR
. (See setPathType(String)
.)
Paths 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 AbstractShape.DEFAULT_HIGHLIGHT_MATERIAL
.
When the path type is LINEAR
the path conforms to terrain only if the follow-terrain property is true.
Otherwise the path control points will be connected by straight line segments.
The terrain conformance of GREAT_CIRCLE
or RHUMB_LINE
paths is determined by the path's
follow-terrain and terrain-conformance properties. When the follow-terrain property is true, terrain conformance
adapts as the view moves relative to the path; the terrain-conformance property governs the precision of conformance,
and the number of intermediate positions computed varies. See setFollowTerrain(boolean)
and setTerrainConformance(double)
. If the follow-terrain property is false, the view position is not considered and the
number of intermediate positions between specified positions is the constant value specified by the num-subsegments
property (see setNumSubsegments(int)
). The latter case may produce higher performance than the former.
The path positions may be shown by calling setShowPositions(boolean)
with an argument of true
.
This causes dots to be drawn at each originally specified path position. Dots are not drawn at tessellated path
positions. The size of the dots may be specified via setShowPositionsScale(double)
. The dots are drawn only
when the Path is within a threshold distance from the eye point. The threshold may be specified by calling setShowPositionsThreshold(double)
. The dots are drawn in the path's outline material colors by default.
The path's line and the path's position dots may be drawn in unique RGBA colors by configuring the path with a Path.PositionColors
(see setPositionColors(gov.nasa.worldwind.render.Path.PositionColors)
).
Path picking includes information about which position dots are picked, in addition to the path itself. A position
dot under the cursor is returned as an Integer object in the PickedObject's AVList under they key AVKey.ORDINAL.
Position dots intersecting the pick rectangle are returned as a List of Integer objects in the PickedObject's AVList
under the key AVKey.ORDINAL_LIST.
When drawn on a 2D globe, this shape uses a SurfacePolyline
to represent itself. The following features are
not provided in this case: display of path positions, extrusion, outline pick width, and identification of path
position picked.Modifier and Type | Class and Description |
---|---|
protected static class |
Path.PathData
Maintains globe-dependent computed data such as Cartesian vertices and extents.
|
protected static class |
Path.PathPickSupport
Subclass of PickSupport that adds the capability to resolve a Path's picked position point.
|
protected static class |
Path.PickablePositions
PickablePositions associates a range of pick color codes with a Path.
|
static interface |
Path.PositionColors
The PositionColors interface defines an RGBA color for each of a path's original positions.
|
AbstractShape.AbstractShapeData
Modifier and Type | Field and Description |
---|---|
protected static double |
DEFAULT_DRAW_POSITIONS_SCALE
The default scale for position dots.
|
protected static double |
DEFAULT_DRAW_POSITIONS_THRESHOLD
The default distance from the eye beyond which positions dots are not drawn.
|
protected static Material |
DEFAULT_INTERIOR_MATERIAL
The default interior color.
|
protected static int |
DEFAULT_NUM_SUBSEGMENTS
The default number of tessellation points between the specified path positions.
|
protected static Material |
DEFAULT_OUTLINE_MATERIAL
The default outline color.
|
protected static java.lang.String |
DEFAULT_PATH_TYPE
The default path type.
|
protected static double |
DEFAULT_TERRAIN_CONFORMANCE
The default terrain conformance target.
|
protected boolean |
drawVerticals |
protected boolean |
extrude |
protected boolean |
followTerrain |
protected int |
numPositions |
protected int |
numSubsegments |
protected java.lang.String |
pathType |
protected static java.nio.ByteBuffer |
pickPositionColors |
protected Path.PositionColors |
positionColors |
protected java.lang.Iterable<? extends Position> |
positions |
protected boolean |
positionsSpanDateline |
protected boolean |
showPositions |
protected double |
showPositionsScale |
protected double |
showPositionsThreshold |
protected static double |
SURFACE_PATH_DEPTH_OFFSET
The offset applied to a terrain following Path's depth values to to ensure it shows over the terrain: 0.99.
|
protected double |
terrainConformance |
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, dragEnabled, draggableSupport, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, surfaceShape, VBO_THRESHOLD, viewDistanceExpiration, visible
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
Path()
Creates a path with no positions.
|
Path(java.lang.Iterable<? extends Position> positions)
Creates a path with specified positions.
|
Path(Path source) |
Path(Position.PositionList positions)
Creates a path with positions specified via a generic list.
|
Path(Position posA,
Position posB)
Creates a path between two positions.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addOrderedRenderable(DrawContext dc)
Adds this shape to the draw context's ordered renderable list.
|
protected void |
addPickablePositions(DrawContext dc,
PickSupport pickCandidates)
Registers this Path's pickable position color codes with the specified pickCandidates.
|
protected void |
addTessellatedPosition(Position pos,
java.awt.Color color,
java.lang.Integer ordinal,
Path.PathData pathData)
Adds a position to this path's
tessellatedPositions list. |
protected void |
appendTerrainPoint(DrawContext dc,
Position position,
float[] color,
java.nio.FloatBuffer path,
Path.PathData pathData)
Computes a point on a path and adds it to the renderable geometry.
|
protected java.nio.FloatBuffer |
computeAbsolutePoints(DrawContext dc,
java.util.List<Position> positions,
java.nio.FloatBuffer path,
Path.PathData pathData)
Computes a model-coordinate path from a list of positions, using the altitudes in the specified positions.
|
protected Extent |
computeExtent(Path.PathData current)
Computes the path's bounding box from the current rendering path.
|
protected double |
computeEyeDistance(DrawContext dc,
Path.PathData pathData)
Computes the minimum distance between this Path and the eye point.
|
protected void |
computePath(DrawContext dc,
java.util.List<Position> positions,
Path.PathData pathData)
Computes the shape's model-coordinate path from a list of positions.
|
protected java.nio.FloatBuffer |
computePointsRelativeToTerrain(DrawContext dc,
java.util.List<Position> positions,
java.lang.Double altitude,
java.nio.FloatBuffer path,
Path.PathData pathData)
Computes a terrain-conforming, model-coordinate path from a list of positions, using either a specified altitude
or the altitudes in the specified positions.
|
protected void |
computePositionCount()
Counts the number of positions in this path's specified positions.
|
protected Vec4 |
computeReferenceCenter(DrawContext dc)
Computes this path's reference center.
|
protected double |
computeSegmentLength(DrawContext dc,
Position posA,
Position posB)
Computes the approximate model-coordinate, path length between two positions.
|
protected AbstractShape.AbstractShapeData |
createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.
|
protected SurfaceShape |
createSurfaceShape()
Returns a
SurfaceShape that corresponds to this Path and is used for drawing on 2D globes. |
protected void |
determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
|
protected void |
doDrawInterior(DrawContext dc)
Draws this path's interior when the path is extruded.
|
protected void |
doDrawInteriorVA(DrawContext dc,
Path.PathData pathData) |
protected void |
doDrawInteriorVBO(DrawContext dc,
int[] vboIds,
Path.PathData pathData) |
protected void |
doDrawOrderedRenderable(DrawContext dc,
PickSupport pickCandidates)
Draw this shape as an ordered renderable.
|
protected void |
doDrawOutline(DrawContext dc)
Draws this shape's outline.
|
protected void |
doDrawOutlineVA(DrawContext dc,
Path.PathData pathData) |
protected void |
doDrawOutlineVBO(DrawContext dc,
int[] vboIds,
Path.PathData pathData) |
protected void |
doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)
Exports shape-specific fields.
|
protected boolean |
doMakeOrderedRenderable(DrawContext dc)
Produces the geometry and other state necessary to represent this shape as an ordered renderable.
|
protected void |
drawPointsVA(DrawContext dc,
Path.PathData pathData)
Draws vertical lines at this path's specified positions.
|
protected void |
drawPointsVBO(DrawContext dc,
int[] vboIds,
Path.PathData pathData)
Draws points at this path's specified positions.
|
protected void |
drawVerticalOutlineVA(DrawContext dc,
Path.PathData pathData)
Draws vertical lines at this path's specified positions.
|
protected void |
drawVerticalOutlineVBO(DrawContext dc,
int[] vboIds,
Path.PathData pathData) |
protected void |
fillVBO(DrawContext dc)
Fill this shape's vertex buffer objects.
|
protected java.awt.Color |
getColor(Position pos,
java.lang.Integer ordinal)
Returns an RGBA color corresponding to the specified position from the original position list and its
corresponding ordinal number by delegating the call to this path's positionColors.
|
protected Path.PathData |
getCurrentPathData() |
protected double |
getDistanceMetric(DrawContext dc,
Path.PathData pathData)
Computes this Path's distance from the eye point, for use in determining when to show positions points.
|
Extent |
getExtent(Globe globe,
double verticalExaggeration)
Returns the objects enclosing volume as an
Extent in model coordinates, given a
specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration() . |
int |
getNumSubsegments()
Indicates the number of segments used between specified positions to achieve this path's path type.
|
protected java.lang.Integer |
getOrdinal(int positionIndex)
Returns the ordinal number corresponding to the position.
|
java.lang.String |
getPathType()
Indicates this paths path type.
|
protected Position |
getPosition(int positionIndex)
Returns the Path position corresponding index.
|
Path.PositionColors |
getPositionColors()
Indicates the PositionColors that defines the RGBA color for each of this path's positions.
|
java.lang.Iterable<? extends Position> |
getPositions()
Returns this path's positions.
|
Position |
getReferencePosition()
Computes the path's reference position.
|
Sector |
getSector()
Returns the object's geographic extent.
|
double |
getShowPositionsScale()
Indicates the scale factor controlling the size of dots drawn at this path's specified positions.
|
double |
getShowPositionsThreshold()
Indicates the eye distance from this shape's center beyond which position dots are not drawn.
|
double |
getTerrainConformance()
Indicates the terrain conformance target when this path follows the terrain.
|
protected void |
initialize()
Called during construction to establish any subclass-specific state such as different default values than those
set by this class.
|
java.util.List<Intersection> |
intersect(Line line,
Terrain terrain)
Compute the intersections of a specified line with this shape.
|
boolean |
isDrawVerticals()
Indicates whether to draw at each specified path position when this path is extruded.
|
boolean |
isExtrude()
Indicates whether to extrude this path.
|
boolean |
isFollowTerrain()
Indicates whether this path is terrain following.
|
protected boolean |
isOrderedRenderableValid(DrawContext dc)
Determines whether this shape's ordered renderable state is valid and can be rendered.
|
protected boolean |
isSegmentVisible(DrawContext dc,
Position posA,
Position posB,
Vec4 ptA,
Vec4 ptB)
Determines whether the segment between two path positions is visible.
|
boolean |
isShowPositions()
Indicates whether dots are drawn at the Path's original positions.
|
protected boolean |
isSmall(DrawContext dc,
Vec4 ptA,
Vec4 ptB,
int numPixels) |
protected boolean |
isSurfacePath(DrawContext dc)
Indicates whether this Path's defining positions and the positions in between are located on the underlying
terrain.
|
protected void |
makePath2DIndices(Path.PathData pathData) |
protected void |
makePositions(DrawContext dc,
Path.PathData pathData) |
protected void |
makeSegment(DrawContext dc,
Position posA,
Position posB,
Vec4 ptA,
Vec4 ptB,
java.awt.Color colorA,
java.awt.Color colorB,
int ordinalA,
int ordinalB,
Path.PathData pathData)
Creates the interior segment positions to adhere to the current path type and terrain-following settings.
|
protected void |
makeTessellatedPositions(DrawContext dc,
Path.PathData pathData)
Generates positions defining this path with path type and terrain-conforming properties applied.
|
void |
move(Position delta)
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
void |
moveTo(Globe globe,
Position position)
Move 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 boolean |
mustApplyLighting(DrawContext dc,
ShapeAttributes activeAttrs)
Indicates whether standard lighting must be applied by consulting either the specified active attributes or the
current active attributes.
|
protected boolean |
mustApplyTexture(DrawContext dc)
Indicates whether texture should be applied to this shape.
|
protected boolean |
mustDrawInterior()
Indicates whether this shape's interior must be drawn.
|
protected boolean |
mustRegenerateGeometry(DrawContext dc)
Indicates whether this shape's renderable geometry must be recomputed, either as a result of an attribute or
property change or the expiration of the geometry regeneration interval.
|
protected void |
prepareToDrawPoints(DrawContext dc) |
protected void |
reset()
Invalidates computed values.
|
protected PickedObject |
resolvePickedPosition(int colorCode,
int positionIndex)
Returns a new PickedObject corresponding to this Path's position point at the specified index.
|
void |
setDrawVerticals(boolean drawVerticals)
Specifies whether to draw vertical lines at each specified path position when this path is extruded.
|
void |
setExtrude(boolean extrude)
Specifies whether to extrude this path.
|
void |
setFollowTerrain(boolean followTerrain)
Specifies whether this path is terrain following.
|
void |
setNumSubsegments(int numSubsegments)
Specifies the number of segments used between specified positions to achieve this path's path type.
|
void |
setPathType(java.lang.String pathType)
Specifies this path's path type.
|
void |
setPositionColors(Path.PositionColors positionColors)
Specifies the position colors used to define an RGBA color for each of this path's positions.
|
void |
setPositions(java.lang.Iterable<? extends Position> positions)
Specifies this path's positions, which replace this path's current positions, if any.
|
void |
setShowPositions(boolean showPositions)
Specifies whether to draw dots at the original positions of the Path.
|
void |
setShowPositionsScale(double showPositionsScale)
Specifies the scale factor controlling the size of dots drawn at this path's specified positions.
|
void |
setShowPositionsThreshold(double showPositionsThreshold)
Specifies the eye distance from this shape's center beyond which position dots are not drawn.
|
void |
setTerrainConformance(double terrainConformance)
Specifies how accurately this path must adhere to the terrain when the path is terrain following.
|
protected boolean |
shouldUseVBOs(DrawContext dc)
Indicates whether this shape should use OpenGL vertex buffer objects.
|
protected void |
updateSurfaceShape()
Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this shape on 2D
globes.
|
beginDrawing, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createPickedObject, doDrag, doGetRestorableState, doRestoreState, drag, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isExportFormatSupported, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawOutline, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, render, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible
onMessage, propertyChange
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected static final double DEFAULT_DRAW_POSITIONS_SCALE
protected static final double DEFAULT_DRAW_POSITIONS_THRESHOLD
protected static final Material DEFAULT_INTERIOR_MATERIAL
protected static final int DEFAULT_NUM_SUBSEGMENTS
protected static final Material DEFAULT_OUTLINE_MATERIAL
protected static final java.lang.String DEFAULT_PATH_TYPE
protected static final double DEFAULT_TERRAIN_CONFORMANCE
protected boolean drawVerticals
protected boolean extrude
protected boolean followTerrain
protected int numPositions
protected int numSubsegments
protected java.lang.String pathType
protected static java.nio.ByteBuffer pickPositionColors
protected Path.PositionColors positionColors
protected java.lang.Iterable<? extends Position> positions
protected boolean positionsSpanDateline
protected boolean showPositions
protected double showPositionsScale
protected double showPositionsThreshold
protected static final double SURFACE_PATH_DEPTH_OFFSET
protected double terrainConformance
public Path()
public Path(java.lang.Iterable<? extends Position> positions)
positions
- the path positions. This reference is retained by this shape; the positions are not copied. If
any positions in the set change, setPositions(Iterable)
must be called to inform this
shape of the change.java.lang.IllegalArgumentException
- if positions is null.public Path(Path source)
public Path(Position.PositionList positions)
positions
- the path positions. This reference is retained by this shape; the positions are not copied. If
any positions in the set change, setPositions(Iterable)
must be called to inform this
shape of the change.java.lang.IllegalArgumentException
- if positions is null.protected void addOrderedRenderable(DrawContext dc)
addOrderedRenderable
in class AbstractShape
dc
- the current draw context.protected void addPickablePositions(DrawContext dc, PickSupport pickCandidates)
dc
- the current draw context.pickCandidates
- the PickSupport to register with. Must be an instance of PathPickSupport.protected void addTessellatedPosition(Position pos, java.awt.Color color, java.lang.Integer ordinal, Path.PathData pathData)
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.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.protected void appendTerrainPoint(DrawContext dc, Position position, float[] color, java.nio.FloatBuffer path, Path.PathData pathData)
dc
- the current draw context.position
- the path position.color
- an array of length 4 containing the position's corresponding color as RGBA values in the range
[0, 1], or null
if the position has no associated color.path
- the path to append to. Assumes that the path has adequate capacity.pathData
- the current globe-specific path data.protected java.nio.FloatBuffer computeAbsolutePoints(DrawContext dc, java.util.List<Position> positions, java.nio.FloatBuffer path, Path.PathData pathData)
dc
- the current draw context.positions
- the positions to create a path for.path
- a buffer in which to store the computed points. May be null. The buffer is not used if it is
null or tool small for the required number of points. A new buffer is created in that case and
returned by this method. This method modifies the buffer,s position and limit fields.pathData
- the current globe-specific path data.protected Extent computeExtent(Path.PathData current)
current
- the current data for this shape.protected double computeEyeDistance(DrawContext dc, Path.PathData pathData)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the draw context.pathData
- the current shape data for this shape.protected void computePath(DrawContext dc, java.util.List<Position> positions, Path.PathData pathData)
dc
- the current draw context.positions
- the positions to create a path for.pathData
- the current globe-specific path data.protected java.nio.FloatBuffer computePointsRelativeToTerrain(DrawContext dc, java.util.List<Position> positions, java.lang.Double altitude, java.nio.FloatBuffer path, Path.PathData pathData)
dc
- the current draw context.positions
- the positions to create a path for.altitude
- if non-null, the height above the terrain to use for all positions. If null, each position's
altitude is used as the height above the terrain.path
- a buffer in which to store the computed points. May be null. The buffer is not used if it is
null or tool small for the required number of points. A new buffer is created in that case and
returned by this method. This method modifies the buffer,s position and limit fields.pathData
- the current globe-specific path data.protected void computePositionCount()
protected Vec4 computeReferenceCenter(DrawContext dc)
dc
- the current draw context.protected double computeSegmentLength(DrawContext dc, Position posA, Position posB)
dc
- the current draw context.posA
- the first position.posB
- the second position.protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
AbstractShape
createCacheEntry
in class AbstractShape
dc
- the current draw context.protected SurfaceShape createSurfaceShape()
AbstractShape
SurfaceShape
that corresponds to this Path and is used for drawing on 2D globes.createSurfaceShape
in class AbstractShape
protected void determineActiveAttributes()
AbstractShape
determineActiveAttributes
in class AbstractShape
AbstractShape.getActiveAttributes()
protected void doDrawInterior(DrawContext dc)
doDrawInterior
in class AbstractShape
dc
- the current draw context.protected void doDrawInteriorVA(DrawContext dc, Path.PathData pathData)
protected void doDrawInteriorVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates)
PickSupport
. The PickSupport
may not be the one associated with this instance. During batch
picking the PickSupport
of the instance initiating the batch picking is used so that all shapes
rendered in batch are added to the same pick list.
A AbstractShape.AbstractShapeData
must be current when this method is called.
Overridden to add this Path's pickable positions to the pick candidates.doDrawOrderedRenderable
in class AbstractShape
dc
- the current draw context.pickCandidates
- a pick support holding the picked object list to add this shape to.protected void doDrawOutline(DrawContext dc)
AbstractShape.prepareToDrawOutline(DrawContext,
ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and line
attributes. Subclasses should execute the drawing commands specific to the type of shape.
A AbstractShape.AbstractShapeData
must be current when this method is called.
If this Path is entirely located on the terrain, this applies an offset to the Path's depth values to to ensure
it shows over the terrain. This does not apply a depth offset in any other case to avoid incorrectly drawing the
path over objects it should be behind, including the terrain. In addition to applying a depth offset, this
disables writing to the depth buffer to avoid causing subsequently drawn ordered renderables to incorrectly fail
the depth test. Since this Path is located on the terrain, the terrain already provides the necessary depth
values and we can be certain that other ordered renderables should appear on top of it.doDrawOutline
in class AbstractShape
dc
- the current draw context.protected void doDrawOutlineVA(DrawContext dc, Path.PathData pathData)
protected void doDrawOutlineVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
protected void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
doExportAsKML
in class AbstractShape
xmlWriter
- the export writer to write to.java.io.IOException
- if an IO error occurs while writing to the output destination.javax.xml.stream.XMLStreamException
- if an exception occurs converting this shape's fields to XML.protected boolean doMakeOrderedRenderable(DrawContext dc)
AbstractShape
AbstractShape.pick(DrawContext, java.awt.Point)
and AbstractShape.render(DrawContext)
when it's been determined that the shape is
likely to be visible.doMakeOrderedRenderable
in class AbstractShape
dc
- the current draw context.AbstractShape.pick(DrawContext, java.awt.Point)
,
AbstractShape.render(DrawContext)
protected void drawPointsVA(DrawContext dc, Path.PathData pathData)
dc
- the current draw context.pathData
- the current globe-specific path data.protected void drawPointsVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
dc
- the current draw context.vboIds
- the ids of this shapes buffers.pathData
- the current globe-specific path data.protected void drawVerticalOutlineVA(DrawContext dc, Path.PathData pathData)
dc
- the current draw context.pathData
- the current globe-specific path data.protected void drawVerticalOutlineVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
protected void fillVBO(DrawContext dc)
AbstractShape
AbstractShape.AbstractShapeData
must be current when this method is called.fillVBO
in class AbstractShape
dc
- the current draw context.protected java.awt.Color getColor(Position pos, java.lang.Integer ordinal)
null
if this path's positionColors property is null
. This returns white if a color cannot be determined
for the specified position and ordinal.pos
- the path position the color corresponds to.ordinal
- the ordinal number of the specified position.null
if this path's
positionColors property is null
.protected Path.PathData getCurrentPathData()
protected double getDistanceMetric(DrawContext dc, Path.PathData pathData)
dc
- the current draw context.pathData
- this path's current shape data.public Extent getExtent(Globe globe, double verticalExaggeration)
ExtentHolder
Extent
in model coordinates, given a
specified Globe
and vertical exaggeration (see SceneController.getVerticalExaggeration()
.getExtent
in interface ExtentHolder
getExtent
in class AbstractShape
globe
- the Globe the object is related to.verticalExaggeration
- the vertical exaggeration of the scene containing this object.public int getNumSubsegments()
AVKey.LINEAR
.setNumSubsegments(int)
protected java.lang.Integer getOrdinal(int positionIndex)
positionIndex
- the position's index.public java.lang.String getPathType()
setPathType(String)
protected Position getPosition(int positionIndex)
positionIndex
- the position's index.public Path.PositionColors getPositionColors()
null
is valid and indicates that this path's positions are colored according to its
ShapeAttributes.null
if this path is colored according to its
ShapeAttributes.setPositionColors(gov.nasa.worldwind.render.Path.PositionColors)
public java.lang.Iterable<? extends Position> getPositions()
public Position getReferencePosition()
public Sector getSector()
GeographicExtent
public double getShowPositionsScale()
ShapeAttributes
to determine the actual size of the
dots, in pixels. See ShapeAttributes.setOutlineWidth(double)
.public double getShowPositionsThreshold()
public double getTerrainConformance()
setTerrainConformance(double)
protected void initialize()
initialize
in class AbstractShape
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
AbstractShape
WorldWind.ABSOLUTE
, the shape's geometry is created relative to the specified terrain rather than the terrain
used during rendering, which may be at lower level of detail than required for accurate intersection
determination.intersect
in class AbstractShape
line
- the line to intersect.terrain
- the Terrain
to use when computing the shape's geometry.java.lang.InterruptedException
- if the operation is interrupted.Terrain
public boolean isDrawVerticals()
setDrawVerticals(boolean)
public boolean isExtrude()
setExtrude(boolean)
public boolean isFollowTerrain()
setFollowTerrain(boolean)
protected boolean isOrderedRenderableValid(DrawContext dc)
AbstractShape
AbstractShape.makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.isOrderedRenderableValid
in class AbstractShape
dc
- the current draw context.protected boolean isSegmentVisible(DrawContext dc, Position posA, Position posB, Vec4 ptA, Vec4 ptB)
dc
- the current draw context.posA
- the segment's first position.posB
- the segment's second position.ptA
- the model-coordinate point corresponding to the segment's first position.ptB
- the model-coordinate point corresponding to the segment's second position.public boolean isShowPositions()
protected boolean isSmall(DrawContext dc, Vec4 ptA, Vec4 ptB, int numPixels)
protected boolean isSurfacePath(DrawContext dc)
true
if this Path's altitude mode is WorldWind.CLAMP_TO_GROUND
and the follow-terrain property is true
. Otherwise this returns false
.true
if this Path's positions and the positions in between are located on the underlying
terrain, and false
otherwise.protected void makePath2DIndices(Path.PathData pathData)
protected void makePositions(DrawContext dc, Path.PathData pathData)
protected void makeSegment(DrawContext dc, Position posA, Position posB, Vec4 ptA, Vec4 ptB, java.awt.Color colorA, java.awt.Color colorB, int ordinalA, int ordinalB, Path.PathData pathData)
dc
- the current draw context.posA
- the segment's first position.posB
- the segment's second position.ptA
- the model-coordinate point corresponding to the segment's first position.ptB
- the model-coordinate point corresponding to the segment's second position.colorA
- the color corresponding to the segment's first position, or null
if the first
position has no associated color.colorB
- the color corresponding to the segment's second position, or null
if the first
position has no associated color.ordinalA
- the ordinal number corresponding to the segment's first position in the original position list.ordinalB
- the ordinal number corresponding to the segment's second position in the original position list.pathData
- the current globe-specific path data.protected void makeTessellatedPositions(DrawContext dc, Path.PathData pathData)
tessellatedPositions
and polePositions
fields.pathData
- the current globe-specific path data.dc
- the current draw context.public void move(Position delta)
Movable
move
in interface Movable
move
in class AbstractShape
delta
- the latitude and longitude to add to the shape's reference position.public void moveTo(Globe globe, Position position)
Movable2
moveTo
in interface Movable2
moveTo
in class AbstractShape
globe
- the globe on which to move the shape.position
- the new position of the shape's reference position.public void moveTo(Position position)
Movable
position
- the new position of the shape's reference position.protected boolean mustApplyLighting(DrawContext dc, ShapeAttributes activeAttrs)
AbstractShape
mustApplyLighting
in class AbstractShape
dc
- the current draw contextactiveAttrs
- the attribute bundle to consider when determining whether lighting is applied. May be null, in
which case the current active attributes are used.protected boolean mustApplyTexture(DrawContext dc)
AbstractShape
mustApplyTexture
in class AbstractShape
dc
- the current draw contextprotected boolean mustDrawInterior()
AbstractShape
mustDrawInterior
in class AbstractShape
protected boolean mustRegenerateGeometry(DrawContext dc)
AbstractShape
AbstractShape.AbstractShapeData
must be current when this method is called.mustRegenerateGeometry
in class AbstractShape
dc
- the current draw context.protected void prepareToDrawPoints(DrawContext dc)
protected void reset()
AbstractShape
reset
in class AbstractShape
protected PickedObject resolvePickedPosition(int colorCode, int positionIndex)
colorCode
- the color code corresponding to the picked position point.positionIndex
- the position point's index.public void setDrawVerticals(boolean drawVerticals)
drawVerticals
- true to draw the lines, otherwise false. The default value is true.public void setExtrude(boolean extrude)
extrude
- true to extrude this path, otherwise false. The default value is false.public void setFollowTerrain(boolean followTerrain)
followTerrain
- true if terrain following, otherwise false. The default value is false.public void setNumSubsegments(int numSubsegments)
AVKey.LINEAR
.numSubsegments
- the number of sub-segments. The default is 10.public void setPathType(java.lang.String pathType)
AVKey.GREAT_CIRCLE
, AVKey.RHUMB_LINE
and
AVKey.LINEAR
.pathType
- the current path type. The default value is AVKey.LINEAR
.public void setPositionColors(Path.PositionColors positionColors)
null
, the specified positionColors
is called during rendering to define a color at
each of this path's positions specified during construction or in a call to setPositions(Iterable)
. The
returned colors are applied to this path's line and the optional dots drawn at each position when
showPositions
is true, and override the ShapeAttributes' outline color and outline opacity for both
normal display and highlighted display. The specified positionColors
do not affect this path's
filled interior or vertical drop lines displayed when this path is extruded.
If this path is configured to tessellate itself by creating additional positions between the originally specified
positions, an interpolated color is assigned to each tessellated position by computing a weighted linear
combination of the colors at the originally specified positions.
Specify null
to disable position colors and draw this path's line and optional position dots
according to its ShapeAttributes. This path's position colors reference is null
by default.positionColors
- the PositionColors that defines an RGBA color for each of this path's positions, or
null
to color this path's positions according to its ShapeAttributes.getPositionColors()
,
Path.PositionColors
public void setPositions(java.lang.Iterable<? extends Position> positions)
positions
- this path's positions.java.lang.IllegalArgumentException
- if positions is null.public void setShowPositions(boolean showPositions)
showPositions
- true if dots are drawn at each original (not tessellated) position, otherwise false.public void setShowPositionsScale(double showPositionsScale)
ShapeAttributes
to determine the actual size of the
dots, in pixels. See ShapeAttributes.setOutlineWidth(double)
.showPositionsScale
- the new draw-position scale.public void setShowPositionsThreshold(double showPositionsThreshold)
showPositionsThreshold
- the eye distance at which to enable or disable position dot drawing.public void setTerrainConformance(double terrainConformance)
terrainConformance
- the number of pixels between tessellation points.protected boolean shouldUseVBOs(DrawContext dc)
AbstractShape
shouldUseVBOs
in class AbstractShape
dc
- the current draw context.protected void updateSurfaceShape()
AbstractShape
updateSurfaceShape
in class AbstractShape