Class DirectedSurfacePolyline
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractSurfaceObject
-
- gov.nasa.worldwind.render.AbstractSurfaceShape
-
- gov.nasa.worldwind.render.SurfacePolyline
-
- gov.nasa.worldwindx.examples.util.DirectedSurfacePolyline
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,ExtentHolder
,MeasurableArea
,MeasurableLength
,Movable
,Movable2
,Attributable
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,SurfaceObject
,SurfaceRenderable
,SurfaceShape
,Restorable
,Combinable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class DirectedSurfacePolyline extends SurfacePolyline
ASurfacePolyline
that draws arrowheads between the polyline 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 polyline segment, unless the 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.AbstractSurfaceShape
AbstractSurfaceShape.GeometryKey, AbstractSurfaceShape.SurfaceShapeStateKey
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey
-
-
Field Summary
Fields Modifier and Type Field Description protected Angle
arrowAngle
The angle of the arrowhead tip.protected double
arrowLength
The length, in meters, of the arrowhead, from tip to base.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.-
Fields inherited from class gov.nasa.worldwind.render.SurfacePolyline
closed, locations
-
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
activeAttrs, activeGeometry, activeOutlineGeometry, areaMeasurer, areaMeasurerLastModifiedTime, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_MAX_EDGE_INTERVALS, DEFAULT_MIN_EDGE_INTERVALS, DEFAULT_OUTLINE_MATERIAL, DEFAULT_PATH_TYPE, DEFAULT_TEXELS_PER_EDGE_INTERVAL, defaultAttrs, dragEnabled, draggableSupport, geometryCache, highlightAttrs, highlighted, maxEdgeIntervals, minEdgeIntervals, normalAttrs, pathType, sectorCache, stackHandler, texelsPerEdgeInterval, texture, vertexBuffer
-
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description DirectedSurfacePolyline()
Constructs a new directed surface polyline with the default attributes and no locations.DirectedSurfacePolyline(ShapeAttributes normalAttrs)
Constructs a new directed surface polyline with the specified normal (as opposed to highlight) attributes and no locations.DirectedSurfacePolyline(ShapeAttributes normalAttrs, java.lang.Iterable<? extends LatLon> iterable)
Constructs a new directed surface polyline with the specified normal (as opposed to highlight) attributes and the specified iterable of locations.DirectedSurfacePolyline(DirectedSurfacePolyline source)
Creates a shallow copy of the specified source shape.DirectedSurfacePolyline(java.lang.Iterable<? extends LatLon> iterable)
Constructs a new directed surface polyline with the default attributes and the specified iterable of locations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
computeArrowheadGeometry(DrawContext dc, SurfaceTileDrawContext sdc, LatLon begin, LatLon end)
Compute the geometry of a direction arrow for a polyline segment.protected void
computeDirectionArrows(DrawContext dc, SurfaceTileDrawContext sdc)
Computes the geometry of the direction arrows.protected void
drawDirectionArrows(DrawContext dc)
Draws this DirectedSurfacePolyline's direction arrows.protected void
drawOutline(DrawContext dc, SurfaceTileDrawContext sdc)
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.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.-
Methods inherited from class gov.nasa.worldwind.render.SurfacePolyline
canContainPole, createGeometry, doGetRestorableState, doMoveTo, doMoveTo, doRestoreState, drawInterior, exportAsKML, getLocations, getLocations, getReferencePosition, isClosed, legacyRestoreState, setClosed, setLocations
-
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
addIntermediateLocations, applyInteriorState, applyInteriorTextureState, applyModelviewTransform, applyOutlineState, beginDrawing, clearCaches, combine, combineBounds, combineContours, computeEdgeIntervalsPerDegree, computeEdgeIntervalsPerDegree, computeSectors, computeSectors, containsPole, createActiveAttributes, createGeometry, createGeometryKey, cutAlongDateLine, determineActiveAttributes, determineActiveGeometry, doCombineContour, doCombineContours, doDrag, doDrawGeographic, doTessellateInterior, drag, drawGeographic, drawLineStrip, endDrawing, export, generateIntermediateLocations, getActiveAttributes, getActiveGeometry, getArea, getArea, getAttributes, getCachedGeometry, getExtent, getHeight, getHighlightAttributes, getInteriorTexture, getLength, getMinAndMaxEdgeIntervals, getPathType, getPerimeter, getRestorableState, getSectors, getStateKey, getTexelsPerEdgeInterval, getWidth, handleUnsuccessfulInteriorTessellation, isDragEnabled, isExportFormatSupported, isHighlighted, isSectorEmpty, makeOrderedPreRenderable, move, moveTo, moveTo, pathTypeFromString, repeatAroundDateline, restoreState, setAttributes, setDragEnabled, setHighlightAttributes, setHighlighted, setMinAndMaxEdgeIntervals, setPathType, setTexelsPerEdgeInterval, setupAreaMeasurer, tessellateInterior, tessellateInteriorVertices
-
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
buildPickRepresentation, computeExtent, computeExtent, createPickedObject, createPickTileBuilder, drawBoundingSectors, drawOrderedRenderable, drawPickRepresentation, getDelegateOwner, getDistanceFromEye, getExtent, getUniqueId, intersectsFrustum, intersectsPickFrustum, intersectsVisibleSector, isDrawBoundingSectors, isEnableBatchPicking, isVisible, makeOrderedRenderable, nextUniqueId, onShapeChanged, pick, pickBatched, pickOrderedRenderable, preRender, render, setDelegateOwner, setDrawBoundingSectors, setEnableBatchPicking, setVisible, updateModifiedTime
-
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
-
Methods inherited from interface gov.nasa.worldwind.Exportable
export, isExportFormatSupported
-
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
-
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getDelegateOwner, getDistanceFromEye, getExtent, isEnableBatchPicking, isVisible, pick, preRender, setDelegateOwner, setEnableBatchPicking, setVisible
-
-
-
-
Field Detail
-
DEFAULT_ARROW_LENGTH
public static final double DEFAULT_ARROW_LENGTH
Default arrow length, in meters.- See Also:
- Constant Field Values
-
DEFAULT_ARROW_ANGLE
public static final Angle DEFAULT_ARROW_ANGLE
Default arrow angle.
-
DEFAULT_MAX_SCREEN_SIZE
public static final double DEFAULT_MAX_SCREEN_SIZE
Default maximum screen size of the arrowheads, in pixels.- See Also:
- Constant Field Values
-
arrowLength
protected double arrowLength
The length, in meters, of the arrowhead, from tip to base.
-
arrowAngle
protected Angle arrowAngle
The angle of the arrowhead tip.
-
maxScreenSize
protected double maxScreenSize
The maximum screen size, in pixels, of the direction arrowheads.
-
-
Constructor Detail
-
DirectedSurfacePolyline
public DirectedSurfacePolyline()
Constructs a new directed surface polyline with the default attributes and no locations.
-
DirectedSurfacePolyline
public DirectedSurfacePolyline(DirectedSurfacePolyline source)
Creates a shallow copy of the specified source shape.- Parameters:
source
- the shape to copy.
-
DirectedSurfacePolyline
public DirectedSurfacePolyline(ShapeAttributes normalAttrs)
Constructs a new directed surface polyline with the specified normal (as opposed to highlight) attributes and no locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.- Parameters:
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.
-
DirectedSurfacePolyline
public DirectedSurfacePolyline(java.lang.Iterable<? extends LatLon> iterable)
Constructs a new directed surface polyline with the default attributes and the specified iterable of locations.Note: If fewer than two locations is specified, no polyline is drawn.
- Parameters:
iterable
- the polyline locations.- Throws:
java.lang.IllegalArgumentException
- if the locations iterable is null.
-
DirectedSurfacePolyline
public DirectedSurfacePolyline(ShapeAttributes normalAttrs, java.lang.Iterable<? extends LatLon> iterable)
Constructs a new directed surface polyline with the specified normal (as opposed to highlight) attributes and the specified iterable of locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.Note: If fewer than two locations is specified, no polyline is drawn.
- Parameters:
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.iterable
- the polyline locations.- Throws:
java.lang.IllegalArgumentException
- if the locations iterable is null.
-
-
Method Detail
-
getArrowLength
public double getArrowLength()
Indicates the length, in meters, of the direction arrowheads, from base to tip.- Returns:
- The geographic length of the direction arrowheads.
-
setArrowLength
public 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.
-
getMaxScreenSize
public 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 thanmaxScreenSize
pixels.- Returns:
- The maximum screen size, in pixels, of the direction arrowheads, measured tip to base.
-
setMaxScreenSize
public 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 thanmaxScreenSize
pixels.- Parameters:
maxScreenSize
- the maximum screen size, in pixels, of the direction arrowheads, measured tip to base.
-
getArrowAngle
public 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.
-
setArrowAngle
public 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.
-
drawOutline
protected void drawOutline(DrawContext dc, SurfaceTileDrawContext sdc)
Overridden to also draw direction arrows.
- Overrides:
drawOutline
in classAbstractSurfaceShape
- Parameters:
dc
- the current draw context.sdc
- the context containing a geographic region and screen viewport corresponding to a surface tile.
-
computeDirectionArrows
protected void computeDirectionArrows(DrawContext dc, SurfaceTileDrawContext sdc)
Computes the geometry of the direction arrows. Called fromdrawOutline(gov.nasa.worldwind.render.DrawContext, gov.nasa.worldwind.util.SurfaceTileDrawContext)
.- Parameters:
dc
- the current draw context.sdc
- the context containing a geographic region and screen viewport corresponding to a surface tile.
-
computeArrowheadGeometry
protected void computeArrowheadGeometry(DrawContext dc, SurfaceTileDrawContext sdc, LatLon begin, LatLon end)
Compute the geometry of a direction arrow for a polyline segment.- Parameters:
dc
- the current draw context.sdc
- the context containing a geographic region and screen viewport corresponding to a surface tile.begin
- the polyline segment's beginning location.end
- the polyline segment's ending location.
-
drawDirectionArrows
protected void drawDirectionArrows(DrawContext dc)
Draws this DirectedSurfacePolyline's direction arrows. Called fromdrawOutline(gov.nasa.worldwind.render.DrawContext, gov.nasa.worldwind.util.SurfaceTileDrawContext)
after drawing the polyline's actual outline.- Parameters:
dc
- the current draw context.
-
-