Class 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 is WorldWind.RELATIVE_TO_GROUND, the altitudes are added to the elevation of the terrain at the position. If the altitude mode is WorldWind.CLAMP_TO_GROUND the altitudes are ignored.

    Between the specified positions the path is drawn along a curve specified by the path's path type, either AVKey.GREAT_CIRCLE, AVKey.RHUMB_LINE or AVKey.LINEAR. (See setPathType(String).)

    Paths have separate attributes for normal display and highlighted display. If no attributes are specified, default attributes are used. See DEFAULT_PATH_INTERIOR_MATERIAL, DEFAULT_PATH_OUTLINE_MATERIAL, and AbstractShape.DEFAULT_HIGHLIGHT_MATERIAL.

    When the path type is LINEAR the path conforms to terrain only if the follow-terrain property is true. Otherwise the path control points will be connected by straight line segments.

    The terrain conformance of GREAT_CIRCLE or RHUMB_LINE paths is determined by the path's follow-terrain and terrain-conformance properties. When the follow-terrain property is true, terrain conformance adapts as the view moves relative to the path; the terrain-conformance property governs the precision of conformance, and the number of intermediate positions computed varies. See setFollowTerrain(boolean) and setTerrainConformance(double). If the follow-terrain property is false, the view position is not considered and the number of intermediate positions between specified positions is the constant value specified by the num-subsegments property (see setNumSubsegments(int)). The latter case may produce higher performance than the former.

    The path positions may be shown by calling setShowPositions(boolean) with an argument of true. This causes dots to be drawn at each originally specified path position. Dots are not drawn at tessellated path positions. The size of the dots may be specified via setShowPositionsScale(double). The dots are drawn only when the Path is within a threshold distance from the eye point. The threshold may be specified by calling setShowPositionsThreshold(double). The dots are drawn in the path's outline material colors by default.

    The path's line and the path's position dots may be drawn in unique RGBA colors by configuring the path with a Path.PositionColors (see setPositionColors(gov.nasa.worldwind.render.Path.PositionColors)).

    Path picking includes information about which position dots are picked, in addition to the path itself. A position dot under the cursor is returned as an Integer object in the PickedObject's AVList under they key AVKey.ORDINAL. Position dots intersecting the pick rectangle are returned as a List of Integer objects in the PickedObject's AVList under the key AVKey.ORDINAL_LIST.

    When drawn on a 2D globe, this shape uses a SurfacePolyline to represent itself. The following features are not provided in this case: display of path positions, extrusion, outline pick width, and identification of path position picked.

    • 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
      • 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
    • 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.
      • Path

        public Path​(Position posA,
                    Position posB)
        Creates a path between two positions.
        Parameters:
        posA - the first position.
        posB - the second position.
        Throws:
        java.lang.IllegalArgumentException - if either position is null.
    • Method Detail

      • 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 class AbstractShape
      • 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 class AbstractShape
      • 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 class AbstractShape
      • 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 of null 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 specified positionColors is called during rendering to define a color at each of this path's positions specified during construction or in a call to setPositions(Iterable). The returned colors are applied to this path's line and the optional dots drawn at each position when showPositions is true, and override the ShapeAttributes' outline color and outline opacity for both normal display and highlighted display. The specified positionColors do not affect this path's filled interior or vertical drop lines displayed when this path is extruded.

        If this path is configured to tessellate itself by creating additional positions between the originally specified positions, an interpolated color is assigned to each tessellated position by computing a weighted linear combination of the colors at the originally specified positions.

        Specify null to disable position colors and draw this path's line and optional position dots according to its ShapeAttributes. This path's position colors reference is null by default.

        Parameters:
        positionColors - the PositionColors that defines an RGBA color for each of this path's positions, or null to color this path's positions according to its ShapeAttributes.
        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)
      • 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)
      • 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's ShapeAttributes to determine the actual size of the dots, in pixels. See ShapeAttributes.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's ShapeAttributes to determine the actual size of the dots, in pixels. See ShapeAttributes.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 class AbstractShape
        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 class AbstractShape
        Parameters:
        dc - the current draw context
        activeAttrs - 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 class AbstractShape
        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 class AbstractShape
        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 class AbstractShape
        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 returns true if this Path's altitude mode is WorldWind.CLAMP_TO_GROUND and the follow-terrain property is true. Otherwise this returns false.
        Parameters:
        dc - The current draw context.
        Returns:
        true if this Path's positions and the positions in between are located on the underlying terrain, and false otherwise.
      • isSurfacePath

        public boolean isSurfacePath()
        Indicates whether this Path's defining positions and the positions in between are located on the underlying terrain. This returns true if this Path's altitude mode is WorldWind.CLAMP_TO_GROUND and the follow-terrain property is true. Otherwise this returns false.
        Returns:
        true if this Path's positions and the positions in between are located on the underlying terrain, and false 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 to WorldWind.CLAMP_TO_GROUND and the follow terrain property is set to true. 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.
      • computePositionCount

        protected void computePositionCount()
        Counts the number of positions in this path's specified positions.
      • 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 specified PickSupport. The PickSupport may not be the one associated with this instance. During batch picking the PickSupport of the instance initiating the batch picking is used so that all shapes rendered in batch are added to the same pick list.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Overridden to add this Path's pickable positions to the pick candidates.

        Overrides:
        doDrawOrderedRenderable in class AbstractShape
        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 class AbstractShape
        Parameters:
        dc - the current draw context.
      • doDrawOutline

        protected void doDrawOutline​(DrawContext dc)
        Draws this shape's outline. Called immediately after calling 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.

        Specified by:
        doDrawOutline in class AbstractShape
        Parameters:
        dc - the current draw context.
      • 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 class AbstractShape
        Parameters:
        dc - the current draw context.
      • 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], or null if the position has no associated color.
        path - the path to append to. Assumes that the path has adequate capacity.
        pathData - the current globe-specific path data.
      • 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's tessellatedPositions and polePositions 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.
      • addTessellatedPosition

        protected void addTessellatedPosition​(Position pos,
                                              java.awt.Color color,
                                              java.lang.Integer ordinal,
                                              Path.PathData pathData)
        Adds a position to this path's tessellatedPositions list. If the specified color is not null, this adds the color to this path's tessellatedColors list. If the specified ordinal is not null, this adds the position's index to the polePositions and positionPoints index buffers.
        Parameters:
        pos - the position to add.
        color - the color corresponding to the position. May be null to indicate that the position has no associated color.
        ordinal - the ordinal number corresponding to the position's location in the original position list. May be null to indicate that the position is not one of the originally specified positions.
        pathData - the current globe-specific path data.
      • 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 returns null if this path's positionColors property is null. 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 is null.
      • 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, or null if the first position has no associated color.
        colorB - the color corresponding to the segment's second position, or null if the first position has no associated color.
        ordinalA - the ordinal number corresponding to the segment's first position in the original position list.
        ordinalB - the ordinal number corresponding to the segment's second position in the original position list.
        pathData - the current globe-specific path data.
      • 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 an Extent in model coordinates, given a specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration().
        Specified by:
        getExtent in interface ExtentHolder
        Overrides:
        getExtent in class AbstractShape
        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 class AbstractShape
        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 than WorldWind.ABSOLUTE, the shape's geometry is created relative to the specified terrain rather than the terrain used during rendering, which may be at lower level of detail than required for accurate intersection determination.
        Specified by:
        intersect in class AbstractShape
        Parameters:
        line - the line to intersect.
        terrain - the Terrain 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 interface Movable
        Overrides:
        move in class AbstractShape
        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 interface Movable2
        Overrides:
        moveTo in class AbstractShape
        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 class AbstractShape
        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.