NASA World Wind

gov.nasa.worldwind.render
Class Polyline

java.lang.Object
  extended by gov.nasa.worldwind.render.Polyline
All Implemented Interfaces:
Movable, Renderable, Restorable

public class Polyline
extends java.lang.Object
implements Renderable, Movable, Restorable


Field Summary
static int ANTIALIAS_DONT_CARE
           
static int ANTIALIAS_FASTEST
           
static int ANTIALIAS_NICEST
           
static int GREAT_CIRCLE
           
static int LINEAR
           
static int LOXODROME
           
static int RHUMB_LINE
           
 
Constructor Summary
Polyline()
           
Polyline(java.lang.Iterable<LatLon> positions, double elevation)
           
Polyline(java.lang.Iterable<Position> positions)
           
 
Method Summary
 int getAntiAliasHint()
           
 java.awt.Color getColor()
           
 java.awt.Color getHighlightColor()
           
 double getLength()
          Returns the length of the line as drawn.
 double getLineWidth()
           
 int getNumSubsegments()
           
 double getOffset()
           
 int getPathType()
           
 java.lang.Iterable<Position> getPositions()
           
 Position getReferencePosition()
           
 java.lang.String getRestorableState()
          Returns an XML state document String describing the public attributes of this Polyline.
 int getStippleFactor()
           
 short getStipplePattern()
           
 double getTerrainConformance()
           
 boolean isClosed()
           
 boolean isFilled()
           
 boolean isFollowTerrain()
           
 boolean isHighlighted()
           
protected  void makeVertices(DrawContext dc)
           
 void move(Position delta)
          Shift the shape over the globe's surface while maintaining its original azimuth -- its orientation relative to North.
 void moveTo(Position position)
          Move the shape over the globe's surface while maintaining its original azimuth -- its orientation relative to North.
 void render(DrawContext dc)
          Causes this Renderable to render itself using the DrawContext provided.
 void restoreState(java.lang.String stateInXml)
          Restores publicly settable attribute values found in the specified XML state document String.
 void setAntiAliasHint(int hint)
           
 void setClosed(boolean closed)
           
 void setColor(java.awt.Color color)
           
 void setFilled(boolean filled)
           
 void setFollowTerrain(boolean followTerrain)
          Indicates whether the path should follow the terrain's surface.
 void setHighlightColor(java.awt.Color highlightColor)
           
 void setHighlighted(boolean highlighted)
           
 void setLineWidth(double lineWidth)
           
 void setNumSubsegments(int numSubsegments)
          Specifies the number of intermediate segments to draw for each segment between positions.
 void setOffset(double offset)
          Specifies an offset, in meters, to add to the path points when the path's follow-terrain attribute is true.
 void setPathType(int pathType)
          Sets the type of path to draw, one of GREAT_CIRCLE, which draws each segment of the path as a great circle, LINEAR, which determines the intermediate positions between segments by interpolating the segment endpoints, or RHUMB_LINE, which draws each segment of the path as a line of constant heading.
 void setPositions(java.lang.Iterable<LatLon> inPositions, double elevation)
          Sets the paths positions as latitude and longitude values at a constant altitude.
 void setPositions(java.lang.Iterable<Position> inPositions)
          Specifies the path's positions.
 void setStippleFactor(int stippleFactor)
          Sets the stipple factor for specifying line types other than solid.
 void setStipplePattern(short stipplePattern)
          Sets the stipple pattern for specifying line types other than solid.
 void setTerrainConformance(double terrainConformance)
          Specifies the precision to which the path follows the terrain when the follow-terrain attribute is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANTIALIAS_DONT_CARE

public static final int ANTIALIAS_DONT_CARE

ANTIALIAS_FASTEST

public static final int ANTIALIAS_FASTEST

ANTIALIAS_NICEST

public static final int ANTIALIAS_NICEST

GREAT_CIRCLE

public static final int GREAT_CIRCLE
See Also:
Constant Field Values

LINEAR

public static final int LINEAR
See Also:
Constant Field Values

LOXODROME

public static final int LOXODROME
See Also:
Constant Field Values

RHUMB_LINE

public static final int RHUMB_LINE
See Also:
Constant Field Values
Constructor Detail

Polyline

public Polyline()

Polyline

public Polyline(java.lang.Iterable<LatLon> positions,
                double elevation)

Polyline

public Polyline(java.lang.Iterable<Position> positions)
Method Detail

getAntiAliasHint

public int getAntiAliasHint()

getColor

public java.awt.Color getColor()

getHighlightColor

public java.awt.Color getHighlightColor()

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.

getLineWidth

public double getLineWidth()

getNumSubsegments

public int getNumSubsegments()

getOffset

public double getOffset()

getPathType

public int getPathType()

getPositions

public java.lang.Iterable<Position> getPositions()

getReferencePosition

