NASA World Wind

gov.nasa.worldwind.layers
Class TerrainProfileLayer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
              extended by gov.nasa.worldwind.layers.TerrainProfileLayer
All Implemented Interfaces:
AVList, Disposable, MessageListener, PositionListener, SelectListener, Layer, Restorable, WWObject, PropertyChangeListener, EventListener

public class TerrainProfileLayer
extends AbstractLayer
implements PositionListener, SelectListener

Displays a terrain profile graph in a screen corner.

Usage: do setEventSource(wwd) to have the graph activated and updated with position changes. See public properties for options: keepProportions, follow, unit, start and end latlon...


Nested Class Summary
protected  class TerrainProfileLayer.OrderedIcon
           
 
Field Summary
protected  int borderWidth
           
protected  String buttonMaximize
           
protected  String buttonMinimize
           
protected  Color color
           
protected  Font defaultFont
           
protected  LatLon endLatLon
           
protected  String follow
           
static String FOLLOW_CURSOR
           
static String FOLLOW_EYE
           
static String FOLLOW_NONE
           
static String FOLLOW_OBJECT
           
static String FOLLOW_PATH
           
static String FOLLOW_VIEW
           
protected  boolean initialized
           
protected  boolean isMaximized
           
protected  boolean isMinimized
           
protected  boolean keepProportions
           
protected  double length
           
protected  Point locationCenter
           
protected  Vec4 locationOffset
           
protected  double maxElevation
           
static double METER_TO_FEET
           
protected  double minElevation
           
protected static int MINIMIZED_SIZE
           
protected  Angle objectHeading
           
protected  Position objectPosition
           
protected  TerrainProfileLayer.OrderedIcon orderedImage
           
protected  ArrayList<? extends LatLon> pathPositions
           
protected  int pathType
           
protected  int pickedSample
           
protected  PickSupport pickSupport
           
protected  String position
           
protected  Position[] positions
           
protected  double profileLengthFactor
           
protected  String resizeBehavior
           
protected  int samples
           
protected  boolean showEyePosition
           
protected  boolean showPickedLine
           
protected  boolean showProfileLine
           
protected  Dimension size
           
protected  LatLon startLatLon
           
protected  double toViewportScale
           
protected  String unit
           
static String UNIT_IMPERIAL
           
static String UNIT_METRIC
           
protected  WorldWindow wwd
           
protected  boolean zeroBased
           
 
Constructor Summary
TerrainProfileLayer()
          Renders a terrain profile graphic in a screen corner.
 
Method Summary
protected  Position computeCursorPosition(DrawContext dc)
           
protected  Vec4 computeLocation(Rectangle viewport, double scale)
           
protected  void computeMirroredPositions(LatLon centerLatLon)
           
protected  int computeObjectSample(LatLon pos)
          Compute the sample number along the path closest to the given LatLon.
protected  double computePathLength()
           
protected  void computePathPositions()
           
protected  Position computePickPosition(DrawContext dc, Vec4 locationSW, Dimension mapSize)
          Computes the Position of the pickPoint over the graph and updates pickedSample indice
protected  void computeProfile(DrawContext dc)
          Compute the terrain profile.
protected  double computeScale(Rectangle viewport)
           
protected  Position computeViewCenterPosition(DrawContext dc)
           
 void doPick(DrawContext dc, Point pickPoint)
           
 void doRender(DrawContext dc)
           
protected  void drawFilledRectangle(DrawContext dc, Vec4 origin, Dimension dimension, Color color)
           
protected  void drawGraph(DrawContext dc, Dimension dimension)
           
protected  void drawGrid(DrawContext dc, Dimension dimension)
           
protected  void drawGUI(DrawContext dc, Dimension dimension)
           
protected  void drawHorizontalLine(DrawContext dc, Dimension dimension, double y)
           
protected  void drawLabel(DrawContext dc, String text, Vec4 screenPoint, int align)
           
