Package gov.nasa.worldwind.layers
Class ViewControlsLayer
- java.lang.Object
- 
- gov.nasa.worldwind.avlist.AVListImpl
- 
- gov.nasa.worldwind.WWObjectImpl
- 
- gov.nasa.worldwind.layers.AbstractLayer
- 
- gov.nasa.worldwind.layers.RenderableLayer
- 
- gov.nasa.worldwind.layers.ViewControlsLayer
 
 
 
 
 
- 
- All Implemented Interfaces:
- AVList,- Disposable,- MessageListener,- Layer,- Restorable,- WWObject,- java.beans.PropertyChangeListener,- java.util.EventListener
 
 public class ViewControlsLayer extends RenderableLayer This layer displays onscreen view controls. Controls are available for pan, zoom, heading, pitch, tilt, field-of-view and vertical exaggeration. Each of the controls can be enabled or disabled independently.An instance of this class depends on an instance of ViewControlsSelectListenerto control it. The select listener must be registered as such viaWorldWindow.addSelectListener(gov.nasa.worldwind.event.SelectListener).ViewControlsLayerinstances are not sharable amongWorldWindows.- See Also:
- ViewControlsSelectListener
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected intborderWidthprotected intbuttonSizeprotected ScreenAnnotationcontrolFovNarrowprotected ScreenAnnotationcontrolFovWideprotected ScreenAnnotationcontrolHeadingLeftprotected ScreenAnnotationcontrolHeadingRightprotected ScreenAnnotationcontrolLookprotected ScreenAnnotationcontrolPanprotected ScreenAnnotationcontrolPitchDownprotected ScreenAnnotationcontrolPitchUpprotected ScreenAnnotationcontrolVeDownprotected ScreenAnnotationcontrolVeUpprotected ScreenAnnotationcontrolZoomInprotected ScreenAnnotationcontrolZoomOutprotected ScreenAnnotationcurrentControlprotected static java.lang.StringIMAGE_FOV_NARROWprotected static java.lang.StringIMAGE_FOV_WIDEprotected static java.lang.StringIMAGE_HEADING_LEFTprotected static java.lang.StringIMAGE_HEADING_RIGHTprotected static java.lang.StringIMAGE_LOOKprotected static java.lang.StringIMAGE_PANprotected static java.lang.StringIMAGE_PITCH_DOWNprotected static java.lang.StringIMAGE_PITCH_UPprotected static java.lang.StringIMAGE_VE_DOWNprotected static java.lang.StringIMAGE_VE_UPprotected static java.lang.StringIMAGE_ZOOM_INprotected static java.lang.StringIMAGE_ZOOM_OUTprotected booleaninitializedprotected java.lang.Stringlayoutprotected Vec4locationCenterprotected Vec4locationOffsetprotected intpanSizeprotected java.lang.Stringpositionprotected java.awt.RectanglereferenceViewportprotected doublescaleprotected booleanshowFovControlsprotected booleanshowHeadingControlsprotected booleanshowLookControlsprotected booleanshowPanControlsprotected booleanshowPitchControlsprotected booleanshowVeControlsprotected booleanshowZoomControls- 
Fields inherited from class gov.nasa.worldwind.layers.RenderableLayerpickSupport, renderables, renderablesOverride
 
- 
 - 
