Class DirectedPath
- java.lang.Object
- 
- gov.nasa.worldwind.avlist.AVListImpl
- 
- gov.nasa.worldwind.WWObjectImpl
- 
- gov.nasa.worldwind.render.AbstractShape
- 
- gov.nasa.worldwind.render.Path
- 
- gov.nasa.worldwindx.examples.util.DirectedPath
 
 
 
 
 
- 
- All Implemented Interfaces:
- AVList,- Draggable,- MessageListener,- Exportable,- ExtentHolder,- Movable,- Movable2,- Attributable,- GeographicExtent,- Highlightable,- OrderedRenderable,- PreRenderable,- Renderable,- Restorable,- WWObject,- java.beans.PropertyChangeListener,- java.util.EventListener
 
 public class DirectedPath extends Path APaththat 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.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.PathPath.PathData, Path.PathPickSupport, Path.PickablePositions, Path.PositionColors
 - 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShapeAbstractShape.AbstractShapeData
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected AnglearrowAngleThe angle of the arrowhead tip.protected doublearrowLengthThe length, in meters, of the arrowhead, from tip to base.protected static java.lang.StringARROWS_EXTENTprotected static java.lang.StringARROWS_KEYstatic AngleDEFAULT_ARROW_ANGLEDefault arrow angle.static doubleDEFAULT_ARROW_LENGTHDefault arrow length, in meters.static doubleDEFAULT_MAX_SCREEN_SIZEDefault maximum screen size of the arrowheads, in pixels.protected doublemaxScreenSizeThe maximum screen size, in pixels, of the direction arrowheads.- 
Fields inherited from class gov.nasa.worldwind.render.PathDEFAULT_DRAW_POSITIONS_SCALE, DEFAULT_DRAW_POSITIONS_THRESHOLD, DEFAULT_NUM_SUBSEGMENTS, DEFAULT_PATH_INTERIOR_MATERIAL, DEFAULT_PATH_OUTLINE_MATERIAL, DEFAULT_PATH_TYPE, DEFAULT_TERRAIN_CONFORMANCE, drawVerticals, extrude, followTerrain, measurer, numPositions, numSubsegments, offset, pathType, pickPositionColors, positionColors, positions, positionsSpanDateline, showPositions, showPositionsScale, showPositionsThreshold, SURFACE_PATH_DEPTH_OFFSET, terrainConformance
 - 
Fields inherited from class gov.nasa.worldwind.render.AbstractShapeactiveAttributes, 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.ExportableFORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
- 
 - 
