Changeset 10534 in josm for trunk/src/org
- Timestamp:
- 2016-07-16T16:24:16+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r10488 r10534 904 904 tile = new Tile(tileSource, x, y, zoom); 905 905 tileCache.addTile(tile); 906 } 907 908 if (!tile.isLoaded()) { 906 909 tile.loadPlaceholderFromCache(tileCache); 907 910 } … … 939 942 EastNorth topLeft = mv.getEastNorth(0, 0); 940 943 EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight()); 941 return new TileSet(topLeft, botRight, currentZoomLevel);944 return new MapWrappingTileSet(topLeft, botRight, currentZoomLevel); 942 945 } 943 946 … … 1197 1200 } 1198 1201 1202 private LatLon getShiftedLatLon(ICoordinate latLon) { 1203 return getShiftedLatLon(Main.getProjection().latlon2eastNorth(new LatLon(latLon))); 1204 } 1205 1206 1199 1207 private final TileSet nullTileSet = new TileSet((LatLon) null, (LatLon) null, 0); 1200 1208 1201 private final class TileSet { 1209 private final class MapWrappingTileSet extends TileSet { 1210 private MapWrappingTileSet(EastNorth topLeft, EastNorth botRight, int zoom) { 1211 this(getShiftedLatLon(topLeft), getShiftedLatLon(botRight), zoom); 1212 } 1213 1214 private MapWrappingTileSet(LatLon topLeft, LatLon botRight, int zoom) { 1215 super(topLeft, botRight, zoom); 1216 double centerLon = getShiftedLatLon(Main.map.mapView.getCenter()).lon(); 1217 1218 if (topLeft.lon() > centerLon) { 1219 x0 = tileSource.getTileXMin(zoom); 1220 } 1221 if (botRight.lon() < centerLon) { 1222 x1 = tileSource.getTileXMax(zoom); 1223 } 1224 sanitize(); 1225 } 1226 } 1227 1228 private class TileSet { 1202 1229 int x0, x1, y0, y1; 1203 1230 int zoom; … … 1231 1258 x1 = t2.getXIndex(); 1232 1259 y1 = t2.getYIndex(); 1233 double centerLon = getShiftedLatLon(Main.map.mapView.getCenter()).lon(); 1234 1235 if (topLeft.lon() > centerLon) { 1236 x0 = tileSource.getTileXMin(zoom); 1237 } 1238 if (botRight.lon() < centerLon) { 1239 x1 = tileSource.getTileXMax(zoom); 1240 } 1241 1260 sanitize(); 1261 } 1262 1263 protected void sanitize() { 1242 1264 if (x0 > x1) { 1243 1265 int tmp = x0; … … 1418 1440 TileSet ts = tileSets[zoom-minZoom]; 1419 1441 if (ts == null) { 1420 ts = new TileSet(topLeft, botRight, zoom);1442 ts = new MapWrappingTileSet(topLeft, botRight, zoom); 1421 1443 tileSets[zoom-minZoom] = ts; 1422 1444 } … … 1536 1558 } 1537 1559 Tile t2 = tempCornerTile(missed); 1538 LatLon topLeft2 = newLatLon(tileSource.tileXYToLatLon(missed));1539 LatLon botRight2 = newLatLon(tileSource.tileXYToLatLon(t2));1560 LatLon topLeft2 = getShiftedLatLon(tileSource.tileXYToLatLon(missed)); 1561 LatLon botRight2 = getShiftedLatLon(tileSource.tileXYToLatLon(t2)); 1540 1562 TileSet ts2 = new TileSet(topLeft2, botRight2, newzoom); 1541 1563 // Instantiating large TileSets is expensive. If there
Note:
See TracChangeset
for help on using the changeset viewer.