protected  void drawLine(DrawContext dc, double x1, double y1, double x2, double y2)
           
 void drawProfile(DrawContext dc)
           
protected  void drawVerticalLine(DrawContext dc, Dimension dimension, double x)
           
protected  Color getBackgroundColor(Color color)
           
 int getBorderWidth()
           
 Color getColor()
          Get the graphic color.
 LatLon getEndLatLon()
          Get the profile end position lat/lon when FOLLOW_NONE.
 String getFollow()
          Get the graph center point placement behavior.
 Font getFont()
          Get the graphic legend Font.
 boolean getIsMaximized()
          Get whether the profile graph is maximized - displays over the whole viewport.
 boolean getIsMinimized()
          Get whether the profile graph is minimized.
 boolean getKeepProportions()
          Get whether distance/elevation proportions are maintained.
 Point getLocationCenter()
          Get the screen location of the graph center if set (can be null).
 Vec4 getLocationOffset()
          Returns the current location offset.
 Angle getObjectHeading()
          Get the object heading the graph follows when it is set to FOLLOW_OBJECT.
 Position getObjectPosition()
          Get the object position the graph follows when it is set to FOLLOW_OBJECT.
 double getOpacity()
          Returns the layer's opacity value.
 List<? extends LatLon> getPathPositions()
          Get the path positions that the profile follows if set to FOLLOW_PATH.
 int getPathType()
           
 Polyline getPickedLine()
          Get the Polyline used to render the picked position on the terrain.
 String getPosition()
           
 double getProfileLenghtFactor()
          Get the profile length factor.
 Polyline getProfileLine()
          Get the Polyline used to render the profile line on the ground.
 String getResizeBehavior()
          Returns the layer's resize behavior.
 int getSamples()
          Get the number of elevation samples in the profile.
 boolean getShowEyePosition()
          Get whether the eye or object position is shown on the graph when FOLLOW_EYE or FOLLOW_OBJECT.
 Dimension getSize()
          Get the graphic Dimension (in pixels).
 LatLon getStartLatLon()
          Get the profile start position lat/lon when FOLLOW_NONE.
 double getToViewportScale()
          Returns the graphic-to-viewport scale factor.
 String getUnit()
           
 boolean getZeroBased()
          Get whether the profile graph should include sea level.
protected  void initialize(DrawContext dc)
           
 boolean isShowPickedLine()
          Get whether the picked line is displayed over the ground.
 boolean isShowProfileLine()
          Get whether the profile line is displayed over the ground.
 void moved(PositionEvent event)
           
 void propertyChange(PropertyChangeEvent propertyChangeEvent)
          The property change listener for this instance.
 void selected(SelectEvent event)
           
 void setBorderWidth(int borderWidth)
          Sets the graphic offset from the viewport border.
 void setColor(Color color)
          Set the graphic Color.
 void setEndLatLon(LatLon latLon)
          Set the profile end position lat/lon when FOLLOW_NONE.
 void setEventSource(WorldWindow wwd)
           
 void setFollow(String behavior)
          Set the graph center point placement behavior.
 void setFont(Font font)
          Set the graphic legend Font.
 void setIsMaximized(boolean state)
          Set wheter the profile graph should be maximized - displays over the whole viewport.
 void setIsMinimized(boolean state)
          Set whether the profile graph should be minimized.
 void setKeepProportions(boolean state)
          Set whether distance/elevation proportions are maintained.
 void setLocationCenter(Point point)
          Set the screen location of the graph center - overrides setPosition(java.lang.String) if not null.
 void setLocationOffset(Vec4 locationOffset)
          Specifies a placement offset from the layer position on the screen.
 void setObjectHeading(Angle heading)
          Set the object heading the graph follows when it is set to FOLLOW_OBJECT.
 void setObjectPosition(Position pos)
          Set the object position the graph follows when it is set to FOLLOW_OBJECT.
 void setOpacity(double opacity)
          Sets the layer opacity, which is applied to the layer's chart.
 void setPathPositions(ArrayList<? extends LatLon> positions)
          Set the path positions that the profile should follow if FOLLOW_PATH.
 void setPathType(int type)
          Sets the type of path to follow, one of Polyline.GREAT_CIRCLE, which computes each segment of the path as a great circle, or Polyline.RHUMB_LINE, which computes each segment of the path as a line of constant heading.
