Class ShapeDataCache.ShapeDataCacheEntry

    • 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)