Ignore:
Timestamp:
2015-09-10T18:30:42+02:00 (9 years ago)
Author:
wiktorn
Message:

Align ElevationProfile plugin to JobDispatcher removal. Addresses: #11840

Location:
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileController.java

    r30344 r31544  
    22package org.openstreetmap.josm.plugins.elevation.grid;
    33
    4 import org.openstreetmap.gui.jmapviewer.JobDispatcher;
    54import org.openstreetmap.gui.jmapviewer.Tile;
    65import org.openstreetmap.gui.jmapviewer.TileController;
     
    1615 */
    1716public class ElevationGridTileController extends TileController {
    18     private final JobDispatcher jobDispatcher; // is private and no getter
    1917
    20     /**
    21     * @param source
    22     * @param tileCache
    23     * @param listener
    24     */
    25     public ElevationGridTileController(TileSource source, TileCache tileCache,
    26             TileLoaderListener listener, TileLoader loader) {
    27         super(source, tileCache, listener);
     18        /**
     19        * @param source
     20        * @param tileCache
     21        * @param listener
     22        */
     23        public ElevationGridTileController(TileSource source, TileCache tileCache,
     24                        TileLoaderListener listener, TileLoader loader) {
     25                super(source, tileCache, listener);
    2826
    29         tileSource = source; // FIXME: hard-coded in base class (although parameter is given)!!
    30         tileLoader = loader; // FIXME: hard-coded in base class!
    31         jobDispatcher = JobDispatcher.getInstance();
    32     }
     27                tileSource = source; // FIXME: hard-coded in base class (although parameter is given)!!
     28                tileLoader = loader; // FIXME: hard-coded in base class!
     29        }
    3330
    34     @Override
    35     public Tile getTile(int tilex, int tiley, int zoom) {
    36         int max = (1 << zoom);
    37         if (tilex < 0 || tilex >= max || tiley < 0 || tiley >= max)
    38             return null;
    39         Tile tile = tileCache.getTile(tileSource, tilex, tiley, zoom);
    40         if (tile == null) {
    41             // FIXME: Provide/use a factory method here
    42             tile = new ElevationGridTile(tileSource, tilex, tiley, zoom);
    43             tileCache.addTile(tile);
    44             tile.loadPlaceholderFromCache(tileCache);
    45         }
    46         if (tile.hasError()) {
    47             tile.loadPlaceholderFromCache(tileCache);
    48         }
    49         if (!tile.isLoaded()) {
    50             jobDispatcher.addJob(tileLoader.createTileLoaderJob(tile));
    51         }
    52         return tile;
    53     }
     31        @Override
     32        public Tile getTile(int tilex, int tiley, int zoom) {
     33                int max = (1 << zoom);
     34                if (tilex < 0 || tilex >= max || tiley < 0 || tiley >= max)
     35                        return null;
     36                Tile tile = tileCache.getTile(tileSource, tilex, tiley, zoom);
     37                if (tile == null) {
     38                        // FIXME: Provide/use a factory method here
     39                        tile = new ElevationGridTile(tileSource, tilex, tiley, zoom);
     40                        tileCache.addTile(tile);
     41                        tile.loadPlaceholderFromCache(tileCache);
     42                }
     43                if (tile.hasError()) {
     44                        tile.loadPlaceholderFromCache(tileCache);
     45                }
     46                if (!tile.isLoaded()) {
     47                        tileLoader.createTileLoaderJob(tile).submit();
     48                }
     49                return tile;
     50        }
    5451
    55     /**
    56      *
    57      */
    58     @Override
    59     public void cancelOutstandingJobs() {
    60         super.cancelOutstandingJobs(); // should not make a difference but you never know...
    61         jobDispatcher.cancelOutstandingJobs();
    62     }
     52        /**
     53         *
     54         */
    6355}
  • applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileLoader.java

    r31147 r31544  
    6363        }
    6464
     65        @Override
     66        public void cancelOutstandingTasks() {
     67                // intentionally left blank
     68        }
     69
    6570}
Note: See TracChangeset for help on using the changeset viewer.