public class RenderableLayer extends AbstractLayer
RenderableLayer
class manages a collection of Renderable
objects
for rendering, picking, and disposal.Renderable
Modifier and Type | Field and Description |
---|---|
protected PickSupport |
pickSupport |
protected java.util.Collection<Renderable> |
renderables |
protected java.lang.Iterable<Renderable> |
renderablesOverride |
Constructor and Description |
---|
RenderableLayer()
Creates a new
RenderableLayer with a null delegateOwner |
Modifier and Type | Method and Description |
---|---|
void |
addRenderable(int index,
Renderable renderable)
Inserts the specified
renderable at the specified index in this layer's internal
collection. |
void |
addRenderable(Renderable renderable)
Adds the specified
renderable to the end of this layer's internal collection. |
void |
addRenderables(java.lang.Iterable<? extends Renderable> renderables)
Adds the contents of the specified
renderables to this layer's internal collection. |
protected void |
clearRenderables() |
void |
dispose()
Disposes the contents of this layer's internal Renderable collection, but does not remove any elements from that
collection.
|
protected void |
disposeRenderables() |
protected void |
doPick(DrawContext dc,
java.lang.Iterable<? extends Renderable> renderables,
java.awt.Point pickPoint) |
protected void |
doPick(DrawContext dc,
java.awt.Point pickPoint) |
protected void |
doPreRender(DrawContext dc) |
protected void |
doPreRender(DrawContext dc,
java.lang.Iterable<? extends Renderable> renderables) |
protected void |
doRender(DrawContext dc) |
protected void |
doRender(DrawContext dc,
java.lang.Iterable<? extends Renderable> renderables) |
protected java.lang.Iterable<Renderable> |
getActiveRenderables()
Returns the Iterable of currently active Renderables.
|
int |
getNumRenderables() |
double |
getOpacity()
Returns the layer's opacity value, which is ignored by this layer because each of its renderables typiically has
its own opacity control.
|
java.lang.Iterable<Renderable> |
getRenderables()
Returns the Iterable of Renderables currently in use by this layer.
|
void |
onMessage(Message message)
Empty implementation of MessageListener.
|
void |
removeAllRenderables()
Clears the contents of this layer's internal Renderable collection.
|
void |
removeRenderable(Renderable renderable)
Removes the specified
renderable from this layer's internal collection, if it exists. |
void |
setOpacity(double opacity)
Opacity is not applied to layers of this type because each renderable typically has its own opacity control.
|
void |
setRenderables(java.lang.Iterable<Renderable> renderableIterable)
Overrides the collection of currently active Renderables with the specified
renderableIterable . |
java.lang.String |
toString() |
createLayerConfigElements, 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
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 PickSupport pickSupport
protected java.util.Collection<Renderable> renderables
protected java.lang.Iterable<Renderable> renderablesOverride
public RenderableLayer()
RenderableLayer
with a null delegateOwner
public void addRenderable(int index, Renderable renderable)
renderable
at the specified index
in this layer's internal
collection. If this layer's internal collection has been overridden with a call to setRenderables(Iterable)
, this will throw an exception.
If the renderable
implements AVList
, the layer forwards its
property change events to the layer's property change listeners. Any property change listeners the layer attaches
to the renderable
are removed in removeRenderable(gov.nasa.worldwind.render.Renderable)
,
removeAllRenderables()
, or dispose()
.index
- the index at which to insert the specified renderable.renderable
- Renderable to insert.java.lang.IllegalArgumentException
- If renderable
is null, if the index
is less than zero,
or if the index
is greater than the number of renderables in this
layer.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setRenderables
.public void addRenderable(Renderable renderable)
renderable
to the end of this layer's internal collection. If this layer's
internal collection has been overridden with a call to setRenderables(Iterable)
, this will throw an
exception.
If the renderable
implements AVList
, the layer forwards its
property change events to the layer's property change listeners. Any property change listeners the layer attaches
to the renderable
are removed in removeRenderable(gov.nasa.worldwind.render.Renderable)
,
removeAllRenderables()
, or dispose()
.renderable
- Renderable to add.java.lang.IllegalArgumentException
- If renderable
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setRenderables
.public void addRenderables(java.lang.Iterable<? extends Renderable> renderables)
renderables
to this layer's internal collection. If this layer's
internal collection has been overriden with a call to setRenderables(Iterable)
, this will throw an
exception.
If any of the renderables
implement AVList
, the layer forwards
their property change events to the layer's property change listeners. Any property change listeners the layer
attaches to the renderable
are removed in removeRenderable(gov.nasa.worldwind.render.Renderable)
,
removeAllRenderables()
, or dispose()
.renderables
- Renderables to add.java.lang.IllegalArgumentException
- If renderables
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setRenderables
.protected void clearRenderables()
public void dispose()
AVList
, this stops forwarding
their property change events to the layer's property change listeners. Any property change listeners the layer
attached to the renderables
in addRenderable(gov.nasa.worldwind.render.Renderable)
or
addRenderables(Iterable)
are removed.dispose
in interface Disposable
dispose
in class AbstractLayer
java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setRenderables
.protected void disposeRenderables()
protected void doPick(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables, java.awt.Point pickPoint)
protected void doPick(DrawContext dc, java.awt.Point pickPoint)
doPick
in class AbstractLayer
protected void doPreRender(DrawContext dc)
doPreRender
in class AbstractLayer
protected void doPreRender(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables)
protected void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected void doRender(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables)
protected java.lang.Iterable<Renderable> getActiveRenderables()
setRenderables(Iterable)
, this will returns a reference to that Iterable. If the caller passed
setRenderables
a null parameter, or if setRenderables
has not been called, this returns
a view of this layer's internal collection of Renderables.public int getNumRenderables()
public double getOpacity()
getOpacity
in interface Layer
getOpacity
in class AbstractLayer
public java.lang.Iterable<Renderable> getRenderables()
setRenderables(Iterable)
, this will returns a reference to that Iterable. If the caller passed
setRenderables
a null parameter, or if setRenderables
has not been called, this returns
a view of this layer's internal collection of Renderables.public void onMessage(Message message)
MessageListener
.onMessage
in interface MessageListener
onMessage
in class WWObjectImpl
message
- The message that was received.public void removeAllRenderables()
setRenderables(Iterable)
, this will throw an exception.
If any of the renderables
implement AVList
, this stops forwarding
their property change events to the layer's property change listeners. Any property change listeners the layer
attached to the renderables
in addRenderable(gov.nasa.worldwind.render.Renderable)
or
addRenderables(Iterable)
are removed.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setRenderables
.public void removeRenderable(Renderable renderable)
renderable
from this layer's internal collection, if it exists. If this
layer's internal collection has been overridden with a call to setRenderables(Iterable)
, this will throw
an exception.
If the renderable
implements AVList
, this stops forwarding the its
property change events to the layer's property change listeners. Any property change listeners the layer attached
to the renderable
in addRenderable(gov.nasa.worldwind.render.Renderable)
or addRenderables(Iterable)
are removed.renderable
- Renderable to remove.java.lang.IllegalArgumentException
- If renderable
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setRenderables
.public void setOpacity(double opacity)
setOpacity
in interface Layer
setOpacity
in class AbstractLayer
opacity
- the current opacity value, which is ignored by this layer.public void setRenderables(java.lang.Iterable<Renderable> renderableIterable)
renderableIterable
. This
layer will maintain a reference to renderableIterable
strictly for picking and rendering. This layer
will not modify the reference, or dispose of its contents. This will also clear and dispose of the internal
collection of Renderables, and will prevent any modification to its contents via addRenderable,
addRenderables, removeRenderables, or dispose
.
Unlike addRenderable(gov.nasa.worldwind.render.Renderable)
or addRenderables(Iterable)
, this
does not forward any of the renderable's property change events to the layer's property change listeners. Since
the layer is not in control of the iIterable's contents, attaching property change listeners to the renderables
could cause the them to hold dangling references to the layer. If any of the renderables in the Iterable rely on
forwarding property change events for proper operation - such as AbstractBrowserBalloon
- use addRenderables(Iterable)
instead.
If the specified renderableIterable
is null, this layer reverts to maintaining its internal
collection.renderableIterable
- Iterable to use instead of this layer's internal collection, or null to use this
layer's internal collection.public java.lang.String toString()
toString
in class AbstractLayer