public class ViewControlsLayer extends RenderableLayer
ViewControlsSelectListener
to control it. The select
listener must be registered as such via WorldWindow.addSelectListener(gov.nasa.worldwind.event.SelectListener)
.
ViewControlsLayer
instances are not sharable among WorldWindow
s.ViewControlsSelectListener
Modifier and Type | Field and Description |
---|---|
protected int |
borderWidth |
protected int |
buttonSize |
protected ScreenAnnotation |
controlFovNarrow |
protected ScreenAnnotation |
controlFovWide |
protected ScreenAnnotation |
controlHeadingLeft |
protected ScreenAnnotation |
controlHeadingRight |
protected ScreenAnnotation |
controlLook |
protected ScreenAnnotation |
controlPan |
protected ScreenAnnotation |
controlPitchDown |
protected ScreenAnnotation |
controlPitchUp |
protected ScreenAnnotation |
controlVeDown |
protected ScreenAnnotation |
controlVeUp |
protected ScreenAnnotation |
controlZoomIn |
protected ScreenAnnotation |
controlZoomOut |
protected ScreenAnnotation |
currentControl |
protected static java.lang.String |
IMAGE_FOV_NARROW |
protected static java.lang.String |
IMAGE_FOV_WIDE |
protected static java.lang.String |
IMAGE_HEADING_LEFT |
protected static java.lang.String |
IMAGE_HEADING_RIGHT |
protected static java.lang.String |
IMAGE_LOOK |
protected static java.lang.String |
IMAGE_PAN |
protected static java.lang.String |
IMAGE_PITCH_DOWN |
protected static java.lang.String |
IMAGE_PITCH_UP |
protected static java.lang.String |
IMAGE_VE_DOWN |
protected static java.lang.String |
IMAGE_VE_UP |
protected static java.lang.String |
IMAGE_ZOOM_IN |
protected static java.lang.String |
IMAGE_ZOOM_OUT |
protected boolean |
initialized |
protected java.lang.String |
layout |
protected Vec4 |
locationCenter |
protected Vec4 |
locationOffset |
protected int |
panSize |
protected java.lang.String |
position |
protected java.awt.Rectangle |
referenceViewport |
protected double |
scale |
protected boolean |
showFovControls |
protected boolean |
showHeadingControls |
protected boolean |
showLookControls |
protected boolean |
showPanControls |
protected boolean |
showPitchControls |
protected boolean |
showVeControls |
protected boolean |
showZoomControls |
pickSupport, renderables, renderablesOverride
Constructor and Description |
---|
ViewControlsLayer() |
Modifier and Type | Method and Description |
---|---|
protected void |
clearControls() |
protected 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.
|
void |
doRender(DrawContext dc) |
int |
getBorderWidth() |
protected int |
getButtonSize() |
java.lang.String |
getControlType(java.lang.Object control)
Get the control type associated with the given object or null if unknown.
|
java.lang.Object |
getHighlightedObject()
Indicates the currently highlighted control, if any.
|
protected java.lang.Object |
getImageSource(java.lang.String control)
Get a control image source.
|
java.lang.String |
getLayout()
Returns the current layout.
|
Vec4 |
getLocationCenter()
Returns the current layer image location.
|
Vec4 |
getLocationOffset()
Returns the current location offset.
|
double |
getOpacity()
Returns the layer's opacity value, which is ignored by this layer.
|
protected int |
getPanSize() |
java.lang.String |
getPosition()
Returns the current relative view controls position.
|
double |
getScale()
Get the controls display scale.
|
void |
highlight(java.lang.Object control)
Specifies the control to highlight.
|
protected void |
initialize(DrawContext dc) |
protected boolean |
isInitialized() |
boolean |
isShowFovControls() |
boolean |
isShowHeadingControls() |
boolean |
isShowLookControls() |
boolean |
isShowPanControls() |
boolean |
isShowPitchControls() |
boolean |
isShowVeControls() |
boolean |
isShowZoomControls() |
void |
setBorderWidth(int borderWidth)
Sets the view controls offset from the viewport border.
|
protected void |
setButtonSize(int buttonSize) |
void |
setLayout(java.lang.String layout)
Sets the desired layout.
|
void |
setLocationCenter(Vec4 locationCenter)
Specifies the screen location of the layer, relative to the image's center.
|
void |
setLocationOffset(Vec4 locationOffset)
Specifies a placement offset from the layer position on the screen.
|
void |
setOpacity(double opacity)
Layer opacity is not applied to layers of this type.
|
protected void |
setPanSize(int panSize) |
void |
setPosition(java.lang.String position)
Sets the relative viewport location to display the view controls.
|
void |
setScale(double scale)
Set the controls display scale.
|
void |
setShowFovControls(boolean state) |
void |
setShowHeadingControls(boolean state) |
void |
setShowLookControls(boolean state) |
void |
setShowPanControls(boolean state) |
void |
setShowPitchControls(boolean state) |
void |
setShowVeControls(boolean state) |
void |
setShowZoomControls(boolean state) |
java.lang.String |
toString() |
protected void |
updatePositions(DrawContext dc) |
addRenderable, addRenderable, addRenderables, clearRenderables, dispose, disposeRenderables, doPick, doPick, doPreRender, doPreRender, doRender, getActiveRenderables, getNumRenderables, getRenderables, onMessage, removeAllRenderables, removeRenderable, setRenderables
createLayerConfigElements, 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
propertyChange
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected int borderWidth
protected int buttonSize
protected ScreenAnnotation controlFovNarrow
protected ScreenAnnotation controlFovWide
protected ScreenAnnotation controlHeadingLeft
protected ScreenAnnotation controlHeadingRight
protected ScreenAnnotation controlLook
protected ScreenAnnotation controlPan
protected ScreenAnnotation controlPitchDown
protected ScreenAnnotation controlPitchUp
protected ScreenAnnotation controlVeDown
protected ScreenAnnotation controlVeUp
protected ScreenAnnotation controlZoomIn
protected ScreenAnnotation controlZoomOut
protected ScreenAnnotation currentControl
protected static final java.lang.String IMAGE_FOV_NARROW
protected static final java.lang.String IMAGE_FOV_WIDE
protected static final java.lang.String IMAGE_HEADING_LEFT
protected static final java.lang.String IMAGE_HEADING_RIGHT
protected static final java.lang.String IMAGE_LOOK
protected static final java.lang.String IMAGE_PAN
protected static final java.lang.String IMAGE_PITCH_DOWN
protected static final java.lang.String IMAGE_PITCH_UP
protected static final java.lang.String IMAGE_VE_DOWN
protected static final java.lang.String IMAGE_VE_UP
protected static final java.lang.String IMAGE_ZOOM_IN
protected static final java.lang.String IMAGE_ZOOM_OUT
protected boolean initialized
protected java.lang.String layout
protected Vec4 locationCenter
protected Vec4 locationOffset
protected int panSize
protected java.lang.String position
protected java.awt.Rectangle referenceViewport
protected double scale
protected boolean showFovControls
protected boolean showHeadingControls
protected boolean showLookControls
protected boolean showPanControls
protected boolean showPitchControls
protected boolean showVeControls
protected boolean showZoomControls
protected void clearControls()
protected java.awt.Point computeLocation(java.awt.Rectangle viewport, java.awt.Rectangle controls)
viewport
- the current viewport rectangle.controls
- the overall controls rectanglepublic void doRender(DrawContext dc)
doRender
in class RenderableLayer
public int getBorderWidth()
protected int getButtonSize()
public java.lang.String getControlType(java.lang.Object control)
control
- the control objectAVKey.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_NARROW
or AVKey.VIEW_FOV_WIDE
. Returns null if the object is not a view control associated with this layer.
public java.lang.Object getHighlightedObject()
protected java.lang.Object getImageSource(java.lang.String control)
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_NARROW
or AVKey.VIEW_FOV_WIDE
.public java.lang.String getLayout()
AVKey.HORIZONTAL
or AVKey.VERTICAL
.public Vec4 getLocationCenter()
public Vec4 getLocationOffset()
public double getOpacity()
getOpacity
in interface Layer
getOpacity
in class RenderableLayer
protected int getPanSize()
public java.lang.String getPosition()
public double getScale()
getScale
in interface Layer
getScale
in class AbstractLayer
public void highlight(java.lang.Object control)
control
- the control to highlight.protected void initialize(DrawContext dc)
protected boolean isInitialized()
public boolean isShowFovControls()
public boolean isShowHeadingControls()
public boolean isShowLookControls()
public boolean isShowPanControls()
public boolean isShowPitchControls()
public boolean isShowVeControls()
public boolean isShowZoomControls()
public void setBorderWidth(int borderWidth)
borderWidth
- the number of pixels to offset the view controls from the borders indicated by setPosition(String)
.protected void setButtonSize(int buttonSize)
public void setLayout(java.lang.String layout)
AVKey.HORIZONTAL
or AVKey.VERTICAL
.layout
- the desired layout.public void setLocationCenter(Vec4 locationCenter)
setPosition(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 (see setLocationOffset(gov.nasa.worldwind.geom.Vec4)
)}.locationCenter
- the location center. May be null.setPosition(String)
,
setLocationOffset(gov.nasa.worldwind.geom.Vec4)
public void setLocationOffset(Vec4 locationOffset)
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.setLocationCenter(gov.nasa.worldwind.geom.Vec4)
,
setPosition(String)
public void setOpacity(double opacity)
setOpacity
in interface Layer
setOpacity
in class RenderableLayer
opacity
- the current opacity value, which is ignored by this layer.protected void setPanSize(int panSize)
public void setPosition(java.lang.String position)
AVKey.NORTHEAST
, AVKey.NORTHWEST
, AVKey.SOUTHEAST
, or AVKey.SOUTHWEST
(the default). These indicate the corner of
the viewport to place view controls.position
- the desired view controls position, in screen coordinates.public void setScale(double scale)
scale
- the controls display scale.public void setShowFovControls(boolean state)
public void setShowHeadingControls(boolean state)
public void setShowLookControls(boolean state)
public void setShowPanControls(boolean state)
public void setShowPitchControls(boolean state)
public void setShowVeControls(boolean state)
public void setShowZoomControls(boolean state)
public java.lang.String toString()
toString
in class RenderableLayer
protected void updatePositions(DrawContext dc)