Constructor SummaryConstructors Constructor Description ViewControlsLayer()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclearControls()protected java.awt.PointcomputeLocation(java.awt.Rectangle viewport, java.awt.Rectangle controls)Compute the screen location of the controls overall rectangle bottom right corner according to either the location center if not null, or the screen position.voiddoRender(DrawContext dc)intgetBorderWidth()protected intgetButtonSize()java.lang.StringgetControlType(java.lang.Object control)Get the control type associated with the given object or null if unknown.java.lang.ObjectgetHighlightedObject()Indicates the currently highlighted control, if any.protected java.lang.ObjectgetImageSource(java.lang.String control)Get a control image source.java.lang.StringgetLayout()Returns the current layout.Vec4getLocationCenter()Returns the current layer image location.Vec4getLocationOffset()Returns the current location offset.doublegetOpacity()Returns the layer's opacity value, which is ignored by this layer.protected intgetPanSize()java.lang.StringgetPosition()Returns the current relative view controls position.doublegetScale()Get the controls display scale.voidhighlight(java.lang.Object control)Specifies the control to highlight.protected voidinitialize(DrawContext dc)protected booleanisInitialized()booleanisShowFovControls()booleanisShowHeadingControls()booleanisShowLookControls()booleanisShowPanControls()booleanisShowPitchControls()booleanisShowVeControls()booleanisShowZoomControls()voidsetBorderWidth(int borderWidth)Sets the view controls offset from the viewport border.protected voidsetButtonSize(int buttonSize)voidsetLayout(java.lang.String layout)Sets the desired layout.voidsetLocationCenter(Vec4 locationCenter)Specifies the screen location of the layer, relative to the image's center.voidsetLocationOffset(Vec4 locationOffset)Specifies a placement offset from the layer position on the screen.voidsetOpacity(double opacity)Layer opacity is not applied to layers of this type.protected voidsetPanSize(int panSize)voidsetPosition(java.lang.String position)Sets the relative viewport location to display the view controls.voidsetScale(double scale)Set the controls display scale.voidsetShowFovControls(boolean state)voidsetShowHeadingControls(boolean state)voidsetShowLookControls(boolean state)voidsetShowPanControls(boolean state)voidsetShowPitchControls(boolean state)voidsetShowVeControls(boolean state)voidsetShowZoomControls(boolean state)java.lang.StringtoString()protected voidupdatePositions(DrawContext dc)- 
Methods inherited from class gov.nasa.worldwind.layers.RenderableLayeraddRenderable, addRenderable, addRenderables, clearRenderables, dispose, disposeRenderables, doPick, doPick, doPreRender, doPreRender, doRender, getActiveRenderables, getNumRenderables, getRenderables, onMessage, removeAllRenderables, removeRenderable, setRenderables
 - 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayercreateLayerConfigElements, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getRestorableState, 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.WWObjectImplpropertyChange
 - 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpladdPropertyChangeListener, 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.Objectclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface gov.nasa.worldwind.avlist.AVListaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
- 
 
- 
- 
- 
Field Detail- 
IMAGE_PANprotected static final java.lang.String IMAGE_PAN - See Also:
- Constant Field Values
 
 - 
IMAGE_LOOKprotected static final java.lang.String IMAGE_LOOK - See Also:
- Constant Field Values
 
 - 
IMAGE_HEADING_LEFTprotected static final java.lang.String IMAGE_HEADING_LEFT - See Also:
- Constant Field Values
 
 - 
IMAGE_HEADING_RIGHTprotected static final java.lang.String IMAGE_HEADING_RIGHT - See Also:
- Constant Field Values
 
 - 
IMAGE_ZOOM_INprotected static final java.lang.String IMAGE_ZOOM_IN - See Also:
- Constant Field Values
 
 - 
IMAGE_ZOOM_OUTprotected static final java.lang.String IMAGE_ZOOM_OUT - See Also:
- Constant Field Values
 
 - 
IMAGE_PITCH_UPprotected static final java.lang.String IMAGE_PITCH_UP - See Also:
- Constant Field Values
 
 - 
IMAGE_PITCH_DOWNprotected static final java.lang.String IMAGE_PITCH_DOWN - See Also:
- Constant Field Values
 
 - 
IMAGE_FOV_NARROWprotected static final java.lang.String IMAGE_FOV_NARROW - See Also:
- Constant Field Values
 
 - 
IMAGE_FOV_WIDEprotected static final java.lang.String IMAGE_FOV_WIDE - See Also:
- Constant Field Values
 
 - 
IMAGE_VE_UPprotected static final java.lang.String IMAGE_VE_UP - See Also:
- Constant Field Values
 
 - 
IMAGE_VE_DOWNprotected static final java.lang.String IMAGE_VE_DOWN - See Also:
- Constant Field Values
 
 - 
controlPanprotected ScreenAnnotation controlPan 
 - 
controlLookprotected ScreenAnnotation controlLook 
 - 
controlHeadingLeftprotected ScreenAnnotation controlHeadingLeft 
 - 
controlHeadingRightprotected ScreenAnnotation controlHeadingRight 
 - 
controlZoomInprotected ScreenAnnotation controlZoomIn 
 - 
controlZoomOutprotected ScreenAnnotation controlZoomOut 
 - 
controlPitchUpprotected ScreenAnnotation controlPitchUp 
 - 
controlPitchDownprotected ScreenAnnotation controlPitchDown 
 - 