Constructor SummaryConstructors Constructor Description DirectedPath()Creates a path with no 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.DirectedPath(java.lang.Iterable<? extends Position> positions)Creates a path with specified positions.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeArrowheadGeometry(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 voidcomputeDirectionArrows(DrawContext dc, Path.PathData pathData)Compute the geometry of the direction arrows.protected voidcomputePath(DrawContext dc, java.util.List<Position> positions, Path.PathData pathData)Computes the shape's model-coordinate path from a list of positions.protected SurfaceShapecreateSurfaceShape()Returns aSurfaceShapethat corresponds to this Path and is used for drawing on 2D globes.protected voiddoDrawOutline(DrawContext dc)Draws this shape's outline.protected voiddrawDirectionArrows(DrawContext dc, Path.PathData pathData)Draws this DirectedPath's direction arrows.AnglegetArrowAngle()Indicates the angle of the direction arrowheads.doublegetArrowLength()Indicates the length, in meters, of the direction arrowheads, from base to tip.doublegetMaxScreenSize()Indicates the maximum screen size, in pixels, of the direction arrowheads.protected booleanintersectsFrustum(DrawContext dc)Determines whether this shape intersects the view frustum.protected booleanisArrowheadSmall(DrawContext dc, Vec4 arrowPt, int numPixels)Determines if an direction arrow drawn a point will be less than a specified number of pixels.voidsetArrowAngle(Angle arrowAngle)Specifies the angle of the direction arrowheads.voidsetArrowLength(double arrowLength)Specifies the length, in meters, of the direction arrowheads, from base to tip.voidsetMaxScreenSize(double maxScreenSize)Specifies the maximum screen size, in pixels, of the direction arrowheads.protected voidupdateSurfaceShape()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.PathaddOrderedRenderable, 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, getLength, getLength, getMeasurer, getNumSubsegments, getOrdinal, getPathType, getPosition, getPositionColors, getPositions, getReferencePosition, getSector, getShowPositionsScale, getShowPositionsThreshold, getTerrainConformance, initialize, intersect, isDrawVerticals, isExtrude, isFollowTerrain, isOrderedRenderableValid, isSegmentVisible, isShowPositions, isSmall, isSurfacePath, isSurfacePath, makeClosed, makePath2DIndices, makePositions, makeSegment, makeTessellatedPositions, move, moveTo, moveTo, mustApplyLighting, mustApplyTexture, mustDrawInterior, mustRegenerateGeometry, prepareToDrawPoints, reset, resolvePickedPosition, setDrawVerticals, setExtrude, setFollowTerrain, setNumSubsegments, setOffset, setPathType, setPositionColors, setPositions, setShowPositions, setShowPositionsScale, setShowPositionsThreshold, setSurfacePath, setTerrainConformance, shouldUseVBOs
 - 
Methods inherited from class gov.nasa.worldwind.render.AbstractShapebeginDrawing, 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
 - 
Methods inherited from class gov.nasa.worldwind.WWObjectImplonMessage, propertyChange
 - 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpladdPropertyChangeListener, 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.Objectclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface gov.nasa.worldwind.avlist.AVListaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_ARROW_LENGTHpublic static final double DEFAULT_ARROW_LENGTH Default arrow length, in meters.- See Also:
- Constant Field Values
 
 - 
DEFAULT_ARROW_ANGLEpublic static final Angle DEFAULT_ARROW_ANGLE Default arrow angle.
 - 
DEFAULT_MAX_SCREEN_SIZEpublic static final double DEFAULT_MAX_SCREEN_SIZE Default maximum screen size of the arrowheads, in pixels.- See Also:
- Constant Field Values
 
 - 
arrowLengthprotected double arrowLength The length, in meters, of the arrowhead, from tip to base.
 - 
arrowAngleprotected Angle arrowAngle The angle of the arrowhead tip.
 - 
maxScreenSizeprotected double maxScreenSize The maximum screen size, in pixels, of the direction arrowheads.
 - 
ARROWS_KEYprotected static final java.lang.String ARROWS_KEY - See Also:
- Constant Field Values
 
 - 
ARROWS_EXTENTprotected static final java.lang.String ARROWS_EXTENT - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
DirectedPathpublic DirectedPath() Creates a path with no positions.
 - 
DirectedPathpublic DirectedPath(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,- Path.setPositions(Iterable)must be called to inform this shape of the change.
- Throws:
- java.lang.IllegalArgumentException- if positions is null.
 
 - 
DirectedPathpublic DirectedPath(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,- Path.setPositions(Iterable)must be called to inform this shape of the change.
- Throws:
- java.lang.IllegalArgumentException- if positions is null.
 
 
- 
 - 
Method Detail- 
getArrowLengthpublic double getArrowLength() Indicates the length, in meters, of the direction arrowheads, from base to tip.- Returns:
- The geographic length of the direction arrowheads.
 
 - 
setArrowLengthpublic void setArrowLength(double arrowLength) Specifies the length, in meters, of the direction arrowheads, from base to tip.- Parameters:
- arrowLength- length, in meters, of the direction arrowheads. The length must be greater than zero.
 
 - 
getMaxScreenSizepublic double getMaxScreenSize() Indicates the maximum screen size, in pixels, of the direction arrowheads. The arrowheads are drawn a fixed geographic, but they are not allowed to get bigger thanmaxScreenSizepixels.- Returns:
- The maximum screen size, in pixels, of the direction arrowheads, measured tip to base.
 
 - 
setMaxScreenSizepublic void setMaxScreenSize(double maxScreenSize) Specifies the maximum screen size, in pixels, of the direction arrowheads. The arrowheads are drawn at a fixed geographic size, but they will not allowed to get bigger thanmaxScreenSizepixels.- Parameters:
- maxScreenSize- the maximum screen size, in pixels, of the direction arrowheads, measured tip to base.
 
 - 
getArrowAnglepublic Angle getArrowAngle() Indicates the angle of the direction arrowheads. A larger angle draws a fat arrowhead, and a smaller angle draws a narrow arrow head.- Returns:
- The angle of the direction arrowhead tip.
 
 - 
setArrowAnglepublic void setArrowAngle(Angle arrowAngle) Specifies the angle of the direction arrowheads. A larger angle draws a fat arrowhead, and a smaller angle draws a narrow arrow.- Parameters:
- arrowAngle- angle of the direction arrowhead tip. Valid values are between 0 degrees and 90 degrees.
 
 - 
intersectsFrustumprotected boolean intersectsFrustum(DrawContext dc) Description copied from class:AbstractShapeDetermines whether this shape intersects the view frustum.A AbstractShape.AbstractShapeDatamust be current when this method is called.- Overrides:
- intersectsFrustumin class- AbstractShape
- Parameters:
- dc- the current draw context.
- Returns:
- true if this shape intersects the frustum, otherwise false.
 
 - 
computePathprotected 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.Overridden to also compute the geometry of the direction arrows. - Overrides:
- computePathin class- Path
- Parameters:
- dc- the current draw context.
- positions- the positions to create a path for.
- pathData- the current globe-specific path data.
 
 - 
createSurfaceShapeprotected SurfaceShape createSurfaceShape() Returns aSurfaceShapethat corresponds to this Path and is used for drawing on 2D globes.Overridden to return a DirectedSurfacePolyline.- Overrides:
- createSurfaceShapein class- Path
- Returns:
- The surface shape to represent this Path on a 2D globe.
 
 - 
updateSurfaceShapeprotected void updateSurfaceShape() 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.Overridden to update the arrow properties of DirectedSurfacePolyline.- Overrides:
- updateSurfaceShapein class- Path
 
 - 
computeDirectionArrowsprotected void computeDirectionArrows(DrawContext dc, Path.PathData pathData) Compute the geometry of the direction arrows.- Parameters:
- dc- current draw context.
- pathData- the current globe-specific path data.
 
 - 
computeArrowheadGeometryprotected 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.- Parameters:
- dc- current draw context
- poleA- The first pole.
- poleB- The second pole.
- polePtA- the first pole position. This is one of the application defined path positions.
- polePtB- second pole position
- buffer- buffer in which to place computed points
- pathData- the current globe-specific path data.
 
 - 
isArrowheadSmallprotected 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.- Parameters:
- dc- current draw context
- arrowPt- point at which to draw direction arrow
- numPixels- the number of pixels which is considered to be "small"
- Returns:
- trueif an arrow drawn at- arrowPtwould occupy less than or equal to- numPixels.
 
 - 
doDrawOutlineprotected 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.AbstractShapeDatamust 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. - Overrides:
- doDrawOutlinein class- Path
- Parameters:
- dc- Current draw context.
 
 - 
drawDirectionArrowsprotected void drawDirectionArrows(DrawContext dc, Path.PathData pathData) Draws this DirectedPath's direction arrows. Called fromdoDrawOutline(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. - Parameters:
- dc- Current draw context.
- pathData- the current globe-specific path data.
 
 
- 
 
-