protected  void setPosition(int index, LatLon latLon)
           
 void setPosition(String position)
          Sets the relative viewport location to display the graphic.
 void setProfileLengthFactor(double factor)
          Set the profile length factor - has no effect if FOLLOW_NONE or FOLLOW_PATH
 void setResizeBehavior(String resizeBehavior)
          Sets the behavior the layer uses to size the graphic when the viewport size changes, typically when the World Wind window is resized.
 void setSamples(int number)
          Set the number of elevation samples in the profile.
 void setShowEyePosition(Boolean state)
          Set whether the eye or object position should be shown on the graph when FOLLOW_EYE or FOLLOW_OBJECT.
 void setShowPickedLine(boolean state)
          Set whether the picked line should be displayed over the ground.
 void setShowProfileLine(boolean state)
          Set whether the profile line should be displayed over the terrain.
 void setSize(Dimension size)
          Set the graphic Dimension (in pixels).
 void setStartLatLon(LatLon latLon)
          Set the profile start position lat/lon when FOLLOW_NONE.
 void setToViewportScale(double toViewportScale)
          Sets the scale factor applied to the viewport size to determine the displayed size of the graphic.
 void setUnit(String unit)
          Sets the unit the graphic uses to display distances and elevations.
 void setZeroBased(boolean state)
          Set whether the profile graph should include sea level.
 String toString()
           
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
createLayerConfigElements, dispose, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setPickEnabled, setScreenCredit
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage
 
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, finalize, getClass, hashCode, notify, notifyAll, 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.event.MessageListener
onMessage
 

Field Detail

borderWidth

protected int borderWidth

buttonMaximize

protected final String buttonMaximize
See Also:
Constant Field Values

buttonMinimize

protected final String buttonMinimize
See Also:
Constant Field Values

color

protected Color color

defaultFont

protected Font defaultFont

endLatLon

protected LatLon endLatLon

follow

protected String follow

FOLLOW_CURSOR

public static final String FOLLOW_CURSOR
See Also:
Constant Field Values

FOLLOW_EYE

public static final String FOLLOW_EYE
See Also:
Constant Field Values

FOLLOW_NONE

public static final String FOLLOW_NONE
See Also:
Constant Field Values

FOLLOW_OBJECT

public static final String FOLLOW_OBJECT
See Also:
Constant Field Values

FOLLOW_PATH

public static final String FOLLOW_PATH
See Also:
Constant Field Values

FOLLOW_VIEW

public static final String FOLLOW_VIEW
See Also:
Constant Field Values

initialized

protected boolean initialized

isMaximized

protected boolean isMaximized

isMinimized

protected boolean isMinimized

keepProportions

protected boolean keepProportions

length

protected double length

locationCenter

protected Point locationCenter

locationOffset

protected Vec4 locationOffset

maxElevation

protected double maxElevation

METER_TO_FEET

public static final double METER_TO_FEET
See Also:
Constant Field Values

minElevation

protected double minElevation

MINIMIZED_SIZE

protected static final int MINIMIZED_SIZE
See Also:
Constant Field Values

objectHeading

protected Angle objectHeading

objectPosition

protected Position objectPosition

orderedImage

protected TerrainProfileLayer.OrderedIcon orderedImage

pathPositions

protected ArrayList<? extends LatLon> pathPositions

pathType

protected int pathType

pickedSample

protected int pickedSample

pickSupport

protected PickSupport pickSupport

position

protected String position

positions

protected Position[] positions

