NASA World Wind

gov.nasa.worldwind.layers
Class AbstractLayer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
All Implemented Interfaces:
AVList, Disposable, Layer, Restorable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
AbstractAirspaceEditor, AbstractGraticuleLayer, AirspaceLayer, AnnotationLayer, CompassLayer, CrosshairLayer, GliderImageLayer, IconLayer, MarkerLayer, PlaceNameLayer, RenderableLayer, ScalebarLayer, SegmentPlaneEditor, SkyGradientLayer, StatusLayer, TerrainProfileLayer, TiledImageLayer, TrackLayer, WorldMapLayer

public abstract class AbstractLayer
extends WWObjectImpl
implements Layer


Field Summary
protected  ScreenCredit screenCredit
           
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Constructor Summary
AbstractLayer()
           
 
Method Summary
 void dispose()
           
protected  void doPick(DrawContext dc, Point point)
           
protected  void doPreRender(DrawContext dc)
           
protected abstract  void doRender(DrawContext dc)
           
 long getExpiryTime()
          Returns the current expiry time.
 double getMaxActiveAltitude()
           
 double getMinActiveAltitude()
           
 String getName()
          Returns the layer's name, as specified in the most recent call to Layer.setName(java.lang.String).
 double getOpacity()
          Returns the layer's opacity, the degree to which it is blended with underlying layers.
 String getRestorableState()
          Returns an XML document string describing the object’s state.
 double getScale()
          Returns the map scale, in terms of the ratio of 1 to the value returned, e.g., 1:24000.
protected  ScreenCredit getScreenCredit()
           
 boolean isAtMaxResolution()
          Indicates whether the most recent rendering of the layer rendered the highest resolution imagery or other data available.
 boolean isEnabled()
          Indicates whether the layer is enabled for rendering and selection.
 boolean isLayerActive(DrawContext dc)
          Indicates whether the layer is active based on arbitrary criteria.
 boolean isLayerInView(DrawContext dc)
          Indicates whether the layer is in the view.
 boolean isMultiResolution()
          Indicates whether the layer provides multiple resolutions of imagery or other data.
 boolean isNetworkRetrievalEnabled()
          Indicates whether the layer is allowed to retrieve data from the network.
 boolean isPickEnabled()
          Indicates whether the layer performs selection during picking.
 void pick(DrawContext dc, Point point)
          Cause the layer to perform picking, which determines whether the object or its components intersect a given point on the screen.
 void preRender(DrawContext dc)
           
 void render(DrawContext dc)
          Cause the layer to draw its representation.
 void restoreState(String stateInXml)
          Restores the object’s state to what is described in the specified XML document string.
 void setEnabled(boolean enabled)
          Controls whether the layer is enabled for rendering and selection.
 void setExpiryTime(long expiryTime)
          Specifies the time of the layer's most recent dataset update.
 void setMaxActiveAltitude(double maxActiveAltitude)
           
 void setMinActiveAltitude(double minActiveAltitude)
           
 void setName(String name)
          Set the layer's name.
 void setNetworkRetrievalEnabled(boolean networkDownloadEnabled)
          Controls whether the layer is allowed to retrieve data from the network.
 void setOpacity(double opacity)
          Sets the layer's opacity, the degree to which it is blended with underlying layers.
 void setPickEnabled(boolean pickable)
          Controls whether the layer should perform picking.
protected  void setScreenCredit(ScreenCredit screenCredit)
           
 String toString()
           
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 java.beans.PropertyChangeListener
propertyChange
 

Field Detail

screenCredit

protected ScreenCredit screenCredit
Constructor Detail

AbstractLayer

public AbstractLayer()
Method Detail

dispose

public void dispose()
Specified by:
dispose in interface Disposable

doPick

protected void doPick(DrawContext dc,
                      Point point)

doPreRender

protected void doPreRender(DrawContext dc)

doRender

protected abstract void doRender(DrawContext dc)

getExpiryTime

public long getExpiryTime()
Description copied from interface: Layer
Returns the current expiry time.

Specified by:
getExpiryTime in interface Layer
Returns:
the current expiry time.

getMaxActiveAltitude

public double getMaxActiveAltitude()

getMinActiveAltitude

public double getMinActiveAltitude()

getName

public String getName()
Description copied from interface: Layer
Returns the layer's name, as specified in the most recent call to Layer.setName(java.lang.String).

Specified by:
getName in interface Layer
Returns:
the layer's name.

getOpacity

public double getOpacity()
Description copied from interface: Layer
Returns the layer's opacity, the degree to which it is blended with underlying layers.

Many layers apply special usage of opacity, and some ignore it in favor of the opacity settings of their internal renderables. See the description of this method in specific layers to determine usage there.

Specified by:
getOpacity in interface Layer
Returns:
The layer's opacity, a value between 0 and 1.

getRestorableState

public String getRestorableState()
Description copied from interface: Restorable
Returns an XML document string describing the object’s state. This state can be restored later by calling restoreState and passing the XML document.

Specified by:
getRestorableState in interface Restorable
Returns:
an XML document string describing the object's state.

getScale

public double getScale()
Description copied from interface: Layer
Returns the map scale, in terms of the ratio of 1 to the value returned, e.g., 1:24000.

Specified by:
getScale in interface Layer
Returns:
the map scale.

getScreenCredit

protected ScreenCredit getScreenCredit()

isAtMaxResolution

public boolean isAtMaxResolution()
Description copied from interface: Layer
Indicates whether the most recent rendering of the layer rendered the highest resolution imagery or other data available. Some layers do not track resolution. For those layers this value will always be true. Typically such layers also return false from Layer.isMultiResolution().

