Changeset 9846 in osm for applications/viewer/jmapviewer/src/org/openstreetmap
- Timestamp:
- 2008-08-15T13:03:46+02:00 (16 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 1 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Demo.java
r9780 r9846 16 16 import javax.swing.JPanel; 17 17 18 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 18 19 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 19 20 … … 34 35 final JMapViewer map = new JMapViewer(); 35 36 // final JMapViewer map = new JMapViewer(new MemoryTileCache(),4); 36 map.setTileLoader(new OsmFileCacheTileLoader(map));37 // map.setTileLoader(new OsmFileCacheTileLoader(map)); 37 38 // new DefaultMapController(map); 38 39 setLayout(new BorderLayout()); … … 55 56 }); 56 57 JComboBox tileSourceSelector = 57 new JComboBox(new Object[] { new OsmTileSource.Mapnik(),58 new JComboBox(new TileSource[] { new OsmTileSource.Mapnik(), 58 59 new OsmTileSource.TilesAtHome(), new OsmTileSource.CycleMap() }); 59 60 tileSourceSelector.addItemListener(new ItemListener() { … … 62 63 } 63 64 }); 65 JComboBox tileLoaderSelector = 66 new JComboBox(new TileLoader[] { new OsmFileCacheTileLoader(map), 67 new OsmTileLoader(map) }); 68 tileLoaderSelector.addItemListener(new ItemListener() { 69 public void itemStateChanged(ItemEvent e) { 70 map.setTileLoader((TileLoader) e.getItem()); 71 } 72 }); 73 map.setTileLoader((TileLoader) tileLoaderSelector.getSelectedItem()); 64 74 panel.add(tileSourceSelector); 75 panel.add(tileLoaderSelector); 65 76 final JCheckBox showMapMarker = new JCheckBox("Map markers visible"); 66 77 showMapMarker.setSelected(map.getMapMarkersVisible()); … … 108 119 */ 109 120 public static void main(String[] args) { 110 // Properties systemProperties = System.getProperties();111 // systemProperties.setProperty("http.proxyHost", "localhost");112 // systemProperties.setProperty("http.proxyPort", "8008");121 // java.util.Properties systemProperties = System.getProperties(); 122 // systemProperties.setProperty("http.proxyHost", "localhost"); 123 // systemProperties.setProperty("http.proxyPort", "8008"); 113 124 new Demo().setVisible(true); 114 125 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r9785 r9846 26 26 import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; 27 27 import org.openstreetmap.gui.jmapviewer.interfaces.TileCache; 28 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 29 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; 28 30 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 29 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;30 31 31 32 /** … … 37 38 * 38 39 */ 39 public class JMapViewer extends JPanel {40 public class JMapViewer extends JPanel implements TileLoaderListener { 40 41 41 42 private static final long serialVersionUID = 1L; … … 97 98 tileLoader = new OsmTileLoader(this); 98 99 this.tileCache = tileCache; 99 jobDispatcher = new JobDispatcher(downloadThreadCount);100 jobDispatcher = JobDispatcher.getInstance(); 100 101 mapMarkerList = new LinkedList<MapMarker>(); 101 102 mapMarkersVisible = true; … … 367 368 int mapSize = Tile.SIZE << zoom; 368 369 g.drawRect(w2 - center.x, h2 - center.y, mapSize, mapSize); 369 370 370 371 // g.drawString("Tiles in cache: " + tileCache.getTileCount(), 50, 20); 371 372 if (!mapMarkersVisible || mapMarkerList == null) -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
r9494 r9846 5 5 import java.util.concurrent.BlockingQueue; 6 6 import java.util.concurrent.LinkedBlockingQueue; 7 8 import org.openstreetmap.gui.jmapviewer.interfaces.Job; 7 import java.util.concurrent.TimeUnit; 9 8 10 9 /** 11 10 * A generic class that processes a list of {@link Runnable} one-by-one using 12 * one or more {@link Thread}-instances. 11 * one or more {@link Thread}-instances. The number of instances varies between 12 * 1 and {@link #WORKER_THREAD_MAX_COUNT} (default: 8). If an instance is idle 13 * more than {@link #WORKER_THREAD_TIMEOUT} seconds (default: 30), the instance 14 * ends itself. 13 15 * 14 16 * @author Jan Peter Stotz … … 16 18 public class JobDispatcher { 17 19 20 private static JobDispatcher instance; 21 22 /** 23 * @return the singelton instance of the {@link JobDispatcher} 24 */ 25 public static JobDispatcher getInstance() { 26 if (instance == null) 27 instance = new JobDispatcher(); 28 return instance; 29 } 30 31 private JobDispatcher() { 32 addWorkerThread().firstThread = true; 33 } 34 18 35 protected BlockingQueue<Runnable> jobQueue = new LinkedBlockingQueue<Runnable>(); 19 36 20 JobThread[] threads; 21 22 public JobDispatcher(int threadCound) { 23 threads = new JobThread[threadCound]; 24 for (int i = 0; i < threadCound; i++) { 25 threads[i] = new JobThread(i + 1); 26 } 27 } 37 public static int WORKER_THREAD_MAX_COUNT = 8; 28 38 29 39 /** 30 * Removes all jobs from the queue that are currently not being processed 31 * and stops those currently being processed. 40 * Specifies the time span in seconds that a worker thread waits for new 41 * jobs to perform. If the time span has elapsed the worker thread 42 * terminates itself. Only the first worker thread works differently, it 43 * ignores the timeout and will never terminate itself. 44 */ 45 public static int WORKER_THREAD_TIMEOUT = 30; 46 47 /** 48 * Total number of worker threads currently idle or active 49 */ 50 protected int workerThreadCount = 0; 51 52 /** 53 * Number of worker threads currently idle 54 */ 55 protected int workerThreadIdleCount = 0; 56 57 /** 58 * Just an id for identifying an worker thread instance 59 */ 60 protected int workerThreadId = 0; 61 62 /** 63 * Removes all jobs from the queue that are currently not being processed. 32 64 */ 33 65 public void cancelOutstandingJobs() { 34 66 jobQueue.clear(); 35 for (int i = 0; i < threads.length; i++) {36 try {37 Runnable job = threads[i].getJob();38 if ((job != null) && (job instanceof Job))39 ((Job) job).stop();40 } catch (Exception e) {41 e.printStackTrace();42 }43 }44 67 } 45 68 … … 47 70 try { 48 71 jobQueue.put(job); 72 if (workerThreadIdleCount == 0 && workerThreadCount < WORKER_THREAD_MAX_COUNT) 73 addWorkerThread(); 49 74 } catch (InterruptedException e) { 50 75 } 76 } 77 78 protected JobThread addWorkerThread() { 79 JobThread jobThread = new JobThread(++workerThreadId); 80 synchronized (this) { 81 workerThreadCount++; 82 } 83 return jobThread; 51 84 } 52 85 … … 54 87 55 88 Runnable job; 89 boolean firstThread = false; 56 90 57 91 public JobThread(int threadId) { … … 64 98 @Override 65 99 public void run() { 100 executeJobs(); 101 synchronized (instance) { 102 workerThreadCount--; 103 } 104 } 105 106 protected void executeJobs() { 66 107 while (!isInterrupted()) { 67 108 try { 68 job = jobQueue.take(); 109 synchronized (instance) { 110 workerThreadIdleCount++; 111 } 112 if (firstThread) 113 job = jobQueue.take(); 114 else 115 job = jobQueue.poll(WORKER_THREAD_TIMEOUT, TimeUnit.SECONDS); 69 116 } catch (InterruptedException e1) { 70 117 return; 118 } finally { 119 synchronized (instance) { 120 workerThreadIdleCount--; 121 } 71 122 } 123 if (job == null) 124 return; 72 125 try { 73 126 job.run(); … … 78 131 } 79 132 } 80 81 /**82 * @return the job being executed at the moment or <code>null</code> if83 * the thread is idle.84 */85 public Runnable getJob() {86 return job;87 }88 89 133 } 90 134 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
r9780 r9846 13 13 import java.net.URL; 14 14 import java.net.URLConnection; 15 16 import org.openstreetmap.gui.jmapviewer.interfaces.Job; 15 import java.nio.charset.Charset; 16 17 17 import org.openstreetmap.gui.jmapviewer.interfaces.TileCache; 18 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 19 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; 18 20 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 19 import org.openstreetmap.gui.jmapviewer.interfaces.Tile Loader;21 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource.TileUpdate; 20 22 21 23 /** … … 28 30 public class OsmFileCacheTileLoader extends OsmTileLoader { 29 31 30 private static final String FILE_EXT = ".png"; 32 private static final String TILE_FILE_EXT = ".png"; 33 private static final String ETAG_FILE_EXT = ".etag"; 34 35 private static final Charset ETAG_CHARSET = Charset.forName("UTF-8"); 31 36 32 37 public static final long FILE_AGE_ONE_DAY = 1000 * 60 * 60 * 24; … … 35 40 protected String cacheDirBase; 36 41 37 protected long maxFileAge = FILE_AGE_ONE_WEEK; 38 39 public OsmFileCacheTileLoader(JMapViewer map) { 42 protected long maxCacheFileAge = FILE_AGE_ONE_WEEK; 43 protected long recheckAfter = FILE_AGE_ONE_DAY; 44 45 public OsmFileCacheTileLoader(TileLoaderListener map) { 40 46 super(map); 41 47 String tempDir = System.getProperty("java.io.tmpdir"); … … 53 59 } 54 60 55 public JobcreateTileLoaderJob(final TileSource source, final int tilex, final int tiley,61 public Runnable createTileLoaderJob(final TileSource source, final int tilex, final int tiley, 56 62 final int zoom) { 57 63 return new FileLoadJob(source, tilex, tiley, zoom); 58 64 } 59 65 60 protected class FileLoadJob implements Job{66 protected class FileLoadJob implements Runnable { 61 67 InputStream input = null; 62 68 63 69 int tilex, tiley, zoom; 70 Tile tile; 64 71 TileSource source; 65 72 File tileCacheDir; 73 File tileFile = null; 74 long fileAge = 0; 75 boolean fileTilePainted = false; 66 76 67 77 public FileLoadJob(TileSource source, int tilex, int tiley, int zoom) { … … 74 84 75 85 public void run() { 76 TileCache cache = map.getTileCache(); 77 Tile tile; 86 TileCache cache = listener.getTileCache(); 78 87 synchronized (cache) { 79 88 tile = cache.getTile(source, tilex, tiley, zoom); … … 85 94 if (!tileCacheDir.exists()) 86 95 tileCacheDir.mkdirs(); 87 try { 88 long fileAge = 0; 89 FileInputStream fin = null; 90 File f = null; 91 try { 92 f = getTileFile(tile); 93 fin = new FileInputStream(f); 94 tile.loadImage(fin); 95 fin.close(); 96 fileAge = f.lastModified(); 97 boolean oldTile = System.currentTimeMillis() - fileAge > maxFileAge; 98 System.out.println("Loaded from file: " + tile); 99 if (!oldTile) { 100 tile.setLoaded(true); 101 map.repaint(); 102 return; 96 if (loadTileFromFile()) 97 return; 98 if (fileTilePainted) { 99 Runnable job = new Runnable() { 100 101 public void run() { 102 loadorUpdateTile(); 103 103 } 104 // System.out.println("Cache hit for " + tile + 105 // " but file age is high: " 106 // + new Date(fileAge)); 107 map.repaint(); 108 // if (!isOsmTileNewer(tile, fileAge)) { 109 // tile.setLoaded(true); 110 // return; 111 // } 112 } catch (Exception e) { 113 try { 114 if (fin != null) { 115 fin.close(); 116 f.delete(); 117 } 118 } catch (Exception e1) { 119 } 120 } 121 // Thread.sleep(500); 104 }; 105 JobDispatcher.getInstance().addJob(job); 106 } else { 107 loadorUpdateTile(); 108 } 109 } 110 111 protected void loadorUpdateTile() { 112 113 try { 122 114 // System.out.println("Loading tile from OSM: " + tile); 123 115 HttpURLConnection urlConn = loadTileFromOsm(tile); 124 // if (fileAge > 0) 125 // urlConn.setIfModifiedSince(fileAge); 126 // 127 // if (urlConn.getResponseCode() == 304) { 128 // System.out.println("Local version is up to date"); 129 // tile.setLoaded(true); 130 // return; 131 // } 116 if (tileFile != null) { 117 switch (source.getTileUpdate()) { 118 case IfModifiedSince: 119 urlConn.setIfModifiedSince(fileAge); 120 break; 121 case LastModified: 122 if (!isOsmTileNewer(fileAge)) { 123 System.out 124 .println("LastModified: Local version is up to date: " + tile); 125 tile.setLoaded(true); 126 tileFile.setLastModified(System.currentTimeMillis() - maxCacheFileAge 127 + recheckAfter); 128 return; 129 } 130 break; 131 } 132 } 133 if (source.getTileUpdate() == TileUpdate.ETag 134 || source.getTileUpdate() == TileUpdate.IfNoneMatch) { 135 if (tileFile != null) { 136 String fileETag = loadETagfromFile(); 137 if (fileETag != null) { 138 switch (source.getTileUpdate()) { 139 case IfNoneMatch: 140 urlConn.addRequestProperty("If-None-Match", fileETag); 141 break; 142 case ETag: 143 if (hasOsmTileETag(fileETag)) { 144 tile.setLoaded(true); 145 tileFile.setLastModified(System.currentTimeMillis() - maxCacheFileAge 146 + recheckAfter); 147 return; 148 } 149 } 150 } 151 } 152 153 String eTag = urlConn.getHeaderField("ETag"); 154 saveETagToFile(eTag); 155 } 156 if (urlConn.getResponseCode() == 304) { 157 // If we are isModifiedSince or If-None-Match has been set 158 // and the server answers with a HTTP 304 = "Not Modified" 159 System.out.println("Local version is up to date: " + tile); 160 tile.setLoaded(true); 161 tileFile.setLastModified(System.currentTimeMillis() - maxCacheFileAge 162 + recheckAfter); 163 return; 164 } 165 132 166 byte[] buffer = loadTileInBuffer(urlConn); 133 tile.loadImage(new ByteArrayInputStream(buffer)); 134 tile.setLoaded(true); 135 map.repaint(); 136 input = null; 137 saveTileToFile(tile, buffer); 167 if (buffer != null) { 168 tile.loadImage(new ByteArrayInputStream(buffer)); 169 tile.setLoaded(true); 170 listener.repaint(); 171 saveTileToFile(buffer); 172 } else { 173 tile.setLoaded(true); 174 } 138 175 } catch (Exception e) { 139 176 if (input == null /* || !input.isStopped() */) … … 143 180 tile.loading = false; 144 181 } 182 } 183 184 protected boolean loadTileFromFile() { 185 FileInputStream fin = null; 186 try { 187 tileFile = getTileFile(); 188 fin = new FileInputStream(tileFile); 189 if (fin.available() == 0) 190 throw new IOException("File empty"); 191 tile.loadImage(fin); 192 fin.close(); 193 fileAge = tileFile.lastModified(); 194 boolean oldTile = System.currentTimeMillis() - fileAge > maxCacheFileAge; 195 // System.out.println("Loaded from file: " + tile); 196 if (!oldTile) { 197 tile.setLoaded(true); 198 } 199 listener.repaint(); 200 fileTilePainted = true; 201 } catch (Exception e) { 202 try { 203 if (fin != null) { 204 fin.close(); 205 tileFile.delete(); 206 } 207 } catch (Exception e1) { 208 } 209 tileFile = null; 210 fileAge = 0; 211 } 212 return false; 145 213 } 146 214 … … 157 225 finished = true; 158 226 } while (!finished); 227 if (bout.size() == 0) 228 return null; 159 229 return bout.toByteArray(); 160 230 } … … 171 241 * </ul> 172 242 * 173 * @param tile174 243 * @param fileAge 175 244 * @return <code>true</code> if the tile on the server is newer than the … … 177 246 * @throws IOException 178 247 */ 179 protected boolean isOsmTileNewer( Tile tile,long fileAge) throws IOException {248 protected boolean isOsmTileNewer(long fileAge) throws IOException { 180 249 URL url; 181 250 url = new URL(tile.getUrl()); 182 251 HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); 183 252 urlConn.setRequestMethod("HEAD"); 184 urlConn.setReadTimeout(30000); // 30 seconds read 253 urlConn.setReadTimeout(30000); // 30 seconds read timeout 185 254 // System.out.println("Tile age: " + new 186 255 // Date(urlConn.getLastModified()) + " / " … … 188 257 long lastModified = urlConn.getLastModified(); 189 258 if (lastModified == 0) 259 return true; // no LastModified time returned 260 return (lastModified > fileAge); 261 } 262 263 protected boolean hasOsmTileETag(String eTag) throws IOException { 264 URL url; 265 url = new URL(tile.getUrl()); 266 HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); 267 urlConn.setRequestMethod("HEAD"); 268 urlConn.setReadTimeout(30000); // 30 seconds read timeout 269 // System.out.println("Tile age: " + new 270 // Date(urlConn.getLastModified()) + " / " 271 // + new Date(fileAge)); 272 String osmETag = urlConn.getHeaderField("ETag"); 273 if (osmETag == null) 190 274 return true; 191 return ( lastModified > fileAge);192 } 193 194 protected File getTileFile( Tile tile) throws IOException {275 return (osmETag.equals(eTag)); 276 } 277 278 protected File getTileFile() throws IOException { 195 279 return new File(tileCacheDir + "/" + tile.getZoom() + "_" + tile.getXtile() + "_" 196 + tile.getYtile() + FILE_EXT);197 } 198 199 protected void saveTileToFile( Tile tile,byte[] rawData) {280 + tile.getYtile() + TILE_FILE_EXT); 281 } 282 283 protected void saveTileToFile(byte[] rawData) { 200 284 try { 201 285 FileOutputStream f = 202 286 new FileOutputStream(tileCacheDir + "/" + tile.getZoom() + "_" 203 + tile.getXtile() + "_" + tile.getYtile() + FILE_EXT);287 + tile.getXtile() + "_" + tile.getYtile() + TILE_FILE_EXT); 204 288 f.write(rawData); 205 289 f.close(); … … 210 294 } 211 295 212 public void stop() { 213 } 296 protected void saveETagToFile(String eTag) { 297 try { 298 FileOutputStream f = 299 new FileOutputStream(tileCacheDir + "/" + tile.getZoom() + "_" 300 + tile.getXtile() + "_" + tile.getYtile() + ETAG_FILE_EXT); 301 f.write(eTag.getBytes(ETAG_CHARSET)); 302 f.close(); 303 } catch (Exception e) { 304 System.err.println("Failed to save ETag: " + e.getLocalizedMessage()); 305 } 306 } 307 308 protected String loadETagfromFile() { 309 try { 310 FileInputStream f = 311 new FileInputStream(tileCacheDir + "/" + tile.getZoom() + "_" 312 + tile.getXtile() + "_" + tile.getYtile() + ETAG_FILE_EXT); 313 byte[] buf = new byte[f.available()]; 314 f.read(buf); 315 f.close(); 316 return new String(buf, ETAG_CHARSET); 317 } catch (Exception e) { 318 return null; 319 } 320 } 321 214 322 } 215 323 216 324 public long getMaxFileAge() { 217 return max FileAge;325 return maxCacheFileAge; 218 326 } 219 327 220 328 /** 221 * Sets the maximum age of the local cached tile in the file system. 329 * Sets the maximum age of the local cached tile in the file system. If a 330 * local tile is older than the specified file age 331 * {@link OsmFileCacheTileLoader} will connect to the tile server and check 332 * if a newer tile is available using the mechanism specified for the 333 * selected tile source/server. 222 334 * 223 335 * @param maxFileAge … … 225 337 * @see #FILE_AGE_ONE_DAY 226 338 * @see #FILE_AGE_ONE_WEEK 339 * @see TileSource#getTileUpdate() 227 340 */ 228 public void set MaxFileAge(long maxFileAge) {229 this.max FileAge = maxFileAge;341 public void setCacheMaxFileAge(long maxFileAge) { 342 this.maxCacheFileAge = maxFileAge; 230 343 } 231 344 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
r9780 r9846 8 8 import java.net.URL; 9 9 10 import org.openstreetmap.gui.jmapviewer.interfaces.Job;11 10 import org.openstreetmap.gui.jmapviewer.interfaces.TileCache; 11 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 12 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; 12 13 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 13 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;14 14 15 15 /** … … 20 20 public class OsmTileLoader implements TileLoader { 21 21 22 protected JMapViewer map;22 protected TileLoaderListener listener; 23 23 24 public OsmTileLoader( JMapViewer map) {25 this. map = map;24 public OsmTileLoader(TileLoaderListener listener) { 25 this.listener = listener; 26 26 } 27 27 28 public JobcreateTileLoaderJob(final TileSource source, final int tilex, final int tiley,28 public Runnable createTileLoaderJob(final TileSource source, final int tilex, final int tiley, 29 29 final int zoom) { 30 return new Job() {30 return new Runnable() { 31 31 32 32 InputStream input = null; 33 33 34 34 public void run() { 35 TileCache cache = map.getTileCache();35 TileCache cache = listener.getTileCache(); 36 36 Tile tile; 37 37 synchronized (cache) { … … 46 46 tile.loadImage(input); 47 47 tile.setLoaded(true); 48 map.repaint();48 listener.repaint(); 49 49 input.close(); 50 50 input = null; 51 51 } catch (Exception e) { 52 52 if (input == null /* || !input.isStopped() */) 53 System.err.println("failed loading " + zoom + "/" 54 + tilex + "/" + tiley +" " + e.getMessage());53 System.err.println("failed loading " + zoom + "/" + tilex + "/" + tiley 54 + " " + e.getMessage()); 55 55 } finally { 56 56 tile.loading = false; … … 58 58 } 59 59 60 /**61 * Terminating all transfers that are currently in progress62 */63 public void stop() {64 65 try {66 // if (input != null)67 // input.stop();68 } catch (Exception e) {69 }70 }71 60 }; 72 61 } … … 80 69 return urlConn; 81 70 } 71 72 @Override 73 public String toString() { 74 return getClass().getSimpleName(); 75 } 76 82 77 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileSource.java
r9780 r9846 36 36 } 37 37 38 public TileUpdate getTileUpdate() { 39 return TileUpdate.IfNoneMatch; 40 } 41 38 42 } 39 43 … … 48 52 return MAP_CYCLE + super.getTileUrl(zoom, tilex, tiley); 49 53 } 54 55 public TileUpdate getTileUpdate() { 56 return TileUpdate.LastModified; 57 } 58 50 59 } 51 60 … … 65 74 } 66 75 76 public TileUpdate getTileUpdate() { 77 return TileUpdate.IfModifiedSince; 78 } 67 79 } 68 80 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
r9780 r9846 20 20 * @param tiley 21 21 * @param zoom 22 * @returns {@link Job} implementation that performs the desired load22 * @returns {@link Runnable} implementation that performs the desired load 23 23 * action. 24 24 */ 25 public JobcreateTileLoaderJob(TileSource tileLayerSource, int tilex, int tiley, int zoom);25 public Runnable createTileLoaderJob(TileSource tileLayerSource, int tilex, int tiley, int zoom); 26 26 } -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
r9780 r9846 28 28 * all tiles but <b>does not support</b> conditional download via 29 29 * <code>If-Modified-Since</code> header entry.</li> 30 * <li>{@link #None} The server does not support any of the listed 31 * mechanisms.</li> 30 32 * </ul> 31 33 * 32 34 */ 33 public enum TileUpdate Detection{34 IfNoneMatch, ETag, IfModifiedSince, LastModified 35 public enum TileUpdate { 36 IfNoneMatch, ETag, IfModifiedSince, LastModified, None 35 37 }; 36 38 … … 43 45 */ 44 46 public int getMaxZoom(); 47 48 /** 49 * @return The supported tile update mechanism 50 * @see TileUpdate 51 */ 52 public TileUpdate getTileUpdate(); 45 53 46 54 /**
Note:
See TracChangeset
for help on using the changeset viewer.