Package gov.nasa.worldwind.cache
Class ShapeDataCache.ShapeDataCacheEntry
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.cache.ShapeDataCache.ShapeDataCacheEntry
-
- All Implemented Interfaces:
AVList
- Direct Known Subclasses:
AbstractShape.AbstractShapeData
,KMLRegion.RegionData
- Enclosing class:
- ShapeDataCache
public static class ShapeDataCache.ShapeDataCacheEntry extends AVListImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected Extent
extent
Indicates the associated shape's extent, in model coordinates relative to the associated globe.protected double
eyeDistance
Indicates the eye distance of the shape in the globe-relative coordinate system.protected GlobeStateKey
globeStateKey
Identifies the associated globe's state at the time the entry was created.protected long
lastUsed
Indicates the last time, in milliseconds, the entry was requested or added.protected TimedExpirySupport
timer
Determines whether the cache entry has expired.protected double
timerAdjustedEyeDistance
Indicates the eye distance current when the cache entry's remaining time was last adjusted.protected double
verticalExaggeration
Indicates the vertical exaggeration in effect when the entry was cached.
-
Constructor Summary
Constructors Constructor Description ShapeDataCacheEntry(DrawContext dc, long minExpiryTime, long maxExpiryTime)
Constructs an entry using the globe and vertical exaggeration of a specified draw context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
adjustTimer(DrawContext dc, double newEyeDistance)
Adjust the timer's expiration time by comparing the cached eye distance to the current eye distance.Extent
getExtent()
Returns this entry's extent.double
getEyeDistance()
Indicates this entry's eye distance.GlobeStateKey
getGlobeStateKey()
Indicates this entry's globe state key, captured when this entry was constructed or when explicitly set.TimedExpirySupport
getTimer()
Returns this entry's expiration timer.double
getVerticalExaggeration()
Indicates this entry's vertical exaggeration, captured when the entry was constructed or when explicitly set.boolean
isExpired(DrawContext dc)
Indicates whether this entry has expired.boolean
isValid(DrawContext dc)
Indicates whether this shape data's globe state and vertical exaggeration are the same as that in the current draw context.void
restartTimer(DrawContext dc)
Resets the timer to the current time.void
setExpired(boolean isExpired)
Sets this entry's expiration state.void
setExtent(Extent extent)
Specifies this entry's extent.void
setEyeDistance(double eyeDistance)
Specifies this entry's eye distance.void
setGlobeStateKey(GlobeStateKey globeStateKey)
Specifies this entry's globe state key.void
setTimer(TimedExpirySupport timer)
Specifies this entry's expiration timer.void
setVerticalExaggeration(double verticalExaggeration)
-
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
-
-
-
-
Field Detail
-
timer
protected TimedExpirySupport timer
Determines whether the cache entry has expired.
-
lastUsed
protected long lastUsed
Indicates the last time, in milliseconds, the entry was requested or added.
-
globeStateKey
protected GlobeStateKey globeStateKey
Identifies the associated globe's state at the time the entry was created.
-
verticalExaggeration
protected double verticalExaggeration
Indicates the vertical exaggeration in effect when the entry was cached.
-
extent
protected Extent extent
Indicates the associated shape's extent, in model coordinates relative to the associated globe.
-
eyeDistance
protected double eyeDistance
Indicates the eye distance of the shape in the globe-relative coordinate system.
-
timerAdjustedEyeDistance
protected double timerAdjustedEyeDistance
Indicates the eye distance current when the cache entry's remaining time was last adjusted.
-
-
Constructor Detail
-
ShapeDataCacheEntry
public ShapeDataCacheEntry(DrawContext dc, long minExpiryTime, long maxExpiryTime)
Constructs an entry using the globe and vertical exaggeration of a specified draw context.- Parameters:
dc
- the draw context. Must contain a globe.minExpiryTime
- the minimum expiration duration, in milliseconds.maxExpiryTime
- the maximum expiration duration, in milliseconds.- Throws:
java.lang.IllegalArgumentException
- if the draw context is null.
-
-
Method Detail
-
isValid
public boolean isValid(DrawContext dc)
Indicates whether this shape data's globe state and vertical exaggeration are the same as that in the current draw context.- Parameters:
dc
- the current draw context.- Returns:
- true if the shape is valid, otherwise false.
-
isExpired
public boolean isExpired(DrawContext dc)
Indicates whether this entry has expired.- Parameters:
dc
- the current draw context.- Returns:
- true if the entry has expired, otherwise false.
-
setExpired
public void setExpired(boolean isExpired)
Sets this entry's expiration state.- Parameters:
isExpired
- true to expire the entry, otherwise false.
-
restartTimer
public void restartTimer(DrawContext dc)
Resets the timer to the current time.- Parameters:
dc
- the current draw context.- Throws:
java.lang.IllegalArgumentException
- if the draw context is null.
-
adjustTimer
public void adjustTimer(DrawContext dc, double newEyeDistance)
Adjust the timer's expiration time by comparing the cached eye distance to the current eye distance. The remaining expiration time is reduced by 50% each time the eye distance decreases by 50%. This method may be called many times, and the remaining expiration time is reduced only after the eye distance is reduced by 50%. This has no effect if the cached eye distance is unknown, or if the expiration time has already been reached.- Parameters:
dc
- the current draw context.newEyeDistance
- the current eye distance.
-
getEyeDistance
public double getEyeDistance()
Indicates this entry's eye distance.- Returns:
- this entry's eye distance, in meters.
-
setEyeDistance
public void setEyeDistance(double eyeDistance)
Specifies this entry's eye distance.- Parameters:
eyeDistance
- the eye distance, in meters.
-
getExtent
public Extent getExtent()
Returns this entry's extent.- Returns:
- this entry's extent.
-
setExtent
public void setExtent(Extent extent)
Specifies this entry's extent.- Parameters:
extent
- the new extent. May be null.
-
getTimer
public TimedExpirySupport getTimer()
Returns this entry's expiration timer.- Returns:
- this entry's expiration timer.
-
setTimer
public void setTimer(TimedExpirySupport timer)
Specifies this entry's expiration timer.- Parameters:
timer
- the new expiration timer.
-
getGlobeStateKey
public GlobeStateKey getGlobeStateKey()
Indicates this entry's globe state key, captured when this entry was constructed or when explicitly set.- Returns:
- this entry's globe state key.
-
setGlobeStateKey
public void setGlobeStateKey(GlobeStateKey globeStateKey)
Specifies this entry's globe state key.- Parameters:
globeStateKey
- the new globe state key.
-
getVerticalExaggeration
public double getVerticalExaggeration()
Indicates this entry's vertical exaggeration, captured when the entry was constructed or when explicitly set.- Returns:
- this entry's vertical exaggeration.
-
setVerticalExaggeration
public void setVerticalExaggeration(double verticalExaggeration)
-
-