public class DirectedPath extends Path
Path
that draws arrowheads between the path positions to indicate direction. All arrowheads are drawn at a
constant geographic size (the arrows get smaller as the view moves away from the path, and larger as the view get
closer to the path). One arrowhead is drawn on each path segment, unless the path segment is smaller than the
arrowhead, in which case the arrowhead is not drawn.Path.PathData, Path.PathPickSupport, Path.PickablePositions, Path.PositionColors
AbstractShape.AbstractShapeData
Modifier and Type | Field and Description |
---|---|
protected Angle |
arrowAngle
The angle of the arrowhead tip.
|
protected double |
arrowLength
The length, in meters, of the arrowhead, from tip to base.
|
protected static java.lang.String |
ARROWS_EXTENT |
protected static java.lang.String |
ARROWS_KEY |
static Angle |
DEFAULT_ARROW_ANGLE
Default arrow angle.
|
static double |
DEFAULT_ARROW_LENGTH
Default arrow length, in meters.
|
static double |
DEFAULT_MAX_SCREEN_SIZE
Default maximum screen size of the arrowheads, in pixels.
|
protected double |
maxScreenSize
The maximum screen size, in pixels, of the direction arrowheads.
|
DEFAULT_DRAW_POSITIONS_SCALE, DEFAULT_DRAW_POSITIONS_THRESHOLD, DEFAULT_INTERIOR_MATERIAL, DEFAULT_NUM_SUBSEGMENTS, DEFAULT_OUTLINE_MATERIAL, DEFAULT_PATH_TYPE, DEFAULT_TERRAIN_CONFORMANCE, drawVerticals, extrude, followTerrain, numPositions, numSubsegments, pathType, pickPositionColors, positionColors, positions, positionsSpanDateline, showPositions, showPositionsScale, showPositionsThreshold, SURFACE_PATH_DEPTH_OFFSET, 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 |
---|
DirectedPath()
Creates a path with no positions.
|
DirectedPath(java.lang.Iterable<? extends Position> positions)
Creates a path with specified positions.
|
DirectedPath(Position.PositionList positions)
Creates a path with positions specified via a generic list.
|
DirectedPath(Position posA,
Position posB)
Creates a path between two positions.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeArrowheadGeometry(DrawContext dc,
int poleA,
int poleB,
Vec4 polePtA,
Vec4 polePtB,
java.nio.FloatBuffer buffer,
Path.PathData pathData)
Compute the geometry of a direction arrow between two points.
|
protected void |
computeDirectionArrows(DrawContext dc,
Path.PathData pathData)
Compute the geometry of the direction arrows.
|
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 SurfaceShape |
createSurfaceShape()
Returns a
SurfaceShape that corresponds to this Path and is used for drawing on 2D globes. |
protected void |
doDrawOutline(DrawContext dc)
Draws this shape's outline.
|
protected void |
drawDirectionArrows(DrawContext dc,
Path.PathData pathData)
Draws this DirectedPath's direction arrows.
|
Angle |
getArrowAngle()
Indicates the angle of the direction arrowheads.
|
double |
getArrowLength()
Indicates the length, in meters, of the direction arrowheads, from base to tip.
|
double |
getMaxScreenSize()
Indicates the maximum screen size, in pixels, of the direction arrowheads.
|
protected boolean |
intersectsFrustum(DrawContext dc)
Determines whether this shape intersects the view frustum.
|
protected boolean |
isArrowheadSmall(DrawContext dc,
Vec4 arrowPt,
int numPixels)
Determines if an direction arrow drawn a point will be less than a specified number of pixels.
|
void |
setArrowAngle(Angle arrowAngle)
Specifies the angle of the direction arrowheads.
|
void |
setArrowLength(double arrowLength)
Specifies the length, in meters, of the direction arrowheads, from base to tip.
|
void |
setMaxScreenSize(double maxScreenSize)
Specifies the maximum screen size, in pixels, of the direction arrowheads.
|
protected void |
updateSurfaceShape()
Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this shape on 2D
globes.
|
addOrderedRenderable, addPickablePositions, addTessellatedPosition, appendTerrainPoint, computeAbsolutePoints, computeExtent, computeEyeDistance, computePointsRelativeToTerrain, computePositionCount, computeReferenceCenter, computeSegmentLength, createCacheEntry, determineActiveAttributes, doDrawInterior, doDrawInteriorVA, doDrawInteriorVBO, doDrawOrderedRenderable, doDrawOutlineVA, doDrawOutlineVBO, doExportAsKML, doMakeOrderedRenderable, drawPointsVA, drawPointsVBO, drawVerticalOutlineVA, drawVerticalOutlineVBO, fillVBO, getColor, getCurrentPathData, getDistanceMetric, getExtent, getNumSubsegments, getOrdinal, getPathType, getPosition, getPositionColors, getPositions, getReferencePosition, getSector, getShowPositionsScale, getShowPositionsThreshold, getTerrainConformance, initialize, intersect, isDrawVerticals, isExtrude, isFollowTerrain, isOrderedRenderableValid, isSegmentVisible, isShowPositions, isSmall, isSurfacePath, makePath2DIndices, makePositions, makeSegment, makeTessellatedPositions, move, moveTo, moveTo, mustApplyLighting, mustApplyTexture, mustDrawInterior, mustRegenerateGeometry, prepareToDrawPoints, reset, resolvePickedPosition, setDrawVerticals, setExtrude, setFollowTerrain, setNumSubsegments, setPathType, setPositionColors, setPositions, setShowPositions, setShowPositionsScale, setShowPositionsThreshold, setTerrainConformance, shouldUseVBOs
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, 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 Angle arrowAngle
protected double arrowLength
protected static final java.lang.String ARROWS_EXTENT
protected static final java.lang.String ARROWS_KEY
public static final Angle DEFAULT_ARROW_ANGLE
public static final double DEFAULT_ARROW_LENGTH
public static final double DEFAULT_MAX_SCREEN_SIZE
protected double maxScreenSize
public DirectedPath()
public DirectedPath(java.lang.Iterable<? extends Position> positions)
Note: If fewer than two positions is specified, no path is drawn.
positions
- the path positions. This reference is retained by this shape; the positions are not copied. If
any positions in the set change, Path.setPositions(Iterable)
must be called to inform this
shape of the change.java.lang.IllegalArgumentException
- if positions is null.public DirectedPath(Position.PositionList positions)
Note: If fewer than two positions is specified, the path is not drawn.
positions
- the path positions. This reference is retained by this shape; the positions are not copied. If
any positions in the set change, Path.setPositions(Iterable)
must be called to inform this
shape of the change.java.lang.IllegalArgumentException
- if positions is null.protected void computeArrowheadGeometry(DrawContext dc, int poleA, int poleB, Vec4 polePtA, Vec4 polePtB, java.nio.FloatBuffer buffer, Path.PathData pathData)
dc
- current draw contextpoleA
- the pole ApoleB
- the pole BpolePtA
- the first pole position. This is one of the application defined path positions.polePtB
- second pole positionbuffer
- buffer in which to place computed pointspathData
- the current globe-specific path data.protected void computeDirectionArrows(DrawContext dc, Path.PathData pathData)
dc
- current draw context.pathData
- the current globe-specific path data.protected void computePath(DrawContext dc, java.util.List<Position> positions, Path.PathData pathData)
Overridden to also compute the geometry of the direction arrows.
computePath
in class Path
dc
- the current draw context.positions
- the positions to create a path for.pathData
- the current globe-specific path data.protected SurfaceShape createSurfaceShape()
SurfaceShape
that corresponds to this Path and is used for drawing on 2D globes.
Overridden to return a DirectedSurfacePolyline
.
createSurfaceShape
in class Path
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.
Overridden to also draw direction arrows.
doDrawOutline
in class Path
dc
- Current draw context.protected void drawDirectionArrows(DrawContext dc, Path.PathData pathData)
doDrawOutline(gov.nasa.worldwind.render.DrawContext)
before drawing the Path's actual outline.
If this Path is entirely located on the terrain, this applies an offset to the arrow's depth values to to ensure they shows over the terrain. This does not apply a depth offset in any other case to avoid incorrectly drawing the arrows over objects they 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 the arrows are 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 them.
dc
- Current draw context.pathData
- the current globe-specific path data.public Angle getArrowAngle()
public double getArrowLength()
public double getMaxScreenSize()
maxScreenSize
pixels.protected boolean intersectsFrustum(DrawContext dc)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
intersectsFrustum
in class AbstractShape
dc
- the current draw context.protected boolean isArrowheadSmall(DrawContext dc, Vec4 arrowPt, int numPixels)
dc
- current draw contextarrowPt
- point at which to draw direction arrownumPixels
- the number of pixels which is considered to be "small"true
if an arrow drawn at arrowPt
would occupy less than or equal to numPixels
.public void setArrowAngle(Angle arrowAngle)
arrowAngle
- angle of the direction arrowhead tip. Valid values are between 0 degrees and 90 degrees.public void setArrowLength(double arrowLength)
arrowLength
- length, in meters, of the direction arrowheads. The length must be greater than zero.public void setMaxScreenSize(double maxScreenSize)
maxScreenSize
pixels.maxScreenSize
- the maximum screen size, in pixels, of the direction arrowheads, measured tip to base.protected void updateSurfaceShape()
Overridden to update the arrow properties of DirectedSurfacePolyline
.
updateSurfaceShape
in class Path