Class TiledImageLayer

    • Field Detail

      • levels

        protected final LevelSet levels
      • topLevels

        protected java.util.ArrayList<TextureTile> topLevels
      • forceLevelZeroLoads

        protected boolean forceLevelZeroLoads
      • levelZeroLoaded

        protected boolean levelZeroLoaded
      • retainLevelZeroTiles

        protected boolean retainLevelZeroTiles
      • tileCountName

        protected java.lang.String tileCountName
      • detailHintOrigin

        protected double detailHintOrigin
      • detailHint

        protected double detailHint
      • useMipMaps

        protected boolean useMipMaps
      • useTransparentTextures

        protected boolean useTransparentTextures
      • supportedImageFormats

        protected java.util.ArrayList<java.lang.String> supportedImageFormats
      • textureFormat

        protected java.lang.String textureFormat
      • drawTileBoundaries

        protected boolean drawTileBoundaries
      • drawBoundingVolumes

        protected boolean drawBoundingVolumes
      • currentTiles

        protected java.util.ArrayList<TextureTile> currentTiles
      • currentResourceTile

        protected TextureTile currentResourceTile
      • atMaxResolution

        protected boolean atMaxResolution
      • requestQ

        protected java.util.concurrent.PriorityBlockingQueue<java.lang.Runnable> requestQ
    • Constructor Detail

      • TiledImageLayer

        public TiledImageLayer​(LevelSet levelSet)
    • Method Detail

      • forceTextureLoad

        protected abstract void forceTextureLoad​(TextureTile tile)
      • setValue

        public java.lang.Object setValue​(java.lang.String key,
                                         java.lang.Object value)
        Description copied from interface: AVList
        Adds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.
        Specified by:
        setValue in interface AVList
        Overrides:
        setValue in class AVListImpl
        Parameters:
        key - the attribute name. May not be null.
        value - the attribute value. May be null, in which case any existing value for the key is removed from the collection.
        Returns:
        previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.
      • getValue

        public java.lang.Object getValue​(java.lang.String key)
        Description copied from interface: AVList
        Returns the value for a specified key.
        Specified by:
        getValue in interface AVList
        Overrides:
        getValue in class AVListImpl
        Parameters:
        key - the attribute name. May not be null.
        Returns:
        the attribute value if one exists in the collection, otherwise null.
      • setName

        public void setName​(java.lang.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
        Overrides:
        setName in class AbstractLayer
        Parameters:
        name - the name to assign to the layer.
      • isForceLevelZeroLoads

        public boolean isForceLevelZeroLoads()
      • setForceLevelZeroLoads

        public void setForceLevelZeroLoads​(boolean forceLevelZeroLoads)
      • isRetainLevelZeroTiles

        public boolean isRetainLevelZeroTiles()
      • setRetainLevelZeroTiles

        public void setRetainLevelZeroTiles​(boolean retainLevelZeroTiles)
      • isDrawTileIDs

        public boolean isDrawTileIDs()
      • setDrawTileIDs

        public void setDrawTileIDs​(boolean drawTileIDs)
      • isDrawTileBoundaries

        public boolean isDrawTileBoundaries()
      • setDrawTileBoundaries

        public void setDrawTileBoundaries​(boolean drawTileBoundaries)
      • isDrawBoundingVolumes

        public boolean isDrawBoundingVolumes()
      • setDrawBoundingVolumes

        public void setDrawBoundingVolumes​(boolean drawBoundingVolumes)
      • setDetailHint

        public void setDetailHint​(double detailHint)
        Modifies the default relationship of image resolution to screen resolution as the viewing altitude changes. Values greater than 0 cause imagery to appear at higher resolution at greater altitudes than normal, but at an increased performance cost. Values less than 0 decrease the default resolution at any given altitude. The default value is 0. Values typically range between -0.5 and 0.5.

        Note: The resolution-to-height relationship is defined by a scale factor that specifies the approximate size of discernible lengths in the image relative to eye distance. The scale is specified as a power of 10. A value of 3, for example, specifies that 1 meter on the surface should be distinguishable from an altitude of 10^3 meters (1000 meters). The default scale is 1/10^2.8, (1 over 10 raised to the power 2.8). The detail hint specifies deviations from that default. A detail hint of 0.2 specifies a scale of 1/1000, i.e., 1/10^(2.8 + .2) = 1/10^3. Scales much larger than 3 typically cause the applied resolution to be higher than discernible for the altitude. Such scales significantly decrease performance.

        Parameters:
        detailHint - the degree to modify the default relationship of image resolution to screen resolution with changing view altitudes. Values greater than 1 increase the resolution. Values less than zero decrease the resolution. The default value is 0.
      • getLevels

        public LevelSet getLevels()
      • getRequestQ

        protected java.util.concurrent.PriorityBlockingQueue<java.lang.Runnable> getRequestQ()
      • 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
        Overrides:
        isMultiResolution in class AbstractLayer
        Returns:
        true if the layer provides multiple resolutions, else false.
      • 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
        Overrides:
        isAtMaxResolution in class AbstractLayer
        Returns:
        true if the layer is at maximum resolution, otherwise false.
      • getTextureFormat

        public java.lang.String getTextureFormat()
        Returns the format used to store images in texture memory, or null if images are stored in their native format.
        Returns:
        the texture image format; null if images are stored in their native format.
        See Also:
        setTextureFormat(String)
      • setTextureFormat

        public void setTextureFormat​(java.lang.String textureFormat)
        Specifies the format used to store images in texture memory, or null to store images in their native format. Supported texture formats are as follows:
        • image/dds - Stores images in the compressed DDS format. If the image is already in DDS format it's stored as-is.
        Parameters:
        textureFormat - the texture image format; null to store images in their native format.
      • isUseMipMaps

        public boolean isUseMipMaps()
      • setUseMipMaps

        public void setUseMipMaps​(boolean useMipMaps)
      • isUseTransparentTextures

        public boolean isUseTransparentTextures()
      • setUseTransparentTextures

        public void setUseTransparentTextures​(boolean useTransparentTextures)
      • setExpiryTime

        public void setExpiryTime​(long expiryTime)
        Specifies the time of the layer's most recent dataset update, beyond which cached data is invalid. If greater than zero, the layer ignores and eliminates any in-memory or on-disk cached data older than the time specified, and requests new information from the data source. If zero, the default, the layer applies any expiry times associated with its individual levels, but only for on-disk cached data. In-memory cached data is expired only when the expiry time is specified with this method and is greater than zero. This method also overwrites the expiry times of the layer's individual levels if the value specified to the method is greater than zero.
        Specified by:
        setExpiryTime in interface Layer
        Overrides:
        setExpiryTime in class AbstractLayer
        Parameters:
        expiryTime - the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch. The default expiry time is zero.
        See Also:
        for a description of milliseconds beyond the epoch.
      • getTopLevels

        public java.util.List<TextureTile> getTopLevels()
      • createTopLevelTiles

        protected void createTopLevelTiles()
      • loadAllTopLevelTextures

        protected void loadAllTopLevelTextures​(DrawContext dc)
      • assembleTiles

        protected void assembleTiles​(DrawContext dc)
      • addTileToCurrent

        protected void addTileToCurrent​(TextureTile tile)
      • getDetailFactor

        protected double getDetailFactor()
      • getMinEffectiveAltitude

        public java.lang.Double getMinEffectiveAltitude​(java.lang.Double radius)
        Description copied from interface: Layer
        Indicates the altitude below which this layer likely has low value or is not expected to be active. This value is independent of the minimum active altitude, Layer.setMinActiveAltitude(double) and does not reflect it.

        The returned altitude is valid when the field of view indicated by View.getFieldOfView() is set to its default value. Changing the field of view to any value other than the default may change this layer's minimum effective altitude, but the returned altitude will not reflect that change.

        Specified by:
        getMinEffectiveAltitude in interface Layer
        Overrides:
        getMinEffectiveAltitude in class AbstractLayer
        Parameters:
        radius - the radius of the Globe the layer is associated with. May be null, in which case the Earth's equatorial radius is used, Earth.WGS84_EQUATORIAL_RADIUS.
        Returns:
        the layer's minimum effective altitude.
      • getMaxEffectiveAltitude

        public java.lang.Double getMaxEffectiveAltitude​(java.lang.Double radius)
        Description copied from interface: Layer
        Indicates the altitude above which this layer likely has low value or is not expected to be active. This value is independent of the maximum active altitude, Layer.setMaxActiveAltitude(double) and does not reflect it.

        The returned altitude is valid when the field of view indicated by View.getFieldOfView() is set to its default value. Changing the field of view to any value other than the default may change this layer's maximum effective altitude, but the returned altitude will not reflect that change.

        Specified by:
        getMaxEffectiveAltitude in interface Layer
        Overrides:
        getMaxEffectiveAltitude in class AbstractLayer
        Parameters:
        radius - the radius of the Globe the layer is associated with. May be null, in which case the Earth's equatorial radius is used, Earth.WGS84_EQUATORIAL_RADIUS.
        Returns:
        the layer's maximum effective altitude.
      • atMaxLevel

        protected boolean atMaxLevel​(DrawContext dc)
      • render

        public void render​(DrawContext dc)
        Description copied from interface: Layer
        Cause the layer to draw its representation.
        Specified by:
        render in interface Layer
        Overrides:
        render in class AbstractLayer
        Parameters:
        dc - the current draw context
      • checkTextureExpiration

        protected void checkTextureExpiration​(DrawContext dc,
                                              java.util.List<TextureTile> tiles)
      • setBlendingFunction

        protected void setBlendingFunction​(DrawContext dc)
      • sendRequests

        protected void sendRequests()
      • isLayerInView

        public boolean isLayerInView​(DrawContext dc)
        Description copied from interface: Layer
        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.
        Specified by:
        isLayerInView in interface Layer
        Overrides:
        isLayerInView in class AbstractLayer
        Parameters:
        dc - the current draw context
        Returns:
        true if the layer is in the view, false otherwise.
      • computeReferencePoint

        protected Vec4 computeReferencePoint​(DrawContext dc)
      • drawBoundingVolumes

        protected void drawBoundingVolumes​(DrawContext dc,
                                           java.util.ArrayList<TextureTile> tiles)
      • createTiledImageLayerConfigDocument

        public static org.w3c.dom.Document createTiledImageLayerConfigDocument​(AVList params)
        Creates a configuration document for a TiledImageLayer described by the specified params. The returned document may be used as a construction parameter to BasicTiledImageLayer.
        Parameters:
        params - parameters describing the TiledImageLayer.
        Returns:
        a configuration document for the TiledImageLayer.
      • getLegacyTiledImageLayerConfigParams

        protected static AVList getLegacyTiledImageLayerConfigParams​(org.w3c.dom.Element domElement,
                                                                     AVList params)
        Parses TiledImageLayer configuration parameters from previous versions of configuration documents. This writes output as key-value pairs to params. If a parameter from the XML document already exists in params, that parameter is ignored. Supported key and parameter names are:
        Supported Names
        ParameterElement PathType
        AVKey.TEXTURE_FORMATCompressTextures"image/dds" if CompressTextures is "true"; null otherwise
        Parameters:
        domElement - the XML document root to parse for legacy TiledImageLayer configuration parameters.
        params - the output key-value pairs which recieve the TiledImageLayer configuration parameters. A null reference is permitted.
        Returns:
        a reference to params, or a new AVList if params is null.
        Throws:
        java.lang.IllegalArgumentException - if the document is null.
      • getAvailableImageFormats

        public java.util.List<java.lang.String> getAvailableImageFormats()
      • isImageFormatAvailable

        public boolean isImageFormatAvailable​(java.lang.String imageFormat)
      • getDefaultImageFormat

        public java.lang.String getDefaultImageFormat()
      • setAvailableImageFormats

        protected void setAvailableImageFormats​(java.lang.String[] formats)
      • requestImage

        protected java.awt.image.BufferedImage requestImage​(TextureTile tile,
                                                            java.lang.String mimeType)
                                                     throws java.net.URISyntaxException,
                                                            java.io.InterruptedIOException,
                                                            java.net.MalformedURLException
        Throws:
        java.net.URISyntaxException
        java.io.InterruptedIOException
        java.net.MalformedURLException
      • downloadImage

        protected void downloadImage​(TextureTile tile,
                                     java.lang.String mimeType,
                                     int timeout)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • retrieveRemoteImage

        protected void retrieveRemoteImage​(TextureTile tile,
                                           java.lang.String mimeType,
                                           int timeout)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • retrieveLocalImage

        protected void retrieveLocalImage​(TextureTile tile,
                                          java.lang.String mimeType,
                                          int timeout)
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • computeLevelForResolution

        public int computeLevelForResolution​(Sector sector,
                                             double resolution)
      • composeImageForSector

        public java.awt.image.BufferedImage composeImageForSector​(Sector sector,
                                                                  int canvasWidth,
                                                                  int canvasHeight,
                                                                  double aspectRatio,
                                                                  int levelNumber,
                                                                  java.lang.String mimeType,
                                                                  boolean abortOnError,
                                                                  java.awt.image.BufferedImage image,
                                                                  int timeout)
                                                           throws java.lang.Exception
        Create an image for the portion of this layer lying within a specified sector.The image is created at a specified aspect ratio within a canvas of a specified size. This returns the specified image if this layer has no content in the specified sector.
        Parameters:
        sector - the sector of interest.
        canvasWidth - the width of the canvas.
        canvasHeight - the height of the canvas.
        aspectRatio - the aspect ratio, width/height, of the window. If the aspect ratio is greater or equal to one, the full width of the canvas is used for the image; the height used is proportional to the inverse of the aspect ratio. If the aspect ratio is less than one, the full height of the canvas is used, and the width used is proportional to the aspect ratio.
        levelNumber - the target level of the tiled image layer.
        mimeType - the type of image to create, e.g., "png" and "jpg".
        abortOnError - indicates whether to stop assembling the image if an error occurs. If false, processing continues until all portions of the layer that intersect the specified sector have been added to the image. Portions for which an error occurs will be blank.
        image - if non-null, a BufferedImage in which to place the image. If null, a new buffered image is created. The image must be the width and height specified in the canvasWidth and canvasHeight arguments.
        timeout - The amount of time to allow for reading the image from the server.
        Returns:
        image the assembled image, of size indicated by the canvasWidth and canvasHeight. If the specified aspect ratio is one, all pixels contain values. If the aspect ratio is greater than one, a full-width segment along the top of the canvas is blank. If the aspect ratio is less than one, a full-height segment along the right side of the canvase is blank. If the image argument was non-null, that buffered image is returned.
        Throws:
        java.lang.IllegalArgumentException - if sector is null.
        java.lang.Exception - Other errors.
        See Also:
        ;
      • countImagesInSector

        public long countImagesInSector​(Sector sector)
      • countImagesInSector

        public long countImagesInSector​(Sector sector,
                                        int levelNumber)
      • getTilesInSector

        public TextureTile[][] getTilesInSector​(Sector sector,
                                                int levelNumber)
      • getImage

        protected java.awt.image.BufferedImage getImage​(TextureTile tile,
                                                        java.lang.String mimeType,
                                                        int timeout)
                                                 throws java.lang.Exception
        Throws:
        java.lang.Exception