Class Path
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwind.render.Path
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,ExtentHolder
,Movable
,Movable2
,Attributable
,GeographicExtent
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
DirectedPath
,KMLLineStringPlacemarkImpl
public class Path extends AbstractShape
Displays a line or curve between positions. The path is drawn between input positions to achieve a specified path type, e.g.,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 isWorldWind.RELATIVE_TO_GROUND
, the altitudes are added to the elevation of the terrain at the position. If the altitude mode isWorldWind.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
orAVKey.LINEAR
. (SeesetPathType(String)
.)Paths have separate attributes for normal display and highlighted display. If no attributes are specified, default attributes are used. See
DEFAULT_PATH_INTERIOR_MATERIAL
,DEFAULT_PATH_OUTLINE_MATERIAL
, andAbstractShape.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
orRHUMB_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. SeesetFollowTerrain(boolean)
andsetTerrainConformance(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 (seesetNumSubsegments(int)
). The latter case may produce higher performance than the former.The path positions may be shown by calling
setShowPositions(boolean)
with an argument oftrue
. 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 viasetShowPositionsScale(double)
. The dots are drawn only when the Path is within a threshold distance from the eye point. The threshold may be specified by callingsetShowPositionsThreshold(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
(seesetPositionColors(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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
-
-
Field Summary
Fields Modifier and Type Field 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 int
DEFAULT_NUM_SUBSEGMENTS
The default number of tessellation points between the specified path positions.protected static Material
DEFAULT_PATH_INTERIOR_MATERIAL
The default interior color.protected static Material
DEFAULT_PATH_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 LengthMeasurer
measurer
protected int
numPositions
protected int
numSubsegments
protected double
offset
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
-
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_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
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description Path()
Creates a path with no positions.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.Path(Path source)
Path(java.lang.Iterable<? extends LatLon> coords, double elevation)
Creates a path with specified coordinates.Path(java.lang.Iterable<? extends Position> positions)
Creates a path with specified positions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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'stessellatedPositions
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 aSurfaceShape
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 anExtent
in model coordinates, given a specifiedGlobe
and vertical exaggeration (seeSceneController.getVerticalExaggeration()
.double
getLength()
Returns the length of the line as drawn.double
getLength(Globe globe)
LengthMeasurer
getMeasurer()
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)
boolean
isSurfacePath()
Indicates whether this Path's defining positions and the positions in between are located on the underlying terrain.protected boolean
isSurfacePath(DrawContext dc)
Indicates whether this Path's defining positions and the positions in between are located on the underlying terrain.void
makeClosed()
Convenience method for migration from Polyline.setClosed.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(Position position)
Move 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.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
setOffset(double offset)
Specifies an offset, in meters, to add to the path points when the path's altitude mode isWorldWind.CLAMP_TO_GROUND
.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
setSurfacePath(boolean surfacePath)
Sets whether this Path's defining positions and the positions in between are located on the underlying terrain.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.-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
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
-
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, 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
-
DEFAULT_PATH_INTERIOR_MATERIAL
protected static final Material DEFAULT_PATH_INTERIOR_MATERIAL
The default interior color.
-
DEFAULT_PATH_OUTLINE_MATERIAL
protected static final Material DEFAULT_PATH_OUTLINE_MATERIAL
The default outline color.
-
DEFAULT_PATH_TYPE
protected static final java.lang.String DEFAULT_PATH_TYPE
The default path type.- See Also:
- Constant Field Values
-
SURFACE_PATH_DEPTH_OFFSET
protected static final 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. Values less than 1.0 pull the path in front of the terrain, values greater than 1.0 push the path behind the terrain.- See Also:
- Constant Field Values
-
DEFAULT_NUM_SUBSEGMENTS
protected static final int DEFAULT_NUM_SUBSEGMENTS
The default number of tessellation points between the specified path positions.- See Also:
- Constant Field Values
-
DEFAULT_TERRAIN_CONFORMANCE
protected static final double DEFAULT_TERRAIN_CONFORMANCE
The default terrain conformance target.- See Also:
- Constant Field Values
-
DEFAULT_DRAW_POSITIONS_THRESHOLD
protected static final double DEFAULT_DRAW_POSITIONS_THRESHOLD
The default distance from the eye beyond which positions dots are not drawn.- See Also:
- Constant Field Values
-
DEFAULT_DRAW_POSITIONS_SCALE
protected static final double DEFAULT_DRAW_POSITIONS_SCALE
The default scale for position dots. The scale is applied to the current outline width to produce the dot size.- See Also:
- Constant Field Values
-
positions
protected java.lang.Iterable<? extends Position> positions
-
numPositions
protected int numPositions
-
positionColors
protected Path.PositionColors positionColors
-
pickPositionColors
protected static java.nio.ByteBuffer pickPositionColors
-
pathType
protected java.lang.String pathType
-
followTerrain
protected boolean followTerrain
-
offset
protected double offset
-
extrude
protected boolean extrude
-
terrainConformance
protected double terrainConformance
-
numSubsegments
protected int numSubsegments
-
drawVerticals
protected boolean drawVerticals
-
showPositions
protected boolean showPositions
-
showPositionsThreshold
protected double showPositionsThreshold
-
showPositionsScale
protected double showPositionsScale
-
positionsSpanDateline
protected boolean positionsSpanDateline
-
measurer
protected LengthMeasurer measurer
-
-
Constructor Detail
-
Path
public Path()
Creates a path with no positions.
-
Path
public Path(Path source)
-
Path
public Path(java.lang.Iterable<? extends Position> positions)
Creates a path with specified positions.Note: If fewer than two positions is 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,setPositions(Iterable)
must be called to inform this shape of the change.- Throws:
java.lang.IllegalArgumentException
- if positions is null.
-
Path
public Path(java.lang.Iterable<? extends LatLon> coords, double elevation)
Creates a path with specified coordinates.Note: If fewer than two coordinates is specified, no path is drawn.
- Parameters:
coords
- the path coordinates. 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.elevation
- the elevation to use for the coordinates.- Throws:
java.lang.IllegalArgumentException
- if positions is null.
-
Path
public Path(Position.PositionList positions)
Creates a path with positions specified via a generic list.Note: If fewer than two positions is specified, the path is not 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,setPositions(Iterable)
must be called to inform this shape of the change.- Throws:
java.lang.IllegalArgumentException
- if positions is null.
-
-
Method Detail
-
createSurfaceShape
protected SurfaceShape createSurfaceShape()
Description copied from class:AbstractShape
Returns aSurfaceShape
that corresponds to this Path and is used for drawing on 2D globes.- Overrides:
createSurfaceShape
in classAbstractShape
- Returns:
- The surface shape to represent this Path on a 2D globe.
-
updateSurfaceShape
protected void updateSurfaceShape()
Description copied from class:AbstractShape
Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this shape on 2D globes. Subclasses should override this method if they need to update more than the highlighted state, visibility state and delegate owner.- Overrides:
updateSurfaceShape
in classAbstractShape
-
createCacheEntry
protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
Description copied from class:AbstractShape
Creates and returns a new cache entry specific to the subclass.- Specified by:
createCacheEntry
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- a data cache entry for the state in the specified draw context.
-
getCurrentPathData
protected Path.PathData getCurrentPathData()
-
initialize
protected void initialize()
Called during construction to establish any subclass-specific state such as different default values than those set by this class.Overridden to assign this Path's pickSupport property to a new PathPickSupport instance.
- Specified by:
initialize
in classAbstractShape
-
reset
protected void reset()
Description copied from class:AbstractShape
Invalidates computed values. Called when this shape's contents or certain attributes change.- Overrides:
reset
in classAbstractShape
-
getPositions
public java.lang.Iterable<? extends Position> getPositions()
Returns this path's positions.- Returns:
- this path's positions. Will be null if no positions have been specified.
-
setPositions
public void setPositions(java.lang.Iterable<? extends Position> positions)
Specifies this path's positions, which replace this path's current positions, if any.Note: If fewer than two positions is specified, this path is not drawn.
- Parameters:
positions
- this path's positions.- Throws:
java.lang.IllegalArgumentException
- if positions is null.
-
makeClosed
public void makeClosed()
Convenience method for migration from Polyline.setClosed. Simply appends a copy of the starting Position to the end of the position list.
-
getPositionColors
public Path.PositionColors getPositionColors()
Indicates the PositionColors that defines the RGBA color for each of this path's positions. A return value ofnull
is valid and indicates that this path's positions are colored according to its ShapeAttributes.- Returns:
- this Path's PositionColors, or
null
if this path is colored according to its ShapeAttributes. - See Also:
setPositionColors(gov.nasa.worldwind.render.Path.PositionColors)
-
setPositionColors
public void setPositionColors(Path.PositionColors positionColors)
Specifies the position colors used to define an RGBA color for each of this path's positions. When non-null
, the specifiedpositionColors
is called during rendering to define a color at each of this path's positions specified during construction or in a call tosetPositions(Iterable)
. The returned colors are applied to this path's line and the optional dots drawn at each position whenshowPositions
is true, and override the ShapeAttributes' outline color and outline opacity for both normal display and highlighted display. The specifiedpositionColors
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 isnull
by default.- Parameters:
positionColors
- the PositionColors that defines an RGBA color for each of this path's positions, ornull
to color this path's positions according to its ShapeAttributes.- See Also:
getPositionColors()
,Path.PositionColors
-
isExtrude
public boolean isExtrude()
Indicates whether to extrude this path. Extruding the path extends a filled interior from the path to the terrain.- Returns:
- true to extrude this path, otherwise false.
- See Also:
setExtrude(boolean)
-
setExtrude
public void setExtrude(boolean extrude)
Specifies whether to extrude this path. Extruding the path extends a filled interior from the path to the terrain.- Parameters:
extrude
- true to extrude this path, otherwise false. The default value is false.
-
isFollowTerrain
public boolean isFollowTerrain()
Indicates whether this path is terrain following.- Returns:
- true if terrain following, otherwise false.
- See Also:
setFollowTerrain(boolean)
-
setFollowTerrain
public void setFollowTerrain(boolean followTerrain)
Specifies whether this path is terrain following.- Parameters:
followTerrain
- true if terrain following, otherwise false. The default value is false.
-
getNumSubsegments
public int getNumSubsegments()
Indicates the number of segments used between specified positions to achieve this path's path type. Higher values cause the path to conform more closely to the path type but decrease performance.Note: The sub-segments number is ignored when the path follows terrain or when the path type is
AVKey.LINEAR
.- Returns:
- the number of sub-segments.
- See Also:
setNumSubsegments(int)
-
setNumSubsegments
public void setNumSubsegments(int numSubsegments)
Specifies the number of segments used between specified positions to achieve this path's path type. Higher values cause the path to conform more closely to the path type but decrease performance.Note: The sub-segments number is ignored when the path follows terrain or when the path type is
AVKey.LINEAR
.- Parameters:
numSubsegments
- the number of sub-segments. The default is 10.
-
getLength
public double getLength()
Returns the length of the line as drawn. If the path follows the terrain, the length returned is the distance one would travel if on the surface. If the path does not follow the terrain, the length returned is the distance along the full length of the path at the path's elevations and current path type.- Returns:
- the path's length in meters.
-
getLength
public double getLength(Globe globe)
-
getMeasurer
public LengthMeasurer getMeasurer()
-
getTerrainConformance
public double getTerrainConformance()
Indicates the terrain conformance target when this path follows the terrain. The value indicates the maximum number of pixels between which intermediate positions of a path segment -- the path portion between two specified positions -- are computed.- Returns:
- the terrain conformance, in pixels.
- See Also:
setTerrainConformance(double)
-
setTerrainConformance
public void setTerrainConformance(double terrainConformance)
Specifies how accurately this path must adhere to the terrain when the path is terrain following. The value specifies the maximum number of pixels between tessellation points. Lower values increase accuracy but decrease performance.- Parameters:
terrainConformance
- the number of pixels between tessellation points.
-
getPathType
public java.lang.String getPathType()
Indicates this paths path type.- Returns:
- the path type.
- See Also:
setPathType(String)
-
setPathType
public void setPathType(java.lang.String pathType)
Specifies this path's path type. Recognized values areAVKey.GREAT_CIRCLE
,AVKey.RHUMB_LINE
andAVKey.LINEAR
.- Parameters:
pathType
- the current path type. The default value isAVKey.LINEAR
.- See Also:
- Path Types
-
isDrawVerticals
public boolean isDrawVerticals()
Indicates whether to draw at each specified path position when this path is extruded.- Returns:
- true to draw the lines, otherwise false.
- See Also:
setDrawVerticals(boolean)
-
setDrawVerticals
public void setDrawVerticals(boolean drawVerticals)
Specifies whether to draw vertical lines at each specified path position when this path is extruded.- Parameters:
drawVerticals
- true to draw the lines, otherwise false. The default value is true.
-
isShowPositions
public boolean isShowPositions()
Indicates whether dots are drawn at the Path's original positions.- Returns:
- true if dots are drawn, otherwise false.
-
setShowPositions
public void setShowPositions(boolean showPositions)
Specifies whether to draw dots at the original positions of the Path. The dot color and size are controlled by the Path's outline material and scale attributes.- Parameters:
showPositions
- true if dots are drawn at each original (not tessellated) position, otherwise false.
-
getShowPositionsScale
public double getShowPositionsScale()
Indicates the scale factor controlling the size of dots drawn at this path's specified positions. The scale is multiplied by the outline width given in this path'sShapeAttributes
to determine the actual size of the dots, in pixels. SeeShapeAttributes.setOutlineWidth(double)
.- Returns:
- the shape's draw-position scale. The default scale is 10.
-
setShowPositionsScale
public void setShowPositionsScale(double showPositionsScale)
Specifies the scale factor controlling the size of dots drawn at this path's specified positions. The scale is multiplied by the outline width given in this path'sShapeAttributes
to determine the actual size of the dots, in pixels. SeeShapeAttributes.setOutlineWidth(double)
.- Parameters:
showPositionsScale
- the new draw-position scale.
-
getShowPositionsThreshold
public double getShowPositionsThreshold()
Indicates the eye distance from this shape's center beyond which position dots are not drawn.- Returns:
- the eye distance at which to enable or disable position dot drawing. The default is 1e6 meters, which typically causes the dots to always be drawn.
-
setShowPositionsThreshold
public void setShowPositionsThreshold(double showPositionsThreshold)
Specifies the eye distance from this shape's center beyond which position dots are not drawn.- Parameters:
showPositionsThreshold
- the eye distance at which to enable or disable position dot drawing.
-
getSector
public Sector getSector()
Description copied from interface:GeographicExtent
Returns the object's geographic extent.- Returns:
- the object's geographic extent.
-
mustDrawInterior
protected boolean mustDrawInterior()
Description copied from class:AbstractShape
Indicates whether this shape's interior must be drawn.- Overrides:
mustDrawInterior
in classAbstractShape
- Returns:
- true if an interior must be drawn, otherwise false.
-
mustApplyLighting
protected boolean mustApplyLighting(DrawContext dc, ShapeAttributes activeAttrs)
Description copied from class:AbstractShape
Indicates whether standard lighting must be applied by consulting either the specified active attributes or the current active attributes.- Overrides:
mustApplyLighting
in classAbstractShape
- Parameters:
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.- Returns:
- true if lighting must be applied, otherwise false.
-
mustApplyTexture
protected boolean mustApplyTexture(DrawContext dc)
Description copied from class:AbstractShape
Indicates whether texture should be applied to this shape. Called during rendering to determine whether texture state should be established during preparation for interior drawing.Note: This method always returns false during the pick pass.
- Specified by:
mustApplyTexture
in classAbstractShape
- Parameters:
dc
- the current draw context- Returns:
- true if texture should be applied, otherwise false.
-
mustRegenerateGeometry
protected boolean mustRegenerateGeometry(DrawContext dc)
Description copied from class:AbstractShape
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.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Overrides:
mustRegenerateGeometry
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape's geometry must be regenerated, otherwise false.
-
shouldUseVBOs
protected boolean shouldUseVBOs(DrawContext dc)
Description copied from class:AbstractShape
Indicates whether this shape should use OpenGL vertex buffer objects.- Overrides:
shouldUseVBOs
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape should use vertex buffer objects, otherwise false.
-
isSurfacePath
protected boolean isSurfacePath(DrawContext dc)
Indicates whether this Path's defining positions and the positions in between are located on the underlying terrain. This returnstrue
if this Path's altitude mode isWorldWind.CLAMP_TO_GROUND
and the follow-terrain property istrue
. Otherwise this returnsfalse
.- Parameters:
dc
- The current draw context.- Returns:
true
if this Path's positions and the positions in between are located on the underlying terrain, andfalse
otherwise.
-
isSurfacePath
public boolean isSurfacePath()
Indicates whether this Path's defining positions and the positions in between are located on the underlying terrain. This returnstrue
if this Path's altitude mode isWorldWind.CLAMP_TO_GROUND
and the follow-terrain property istrue
. Otherwise this returnsfalse
.- Returns:
true
if this Path's positions and the positions in between are located on the underlying terrain, andfalse
otherwise.
-
setSurfacePath
public void setSurfacePath(boolean surfacePath)
Sets whether this Path's defining positions and the positions in between are located on the underlying terrain. If the surfacePath parameter is true this Path's altitude mode is set toWorldWind.CLAMP_TO_GROUND
and the follow terrain property is set totrue
. If the surfacePath parameter is false this Path's altitude mode and follow terrain property are returned to their defaults.- Parameters:
surfacePath
- whether or not this Path should be located on the underlying terrain.
-
determineActiveAttributes
protected void determineActiveAttributes()
Description copied from class:AbstractShape
Determines which attributes -- normal, highlight or default -- to use each frame. Places the result in this shape's current active attributes.- Overrides:
determineActiveAttributes
in classAbstractShape
- See Also:
AbstractShape.getActiveAttributes()
-
computePositionCount
protected void computePositionCount()
Counts the number of positions in this path's specified positions.
-
doMakeOrderedRenderable
protected boolean doMakeOrderedRenderable(DrawContext dc)
Description copied from class:AbstractShape
Produces the geometry and other state necessary to represent this shape as an ordered renderable. Places this shape on the draw context's ordered renderable list for subsequent rendering. This method is called duringAbstractShape.pick(DrawContext, java.awt.Point)
andAbstractShape.render(DrawContext)
when it's been determined that the shape is likely to be visible.- Specified by:
doMakeOrderedRenderable
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if the ordered renderable state was successfully computed, otherwise false, in which case the current pick or render pass is terminated for this shape. Subclasses should return false if it is not possible to create the ordered renderable state.
- See Also:
AbstractShape.pick(DrawContext, java.awt.Point)
,AbstractShape.render(DrawContext)
-
doDrawOrderedRenderable
protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates)
Draw this shape as an ordered renderable. If in picking mode, add it to the picked object list of specifiedPickSupport
. ThePickSupport
may not be the one associated with this instance. During batch picking thePickSupport
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.
- Overrides:
doDrawOrderedRenderable
in classAbstractShape
- Parameters:
dc
- the current draw context.pickCandidates
- a pick support holding the picked object list to add this shape to.
-
addOrderedRenderable
protected void addOrderedRenderable(DrawContext dc)
Adds this shape to the draw context's ordered renderable list.Overridden to place this Path behind other ordered renderables when this Path is entirely located on the underlying terrain. In this case this Path must be drawn first to ensure that other ordered renderables are correctly drawn on top of it and are not affected by this Path's depth offset. If two paths are both located on the terrain, they are drawn with respect to their layer ordering.
- Overrides:
addOrderedRenderable
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
isOrderedRenderableValid
protected boolean isOrderedRenderableValid(DrawContext dc)
Description copied from class:AbstractShape
Determines whether this shape's ordered renderable state is valid and can be rendered. Called byAbstractShape.makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.- Specified by:
isOrderedRenderableValid
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape is ready to be rendered as an ordered renderable.
-
doDrawOutline
protected void doDrawOutline(DrawContext dc)
Draws this shape's outline. Called immediately after callingAbstractShape.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.
- Specified by:
doDrawOutline
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doDrawOutlineVBO
protected void doDrawOutlineVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
-
doDrawOutlineVA
protected void doDrawOutlineVA(DrawContext dc, Path.PathData pathData)
-
drawVerticalOutlineVBO
protected void drawVerticalOutlineVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
-
drawVerticalOutlineVA
protected void drawVerticalOutlineVA(DrawContext dc, Path.PathData pathData)
Draws vertical lines at this path's specified positions.- Parameters:
dc
- the current draw context.pathData
- the current globe-specific path data.
-
drawPointsVA
protected void drawPointsVA(DrawContext dc, Path.PathData pathData)
Draws vertical lines at this path's specified positions.- Parameters:
dc
- the current draw context.pathData
- the current globe-specific path data.
-
drawPointsVBO
protected void drawPointsVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
Draws points at this path's specified positions.Note: when the draw context is in picking mode, this binds the current GL_ARRAY_BUFFER to 0 after using the currently bound GL_ARRAY_BUFFER to specify the vertex pointer. This does not restore GL_ARRAY_BUFFER to the its previous state. If the caller intends to use that buffer after this method returns, the caller must bind the buffer again.
- Parameters:
dc
- the current draw context.vboIds
- the ids of this shapes buffers.pathData
- the current globe-specific path data.
-
prepareToDrawPoints
protected void prepareToDrawPoints(DrawContext dc)
-
doDrawInterior
protected void doDrawInterior(DrawContext dc)
Draws this path's interior when the path is extruded.- Specified by:
doDrawInterior
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doDrawInteriorVBO
protected void doDrawInteriorVBO(DrawContext dc, int[] vboIds, Path.PathData pathData)
-
doDrawInteriorVA
protected void doDrawInteriorVA(DrawContext dc, Path.PathData pathData)
-
computePath
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. Applies the path's terrain-conformance settings. Adds extrusion points -- those on the ground -- when the path is extruded.- Parameters:
dc
- the current draw context.positions
- the positions to create a path for.pathData
- the current globe-specific path data.
-
computePointsRelativeToTerrain
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. Adds extrusion points -- those on the ground -- when the path is extruded and the specified single altitude is not 0.- Parameters:
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.- Returns:
- the buffer in which to place the computed points.
-
computeAbsolutePoints
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. Adds extrusion points -- those on the ground -- when the path is extruded and the specified single altitude is not 0.- Parameters:
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.- Returns:
- the buffer in which to place the computed points.
-
appendTerrainPoint
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. Used to generate extrusion vertices.- Parameters:
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], ornull
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.
-
addPickablePositions
protected void addPickablePositions(DrawContext dc, PickSupport pickCandidates)
Registers this Path's pickable position color codes with the specified pickCandidates. The pickCandidates must be an instance of PathPickSupport. This does nothing if this Path's position points are not drawn.- Parameters:
dc
- the current draw context.pickCandidates
- the PickSupport to register with. Must be an instance of PathPickSupport.
-
resolvePickedPosition
protected PickedObject resolvePickedPosition(int colorCode, int positionIndex)
Returns a new PickedObject corresponding to this Path's position point at the specified index. The returned PickedObject's AVList contains the picked position's geographic position in the key AVKey.POSITION and its ordinal number in the key AVKey.ORDINAL.- Parameters:
colorCode
- the color code corresponding to the picked position point.positionIndex
- the position point's index.- Returns:
- a PickedObject corresponding to the position point at the specified index.
-
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'stessellatedPositions
andpolePositions
fields.- Parameters:
pathData
- the current globe-specific path data.dc
- the current draw context.
-
getDistanceMetric
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. The value returned is only an approximation because the eye distance varies along the path.- Parameters:
dc
- the current draw context.pathData
- this path's current shape data.- Returns:
- the distance of the shape from the eye point. If the eye distance cannot be computed, the eye position's elevation is returned instead.
-
makePositions
protected void makePositions(DrawContext dc, Path.PathData pathData)
-
addTessellatedPosition
protected void addTessellatedPosition(Position pos, java.awt.Color color, java.lang.Integer ordinal, Path.PathData pathData)
Adds a position to this path'stessellatedPositions
list. If the specified color is notnull
, this adds the color to this path'stessellatedColors
list. If the specified ordinal is notnull
, this adds the position's index to thepolePositions
andpositionPoints
index buffers.- Parameters:
pos
- the position to add.color
- the color corresponding to the position. May benull
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 benull
to indicate that the position is not one of the originally specified positions.pathData
- the current globe-specific path data.
-
makePath2DIndices
protected void makePath2DIndices(Path.PathData pathData)
-
getPosition
protected Position getPosition(int positionIndex)
Returns the Path position corresponding index. This returns null if the index does not correspond to an original position.- Parameters:
positionIndex
- the position's index.- Returns:
- the Position corresponding to the specified index.
-
getOrdinal
protected java.lang.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.- Parameters:
positionIndex
- the position's index.- Returns:
- the ordinal number corresponding to the specified position index.
-
getColor
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. This returnsnull
if this path's positionColors property isnull
. This returns white if a color cannot be determined for the specified position and ordinal.- Parameters:
pos
- the path position the color corresponds to.ordinal
- the ordinal number of the specified position.- Returns:
- an RGBA color corresponding to the position and ordinal, or
null
if this path's positionColors property isnull
.
-
isSegmentVisible
protected boolean isSegmentVisible(DrawContext dc, Position posA, Position posB, Vec4 ptA, Vec4 ptB)
Determines whether the segment between two path positions is visible.- Parameters:
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.- Returns:
- true if the segment is visible relative to the current view frustum, otherwise false.
-
makeSegment
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.- Parameters:
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, ornull
if the first position has no associated color.colorB
- the color corresponding to the segment's second position, ornull
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.
-
computeSegmentLength
protected double computeSegmentLength(DrawContext dc, Position posA, Position posB)
Computes the approximate model-coordinate, path length between two positions. The length of the path depends on the path type: great circle, rhumb, or linear.- Parameters:
dc
- the current draw context.posA
- the first position.posB
- the second position.- Returns:
- the distance between the positions.
-
computeReferenceCenter
protected Vec4 computeReferenceCenter(DrawContext dc)
Computes this path's reference center.- Parameters:
dc
- the current draw context.- Returns:
- the computed reference center, or null if it cannot be computed.
-
computeEyeDistance
protected double computeEyeDistance(DrawContext dc, Path.PathData pathData)
Computes the minimum distance between this Path and the eye point.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Parameters:
dc
- the draw context.pathData
- the current shape data for this shape.- Returns:
- the minimum distance from the shape to the eye point.
-
computeExtent
protected Extent computeExtent(Path.PathData current)
Computes the path's bounding box from the current rendering path. Assumes the rendering path is up-to-date.- Parameters:
current
- the current data for this shape.- Returns:
- the computed extent.
-
getExtent
public Extent getExtent(Globe globe, double verticalExaggeration)
Description copied from interface:ExtentHolder
Returns the objects enclosing volume as anExtent
in model coordinates, given a specifiedGlobe
and vertical exaggeration (seeSceneController.getVerticalExaggeration()
.- Specified by:
getExtent
in interfaceExtentHolder
- Overrides:
getExtent
in classAbstractShape
- Parameters:
globe
- the Globe the object is related to.verticalExaggeration
- the vertical exaggeration of the scene containing this object.- Returns:
- the object's Extent in model coordinates.
-
getReferencePosition
public Position getReferencePosition()
Computes the path's reference position. The position returned is the center-most ordinal position in the path's specified positions.- Returns:
- the computed reference position.
-
fillVBO
protected void fillVBO(DrawContext dc)
Description copied from class:AbstractShape
Fill this shape's vertex buffer objects. If the vertex buffer object resource IDs don't yet exist, create them.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Specified by:
fillVBO
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
intersect
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
Description copied from class:AbstractShape
Compute the intersections of a specified line with this shape. If the shape's altitude mode is other thanWorldWind.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.- Specified by:
intersect
in classAbstractShape
- Parameters:
line
- the line to intersect.terrain
- theTerrain
to use when computing the shape's geometry.- Returns:
- a list of intersections identifying where the line intersects the shape, or null if the line does not intersect the shape.
- Throws:
java.lang.InterruptedException
- if the operation is interrupted.- See Also:
Terrain
-
move
public void move(Position delta)
Description copied from interface:Movable
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.- Specified by:
move
in interfaceMovable
- Overrides:
move
in classAbstractShape
- Parameters:
delta
- 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.- Parameters:
position
- the new position of the shape's reference position.
-
moveTo
public void moveTo(Globe globe, Position position)
Description copied from interface:Movable2
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.- Specified by:
moveTo
in interfaceMovable2
- Overrides:
moveTo
in classAbstractShape
- Parameters:
globe
- the globe on which to move the shape.position
- the new position of the shape's reference position.
-
isSmall
protected boolean isSmall(DrawContext dc, Vec4 ptA, Vec4 ptB, int numPixels)
-
doExportAsKML
protected void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
Exports shape-specific fields.- Specified by:
doExportAsKML
in classAbstractShape
- Parameters:
xmlWriter
- the export writer to write to.- Throws:
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.
-
setOffset
public void setOffset(double offset)
Specifies an offset, in meters, to add to the path points when the path's altitude mode isWorldWind.CLAMP_TO_GROUND
. SeeAbstractShape.setAltitudeMode(int)
.- Parameters:
offset
- the path offset in meters.
-
-