controlFovNarrowprotected ScreenAnnotation controlFovNarrow 
 - 
controlFovWideprotected ScreenAnnotation controlFovWide 
 - 
controlVeUpprotected ScreenAnnotation controlVeUp 
 - 
controlVeDownprotected ScreenAnnotation controlVeDown 
 - 
currentControlprotected ScreenAnnotation currentControl 
 - 
positionprotected java.lang.String position 
 - 
layoutprotected java.lang.String layout 
 - 
locationCenterprotected Vec4 locationCenter 
 - 
locationOffsetprotected Vec4 locationOffset 
 - 
scaleprotected double scale 
 - 
borderWidthprotected int borderWidth 
 - 
buttonSizeprotected int buttonSize 
 - 
panSizeprotected int panSize 
 - 
initializedprotected boolean initialized 
 - 
referenceViewportprotected java.awt.Rectangle referenceViewport 
 - 
showPanControlsprotected boolean showPanControls 
 - 
showLookControlsprotected boolean showLookControls 
 - 
showZoomControlsprotected boolean showZoomControls 
 - 
showHeadingControlsprotected boolean showHeadingControls 
 - 
showPitchControlsprotected boolean showPitchControls 
 - 
showFovControlsprotected boolean showFovControls 
 - 
showVeControlsprotected boolean showVeControls 
 
- 
 - 
Method Detail- 
getBorderWidthpublic int getBorderWidth() 
 - 
setBorderWidthpublic void setBorderWidth(int borderWidth) Sets the view controls offset from the viewport border.- Parameters:
- borderWidth- the number of pixels to offset the view controls from the borders indicated by- setPosition(String).
 
 - 
getScalepublic double getScale() Get the controls display scale.- Specified by:
- getScalein interface- Layer
- Overrides:
- getScalein class- AbstractLayer
- Returns:
- the controls display scale.
 
 - 
setScalepublic void setScale(double scale) Set the controls display scale.- Parameters:
- scale- the controls display scale.
 
 - 
getButtonSizeprotected int getButtonSize() 
 - 
setButtonSizeprotected void setButtonSize(int buttonSize) 
 - 
getPanSizeprotected int getPanSize() 
 - 
setPanSizeprotected void setPanSize(int panSize) 
 - 
getPositionpublic java.lang.String getPosition() Returns the current relative view controls position.- Returns:
- the current view controls position.
 
 - 
setPositionpublic void setPosition(java.lang.String position) Sets the relative viewport location to display the view controls. Can be one ofAVKey.NORTHEAST,AVKey.NORTHWEST,AVKey.SOUTHEAST, orAVKey.SOUTHWEST(the default). These indicate the corner of the viewport to place view controls.- Parameters:
- position- the desired view controls position, in screen coordinates.
 
 - 
getLayoutpublic java.lang.String getLayout() Returns the current layout. Can be one ofAVKey.HORIZONTALorAVKey.VERTICAL.- Returns:
- the current layout.
 
 - 
setLayoutpublic void setLayout(java.lang.String layout) Sets the desired layout. Can be one ofAVKey.HORIZONTALorAVKey.VERTICAL.- Parameters:
- layout- the desired layout.
 
 - 
setOpacitypublic void setOpacity(double opacity) Layer opacity is not applied to layers of this type. Opacity is controlled by the alpha values of the operation images.- Specified by:
- setOpacityin interface- Layer
- Overrides:
- setOpacityin class- RenderableLayer
- Parameters:
- opacity- the current opacity value, which is ignored by this layer.
 
 - 
getOpacitypublic double getOpacity() Returns the layer's opacity value, which is ignored by this layer. Opacity is controlled by the alpha values of the operation images.- Specified by:
- getOpacityin interface- Layer
- Overrides:
- getOpacityin class- RenderableLayer
- Returns:
- The layer opacity, a value between 0 and 1.
 
 - 
getLocationCenterpublic Vec4 getLocationCenter() Returns the current layer image location.- Returns:
- the current location center. May be null.
 
 - 
