Class RenderableLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.RenderableLayer
-
- All Implemented Interfaces:
AVList,Disposable,MessageListener,Layer,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
BMNGOneImage,LayerManagerLayer,MeasureTool.CustomRenderableLayer,OpenStreetMapShapefileLoader.TextAndShapesLayer,PickFrustum.PickFrustumLayer,SkyColorLayer,StarsLayer,SurfaceImageLayer,ViewControlsLayer,ViewVolumeViewer.SectorGeometryLayer,ViewVolumeViewer.ViewVolumeLayer
public class RenderableLayer extends AbstractLayer
TheRenderableLayerclass manages a collection ofRenderableobjects for rendering, picking, and disposal.- See Also:
Renderable
-
-
Field Summary
Fields Modifier and Type Field Description protected PickSupportpickSupportprotected java.util.Collection<Renderable>renderablesprotected java.lang.Iterable<Renderable>renderablesOverride
-
Constructor Summary
Constructors Constructor Description RenderableLayer()Creates a newRenderableLayerwith a nulldelegateOwner
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRenderable(int index, Renderable renderable)Inserts the specifiedrenderableat the specifiedindexin this layer's internal collection.voidaddRenderable(Renderable renderable)Adds the specifiedrenderableto the end of this layer's internal collection.voidaddRenderables(java.lang.Iterable<? extends Renderable> renderables)Adds the contents of the specifiedrenderablesto this layer's internal collection.protected voidclearRenderables()voiddispose()Disposes the contents of this layer's internal Renderable collection, but does not remove any elements from that collection.protected voiddisposeRenderables()protected voiddoPick(DrawContext dc, java.awt.Point pickPoint)protected voiddoPick(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables, java.awt.Point pickPoint)protected voiddoPreRender(DrawContext dc)protected voiddoPreRender(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables)protected voiddoRender(DrawContext dc)protected voiddoRender(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables)protected java.lang.Iterable<Renderable>getActiveRenderables()Returns the Iterable of currently active Renderables.intgetNumRenderables()doublegetOpacity()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.voidonMessage(Message message)Empty implementation of MessageListener.voidremoveAllRenderables()Clears the contents of this layer's internal Renderable collection.voidremoveRenderable(Renderable renderable)Removes the specifiedrenderablefrom this layer's internal collection, if it exists.voidsetOpacity(double opacity)Opacity is not applied to layers of this type because each renderable typically has its own opacity control.voidsetRenderables(java.lang.Iterable<Renderable> renderableIterable)Overrides the collection of currently active Renderables with the specifiedrenderableIterable.java.lang.StringtoString()-
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
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
-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
propertyChange
-
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
-
-
-
-
Field Detail
-
renderables
protected java.util.Collection<Renderable> renderables
-
renderablesOverride
protected java.lang.Iterable<Renderable> renderablesOverride
-
pickSupport
protected PickSupport pickSupport
-
-
Method Detail
-
addRenderable
public void addRenderable(Renderable renderable)
Adds the specifiedrenderableto the end of this layer's internal collection. If this layer's internal collection has been overridden with a call tosetRenderables(Iterable), this will throw an exception.If the
renderableimplementsAVList, the layer forwards its property change events to the layer's property change listeners. Any property change listeners the layer attaches to therenderableare removed inremoveRenderable(gov.nasa.worldwind.render.Renderable),removeAllRenderables(), ordispose().- Parameters:
renderable- Renderable to add.- Throws:
java.lang.IllegalArgumentException- Ifrenderableis null.java.lang.IllegalStateException- If a custom Iterable has been specified by a call tosetRenderables.
-
addRenderable
public void addRenderable(int index, Renderable renderable)Inserts the specifiedrenderableat the specifiedindexin this layer's internal collection. If this layer's internal collection has been overridden with a call tosetRenderables(Iterable), this will throw an exception.If the
renderableimplementsAVList, the layer forwards its property change events to the layer's property change listeners. Any property change listeners the layer attaches to therenderableare removed inremoveRenderable(gov.nasa.worldwind.render.Renderable),removeAllRenderables(), ordispose().- Parameters:
index- the index at which to insert the specified renderable.renderable- Renderable to insert.- Throws:
java.lang.IllegalArgumentException- Ifrenderableis null, if theindexis less than zero, or if theindexis greater than the number of renderables in this layer.java.lang.IllegalStateException- If a custom Iterable has been specified by a call tosetRenderables.
-
addRenderables
public void addRenderables(java.lang.Iterable<? extends Renderable> renderables)
Adds the contents of the specifiedrenderablesto this layer's internal collection. If this layer's internal collection has been overriden with a call tosetRenderables(Iterable), this will throw an exception.If any of the
renderablesimplementAVList, the layer forwards their property change events to the layer's property change listeners. Any property change listeners the layer attaches to therenderableare removed inremoveRenderable(gov.nasa.worldwind.render.Renderable),removeAllRenderables(), ordispose().- Parameters:
renderables- Renderables to add.- Throws:
java.lang.IllegalArgumentException- Ifrenderablesis null.java.lang.IllegalStateException- If a custom Iterable has been specified by a call tosetRenderables.
-
removeRenderable
public void removeRenderable(Renderable renderable)
Removes the specifiedrenderablefrom this layer's internal collection, if it exists. If this layer's internal collection has been overridden with a call tosetRenderables(Iterable), this will throw an exception.If the
renderableimplementsAVList, this stops forwarding the its property change events to the layer's property change listeners. Any property change listeners the layer attached to therenderableinaddRenderable(gov.nasa.worldwind.render.Renderable)oraddRenderables(Iterable)are removed.- Parameters:
renderable- Renderable to remove.- Throws:
java.lang.IllegalArgumentException- Ifrenderableis null.java.lang.IllegalStateException- If a custom Iterable has been specified by a call tosetRenderables.
-
removeAllRenderables
public void removeAllRenderables()
Clears the contents of this layer's internal Renderable collection. If this layer's internal collection has been overriden with a call tosetRenderables(Iterable), this will throw an exception.If any of the
renderablesimplementAVList, this stops forwarding their property change events to the layer's property change listeners. Any property change listeners the layer attached to therenderablesinaddRenderable(gov.nasa.worldwind.render.Renderable)oraddRenderables(Iterable)are removed.- Throws:
java.lang.IllegalStateException- If a custom Iterable has been specified by a call tosetRenderables.
-
clearRenderables
protected void clearRenderables()
-
getNumRenderables
public int getNumRenderables()
-
getRenderables
public java.lang.Iterable<Renderable> getRenderables()
Returns the Iterable of Renderables currently in use by this layer. If the caller has specified a custom Iterable viasetRenderables(Iterable), this will returns a reference to that Iterable. If the caller passedsetRenderablesa null parameter, or ifsetRenderableshas not been called, this returns a view of this layer's internal collection of Renderables.- Returns:
- Iterable of currently active Renderables.
-
getActiveRenderables
protected java.lang.Iterable<Renderable> getActiveRenderables()
Returns the Iterable of currently active Renderables. If the caller has specified a custom Iterable viasetRenderables(Iterable), this will returns a reference to that Iterable. If the caller passedsetRenderablesa null parameter, or ifsetRenderableshas not been called, this returns a view of this layer's internal collection of Renderables.- Returns:
- Iterable of currently active Renderables.
-
setRenderables
public void setRenderables(java.lang.Iterable<Renderable> renderableIterable)
Overrides the collection of currently active Renderables with the specifiedrenderableIterable. This layer will maintain a reference torenderableIterablestrictly 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 viaaddRenderable, addRenderables, removeRenderables, or dispose.Unlike
addRenderable(gov.nasa.worldwind.render.Renderable)oraddRenderables(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 asAbstractBrowserBalloon- useaddRenderables(Iterable)instead.If the specified
renderableIterableis null, this layer reverts to maintaining its internal collection.- Parameters:
renderableIterable- Iterable to use instead of this layer's internal collection, or null to use this layer's internal collection.
-
setOpacity
public void setOpacity(double opacity)
Opacity is not applied to layers of this type because each renderable typically has its own opacity control.- Specified by:
setOpacityin interfaceLayer- Overrides:
setOpacityin classAbstractLayer- Parameters:
opacity- the current opacity value, which is ignored by this layer.
-
getOpacity
public 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.- Specified by:
getOpacityin interfaceLayer- Overrides:
getOpacityin classAbstractLayer- Returns:
- The layer opacity, a value between 0 and 1.
-
dispose
public void dispose()
Disposes the contents of this layer's internal Renderable collection, but does not remove any elements from that collection.If any of layer's internal 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 therenderablesinaddRenderable(gov.nasa.worldwind.render.Renderable)oraddRenderables(Iterable)are removed.- Specified by:
disposein interfaceDisposable- Overrides:
disposein classAbstractLayer- Throws:
java.lang.IllegalStateException- If a custom Iterable has been specified by a call tosetRenderables.
-
disposeRenderables
protected void disposeRenderables()
-
doPreRender
protected void doPreRender(DrawContext dc)
- Overrides:
doPreRenderin classAbstractLayer
-
doPick
protected void doPick(DrawContext dc, java.awt.Point pickPoint)
- Overrides:
doPickin classAbstractLayer
-
doRender
protected void doRender(DrawContext dc)
- Specified by:
doRenderin classAbstractLayer
-
doPreRender
protected void doPreRender(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables)
-
doPick
protected void doPick(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables, java.awt.Point pickPoint)
-
doRender
protected void doRender(DrawContext dc, java.lang.Iterable<? extends Renderable> renderables)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractLayer
-
onMessage
public void onMessage(Message message)
Empty implementation of MessageListener.This implementation forwards the message to each Renderable that implements
MessageListener.- Specified by:
onMessagein interfaceMessageListener- Overrides:
onMessagein classWWObjectImpl- Parameters:
message- The message that was received.
-
-