Changeset 3787 in josm
- Timestamp:
- 2011-01-13T18:00:36+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r3785 r3787 1021 1021 private class DeepTileSet { 1022 1022 final EastNorth topLeft, botRight; 1023 final int minZoom ;1023 final int minZoom, maxZoom; 1024 1024 private final TileSet[] tileSets; 1025 1025 private final TileSetInfo[] tileSetInfos; … … 1028 1028 this.botRight = botRight; 1029 1029 this.minZoom = minZoom; 1030 this.maxZoom = maxZoom; 1030 1031 this.tileSets = new TileSet[maxZoom - minZoom + 1]; 1031 1032 this.tileSetInfos = new TileSetInfo[maxZoom - minZoom + 1]; … … 1077 1078 } 1078 1079 1079 DeepTileSet dts = new DeepTileSet(topLeft, botRight, getMinZoomLvl(), getMaxZoomLvl());1080 DeepTileSet dts = new DeepTileSet(topLeft, botRight, getMinZoomLvl(), zoom); 1080 1081 TileSet ts = dts.getTileSet(zoom); 1081 1082 … … 1089 1090 noTilesAtZoom = true; 1090 1091 } 1091 if (!tsi.hasVisibleTiles && tsi.hasOverzoomedTiles) { 1092 while (displayZoomLevel > dts.minZoom && !tsi.hasVisibleTiles && tsi.hasOverzoomedTiles){ 1093 displayZoomLevel--; 1094 tsi = dts.getTileSetInfo(displayZoomLevel); 1095 } 1096 if (zoom > displayZoomLevel && !dts.getTileSetInfo(displayZoomLevel+1).hasLoadingTiles) { 1097 zoom = displayZoomLevel+1; 1098 } else { 1099 zoom = displayZoomLevel; 1100 } 1101 while (displayZoomLevel >= dts.minZoom && !tsi.hasVisibleTiles){ 1102 displayZoomLevel--; 1103 tsi = dts.getTileSetInfo(displayZoomLevel); 1104 } 1105 if (displayZoomLevel < dts.minZoom) { 1106 displayZoomLevel = 0; 1107 } 1092 // Find highest zoom level with at least one visible tile 1093 while (displayZoomLevel > dts.minZoom && 1094 !dts.getTileSetInfo(displayZoomLevel).hasVisibleTiles) { 1095 displayZoomLevel--; 1096 } 1097 // Do binary search between currentZoomLevel and displayZoomLevel 1098 while (zoom > displayZoomLevel && !tsi.hasVisibleTiles && tsi.hasOverzoomedTiles){ 1099 zoom = (zoom + displayZoomLevel)/2; 1108 1100 tsi = dts.getTileSetInfo(zoom); 1109 1101 } 1102 1110 1103 setZoomLevel(zoom); 1104 1105 // If all tiles at displayZoomLevel is loaded, load all tiles at next zoom level 1106 // to make sure there're really no more zoom levels 1107 if (zoom == displayZoomLevel && !tsi.hasLoadingTiles && zoom < dts.maxZoom) { 1108 zoom++; 1109 tsi = dts.getTileSetInfo(zoom); 1110 } 1111 1111 // When we have overzoomed tiles and all tiles at current zoomlevel is loaded, 1112 1112 // load tiles at previovus zoomlevels until we have all tiles on screen is loaded.
Note:
See TracChangeset
for help on using the changeset viewer.