Package gov.nasa.worldwind.layers
Class StarsLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.RenderableLayer
-
- gov.nasa.worldwind.layers.StarsLayer
-
- All Implemented Interfaces:
AVList
,Disposable
,MessageListener
,Layer
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class StarsLayer extends RenderableLayer
Renders a star background based on a subset of ESA Hipparcos catalog.
-
-
Field Summary
Fields Modifier and Type Field Description protected static double
DEFAULT_MIN_ACTIVE_ALTITUDE
protected static java.lang.String
DEFAULT_STARS_FILE
The default name of the stars file.sprotected Angle
latitudeOffset
The star sphere latitudinal rotation.protected Angle
longitudeOffset
The star sphere longitudinal rotation.protected int
numStars
protected java.lang.Double
radius
The radius of the spherical shell containing the stars.protected boolean
rebuild
protected java.nio.FloatBuffer
starsBuffer
The float buffer holding the Cartesian star coordinates.protected java.lang.String
starsFileName
The stars file name.protected java.lang.Object
vboCacheKey
-
Fields inherited from class gov.nasa.worldwind.layers.RenderableLayer
pickSupport, renderables, renderablesOverride
-
-
Constructor Summary
Constructors Constructor Description StarsLayer()
Constructs a stars layer using the default stars file, which may be specified inConfiguration
.StarsLayer(java.lang.String starsFileName)
Constructs a stars layer using a specified stars file.StarsLayer(java.lang.String starsFileName, java.lang.Double radius)
Constructs a stars layer using a specified stars file and star-field radius.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.java.lang.String
getStarsFileName()
Indicates the path and filename of the stars file.protected void
initialize(java.lang.String starsFileName, java.lang.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(java.lang.String fileName)
Specifies the path and filename of the stars file.java.lang.String
toString()
-
Methods inherited from class gov.nasa.worldwind.layers.RenderableLayer
addRenderable, 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, 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
-
DEFAULT_STARS_FILE
protected static final java.lang.String DEFAULT_STARS_FILE
The default name of the stars file.s- See Also:
- Constant Field Values
-
DEFAULT_MIN_ACTIVE_ALTITUDE
protected static final double DEFAULT_MIN_ACTIVE_ALTITUDE
- See Also:
- Constant Field Values
-
starsFileName
protected java.lang.String starsFileName
The stars file name.
-
starsBuffer
protected java.nio.FloatBuffer starsBuffer
The float buffer holding the Cartesian star coordinates.
-
numStars
protected int numStars
-
rebuild
protected boolean rebuild
-
radius
protected java.lang.Double radius
The radius of the spherical shell containing the stars.
-
longitudeOffset
protected Angle longitudeOffset
The star sphere longitudinal rotation.
-
latitudeOffset
protected Angle latitudeOffset
The star sphere latitudinal rotation.
-
vboCacheKey
protected java.lang.Object vboCacheKey
-
-
Constructor Detail
-
StarsLayer
public StarsLayer()
Constructs a stars layer using the default stars file, which may be specified inConfiguration
.
-
StarsLayer
public StarsLayer(java.lang.String starsFileName)
Constructs a stars layer using a specified stars file.- Parameters:
starsFileName
- the full path the star file.
-
StarsLayer
public StarsLayer(java.lang.String starsFileName, java.lang.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
-
initialize
protected void initialize(java.lang.String starsFileName, java.lang.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.
-
getStarsFileName
public java.lang.String getStarsFileName()
Indicates the path and filename of the stars file.- Returns:
- name of stars catalog file.
-
setStarsFileName
public void setStarsFileName(java.lang.String fileName)
Specifies the path and filename of the stars file.- Parameters:
fileName
- the path and filename.- Throws:
java.lang.IllegalArgumentException
- if the file name is null or empty.
-
getLatitudeOffset
public Angle getLatitudeOffset()
Returns the latitude offset (tilt) for the star sphere.- Returns:
- the latitude offset.
-
setLatitudeOffset
public void setLatitudeOffset(Angle offset)
Sets the latitude offset (tilt) of the star sphere.- Parameters:
offset
- the latitude offset.
-
getLongitudeOffset
public Angle getLongitudeOffset()
Returns the longitude offset of the star sphere.- Returns:
- the longitude offset.
-
setLongitudeOffset
public void setLongitudeOffset(Angle offset)
Sets the longitude offset of the star sphere.- Parameters:
offset
- the longitude offset.- Throws:
java.lang.IllegalArgumentException
- if the angle is null.s
-
doRender
public void doRender(DrawContext dc)
- Overrides:
doRender
in classRenderableLayer
-
drawWithVertexArray
protected void drawWithVertexArray(DrawContext dc)
-
drawWithVBO
protected boolean drawWithVBO(DrawContext dc)
-
fillVbo
protected void fillVbo(DrawContext dc)
Creates and fills this layer's vertex buffer.- Parameters:
dc
- the current draw context.
-
loadStars
protected void loadStars()
Read stars file and load it into a float buffer.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classRenderableLayer
-
-