Changeset 4328 in josm
- Timestamp:
- 2011-08-21T17:41:08+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r4306 r4328 106 106 } 107 107 108 /*boolean debug = false;*/108 /*boolean debug = true;*/ 109 109 110 110 protected MemoryTileCache tileCache; … … 311 311 double factor = getScaleFactor(1); 312 312 double result = Math.log(factor)/Math.log(2)/2+1; 313 int intResult = (int)Math.round(result); 313 // In general, smaller zoom levels are more readable. We prefer big, 314 // block, pixelated (but readable) map text to small, smeared, 315 // unreadable underzoomed text. So, use .floor() instead of rounding 316 // to skew things a bit toward the lower zooms. 317 int intResult = (int)Math.floor(result); 314 318 if (intResult > getMaxZoomLvl()) 315 319 return getMaxZoomLvl(); … … 822 826 } 823 827 List<Tile> missedTiles = new LinkedList<Tile>(); 824 for (Tile tile : ts.allTiles()) { 828 // The callers of this code *require* that we return any tiles 829 // that we do not draw in missedTiles. ts.allTiles() by default 830 // will only return already-existing tiles. However, we need 831 // to return *all* tiles to the callers, so force creation here. 832 boolean forceTileCreation = true; 833 for (Tile tile : ts.allTiles(forceTileCreation)) { 825 834 Image img = getLoadedTileImage(tile); 826 835 if (img == null || tile.hasError()) { … … 1028 1037 return ret; 1029 1038 } 1039 private List<Tile> allLoadedTiles() 1040 { 1041 List<Tile> ret = new ArrayList<Tile>(); 1042 for (Tile t : this.allTiles()) { 1043 if (t.isLoaded()) 1044 ret.add(t); 1045 } 1046 return ret; 1047 } 1030 1048 1031 1049 void loadAllTiles(boolean force) … … 1130 1148 if (autoZoom) { 1131 1149 double pixelScaling = getScaleFactor(zoom); 1132 if (pixelScaling > 3 || pixelScaling < 0. 45) {1150 if (pixelScaling > 3 || pixelScaling < 0.7) { 1133 1151 zoom = getBestZoom(); 1134 1152 } … … 1192 1210 int otherZooms[] = { -1, 1, -2, 2, -3, -4, -5}; 1193 1211 for (int zoomOffset : otherZooms) { 1194 if (!autoZoom) {1212 if (!autoZoom) 1195 1213 break; 1196 }1197 if (!autoLoad) {1198 break;1199 }1200 1214 int newzoom = displayZoomLevel + zoomOffset; 1215 if (newzoom < MIN_ZOOM) 1216 continue; 1201 1217 if (missedTiles.size() <= 0) { 1202 1218 break; … … 1213 1229 LatLon botRight2 = tileLatLon(t2); 1214 1230 TileSet ts2 = new TileSet(topLeft2, botRight2, newzoom); 1231 // Instantiating large TileSets is expensive. If there 1232 // are no loaded tiles, don't bother even trying. 1233 if (ts2.allLoadedTiles().size() == 0) { 1234 newlyMissedTiles.add(missed); 1235 continue; 1236 } 1215 1237 if (ts2.tooLarge()) { 1216 1238 continue;
Note:
See TracChangeset
for help on using the changeset viewer.