Last change
on this file since 31739 was 31739, checked in by wiktorn, 9 years ago |
Fix high CPU usage when showing small tiles.
- AbstractTileSourceLayer - check insane() zoom level based on TileCache size instead of hardcoded value
- TileCache - add interface to check size of the cache
- TMSCachedTileLoader - remove unnnecessary TileCache interface and its methods
- HostLimitQueue - correct log message
- JCSCachedTileLoaderJob - add debug logs for putting request into queue and start of processing
|
-
Property svn:eol-style
set to
native
|
File size:
1.5 KB
|
Line | |
---|
1 | // License: GPL. For details, see Readme.txt file.
|
---|
2 | package org.openstreetmap.gui.jmapviewer.interfaces;
|
---|
3 |
|
---|
4 | import org.openstreetmap.gui.jmapviewer.JMapViewer;
|
---|
5 | import org.openstreetmap.gui.jmapviewer.Tile;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Implement this interface for creating your custom tile cache for
|
---|
9 | * {@link JMapViewer}.
|
---|
10 | *
|
---|
11 | * @author Jan Peter Stotz
|
---|
12 | */
|
---|
13 | public interface TileCache {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Retrieves a tile from the cache if present, otherwise <code>null</code>
|
---|
17 | * will be returned.
|
---|
18 | *
|
---|
19 | * @param source
|
---|
20 | * the tile source
|
---|
21 | * @param x
|
---|
22 | * tile number on the x axis of the tile to be retrieved
|
---|
23 | * @param y
|
---|
24 | * tile number on the y axis of the tile to be retrieved
|
---|
25 | * @param z
|
---|
26 | * zoom level of the tile to be retrieved
|
---|
27 | * @return the requested tile or <code>null</code> if the tile is not
|
---|
28 | * present in the cache
|
---|
29 | */
|
---|
30 | Tile getTile(TileSource source, int x, int y, int z);
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Adds a tile to the cache. How long after adding a tile can be retrieved
|
---|
34 | * via {@link #getTile(TileSource, int, int, int)} is unspecified and depends on the
|
---|
35 | * implementation.
|
---|
36 | *
|
---|
37 | * @param tile the tile to be added
|
---|
38 | */
|
---|
39 | void addTile(Tile tile);
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * @return the number of tiles hold by the cache
|
---|
43 | */
|
---|
44 | int getTileCount();
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Clears the cache deleting all tiles from memory.
|
---|
48 | */
|
---|
49 | void clear();
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Size of the cache.
|
---|
53 | * @return maximum number of tiles in cache
|
---|
54 | */
|
---|
55 | int getCacheSize();
|
---|
56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.