Package org.locationtech.udig.catalog.wmsc.server

Examples of org.locationtech.udig.catalog.wmsc.server.TileRangeOnDisk


        /**
         * Load the tiles in the tilerange and then reset the vars
         */
        private void doRequestAndResetVars( final TileSet tileset ) {
            TileRangeOnDisk tileRangeOnDisk = new TileRangeOnDisk(tileset.getServer(), tileset,
                    tileRangeBounds, tileRangeTiles, requestTileWorkQueue, writeTileWorkQueue);
            // set the listener on the tile range so we can wait until all tiles are
            // done for the range before moving on.
            tileRangeOnDisk.addListener(listener);

            // remove any tiles that are already loaded from disk to avoid
            // deadlock waiting for all tiles
            Map<String, Tile> loadedTiles = new HashMap<String, Tile>();
            Iterator<Entry<String, Tile>> iterator = tileRangeTiles.entrySet().iterator();
            while( iterator.hasNext() ) {
                Tile tile = iterator.next().getValue();
                if (tile.getBufferedImage() != null) {
                    loadedTiles.put(tile.getId(), tile);
                }
            }
            Iterator<Entry<String, Tile>> iterator2 = loadedTiles.entrySet().iterator();
            while( iterator2.hasNext() ) {
                Tile tile = iterator2.next().getValue();
                tileRangeTiles.remove(tile.getId());
            }

            // now load any missing tiles and send off thread requests to fetch them
            tileRangeOnDisk.loadTiles(new NullProgressMonitor());

            // block and wait until all unloaded tiles are loaded before moving forward
            while( !tileRangeTiles.isEmpty() ) {
                Tile tile = null;
                try {
                    tile = (Tile) tilesCompleted_queue.take(); // blocks until a tile is done
                } catch (InterruptedException ex) {
                    // log error?
                    // ex.printStackTrace();
                } finally {
                    // remove the tile
                    if (tile != null) {
                        tileRangeTiles.remove(tile.getId());
                    }
                }
            }

            // all tiles in chunk are now complete, so update monitor
            this.monitor.worked((int) percentPerTile * tileRangeOnDisk.getTileCount());

            // reset vars
            requestCount = 0;
            tileRangeBounds = new Envelope();
            tileRangeTiles.clear();
View Full Code Here


        String value = CatalogPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.P_WMSCTILE_CACHING);
        if (value.equals(WMSCTileCaching.ONDISK.toString())) {
            String dir = CatalogPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.P_WMSCTILE_DISKDIR);
            WMTTileImageReadWriter tileReadWriter = new WMTTileImageReadWriter(dir);
           
            range = new TileRangeOnDisk(null, tileset, renderJob.getMapExtentTileCrs(),
                    tileList, requestTileWorkQueue, writeTileWorkQueue, tileReadWriter);
        } else {
            range = new TileRangeInMemory(null, tileset, renderJob.getMapExtentTileCrs(),
                    tileList, requestTileWorkQueue);
        }
View Full Code Here

            // memory and use the proper tilerange for that.
            TileRange range = null;
            String value = CatalogPlugin.getDefault().getPreferenceStore()
                    .getString(PreferenceConstants.P_WMSCTILE_CACHING);
            if (value.equals(WMSCTileCaching.ONDISK.toString())) {
                range = new TileRangeOnDisk(server, tileset, bnds, tilesInRange,
                        requestTileWorkQueue, writeTileWorkQueue);
            } else {
                range = new TileRangeInMemory(server, tileset, bnds, tilesInRange,
                        requestTileWorkQueue);
            }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.wmsc.server.TileRangeOnDisk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.