profileLengthFactor

protected double profileLengthFactor

resizeBehavior

protected String resizeBehavior

samples

protected int samples

showEyePosition

protected boolean showEyePosition

showPickedLine

protected boolean showPickedLine

showProfileLine

protected boolean showProfileLine

size

protected Dimension size

startLatLon

protected LatLon startLatLon

toViewportScale

protected double toViewportScale

unit

protected String unit

UNIT_IMPERIAL

public static final String UNIT_IMPERIAL
See Also:
Constant Field Values

UNIT_METRIC

public static final String UNIT_METRIC
See Also:
Constant Field Values

wwd

protected WorldWindow wwd

zeroBased

protected boolean zeroBased
Constructor Detail

TerrainProfileLayer

public TerrainProfileLayer()
Renders a terrain profile graphic in a screen corner.

Method Detail

computeCursorPosition

protected Position computeCursorPosition(DrawContext dc)

computeLocation

protected Vec4 computeLocation(Rectangle viewport,
                               double scale)

computeMirroredPositions

protected void computeMirroredPositions(LatLon centerLatLon)

computeObjectSample

protected int computeObjectSample(LatLon pos)
Compute the sample number along the path closest to the given LatLon.

Parameters:
pos - the object LatLon
Returns:
the sample number or -1 if not found.

computePathLength

protected double computePathLength()

computePathPositions

protected void computePathPositions()

computePickPosition

protected Position computePickPosition(DrawContext dc,
                                       Vec4 locationSW,
                                       Dimension mapSize)
Computes the Position of the pickPoint over the graph and updates pickedSample indice

Parameters:
dc - the current DrawContext
locationSW - the screen location of the bottom left corner of the graph
mapSize - the graph screen dimension in pixels
Returns:
the picked Position

computeProfile

protected void computeProfile(DrawContext dc)
Compute the terrain profile.

If FOLLOW_VIEW, FOLLOW_EYE, FOLLOW_CURSOR or FOLLOW_OBJECT, collects terrain profile data along a great circle line centered at the current position (view, eye, cursor or object) and perpendicular to the view heading - or object heading if FOLLOW_OBJECT.

If FOLLOW_NONE the profile is computed in between start and end latlon.

If FOLLOW_PATH the profile is computed along the path provided with setPathPositions(ArrayList)

Parameters:
dc - the current DrawContext

computeScale

protected double computeScale(Rectangle viewport)

computeViewCenterPosition

protected Position computeViewCenterPosition(DrawContext dc)

doPick

public void doPick(DrawContext dc,
                   Point pickPoint)
Overrides:
doPick in class AbstractLayer

doRender

public void doRender(DrawContext dc)
Specified by:
doRender in class AbstractLayer

drawFilledRectangle

protected void drawFilledRectangle(DrawContext dc,
                                   Vec4 origin,
                                   Dimension dimension,
                                   Color color)

drawGraph

protected void drawGraph(DrawContext dc,
                         Dimension dimension)

drawGrid

protected void drawGrid(DrawContext dc,
                        Dimension dimension)

drawGUI

protected void drawGUI(DrawContext dc,
                       Dimension dimension)

drawHorizontalLine

protected void drawHorizontalLine(DrawContext dc,
                                  Dimension dimension,
                                  double y)

drawLabel

protected void drawLabel(DrawContext dc,
                         String text,
                         Vec4 screenPoint,
                         int align)

drawLine

protected void drawLine(DrawContext dc,
                        double x1,
                        double y1,
                        double x2,
                        double y2)

drawProfile

public void drawProfile(DrawContext dc)

drawVerticalLine

protected void drawVerticalLine(DrawContext dc,
                                Dimension dimension,
                                double x)

getBackgroundColor

protected Color getBackgroundColor(Color color)

getBorderWidth

public int getBorderWidth()

getColor

public Color getColor()
Get the graphic color.

Returns:
the graphic Color.

getEndLatLon

