]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - src/tim/prune/gui/map/MapTileManager.java
Never overzoom when initially opening a track
[GpsPrune.git] / src / tim / prune / gui / map / MapTileManager.java
index f7370c5c90c833e7f053fc786eafdae37ab7f843..b4a60c88b607a10cee8737f7ce80bd4c3b701e89 100644 (file)
@@ -70,10 +70,19 @@ public class MapTileManager implements ImageObserver
         * @return true if zoom is too high for tiles
         */
        public boolean isOverzoomed()
+       {
+               return _zoom > getMaxZoomLevel();
+       }
+
+       /**
+        * @return the maximum useable zoom level for tiles
+        */
+       public int getMaxZoomLevel()
        {
                // Ask current map source what maximum zoom is
                int maxZoom = (_mapSource == null?0:_mapSource.getMaxZoomLevel());
-               return (_zoom > maxZoom);
+               return maxZoom;
+
        }
 
        /**
@@ -162,6 +171,7 @@ public class MapTileManager implements ImageObserver
                        tempCache = _tempCaches[inLayer]; // Should probably guard array indexes here
                        tileImage = tempCache.getTile(inX, inY);
                        if (tileImage != null) {
+                               //System.out.println("Got tile from memory: " + inX + ", " + inY);
                                return tileImage;
                        }
                }
@@ -195,7 +205,6 @@ public class MapTileManager implements ImageObserver
                        try
                        {
                                URL tileUrl = new URL(_mapSource.makeURL(inLayer, _zoom, inX, inY));
-                               //System.out.println("Trying to fetch: " + tileUrl);
                                if (useDisk)
                                {
                                        DiskTileCacher.saveTile(tileUrl, diskCachePath,