Class TerrainProfileLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.TerrainProfileLayer
-
- All Implemented Interfaces:
AVList,Disposable,MessageListener,PositionListener,SelectListener,Layer,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.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
Nested Classes Modifier and Type Class Description protected classTerrainProfileLayer.OrderedIcon
-
Field Summary
Fields Modifier and Type Field Description protected intborderWidthprotected java.lang.StringbuttonMaximizeprotected java.lang.StringbuttonMinimizeprotected java.awt.Colorcolorprotected java.awt.FontdefaultFontprotected LatLonendLatLonprotected java.lang.Stringfollowstatic java.lang.StringFOLLOW_CURSORstatic java.lang.StringFOLLOW_EYEstatic java.lang.StringFOLLOW_NONEstatic java.lang.StringFOLLOW_OBJECTstatic java.lang.StringFOLLOW_PATHstatic java.lang.StringFOLLOW_VIEWprotected booleaninitializedprotected booleanisMaximizedprotected booleanisMinimizedprotected booleankeepProportionsprotected doublelengthprotected java.awt.PointlocationCenterprotected Vec4locationOffsetprotected doublemaxElevationstatic doubleMETER_TO_FEETprotected doubleminElevationprotected static intMINIMIZED_SIZEprotected AngleobjectHeadingprotected PositionobjectPositionprotected TerrainProfileLayer.OrderedIconorderedImageprotected java.util.ArrayList<? extends LatLon>pathPositionsprotected java.lang.StringpathTypeprotected intpickedSampleprotected PickSupportpickSupportprotected java.lang.Stringpositionprotected Position[]positionsprotected doubleprofileLengthFactorprotected java.lang.StringresizeBehaviorprotected intsamplesprotected booleanshowEyePositionprotected booleanshowPickedLineprotected booleanshowProfileLineprotected java.awt.Dimensionsizeprotected LatLonstartLatLonprotected doubletoViewportScaleprotected java.lang.Stringunitstatic java.lang.StringUNIT_IMPERIALstatic java.lang.StringUNIT_METRICprotected WorldWindowwwdprotected booleanzeroBased
-
Constructor Summary
Constructors Constructor Description TerrainProfileLayer()Renders a terrain profile graphic in a screen corner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PositioncomputeCursorPosition(DrawContext dc)protected Vec4computeLocation(java.awt.Rectangle viewport, double scale)protected voidcomputeMirroredPositions(LatLon centerLatLon)protected intcomputeObjectSample(LatLon pos)Compute the sample number along the path closest to the givenLatLon.protected doublecomputePathLength()protected voidcomputePathPositions()protected PositioncomputePickPosition(DrawContext dc, Vec4 locationSW, java.awt.Dimension mapSize)Computes the Position of the pickPoint over the graph and updates pickedSample indiceprotected voidcomputeProfile(DrawContext dc)Compute the terrain profile.protected doublecomputeScale(java.awt.Rectangle viewport)protected PositioncomputeViewCenterPosition(DrawContext dc)voiddoPick(DrawContext dc, java.awt.Point pickPoint)voiddoRender(DrawContext dc)protected voiddrawFilledRectangle(DrawContext dc, Vec4 origin, java.awt.Dimension dimension, java.awt.Color color)protected voiddrawGraph(DrawContext dc, java.awt.Dimension dimension)protected voiddrawGrid(DrawContext dc, java.awt.Dimension dimension)protected voiddrawGUI(DrawContext dc, java.awt.Dimension dimension)protected voiddrawHorizontalLine(DrawContext dc, java.awt.Dimension dimension, double y)protected voiddrawLabel(DrawContext dc, java.lang.String text, Vec4 screenPoint, int align)protected voiddrawLine(DrawContext dc, double x1, double y1, double x2, double y2)voiddrawProfile(DrawContext dc)protected voiddrawVerticalLine(DrawContext dc, java.awt.Dimension dimension, double x)java.lang.StringgetAVKeyPathType()protected java.awt.ColorgetBackgroundColor(java.awt.Color color)intgetBorderWidth()java.awt.ColorgetColor()Get the graphic color.LatLongetEndLatLon()Get the profile end position lat/lon whenFOLLOW_NONE.java.lang.StringgetFollow()Get the graph center point placement behavior.java.awt.FontgetFont()Get the graphic legend Font.booleangetIsMaximized()Get whether the profile graph is maximized - displays over the whole viewport.booleangetIsMinimized()Get whether the profile graph is minimized.booleangetKeepProportions()Get whether distance/elevation proportions are maintained.java.awt.PointgetLocationCenter()Get the screen location of the graph center if set (can be null).Vec4getLocationOffset()Returns the current location offset.AnglegetObjectHeading()Get the object heading the graph follows when it is set toFOLLOW_OBJECT.PositiongetObjectPosition()Get the object position the graph follows when it is set toFOLLOW_OBJECT.doublegetOpacity()Returns the layer's opacity value.java.util.List<? extends LatLon>getPathPositions()Get the path positions that the profile follows if set toFOLLOW_PATH.PathgetPickedLine()Get thePathused to render the picked position on the terrain.java.lang.StringgetPosition()doublegetProfileLenghtFactor()Get the profile length factor.PathgetProfileLine()Get thePathused to render the profile line on the ground.java.lang.StringgetResizeBehavior()Returns the layer's resize behavior.intgetSamples()Get the number of elevation samples in the profile.booleangetShowEyePosition()Get whether the eye or object position is shown on the graph whenFOLLOW_EYEorFOLLOW_OBJECT.java.awt.DimensiongetSize()Get the graphic Dimension (in pixels).LatLongetStartLatLon()Get the profile start position lat/lon whenFOLLOW_NONE.doublegetToViewportScale()Returns the graphic-to-viewport scale factor.java.lang.StringgetUnit()booleangetZeroBased()Get whether the profile graph should include sea level.protected voidinitialize(DrawContext dc)booleanisShowPickedLine()Get whether the picked line is displayed over the ground.booleanisShowProfileLine()Get whether the profile line is displayed over the ground.voidmoved(PositionEvent event)voidpropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)The property change listener for this instance.voidselected(SelectEvent event)voidsetBorderWidth(int borderWidth)Sets the graphic offset from the viewport border.voidsetColor(java.awt.Color color)Set the graphic Color.voidsetEndLatLon(LatLon latLon)Set the profile end position lat/lon whenFOLLOW_NONE.voidsetEventSource(WorldWindow wwd)voidsetFollow(java.lang.String behavior)Set the graph center point placement behavior.voidsetFont(java.awt.Font font)Set the graphic legend Font.voidsetIsMaximized(boolean state)Set whether the profile graph should be maximized - displays over the whole viewport.voidsetIsMinimized(boolean state)Set whether the profile graph should be minimized.voidsetKeepProportions(boolean state)Set whether distance/elevation proportions are maintained.voidsetLocationCenter(java.awt.Point point)Set the screen location of the graph center - overridessetPosition(java.lang.String)if not null.voidsetLocationOffset(Vec4 locationOffset)Specifies a placement offset from the layer position on the screen.voidsetObjectHeading(Angle heading)Set the object heading the graph follows when it is set toFOLLOW_OBJECT.voidsetObjectPosition(Position pos)Set the object position the graph follows when it is set toFOLLOW_OBJECT.voidsetOpacity(double opacity)Sets the layer opacity, which is applied to the layer's chart.voidsetPathPositions(java.util.ArrayList<? extends LatLon> positions)Set the path positions that the profile should follow ifFOLLOW_PATH.voidsetPathType(java.lang.String pathType)Sets the type of path to follow, one ofAVKey.GREAT_CIRCLE, which computes each segment of the path as a great circle, orAVKey.RHUMB_LINE, which computes each segment of the path as a line of constant heading.protected voidsetPosition(int index, LatLon latLon)voidsetPosition(java.lang.String position)Sets the relative viewport location to display the graphic.voidsetProfileLengthFactor(double factor)Set the profile length factor - has no effect ifFOLLOW_NONEorFOLLOW_PATHvoidsetResizeBehavior(java.lang.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.voidsetSamples(int number)Set the number of elevation samples in the profile.voidsetShowEyePosition(java.lang.Boolean state)Set whether the eye or object position should be shown on the graph whenFOLLOW_EYEorFOLLOW_OBJECT.voidsetShowPickedLine(boolean state)Set whether the picked line should be displayed over the ground.voidsetShowProfileLine(boolean state)Set whether the profile line should be displayed over the terrain.voidsetSize(java.awt.Dimension size)Set the graphic Dimension (in pixels).voidsetStartLatLon(LatLon latLon)Set the profile start position lat/lon whenFOLLOW_NONE.voidsetToViewportScale(double toViewportScale)Sets the scale factor applied to the viewport size to determine the displayed size of the graphic.voidsetUnit(java.lang.String unit)Sets the unit the graphic uses to display distances and elevations.voidsetZeroBased(boolean state)Set whether the profile graph should include sea level.java.lang.StringtoString()-
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, 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
-
UNIT_METRIC
public static final java.lang.String UNIT_METRIC
- See Also:
- Constant Field Values
-
UNIT_IMPERIAL
public static final java.lang.String UNIT_IMPERIAL
- See Also:
- Constant Field Values
-
METER_TO_FEET
public static final double METER_TO_FEET
- See Also:
- Constant Field Values
-
FOLLOW_VIEW
public static final java.lang.String FOLLOW_VIEW
- See Also:
- Constant Field Values
-
FOLLOW_EYE
public static final java.lang.String FOLLOW_EYE
- See Also:
- Constant Field Values
-
FOLLOW_CURSOR
public static final java.lang.String FOLLOW_CURSOR
- See Also:
- Constant Field Values
-
FOLLOW_NONE
public static final java.lang.String FOLLOW_NONE
- See Also:
- Constant Field Values
-
FOLLOW_OBJECT
public static final java.lang.String FOLLOW_OBJECT
- See Also:
- Constant Field Values
-
FOLLOW_PATH
public static final java.lang.String FOLLOW_PATH
- See Also:
- Constant Field Values
-
MINIMIZED_SIZE
protected static final int MINIMIZED_SIZE
- See Also:
- Constant Field Values
-
buttonMinimize
protected final java.lang.String buttonMinimize
- See Also:
- Constant Field Values
-
buttonMaximize
protected final java.lang.String buttonMaximize
- See Also:
- Constant Field Values
-
size
protected java.awt.Dimension size
-
color
protected java.awt.Color color
-
borderWidth
protected int borderWidth
-
position
protected java.lang.String position
-
resizeBehavior
protected java.lang.String resizeBehavior
-
unit
protected java.lang.String unit
-
defaultFont
protected java.awt.Font defaultFont
-
toViewportScale
protected double toViewportScale
-
locationCenter
protected java.awt.Point locationCenter
-
locationOffset
protected Vec4 locationOffset
-
pickSupport
protected PickSupport pickSupport
-
initialized
protected boolean initialized
-
isMinimized
protected boolean isMinimized
-
isMaximized
protected boolean isMaximized
-
showProfileLine
protected boolean showProfileLine
-
showPickedLine
protected boolean showPickedLine
-
pickedSample
protected int pickedSample
-
keepProportions
protected boolean keepProportions
-
zeroBased
protected boolean zeroBased
-
follow
protected java.lang.String follow
-
showEyePosition
protected boolean showEyePosition
-
profileLengthFactor
protected double profileLengthFactor
-
startLatLon
protected LatLon startLatLon
-
endLatLon
protected LatLon endLatLon
-
objectPosition
protected Position objectPosition
-
objectHeading
protected Angle objectHeading
-
pathPositions
protected java.util.ArrayList<? extends LatLon> pathPositions
-
pathType
protected java.lang.String pathType
-
samples
protected int samples
-
minElevation
protected double minElevation
-
maxElevation
protected double maxElevation
-
length
protected double length
-
positions
protected Position[] positions
-
wwd
protected WorldWindow wwd
-
orderedImage
protected TerrainProfileLayer.OrderedIcon orderedImage
-
-
Method Detail
-
getIsMinimized
public boolean getIsMinimized()
Get whether the profile graph is minimized.- Returns:
- true if the profile graph is minimized.
-
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.
-
getIsMaximized
public boolean getIsMaximized()
Get whether the profile graph is maximized - displays over the whole viewport.- Returns:
- true if the profile graph is maximized.
-
setIsMaximized
public void setIsMaximized(boolean state)
Set whether the profile graph should be maximized - displays over the whole viewport.- Parameters:
state- true if the profile should be maximized.
-
getSize
public java.awt.Dimension getSize()
Get the graphic Dimension (in pixels).- Returns:
- the scalebar graphic Dimension.
-
setSize
public void setSize(java.awt.Dimension size)
Set the graphic Dimension (in pixels).- Parameters:
size- the graphic Dimension.
-
getColor
public java.awt.Color getColor()
Get the graphic color.- Returns:
- the graphic Color.
-
setColor
public void setColor(java.awt.Color color)
Set the graphic Color.- Parameters:
color- the graphic Color.
-
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:
setOpacityin interfaceLayer- Overrides:
setOpacityin classAbstractLayer- Parameters:
opacity- the current opacity value, which is ignored by this layer.- See Also:
setColor(java.awt.Color)
-
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:
getOpacityin interfaceLayer- Overrides:
getOpacityin classAbstractLayer- Returns:
- The layer opacity, a value between 0 and 1.
- See Also:
getColor()
-
getToViewportScale
public double getToViewportScale()
Returns the graphic-to-viewport scale factor.- Returns:
- the graphic-to-viewport scale factor.
-
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 isAVKey.RESIZE_STRETCHorAVKey.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.
-
getPosition
public java.lang.String getPosition()
-
setPosition
public void setPosition(java.lang.String position)
Sets the relative viewport location to display the graphic. Can be one ofAVKey.NORTHEAST,AVKey.NORTHWEST,AVKey.SOUTHEAST, orAVKey.SOUTHWEST(the default). These indicate the corner of the viewport.- Parameters:
position- the desired graphic position.
-
getLocationCenter
public java.awt.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).
-
setLocationCenter
public void setLocationCenter(java.awt.Point point)
Set the screen location of the graph center - overridessetPosition(java.lang.String)if not null.- Parameters:
point- the screen location of the graph center (can be null).
-
getLocationOffset
public Vec4 getLocationOffset()
Returns the current location offset. SeesetLocationOffset(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.
-
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)
-
getResizeBehavior
public java.lang.String getResizeBehavior()
Returns the layer's resize behavior.- Returns:
- the layer's resize behavior.
-
setResizeBehavior
public void setResizeBehavior(java.lang.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 isAVKey.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 isAVKey.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 isAVKey.RESIZE_SHRINK_ONLY(the default), graphic sizing behaves as forAVKey.RESIZE_STRETCHbut it will not grow larger than the size specified in its Dimension.- Parameters:
resizeBehavior- the desired resize behavior
-
getBorderWidth
public int getBorderWidth()
-
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 bysetPosition(String).
-
getUnit
public java.lang.String getUnit()
-
setUnit
public void setUnit(java.lang.String unit)
Sets the unit the graphic uses to display distances and elevations. Can be one ofUNIT_METRIC(the default), orUNIT_IMPERIAL.- Parameters:
unit- the desired unit.
-
getFont
public java.awt.Font getFont()
Get the graphic legend Font.- Returns:
- the graphic legend Font.
-
setFont
public void setFont(java.awt.Font font)
Set the graphic legend Font.- Parameters:
font- the graphic legend Font.
-
getKeepProportions
public boolean getKeepProportions()
Get whether distance/elevation proportions are maintained.- Returns:
- true if the graph maintains distance/elevation proportions.
-
setKeepProportions
public void setKeepProportions(boolean state)
Set whether distance/elevation proportions are maintained.- Parameters:
state- true if the graph should maintains distance/elevation proportions.
-
getFollow
public java.lang.String getFollow()
Get the graph center point placement behavior.- Returns:
- the graph center point placement behavior.
-
setFollow
public void setFollow(java.lang.String behavior)
Set the graph center point placement behavior. Can be one ofFOLLOW_VIEW(the default),FOLLOW_CURSOR,FOLLOW_EYE,FOLLOW_OBJECT,FOLLOW_NONEorFOLLOW_PATH. IfFOLLOW_NONEthe profile will be computed between startLatLon and endLatLon. IfFOLLOW_PATHthe profile will be computed along the path defined withsetPathPositions(java.util.ArrayList).- Parameters:
behavior- the graph center point placement behavior.
-
getShowEyePosition
public boolean getShowEyePosition()
Get whether the eye or object position is shown on the graph whenFOLLOW_EYEorFOLLOW_OBJECT.- Returns:
- true if the eye or object position is shown on the graph.
-
setShowEyePosition
public void setShowEyePosition(java.lang.Boolean state)
Set whether the eye or object position should be shown on the graph whenFOLLOW_EYEorFOLLOW_OBJECT.- Parameters:
state- if true the eye or object position should be shown on the graph.
-
setProfileLengthFactor
public void setProfileLengthFactor(double factor)
Set the profile length factor - has no effect ifFOLLOW_NONEorFOLLOW_PATH- Parameters:
factor- the new profile length factor.
-
getProfileLenghtFactor
public double getProfileLenghtFactor()
Get the profile length factor.- Returns:
- the profile length factor.
-
getStartLatLon
public LatLon getStartLatLon()
Get the profile start position lat/lon whenFOLLOW_NONE.- Returns:
- the profile start position lat/lon.
-
setStartLatLon
public void setStartLatLon(LatLon latLon)
Set the profile start position lat/lon whenFOLLOW_NONE.- Parameters:
latLon- the profile start position lat/lon.
-
getEndLatLon
public LatLon getEndLatLon()
Get the profile end position lat/lon whenFOLLOW_NONE.- Returns:
- the profile end position lat/lon.
-
setEndLatLon
public void setEndLatLon(LatLon latLon)
Set the profile end position lat/lon whenFOLLOW_NONE.- Parameters:
latLon- the profile end position lat/lon.
-
getSamples
public int getSamples()
Get the number of elevation samples in the profile.- Returns:
- the number of elevation samples in the profile.
-
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.
-
getZeroBased
public boolean getZeroBased()
Get whether the profile graph should include sea level.- Returns:
- whether the profile graph should include sea level.
-
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.
-
getObjectPosition
public Position getObjectPosition()
Get the object position the graph follows when it is set toFOLLOW_OBJECT.- Returns:
- the object position the graph follows.
-
setObjectPosition
public void setObjectPosition(Position pos)
Set the object position the graph follows when it is set toFOLLOW_OBJECT.- Parameters:
pos- the object position the graph follows.
-
getObjectHeading
public Angle getObjectHeading()
Get the object heading the graph follows when it is set toFOLLOW_OBJECT. The profile graph will be computed perpendicular to the object heading direction.- Returns:
- the object heading the graph follows.
-
setObjectHeading
public void setObjectHeading(Angle heading)
Set the object heading the graph follows when it is set toFOLLOW_OBJECT. The profile graph will be computed perpendicular to the object heading direction.- Parameters:
heading- the object heading the graph follows.
-
getPathPositions
public java.util.List<? extends LatLon> getPathPositions()
Get the path positions that the profile follows if set toFOLLOW_PATH.- Returns:
- the path positions that the profile follows.
-
setPathPositions
public void setPathPositions(java.util.ArrayList<? extends LatLon> positions)
Set the path positions that the profile should follow ifFOLLOW_PATH.- Parameters:
positions- the path positions that the profile should follow.
-
getAVKeyPathType
public java.lang.String getAVKeyPathType()
-
setPathType
public void setPathType(java.lang.String pathType)
Sets the type of path to follow, one ofAVKey.GREAT_CIRCLE, which computes each segment of the path as a great circle, orAVKey.RHUMB_LINE, which computes each segment of the path as a line of constant heading.- Parameters:
pathType- the type of path to follow.
-
getProfileLine
public Path getProfileLine()
Get thePathused to render the profile line on the ground.- Returns:
- the
Pathused to render the profile line on the ground.
-
getPickedLine
public Path getPickedLine()
Get thePathused to render the picked position on the terrain.- Returns:
- the
Pathused to render the picked position on the terrain.
-
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.
-
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.
-
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.
-
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.
-
doRender
public void doRender(DrawContext dc)
- Specified by:
doRenderin classAbstractLayer
-
doPick
public void doPick(DrawContext dc, java.awt.Point pickPoint)
- Overrides:
doPickin classAbstractLayer
-
initialize
protected void initialize(DrawContext dc)
-
drawProfile
public void drawProfile(DrawContext dc)
-
drawGrid
protected void drawGrid(DrawContext dc, java.awt.Dimension dimension)
-
drawGraph
protected void drawGraph(DrawContext dc, java.awt.Dimension dimension)
-
drawGUI
protected void drawGUI(DrawContext dc, java.awt.Dimension dimension)
-
drawHorizontalLine
protected void drawHorizontalLine(DrawContext dc, java.awt.Dimension dimension, double y)
-
drawVerticalLine
protected void drawVerticalLine(DrawContext dc, java.awt.Dimension dimension, double x)
-
drawFilledRectangle
protected void drawFilledRectangle(DrawContext dc, Vec4 origin, java.awt.Dimension dimension, java.awt.Color color)
-
drawLine
protected void drawLine(DrawContext dc, double x1, double y1, double x2, double y2)
-
drawLabel
protected void drawLabel(DrawContext dc, java.lang.String text, Vec4 screenPoint, int align)
-
getBackgroundColor
protected java.awt.Color getBackgroundColor(java.awt.Color color)
-
computeScale
protected double computeScale(java.awt.Rectangle viewport)
-
computeLocation
protected Vec4 computeLocation(java.awt.Rectangle viewport, double scale)
-
computePickPosition
protected Position computePickPosition(DrawContext dc, Vec4 locationSW, java.awt.Dimension mapSize)
Computes the Position of the pickPoint over the graph and updates pickedSample indice- Parameters:
dc- the current DrawContextlocationSW- the screen location of the bottom left corner of the graphmapSize- the graph screen dimension in pixels- Returns:
- the picked Position
-
computeObjectSample
protected int computeObjectSample(LatLon pos)
Compute the sample number along the path closest to the givenLatLon.- Parameters:
pos- the objectLatLon- Returns:
- the sample number or -1 if not found.
-
moved
public void moved(PositionEvent event)
- Specified by:
movedin interfacePositionListener
-
selected
public void selected(SelectEvent event)
- Specified by:
selectedin interfaceSelectListener
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Description copied from class:WWObjectImplThe property change listener for this instance. Receives property change notifications that this instance has registered with other property change notifiers.- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Overrides:
propertyChangein classWWObjectImpl- Parameters:
propertyChangeEvent- the event
-
setEventSource
public void setEventSource(WorldWindow wwd)
-
computeProfile
protected void computeProfile(DrawContext dc)
Compute the terrain profile.If
FOLLOW_VIEW,FOLLOW_EYE,FOLLOW_CURSORorFOLLOW_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 ifFOLLOW_OBJECT.If
FOLLOW_NONEthe profile is computed in between start and end latlon.If
FOLLOW_PATHthe profile is computed along the path provided withsetPathPositions(ArrayList)- Parameters:
dc- the currentDrawContext
-
computeViewCenterPosition
protected Position computeViewCenterPosition(DrawContext dc)
-
computeMirroredPositions
protected void computeMirroredPositions(LatLon centerLatLon)
-
computePathPositions
protected void computePathPositions()
-
computePathLength
protected double computePathLength()
-
setPosition
protected void setPosition(int index, LatLon latLon)
-
computeCursorPosition
protected Position computeCursorPosition(DrawContext dc)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractLayer
-
-