public LatLon getEndLatLon()
Get the profile end position lat/lon when FOLLOW_NONE.

Returns:
the profile end position lat/lon.

getFollow

public String getFollow()
Get the graph center point placement behavior.

Returns:
the graph center point placement behavior.

getFont

public Font getFont()
Get the graphic legend Font.

Returns:
the graphic legend Font.

getIsMaximized

public boolean getIsMaximized()
Get whether the profile graph is maximized - displays over the whole viewport.

Returns:
true if the profile graph is maximized.

getIsMinimized

public boolean getIsMinimized()
Get whether the profile graph is minimized.

Returns:
true if the profile graph is minimized.

getKeepProportions

public boolean getKeepProportions()
Get whether distance/elevation proportions are maintained.

Returns:
true if the graph maintains distance/elevation proportions.

getLocationCenter

public Point getLocationCenter()
Get the screen location of the graph center if set (can be null).

Returns:
the screen location of the graph center if set (can be null).

getLocationOffset

public Vec4 getLocationOffset()
Returns the current location offset. See setLocationOffset(gov.nasa.worldwind.geom.Vec4) for a description of the offset and its values.

Returns:
the location offset. Will be null if no offset has been specified.

getObjectHeading

public Angle getObjectHeading()
Get the object heading the graph follows when it is set to FOLLOW_OBJECT. The profile graph will be computed perpendicular to the object heading direction.

Returns:
the object heading the graph follows.

getObjectPosition

public Position getObjectPosition()
Get the object position the graph follows when it is set to FOLLOW_OBJECT.

Returns:
the object position the graph follows.

getOpacity

public double getOpacity()
Returns the layer's opacity value. The opacity is modified slightly for various elements of the chart to distinguish among them.

Specified by:
getOpacity in interface Layer
Overrides:
getOpacity in class AbstractLayer
Returns:
The layer opacity, a value between 0 and 1.
See Also:
getColor()

getPathPositions

public List<? extends LatLon> getPathPositions()
Get the path positions that the profile follows if set to FOLLOW_PATH.

Returns:
the path positions that the profile follows.

getPathType

public int getPathType()

getPickedLine

public Polyline getPickedLine()
Get the Polyline used to render the picked position on the terrain.

Returns:
the Polyline used to render the picked position on the terrain.

getPosition

public String getPosition()

getProfileLenghtFactor

public double getProfileLenghtFactor()
Get the profile length factor.

Returns:
the profile length factor.

getProfileLine

public Polyline getProfileLine()
Get the Polyline used to render the profile line on the ground.

Returns:
the Polyline used to render the profile line on the ground.

getResizeBehavior

public String getResizeBehavior()
Returns the layer's resize behavior.

Returns:
the layer's resize behavior.

getSamples

public int getSamples()
Get the number of elevation samples in the profile.

Returns:
the number of elevation samples in the profile.

getShowEyePosition

public boolean getShowEyePosition()
Get whether the eye or object position is shown on the graph when FOLLOW_EYE or FOLLOW_OBJECT.

Returns:
true if the eye or object position is shown on the graph.

getSize

public Dimension getSize()
Get the graphic Dimension (in pixels).

Returns:
the scalebar graphic Dimension.

getStartLatLon

public LatLon getStartLatLon()
Get the profile start position lat/lon when FOLLOW_NONE.

Returns:
the profile start position lat/lon.

getToViewportScale

public double getToViewportScale()
Returns the graphic-to-viewport scale factor.

Returns:
the graphic-to-viewport scale factor.

getUnit

public String getUnit()

getZeroBased

public boolean getZeroBased()
Get whether the profile graph should include sea level.

Returns:
whether the profile graph should include sea level.

initialize

protected void initialize(DrawContext dc)

isShowPickedLine

public boolean isShowPickedLine()
Get whether the picked line is displayed over the ground.

Returns:
true if the picked line is displayed over the ground.

