Class BasicElevationModelBulkDownloader

  • All Implemented Interfaces:
    java.lang.Runnable

    public class BasicElevationModelBulkDownloader
    extends BulkRetrievalThread
    Downloads elevation data not currently available in the WorldWind file cache or a specified FileStore. The class derives from Thread and is meant to operate in its own thread.

    The sector and resolution associated with the downloader are specified during construction and are final.

    • Field Detail

      • MAX_TILE_COUNT_PER_REGION

        protected static final int MAX_TILE_COUNT_PER_REGION
        See Also:
        Constant Field Values
      • DEFAULT_AVERAGE_FILE_SIZE

        protected static final long DEFAULT_AVERAGE_FILE_SIZE
        See Also:
        Constant Field Values
      • level

        protected final int level
      • missingTiles

        protected java.util.ArrayList<Tile> missingTiles
    • Constructor Detail

      • BasicElevationModelBulkDownloader

        public BasicElevationModelBulkDownloader​(BasicElevationModel elevationModel,
                                                 Sector sector,
                                                 double resolution,
                                                 BulkRetrievalListener listener)
        Constructs a downloader to retrieve elevations not currently available in the WorldWind file cache.

        The thread returned is not started during construction, the caller must start the thread.

        Parameters:
        elevationModel - the elevation model for which to download elevations.
        sector - the sector to download data for. This value is final.
        resolution - the target resolution, provided in radians of latitude per texel. This value is final.
        listener - an optional retrieval listener. May be null.
        Throws:
        java.lang.IllegalArgumentException - if either the elevation model or sector are null, or the resolution is less than zero.
      • BasicElevationModelBulkDownloader

        public BasicElevationModelBulkDownloader​(BasicElevationModel elevationModel,
                                                 Sector sector,
                                                 double resolution,
                                                 FileStore fileStore,
                                                 BulkRetrievalListener listener)
        Constructs a downloader to retrieve elevations not currently available in a specified file store.

        The thread returned is not started during construction, the caller must start the thread.

        Parameters:
        elevationModel - the elevation model for which to download elevations.
        sector - the sector to download data for. This value is final.
        resolution - the target resolution, provided in radians of latitude per texel. This value is final.
        fileStore - the file store in which to place the downloaded elevations.
        listener - an optional retrieval listener. May be null.
        Throws:
        java.lang.IllegalArgumentException - if either the elevation model, the sector or file store are null, or the resolution is less than zero.
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Specified by:
        run in class BulkRetrievalThread
      • submitMissingTilesRequests

        protected void submitMissingTilesRequests()
                                           throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • callRetrievalListeners

        protected void callRetrievalListeners​(Retriever retriever,
                                              Tile tile)
      • removeRetrievedTile

        protected void removeRetrievedTile​(Tile tile)
      • removeAbsentTile

        protected void removeAbsentTile​(Tile tile)
      • normalizeProgress

        protected void normalizeProgress()
      • getEstimatedMissingDataSize

        protected long getEstimatedMissingDataSize()
      • estimateMissingTilesCount

        protected long estimateMissingTilesCount​(int numSamples)
      • estimateAverageTileSize

        protected long estimateAverageTileSize()
      • computeAverageTileSize

        protected static long computeAverageTileSize​(java.io.File dir)
      • computeLevelForResolution

        protected int computeLevelForResolution​(Sector sector,
                                                double resolution)
      • countTilesInSector

        protected long countTilesInSector​(Sector sector,
                                          int levelNumber)
      • getTilesInSector

        protected Tile[][] getTilesInSector​(Sector sector,
                                            int levelNumber)
      • getMissingTilesInSector

        protected java.util.ArrayList<Tile> getMissingTilesInSector​(Sector sector,
                                                                    int levelNumber)
                                                             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • computeRegionDivisions

        protected int computeRegionDivisions​(Sector sector,
                                             int levelNumber,
                                             int maxCount)
      • computeRandomRegions

        protected Sector[] computeRandomRegions​(Sector sector,
                                                int div,
                                                int numRegions)
      • getRegionIterator

        protected java.util.Iterator<Sector> getRegionIterator​(Sector sector,
                                                               int div)
      • isTileLocalOrAbsent

        protected boolean isTileLocalOrAbsent​(Tile tile)