public class LayerManagerLayer extends RenderableLayer implements SelectListener
Modifier and Type | Field and Description |
---|---|
protected java.awt.Color |
dragColor |
protected boolean |
draggingComponent |
protected boolean |
draggingLayer |
protected java.awt.Point |
dragRefCursorPoint |
protected int |
dragRefIndex |
protected java.awt.Point |
dragRefPoint |
protected java.awt.Dimension |
size |
protected boolean |
update |
protected WorldWindow |
wwd |
pickSupport, renderables, renderablesOverride
Constructor and Description |
---|
LayerManagerLayer(WorldWindow wwd) |
Modifier and Type | Method and Description |
---|---|
protected java.awt.Point |
computeLocation(java.awt.Rectangle viewport)
Compute the draw frame south-west corner screen location according to it's position - see
setPosition(String) , location offset - see setLocationOffset(Vec4) , or location center - see setLocationCenter(Vec4) , and border distance from the viewport edges - see setBorderWidth(int) . |
protected void |
drag(SelectEvent event) |
protected static java.lang.String |
encodeHTMLColor(java.awt.Color c) |
ScreenAnnotation |
getAnnotation()
Get the
ScreenAnnotation used to display the layer list. |
int |
getBorderWidth()
Get the layer manager frame offset from the viewport borders.
|
java.awt.Color |
getColor()
Get the
Color used to draw the layer names and the frame border when they are not highlighted. |
java.awt.Font |
getFont()
Get the
Font used to draw the layer list text. |
java.awt.Color |
getHighlightColor()
Get the
Color used to draw the layer names and the frame border when they are highlighted. |
char |
getLayerDisabledSymbol()
Get the character used to denote a disabled layer.
|
char |
getLayerEnabledSymbol()
Get the character used to denote an enabled layer.
|
Vec4 |
getLocationCenter()
Returns the current layer manager location.
|
Vec4 |
getLocationOffset()
Returns the current location offset.
|
double |
getMaxOpacity()
Get the opacity applied to the layer list when the cursor is inside it's frame.
|
double |
getMinOpacity()
Get the opacity applied to the layer list when the cursor is outside it's frame.
|
java.lang.String |
getPosition()
Returns the current relative layer manager frame position.
|
int |
getSelectedIndex()
Get the selected layer index number in the current
Model layer list. |
protected void |
highlight(boolean highlighted)
Change the annotation appearance according to the given highlighted state.
|
protected void |
initialize() |
boolean |
isComponentDragEnabled()
Determines whether the layer list can be moved or dragged with the mouse cursor.
|
boolean |
isEnabled()
Indicates whether the layer is enabled for rendering and selection.
|
boolean |
isLayerDragEnabled()
Determines whether a layer can be moved or dragged within the list with the mouse cursor.
|
boolean |
isMinimized()
Determines whether the layer list frame is minimized.
|
boolean |
isSnapToCorners()
Determines whether the layer list snaps to the viewport sides and corners while being dragged.
|
protected java.lang.String |
makeAnnotationText(LayerList layers)
Compose the annotation text from the given
LayerList . |
protected void |
moveTo(java.awt.Point targetPoint) |
void |
render(DrawContext dc)
Cause the layer to draw its representation.
|
void |
selected(SelectEvent event)
SelectListener implementation. |
void |
setBorderWidth(int borderWidth)
Sets the layer manager frame offset from the viewport borders.
|
void |
setColor(java.awt.Color color)
Set the
Color used to draw the layer names and the frame border when they are not highlighted. |
void |
setComponentDragEnabled(boolean enabled)
Sets whether the layer list can be moved or dragged with the mouse cursor.
|
void |
setEnabled(boolean enabled)
Controls whether the layer is enabled for rendering and selection.
|
void |
setFont(java.awt.Font font)
Set the
Font used to draw the layer list text. |
void |
setHighlightColor(java.awt.Color color)
Set the
Color used to draw the layer names and the frame border when they are highlighted. |
void |
setLayerDisabledSymbol(char c)
Set the character used to denote a disabled layer.
|
void |
setLayerDragEnabled(boolean enabled)
Sets whether a layer can be moved or dragged within the list with the mouse cursor.
|
void |
setLayerEnabledSymbol(char c)
Set the character used to denote an enabled layer.
|
void |
setLocationCenter(Vec4 locationCenter)
Specifies the screen location of the layer manager, relative to it's frame center.
|
void |
setLocationOffset(Vec4 locationOffset)
Specifies a placement offset from the layer manager frame position on the screen.
|
void |
setMaxOpacity(double opacity)
Set the opacity applied to the layer list when the cursor is inside it's frame - zero to one, one is fully
opaque.
|
void |
setMinimized(boolean minimized)
Set the layer list frame to be minimized.
|
void |
setMinOpacity(double opacity)
Set the opacity applied to the layer list when the cursor is outside it's frame - zero to one, one is fully
opaque.
|
void |
setPosition(java.lang.String position)
Sets the relative viewport location to display the layer manager.
|
void |
setSelectedIndex(int index)
Set the selected layer index number.
|
void |
setSnapToCorners(boolean enabled)
Sets whether the layer list snaps to the viewport sides and corners while being dragged.
|
protected void |
snapToCorners() |
java.lang.String |
toString() |
void |
update()
Schedule the layer list for redrawing before the next render pass.
|
void |
updateNow(DrawContext dc)
Force the layer list to redraw itself from the current
Model with the current highlighted state and
selected layer colors and opacity. |
addRenderable, addRenderable, addRenderables, clearRenderables, dispose, disposeRenderables, doPick, doPick, doPreRender, doPreRender, doRender, doRender, getActiveRenderables, getNumRenderables, getOpacity, getRenderables, onMessage, removeAllRenderables, removeRenderable, setOpacity, setRenderables
createLayerConfigElements, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, restoreState, setDataFileStore, 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 java.awt.Color dragColor
protected boolean draggingComponent
protected boolean draggingLayer
protected java.awt.Point dragRefCursorPoint
protected int dragRefIndex
protected java.awt.Point dragRefPoint
protected java.awt.Dimension size
protected boolean update
protected WorldWindow wwd
public LayerManagerLayer(WorldWindow wwd)
protected java.awt.Point computeLocation(java.awt.Rectangle viewport)
setPosition(String)
, location offset - see setLocationOffset(Vec4)
, or location center - see setLocationCenter(Vec4)
, and border distance from the viewport edges - see setBorderWidth(int)
.viewport
- the current Viewport
rectangle.protected void drag(SelectEvent event)
protected static java.lang.String encodeHTMLColor(java.awt.Color c)
public ScreenAnnotation getAnnotation()
ScreenAnnotation
used to display the layer list.ScreenAnnotation
used to display the layer list.public int getBorderWidth()
setPosition(String)
.public java.awt.Color getColor()
Color
used to draw the layer names and the frame border when they are not highlighted.Color
used to draw the layer names and the frame border when they are not highlighted.public java.awt.Font getFont()
Font
used to draw the layer list text.Font
used to draw the layer list text.public java.awt.Color getHighlightColor()
Color
used to draw the layer names and the frame border when they are highlighted.Color
used to draw the layer names and the frame border when they are highlighted.public char getLayerDisabledSymbol()
public char getLayerEnabledSymbol()
public Vec4 getLocationCenter()
public Vec4 getLocationOffset()
public double getMaxOpacity()
public double getMinOpacity()
public java.lang.String getPosition()
public int getSelectedIndex()
Model
layer list. A layer is selected when the
cursor is over it in the list. Returns -1 if no layer is currently selected.protected void highlight(boolean highlighted)
highlighted
- true
if the annotation should appear highlighted.protected void initialize()
public boolean isComponentDragEnabled()
If enabled, dragging the frame will result in a change to it's location offset - setLocationOffset(Vec4)
. If the list is also set to snap to corners - setSnapToCorners(boolean)
, the
frame position may change so as to be attached to the nearest corner - see setPosition(String)
.
true
if the layer list can be moved or dragged with the mouse cursor.public boolean isEnabled()
Layer
isEnabled
in interface Layer
isEnabled
in class AbstractLayer
public boolean isLayerDragEnabled()
true
if a layer can be moved or dragged within the list.public boolean isMinimized()
true
if the layer list frame is minimized.public boolean isSnapToCorners()
Dragging the layer list frame will result in a change to it's location offset - setLocationOffset(Vec4)
.
If the list is also set to snap to corners - setSnapToCorners(boolean)
, the frame position may change so
as to be attached to the nearest corner - see setPosition(String)
.
true
if the layer list snaps to the viewport sides and corners while being dragged.protected java.lang.String makeAnnotationText(LayerList layers)
LayerList
.layers
- the LayerList
to draw names from.protected void moveTo(java.awt.Point targetPoint)
public void render(DrawContext dc)
Layer
render
in interface Layer
render
in class AbstractLayer
dc
- the current draw contextpublic void selected(SelectEvent event)
SelectListener
implementation.selected
in interface SelectListener
event
- the current SelectEvent
public void setBorderWidth(int borderWidth)
borderWidth
- the number of pixels to offset the layer manager frame from the borders indicated by setPosition(String)
.public void setColor(java.awt.Color color)
Color
used to draw the layer names and the frame border when they are not highlighted.color
- the Color
used to draw the layer names and the frame border when they are not
highlighted.public void setComponentDragEnabled(boolean enabled)
If enabled, dragging the frame will result in a change to it's location offset - setLocationOffset(Vec4)
. If the list is also set to snap to corners - setSnapToCorners(boolean)
, the
frame position may change so as to be attached to the nearest corner - see setPosition(String)
.
enabled
- true
if the layer list can be moved or dragged with the mouse cursor.public void setEnabled(boolean enabled)
Layer
setEnabled
in interface Layer
setEnabled
in class AbstractLayer
enabled
- true
if the layer is enabled, else false
.public void setFont(java.awt.Font font)
Font
used to draw the layer list text.font
- the Font
used to draw the layer list text.public void setHighlightColor(java.awt.Color color)
Color
used to draw the layer names and the frame border when they are highlighted.color
- the Color
used to draw the layer names and the frame border when they are highlighted.public void setLayerDisabledSymbol(char c)
c
- the character used to denote a disabled layer.public void setLayerDragEnabled(boolean enabled)
enabled
- true
if a layer can be moved or dragged within the list.public void setLayerEnabledSymbol(char c)
c
- the character used to denote an enabled layer.public void setLocationCenter(Vec4 locationCenter)
setLocationOffset(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 manager frame from its specified screen position. A
positive X value shifts the frame to the right. A positive Y value shifts the frame up. If
null, no offset is applied. The default offset is null.setLocationCenter(gov.nasa.worldwind.geom.Vec4)
,
setPosition(String)
public void setMaxOpacity(double opacity)
opacity
- the opacity applied to the layer list when the cursor is inside it's frame.public void setMinimized(boolean minimized)
minimized
- true
if the layer list frame should be minimized.public void setMinOpacity(double opacity)
opacity
- the opacity applied to the layer list when the cursor is outside it's frame.public void setPosition(java.lang.String position)
AVKey.NORTHEAST
(the
default), AVKey.NORTHWEST
, AVKey.SOUTHEAST
, or AVKey.SOUTHWEST
. These indicate the corner
of the viewport to place the frame.position
- the desired layer manager positionpublic void setSelectedIndex(int index)
index
- the selected layer index number.public void setSnapToCorners(boolean enabled)
Dragging the layer list frame will result in a change to it's location offset - setLocationOffset(Vec4)
.
If the list is also set to snap to corners the frame position may change so as to be attached to the nearest
corner - see setPosition(String)
.
enabled
- true
if the layer list should snaps to the viewport sides and corners while being
dragged.protected void snapToCorners()
public java.lang.String toString()
toString
in class RenderableLayer
public void update()
public void updateNow(DrawContext dc)
Model
with the current highlighted state and
selected layer colors and opacity.dc
- the current DrawContext
.setMinOpacity(double)
,
setMaxOpacity(double)
,
setColor(java.awt.Color)
,
setHighlightColor(java.awt.Color)