NASA World Wind

gov.nasa.worldwind.layers
Class StarsLayer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
              extended by gov.nasa.worldwind.layers.RenderableLayer
                  extended by gov.nasa.worldwind.layers.StarsLayer
All Implemented Interfaces:
AVList, Disposable, MessageListener, Layer, Restorable, WWObject, PropertyChangeListener, EventListener

public class StarsLayer
extends RenderableLayer

Renders a star background based on a subset of ESA Hipparcos catalog.


Field Summary
protected static double DEFAULT_MIN_ACTIVE_ALTITUDE
           
protected static String DEFAULT_STARS_FILE
          The default name of the stars file.s
protected  Angle latitudeOffset
          The star sphere latitudinal rotation.
protected  Angle longitudeOffset
          The star sphere longitudinal rotation.
protected  int numStars
           
protected  Double radius
          The radius of the spherical shell containing the stars.
protected  boolean rebuild
           
protected  FloatBuffer starsBuffer
          The float buffer holding the Cartesian star coordinates.
protected  String starsFileName
          The stars file name.
protected  Object vboCacheKey
           
 
Fields inherited from class gov.nasa.worldwind.layers.RenderableLayer
pickSupport, renderables, renderablesOverride
 
Constructor Summary
StarsLayer()
          Constructs a stars layer using the default stars file, which may be specified in Configuration.
StarsLayer(String starsFileName)
          Constructs a stars layer using a specified stars file.
StarsLayer(String starsFileName, Double radius)
          Constructs a stars layer using a specified stars file and star-field radius.
 
Method Summary
 void doRender(DrawContext dc)
           
protected  boolean drawWithVBO(DrawContext dc)
           
protected  void drawWithVertexArray(DrawContext dc)
           
protected  void fillVbo(DrawContext dc)
          Creates and fills this layer's vertex buffer.
 Angle getLatitudeOffset()
          Returns the latitude offset (tilt) for the star sphere.
 Angle getLongitudeOffset()
          Returns the longitude offset of the star sphere.
 String getStarsFileName()
          Indicates the path and filename of the stars file.
protected  void initialize(String starsFileName, Double radius)
          Called by constructors to save the stars file name, the stars field radius and the layer's minimum active altitude.
protected  void loadStars()
          Read stars file and load it into a float buffer.
 void setLatitudeOffset(Angle offset)
          Sets the latitude offset (tilt) of the star sphere.
 void setLongitudeOffset(Angle offset)
          Sets the longitude offset of the star sphere.
 void setStarsFileName(String fileName)
          Specifies the path and filename of the stars file.
 String toString()
           
 
Methods inherited from class gov.nasa.worldwind.layers.RenderableLayer
addRenderable, addRenderables, clearRenderables, dispose, disposeRenderables, doPick, doPick, doPreRender, doPreRender, doRender, getActiveRenderables, getNumRenderables, getOpacity, getRenderables, onMessage, removeAllRenderables, removeRenderable, setOpacity, setRenderables
 
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, 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

DEFAULT_MIN_ACTIVE_ALTITUDE

protected static final double DEFAULT_MIN_ACTIVE_ALTITUDE
See Also:
Constant Field Values

DEFAULT_STARS_FILE

protected static final String DEFAULT_STARS_FILE
The default name of the stars file.s

See Also:
Constant Field Values

latitudeOffset

protected Angle latitudeOffset
The star sphere latitudinal rotation.


longitudeOffset

protected Angle longitudeOffset
The star sphere longitudinal rotation.


numStars

protected int numStars

radius

protected Double radius
The radius of the spherical shell containing the stars.


rebuild

protected boolean rebuild

starsBuffer

protected FloatBuffer starsBuffer
The float buffer holding the Cartesian star coordinates.


starsFileName

protected String starsFileName
The stars file name.


vboCacheKey

protected Object vboCacheKey
Constructor Detail

StarsLayer

public StarsLayer()
Constructs a stars layer using the default stars file, which may be specified in Configuration.


StarsLayer

public StarsLayer(String starsFileName)
Constructs a stars layer using a specified stars file.

Parameters:
starsFileName - the full path the star file.

StarsLayer

public StarsLayer(String starsFileName,
                  Double radius)
Constructs a stars layer using a specified stars file and star-field radius.

Parameters:
starsFileName - the full path the star file.
radius - the radius of the stars sphere. May be null, in which case the radius in the stars file is used.
Method Detail

doRender

public void doRender(DrawContext dc)
Overrides:
doRender in class RenderableLayer

drawWithVBO

protected boolean drawWithVBO(DrawContext dc)

drawWithVertexArray

protected void drawWithVertexArray(DrawContext dc)

fillVbo

protected void fillVbo(DrawContext dc)
Creates and fills this layer's vertex buffer.

Parameters:
dc - the current draw context.

getLatitudeOffset

public Angle getLatitudeOffset()
Returns the latitude offset (tilt) for the star sphere.

Returns:
the latitude offset.

getLongitudeOffset

public Angle getLongitudeOffset()
Returns the longitude offset of the star sphere.

Returns:
the longitude offset.

getStarsFileName

public String getStarsFileName()
Indicates the path and filename of the stars file.

Returns:
name of stars catalog file.

initialize

protected void initialize(String starsFileName,
                          Double radius)
Called by constructors to save the stars file name, the stars field radius and the layer's minimum active altitude.

Parameters:
starsFileName - the full path the star file.
radius - the radius of the stars sphere. May be null, in which case the radius in the stars file is used.

loadStars

protected void loadStars()
Read stars file and load it into a float buffer.


setLatitudeOffset

public void setLatitudeOffset(Angle offset)
Sets the latitude offset (tilt) of the star sphere.

Parameters:
offset - the latitude offset.

setLongitudeOffset

public void setLongitudeOffset(Angle offset)
Sets the longitude offset of the star sphere.

Parameters:
offset - the longitude offset.
Throws:
IllegalArgumentException - if the angle is null.s

setStarsFileName

public void setStarsFileName(String fileName)
Specifies the path and filename of the stars file.

Parameters:
fileName - the path and filename.
Throws:
IllegalArgumentException - if the file name is null or empty.

toString

public String toString()
Overrides:
toString in class RenderableLayer

NASA World Wind