Specified by:
isAtMaxResolution in interface Layer
Returns:
true if the layer is at maximum resolution, otherwise false.

isEnabled

public boolean isEnabled()
Description copied from interface: Layer
Indicates whether the layer is enabled for rendering and selection.

Specified by:
isEnabled in interface Layer
Returns:
true if the layer is enabled, else false.

isLayerActive

public boolean isLayerActive(DrawContext dc)
Indicates whether the layer is active based on arbitrary criteria. The method implemented here is a default indicating the layer is active if the current altitude is within the layer's min and max active altitudes. Subclasses able to consider more criteria should override this implementation.

Parameters:
dc - the current draw context
Returns:
true if the layer is active, false otherwise.

isLayerInView

public boolean isLayerInView(DrawContext dc)
Indicates whether the layer is in the view. The method implemented here is a default indicating the layer is in view. Subclasses able to determine their presence in the view should override this implementation.

Parameters:
dc - the current draw context
Returns:
true if the layer is in the view, false otherwise.

isMultiResolution

public boolean isMultiResolution()
Description copied from interface: Layer
Indicates whether the layer provides multiple resolutions of imagery or other data.

Specified by:
isMultiResolution in interface Layer
Returns:
true if the layer provides multiple resolutions, else false.

isNetworkRetrievalEnabled

public boolean isNetworkRetrievalEnabled()
Description copied from interface: Layer
Indicates whether the layer is allowed to retrieve data from the network. Many layers have no need to retrieve data from the network. This state is meaningless for such layers.

Specified by:
isNetworkRetrievalEnabled in interface Layer
Returns:
true if the layer is enabled to retrieve network data, else false.

isPickEnabled

public boolean isPickEnabled()
Description copied from interface: Layer
Indicates whether the layer performs selection during picking.

Specified by:
isPickEnabled in interface Layer
Returns:
true if picking is enabled, else false.

pick

public void pick(DrawContext dc,
                 Point point)
Description copied from interface: Layer
Cause the layer to perform picking, which determines whether the object or its components intersect a given point on the screen. Objects that intersect that point are added to the draw context's pick list and are conveyed to the application via selection events or by a direct query of WorldWindow.getObjectsAtCurrentPosition().

Specified by:
pick in interface Layer
Parameters:
dc - the current draw context for rendering.
point - the screen coordinate point
See Also:
SelectEvent

preRender

public void preRender(DrawContext dc)
Specified by:
preRender in interface Layer

render

public void render(DrawContext dc)
Description copied from interface: Layer
Cause the layer to draw its representation.

Specified by:
render in interface Layer
Parameters:
dc - the current draw context
Throws:
IllegalArgumentException - if dc is null, or dc's Globe or View is null

restoreState

public void restoreState(String stateInXml)
Description copied from interface: Restorable
Restores the object’s state to what is described in the specified XML document string.

Specified by:
restoreState in interface Restorable
Parameters:
stateInXml - an XML document string describing an object's state.

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: Layer
Controls whether the layer is enabled for rendering and selection.

Specified by:
setEnabled in interface Layer
Parameters:
enabled - true if the layer is enabled, else false.

setExpiryTime

public void setExpiryTime(long expiryTime)
Description copied from interface: Layer
Specifies the time of the layer's most recent dataset update. If greater than zero, the layer ignores and eliminates any previously cached data older than the time specfied, and requests new information from the data source. If zero, the layer uses any expiry times intrinsic to the layer, typically initialized at layer construction. The default expiry time is 0, thereby enabling a layer's intrinsic expiration criteria.

Specified by:
setExpiryTime in interface Layer
Parameters:
expiryTime - the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch.
See Also:
for a description of milliseconds beyond the epoch.

setMaxActiveAltitude

public void setMaxActiveAltitude(double maxActiveAltitude)

setMinActiveAltitude

public void setMinActiveAltitude(double minActiveAltitude)

setName

public void setName(String name)
Description copied from interface: Layer
Set the layer's name. The name is a convenience attribute typically used to identify the layer in user interfaces. By default, a layer has no name.

Specified by:
setName in interface Layer
Parameters:
name - the name to assign to the layer.

setNetworkRetrievalEnabled

public void setNetworkRetrievalEnabled(boolean networkDownloadEnabled)
Description copied from interface: Layer
Controls whether the layer is allowed to retrieve data from the network. Many layers have no need for data from the network. This state may be set but is meaningless for such layers.

Specified by:
setNetworkRetrievalEnabled in interface Layer
Parameters:
networkDownloadEnabled - true if network retrieval is allowed, else false.

setOpacity

public void setOpacity(double opacity)
Description copied from interface: Layer
Sets the layer's opacity, the degree to which it is blended with underlying layers.

Many layers apply special usage of opacity, and some ignore it in favor of the opacity settings of their internal renderables. See the description of this method in specific layers to determine usage there.

Specified by:
setOpacity in interface Layer
Parameters:
opacity - The layer opacity, a value between 0 and 1. 0 indicates non-opaque (fully transparent), 1 indicates fully opaque. Values between 0 and 1 indicate partial opacity.

setPickEnabled

public void setPickEnabled(boolean pickable)
Description copied from interface: Layer
Controls whether the layer should perform picking.

Specified by:
setPickEnabled in interface Layer
Parameters:
pickable - true if the layer should perform picking, else false.

setScreenCredit

protected void setScreenCredit(ScreenCredit screenCredit)

toString

public String toString()
Overrides:
toString in class Object

NASA World Wind