isShowProfileLine

public boolean isShowProfileLine()
Get whether the profile line is displayed over the ground.

Returns:
true is the profile line is displayed over the ground.

moved

public void moved(PositionEvent event)
Specified by:
moved in interface PositionListener

propertyChange

public void propertyChange(PropertyChangeEvent propertyChangeEvent)
Description copied from class: WWObjectImpl
The property change listener for this instance. Receives property change notifications that this instance has registered with other property change notifiers.

Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class WWObjectImpl
Parameters:
propertyChangeEvent - the event

selected

public void selected(SelectEvent event)
Specified by:
selected in interface SelectListener

setBorderWidth

public void setBorderWidth(int borderWidth)
Sets the graphic offset from the viewport border.

Parameters:
borderWidth - the number of pixels to offset the graphic from the borders indicated by setPosition(String).

setColor

public void setColor(Color color)
Set the graphic Color.

Parameters:
color - the graphic Color.

setEndLatLon

public void setEndLatLon(LatLon latLon)
Set the profile end position lat/lon when FOLLOW_NONE.

Parameters:
latLon - the profile end position lat/lon.

setEventSource

public void setEventSource(WorldWindow wwd)

setFollow

public void setFollow(String behavior)
Set the graph center point placement behavior. Can be one of FOLLOW_VIEW (the default), FOLLOW_CURSOR, FOLLOW_EYE, FOLLOW_OBJECT, FOLLOW_NONE or FOLLOW_PATH. If FOLLOW_NONE the profile will be computed between startLatLon and endLatLon. If FOLLOW_PATH the profile will be computed along the path defined with setPathPositions(java.util.ArrayList).

Parameters:
behavior - the graph center point placement behavior.

setFont

public void setFont(Font font)
Set the graphic legend Font.

Parameters:
font - the graphic legend Font.

setIsMaximized

public void setIsMaximized(boolean state)
Set wheter the profile graph should be maximized - displays over the whole viewport.

Parameters:
state - true if the profile should be maximized.

setIsMinimized

public void setIsMinimized(boolean state)
Set whether the profile graph should be minimized.

Note that the graph can be both minimized and maximized at the same time. The minimized state will take precedence and the graph will display as an icon. When 'un-minimized' it will display as maximized.

Parameters:
state - true if the profile should be minimized.

setKeepProportions

public void setKeepProportions(boolean state)
Set whether distance/elevation proportions are maintained.

Parameters:
state - true if the graph should maintains distance/elevation proportions.

setLocationCenter

public void setLocationCenter(Point point)
Set the screen location of the graph center - overrides setPosition(java.lang.String) if not null.

Parameters:
point - the screen location of the graph center (can be null).

setLocationOffset

public void setLocationOffset(Vec4 locationOffset)
Specifies a placement offset from the layer position on the screen.

Parameters:
locationOffset - the number of pixels to shift the layer image from its specified screen position. A positive X value shifts the image to the right. A positive Y value shifts the image up. If null, no offset is applied. The default offset is null.
See Also:
setLocationCenter(java.awt.Point), setPosition(java.lang.String)

setObjectHeading

public void setObjectHeading(Angle heading)
Set the object heading the graph follows when it is set to FOLLOW_OBJECT. The profile graph will be computed perpendicular to the object heading direction.

Parameters:
heading - the object heading the graph follows.

setObjectPosition

public void setObjectPosition(Position pos)
Set the object position the graph follows when it is set to FOLLOW_OBJECT.

Parameters:
pos - the object position the graph follows.

setOpacity

public void setOpacity(double opacity)
Sets the layer opacity, which is applied to the layer's chart. The opacity is modified slightly for various elements of the chart to distinguish among them.

Specified by:
setOpacity in interface Layer
Overrides:
setOpacity in class AbstractLayer
Parameters:
opacity - the current opacity value, which is ignored by this layer.
See Also:
setColor(java.awt.Color)

setPathPositions

