Package gov.nasa.worldwind.layers
Class CachedRenderableLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.CachedRenderableLayer
-
- All Implemented Interfaces:
AVList,Disposable,MessageListener,Layer,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class CachedRenderableLayer extends AbstractLayer
Holds a collection of Renderables and manages local caching of them. Provides searching for Renderables by sector, location or name.NOTE: This class is experimental and not fully implemented. You should not use it now.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_DEPTHprotected BasicQuadTree<Renderable>extentTreeprotected PickSupportpickSupport
-
Constructor Summary
Constructors Constructor Description CachedRenderableLayer(Sector coverage)Constructs a layer instance.CachedRenderableLayer(Sector coverage, int numLevels)Constructs a layer instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Renderable item)Add a Renderable to the layer.voidadd(Renderable item, java.lang.String name)Adds a named Renderable to the layer.voiddispose()Disposes any Renderables implementing @{link Dispose} and removes all Renderables from the layer.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)java.lang.Iterable<? extends Renderable>getAllRenderables()Returns all Renderables in the layer.RenderablegetByName(java.lang.String name)Searches the layer for a named Renderable.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.util.Collection<? extends Renderable>getRenderables(LatLon location)Returns all Renderables at a specfied location.java.util.Collection<? extends Renderable>getRenderables(Sector extent)Returns all Renderables within or intersecting a specified sector.booleanhasItems()Indictes whether the layer contains Renderables.voidremove(Renderable item)Remove a Renderable from the layer if the Renderable is in the layer.voidremoveByName(java.lang.String name)Remove a named Renderable from the layer if it is in the layer.voidsetOpacity(double opacity)Opacity is not applied to layers of this type because each renderable typically has its own opacity control.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
onMessage, 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
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
DEFAULT_DEPTH
protected static final int DEFAULT_DEPTH
- See Also:
- Constant Field Values
-
extentTree
protected BasicQuadTree<Renderable> extentTree
-
pickSupport
protected PickSupport pickSupport
-
-
Constructor Detail
-
CachedRenderableLayer
public CachedRenderableLayer(Sector coverage)
Constructs a layer instance.- Parameters:
coverage- the geographic area covered by the layer's Renderables.- Throws:
java.lang.IllegalArgumentException- if the coverage sector is null.
-
CachedRenderableLayer
public CachedRenderableLayer(Sector coverage, int numLevels)
Constructs a layer instance.- Parameters:
coverage- the geographic area covered by the layer's Renderables.numLevels- the depth of the tree used to sort the Renderables.- Throws:
java.lang.IllegalArgumentException- if the coverage sector is null or the number of levels is less than 1;
-
-
Method Detail
-
hasItems
public boolean hasItems()
Indictes whether the layer contains Renderables.- Returns:
- true if the layer contains Renderables, otherwise false.
-
add
public void add(Renderable item)
Add a Renderable to the layer.- Parameters:
item- the Renderable to add.- Throws:
java.lang.IllegalArgumentException- if the item is null or does not implementGeographicExtent.- See Also:
add(gov.nasa.worldwind.render.Renderable, String)
-
add
public void add(Renderable item, java.lang.String name)
Adds a named Renderable to the layer. The Renderable can subsequently participate in a name search of the layer.- Parameters:
item- the Renderable to add.name- a name for the Renderable. May be null, in which case the item has no name.- Throws:
java.lang.IllegalArgumentException- if the item is null or does not implementGeographicExtent.- See Also:
add(gov.nasa.worldwind.render.Renderable)
-
remove
public void remove(Renderable item)
Remove a Renderable from the layer if the Renderable is in the layer.- Parameters:
item- the Renderable to remove- See Also:
removeByName(String)
-
removeByName
public void removeByName(java.lang.String name)
Remove a named Renderable from the layer if it is in the layer.- Parameters:
name- the name of the Renderable to remove. If null, no Renderable is removed.- See Also:
remove(gov.nasa.worldwind.render.Renderable)
-
getRenderables
public java.util.Collection<? extends Renderable> getRenderables(LatLon location)
Returns all Renderables at a specfied location.- Parameters:
location- the location of interest.- Returns:
- the Collection of Renderables at the specified location.
- See Also:
getRenderables(gov.nasa.worldwind.geom.Sector),getAllRenderables()
-
getRenderables
public java.util.Collection<? extends Renderable> getRenderables(Sector extent)
Returns all Renderables within or intersecting a specified sector.- Parameters:
extent- the location of interest.- Returns:
- the Collection of Renderables within or intersecting the boundary of the sector.
- See Also:
getRenderables(gov.nasa.worldwind.geom.LatLon),getAllRenderables()
-
getAllRenderables
public java.lang.Iterable<? extends Renderable> getAllRenderables()
Returns all Renderables in the layer.- Returns:
- an Iterable over all the Renderables in the layer.
-
getByName
public Renderable getByName(java.lang.String name)
Searches the layer for a named Renderable.- Parameters:
name- the name to search for. If null, no search is performed and null is returned.- Returns:
- the Renderable of the given name, or null if no Renderable with the name is in the layer.
-
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 any Renderables implementing @{link Dispose} and removes all Renderables from the layer.- Specified by:
disposein interfaceDisposable- Overrides:
disposein classAbstractLayer
-
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
-
-