public Position getReferencePosition()
Specified by:
getReferencePosition in interface Movable

getRestorableState

public java.lang.String getRestorableState()
Returns an XML state document String describing the public attributes of this Polyline.

Specified by:
getRestorableState in interface Restorable
Returns:
XML state document string describing this Polyline.

getStippleFactor

public int getStippleFactor()

getStipplePattern

public short getStipplePattern()

getTerrainConformance

public double getTerrainConformance()

isClosed

public boolean isClosed()

isFilled

public boolean isFilled()

isFollowTerrain

public boolean isFollowTerrain()

isHighlighted

public boolean isHighlighted()

makeVertices

protected void makeVertices(DrawContext dc)

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
Parameters:
delta - the latitude and longitude to add to the shapes 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.

Specified by:
moveTo in interface Movable
Parameters:
position - the new position of the shapes reference position.

render

public void render(DrawContext dc)
Description copied from interface: Renderable
Causes this Renderable to render itself using the DrawContext provided. The DrawContext provides the elevation model, openGl instance, globe and other information required for drawing. It is recommended that the DrawContext is non-null as most implementations do not support null DrawContexts.

Specified by:
render in interface Renderable
Parameters:
dc - the DrawContext to be used
See Also:
DrawContext

restoreState

public void restoreState(java.lang.String stateInXml)
Restores publicly settable attribute values found in the specified XML state document String. The document specified by stateInXml must be a well formed XML document String, or this will throw an IllegalArgumentException. Unknown structures in stateInXml are benign, because they will simply be ignored.

Specified by:
restoreState in interface Restorable
Parameters:
stateInXml - an XML document String describing a Polyline.
Throws:
java.lang.IllegalArgumentException - If stateInXml is null, or if stateInXml is not a well formed XML document String.

setAntiAliasHint

public void setAntiAliasHint(int hint)

setClosed

public void setClosed(boolean closed)

setColor

public void setColor(java.awt.Color color)

setFilled

public void setFilled(boolean filled)

setFollowTerrain

public void setFollowTerrain(boolean followTerrain)
Indicates whether the path should follow the terrain's surface. If the value is true, the elevation values in this path's positions are ignored and the path is drawn on the terrain surface. Otherwise the path is drawn according to the elevations given in the path's positions. If following the terrain, the path may also have an offset. See setOffset(double);

Parameters:
followTerrain - true to follow the terrain, otherwise false.

setHighlightColor

public void setHighlightColor(java.awt.Color highlightColor)

setHighlighted

public void setHighlighted(boolean highlighted)

setLineWidth

public void setLineWidth(double lineWidth)

setNumSubsegments

public void setNumSubsegments(int numSubsegments)
Specifies the number of intermediate segments to draw for each segment between positions. The end points of the intermediate segments are calculated according to the current path type and follow-terrain setting.

Parameters:
numSubsegments - the number of intermediate subsegments.

setOffset

public void setOffset(double offset)
Specifies an offset, in meters, to add to the path points when the path's follow-terrain attribute is true. See setFollowTerrain(boolean).

Parameters:
offset - the path pffset in meters.

setPathType

public void setPathType(int pathType)
Sets the type of path to draw, one of GREAT_CIRCLE, which draws each segment of the path as a great circle, LINEAR, which determines the intermediate positions between segments by interpolating the segment endpoints, or RHUMB_LINE, which draws each segment of the path as a line of constant heading.

Parameters:
pathType - the type of path to draw.

setPositions

public void setPositions(java.lang.Iterable<LatLon> inPositions,
                         double elevation)
Sets the paths positions as latitude and longitude values at a constant altitude.

Parameters:
inPositions - the latitudes and longitudes of the positions.
elevation - the elevation to assign each position.

setPositions

public void setPositions(java.lang.Iterable<Position> inPositions)
Specifies the path's positions.

Parameters:
inPositions - the path positions.

setStippleFactor

public void setStippleFactor(int stippleFactor)
Sets the stipple factor for specifying line types other than solid. See the OpenGL specification or programming guides for a description of this parameter. Stipple is also affected by the path's stipple pattern, setStipplePattern(short).

Parameters:
stippleFactor - the stipple factor.

setStipplePattern

public void setStipplePattern(short stipplePattern)
Sets the stipple pattern for specifying line types other than solid. See the OpenGL specification or programming guides for a description of this parameter. Stipple is also affected by the path's stipple factor, setStippleFactor(int).

Parameters:
stipplePattern - the stipple pattern.

setTerrainConformance

public void setTerrainConformance(double terrainConformance)
Specifies the precision to which the path follows the terrain when the follow-terrain attribute is true. The conformance value indicates the approximate length of each sub-segment of the path as it's drawn, in pixels. Lower values specify higher precision, but at the cost of performance.

Parameters:
terrainConformance - the path conformance in pixels.

NASA World Wind