public void setPathPositions(ArrayList<? extends LatLon> positions)
Set the path positions that the profile should follow if FOLLOW_PATH.

Parameters:
positions - the path positions that the profile should follow.

setPathType

public void setPathType(int type)
Sets the type of path to follow, one of Polyline.GREAT_CIRCLE, which computes each segment of the path as a great circle, or Polyline.RHUMB_LINE, which computes each segment of the path as a line of constant heading.

Parameters:
type - the type of path to follow.

setPosition

protected void setPosition(int index,
                           LatLon latLon)

setPosition

public void setPosition(String position)
Sets the relative viewport location to display the graphic. Can be one of AVKey.NORTHEAST, AVKey.NORTHWEST, AVKey.SOUTHEAST, or AVKey.SOUTHWEST (the default). These indicate the corner of the viewport.

Parameters:
position - the desired graphic position.

setProfileLengthFactor

public void setProfileLengthFactor(double factor)
Set the profile length factor - has no effect if FOLLOW_NONE or FOLLOW_PATH

Parameters:
factor - the new profile length factor.

setResizeBehavior

public void setResizeBehavior(String resizeBehavior)
Sets the behavior the layer uses to size the graphic when the viewport size changes, typically when the World Wind window is resized. If the value is AVKey.RESIZE_KEEP_FIXED_SIZE, the graphic size is kept to the size specified in its Dimension scaled by the layer's current icon scale. If the value is AVKey.RESIZE_STRETCH, the graphic is resized to have a constant size relative to the current viewport size. If the viewport shrinks the graphic size decreases; if it expands then the graphic enlarges. If the value is AVKey.RESIZE_SHRINK_ONLY (the default), graphic sizing behaves as for AVKey.RESIZE_STRETCH but it will not grow larger than the size specified in its Dimension.

Parameters:
resizeBehavior - the desired resize behavior

setSamples

public void setSamples(int number)
Set the number of elevation samples in the profile.

Parameters:
number - the number of elevation samples in the profile.

setShowEyePosition

public void setShowEyePosition(Boolean state)
Set whether the eye or object position should be shown on the graph when FOLLOW_EYE or FOLLOW_OBJECT.

Parameters:
state - if true the eye or object position should be shown on the graph.

setShowPickedLine

public void setShowPickedLine(boolean state)
Set whether the picked line should be displayed over the ground.

Parameters:
state - if the picked line should be displayed over the ground.

setShowProfileLine

public void setShowProfileLine(boolean state)
Set whether the profile line should be displayed over the terrain.

Parameters:
state - true if the profile line should be displayed over the terrain.

setSize

public void setSize(Dimension size)
Set the graphic Dimension (in pixels).

Parameters:
size - the graphic Dimension.

setStartLatLon

public void setStartLatLon(LatLon latLon)
Set the profile start position lat/lon when FOLLOW_NONE.

Parameters:
latLon - the profile start position lat/lon.

setToViewportScale

public void setToViewportScale(double toViewportScale)
Sets the scale factor applied to the viewport size to determine the displayed size of the graphic. This scale factor is used only when the layer's resize behavior is AVKey.RESIZE_STRETCH or AVKey.RESIZE_SHRINK_ONLY. The graphic's width is adjusted to occupy the proportion of the viewport's width indicated by this factor. The graphic's height is adjusted to maintain the graphic's Dimension aspect ratio.

Parameters:
toViewportScale - the graphic to viewport scale factor.

setUnit

public void setUnit(String unit)
Sets the unit the graphic uses to display distances and elevations. Can be one of UNIT_METRIC (the default), or UNIT_IMPERIAL.

Parameters:
unit - the desired unit.

setZeroBased

public void setZeroBased(boolean state)
Set whether the profile graph should include sea level. True is the default.

Parameters:
state - true if the profile graph should include sea level.

toString

public String toString()
Overrides:
toString in class AbstractLayer

NASA World Wind