Changeset 31544 in osm for applications/editors/josm/plugins/ElevationProfile/src
- Timestamp:
- 2015-09-10T18:30:42+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid
- Files:
-
- 2 edited
-
ElevationGridTileController.java (modified) (2 diffs)
-
ElevationGridTileLoader.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileController.java
r30344 r31544 2 2 package org.openstreetmap.josm.plugins.elevation.grid; 3 3 4 import org.openstreetmap.gui.jmapviewer.JobDispatcher;5 4 import org.openstreetmap.gui.jmapviewer.Tile; 6 5 import org.openstreetmap.gui.jmapviewer.TileController; … … 16 15 */ 17 16 public class ElevationGridTileController extends TileController { 18 private final JobDispatcher jobDispatcher; // is private and no getter19 17 20 /**21 * @param source22 * @param tileCache23 * @param listener24 */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); 28 26 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 } 33 30 34 @Override35 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 here42 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 } 54 51 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 */ 63 55 } -
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileLoader.java
r31147 r31544 63 63 } 64 64 65 @Override 66 public void cancelOutstandingTasks() { 67 // intentionally left blank 68 } 69 65 70 }
Note:
See TracChangeset
for help on using the changeset viewer.