setLocationCenterpublic void setLocationCenter(Vec4 locationCenter) Specifies the screen location of the layer, relative to the image's center. May be null. If this value is non-null, it overrides the position specified bysetPosition(String). The location is specified in pixels. The origin is the window's lower left corner. Positive X values are to the right of the origin, positive Y values are upwards from the origin. The final image location will be affected by the currently specified location offset if a non-null location offset has been specified (seesetLocationOffset(gov.nasa.worldwind.geom.Vec4))}.- Parameters:
- locationCenter- the location center. May be null.
- See Also:
- setPosition(String),- setLocationOffset(gov.nasa.worldwind.geom.Vec4)
 
 - 
getLocationOffsetpublic Vec4 getLocationOffset() Returns the current location offset. See #setLocationOffset for a description of the offset and its values.- Returns:
- the location offset. Will be null if no offset has been specified.
 
 - 
setLocationOffsetpublic 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(gov.nasa.worldwind.geom.Vec4),- setPosition(String)
 
 - 
isShowPanControlspublic boolean isShowPanControls() 
 - 
setShowPanControlspublic void setShowPanControls(boolean state) 
 - 
isShowLookControlspublic boolean isShowLookControls() 
 - 
setShowLookControlspublic void setShowLookControls(boolean state) 
 - 
isShowHeadingControlspublic boolean isShowHeadingControls() 
 - 
setShowHeadingControlspublic void setShowHeadingControls(boolean state) 
 - 
isShowZoomControlspublic boolean isShowZoomControls() 
 - 
setShowZoomControlspublic void setShowZoomControls(boolean state) 
 - 
isShowPitchControlspublic boolean isShowPitchControls() 
 - 
setShowPitchControlspublic void setShowPitchControls(boolean state) 
 - 
isShowFovControlspublic boolean isShowFovControls() 
 - 
setShowFovControlspublic void setShowFovControls(boolean state) 
 - 
setShowVeControlspublic void setShowVeControls(boolean state) 
 - 
isShowVeControlspublic boolean isShowVeControls() 
 - 
getControlTypepublic java.lang.String getControlType(java.lang.Object control) Get the control type associated with the given object or null if unknown.- Parameters:
- control- the control object
- Returns:
- the control type. Can be one of AVKey.VIEW_PAN,AVKey.VIEW_LOOK,AVKey.VIEW_HEADING_LEFT,AVKey.VIEW_HEADING_RIGHT,AVKey.VIEW_ZOOM_IN,AVKey.VIEW_ZOOM_OUT,AVKey.VIEW_PITCH_UP,AVKey.VIEW_PITCH_DOWN,AVKey.VIEW_FOV_NARROWorAVKey.VIEW_FOV_WIDE.Returns null if the object is not a view control associated with this layer. 
 
 - 
getHighlightedObjectpublic java.lang.Object getHighlightedObject() Indicates the currently highlighted control, if any.- Returns:
- the currently highlighted control, or null if no control is highlighted.
 
 - 
highlightpublic void highlight(java.lang.Object control) Specifies the control to highlight. Any currently highlighted control is un-highlighted.- Parameters:
- control- the control to highlight.
 
 - 
doRenderpublic void doRender(DrawContext dc) - Overrides:
- doRenderin class- RenderableLayer
 
 - 
isInitializedprotected boolean isInitialized() 
 - 
initializeprotected void initialize(DrawContext dc) 
 - 
getImageSourceprotected java.lang.Object getImageSource(java.lang.String control) Get a control image source.- Parameters:
- control- the control type. Can be one of- AVKey.VIEW_PAN,- AVKey.VIEW_LOOK,- AVKey.VIEW_HEADING_LEFT,- AVKey.VIEW_HEADING_RIGHT,- AVKey.VIEW_ZOOM_IN,- AVKey.VIEW_ZOOM_OUT,- AVKey.VIEW_PITCH_UP,- AVKey.VIEW_PITCH_DOWN,- AVKey.VIEW_FOV_NARROWor- AVKey.VIEW_FOV_WIDE.
- Returns:
- the image source associated with the given control type.
 
 - 
updatePositionsprotected void updatePositions(DrawContext dc) 
 - 
computeLocationprotected java.awt.Point computeLocation(java.awt.Rectangle viewport, java.awt.Rectangle controls)Compute the screen location of the controls overall rectangle bottom right corner according to either the location center if not null, or the screen position.- Parameters:
- viewport- the current viewport rectangle.
- controls- the overall controls rectangle
- Returns:
- the screen location of the bottom left corner - south west corner.
 
 - 
clearControlsprotected void clearControls() 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- RenderableLayer
 
 
- 
 
-