Changeset 11844 in josm for trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
- Timestamp:
- 2017-04-05T20:38:08+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r11842 r11844 64 64 import org.openstreetmap.gui.jmapviewer.MemoryTileCache; 65 65 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 66 import org.openstreetmap.gui.jmapviewer.Projected; 66 67 import org.openstreetmap.gui.jmapviewer.Tile; 67 68 import org.openstreetmap.gui.jmapviewer.TileAnchor; … … 984 985 private TileSet getVisibleTileSet() { 985 986 ProjectionBounds bounds = Main.map.mapView.getState().getViewArea().getProjectionBounds(); 986 return getTileSet(bounds .getMin(), bounds.getMax(), currentZoomLevel);987 return getTileSet(bounds, currentZoomLevel); 987 988 } 988 989 … … 1258 1259 private final TileSet nullTileSet = new TileSet(); 1259 1260 1260 pr ivateclass TileSet extends TileRange {1261 protected class TileSet extends TileRange { 1261 1262 1262 1263 protected TileSet(TileXY t1, TileXY t2, int zoom) { … … 1394 1395 /** 1395 1396 * Create a TileSet by EastNorth bbox taking a layer shift in account 1396 * @param topLeft top-left lat/lon 1397 * @param botRight bottom-right lat/lon 1397 * @param bounds the EastNorth bounds 1398 1398 * @param zoom zoom level 1399 1399 * @return the tile set 1400 * @since 10651 1401 */ 1402 protected TileSet getTileSet(EastNorth topLeft, EastNorth botRight, int zoom) { 1403 return getTileSet(getShiftedLatLon(topLeft), getShiftedLatLon(botRight), zoom); 1404 } 1405 1406 /** 1407 * Create a TileSet by known LatLon bbox without layer shift correction 1408 * @param topLeft top-left lat/lon 1409 * @param botRight bottom-right lat/lon 1410 * @param zoom zoom level 1411 * @return the tile set 1412 * @since 10651 1413 */ 1414 protected TileSet getTileSet(LatLon topLeft, LatLon botRight, int zoom) { 1415 if (zoom == 0) 1416 return new TileSet(); 1417 1418 TileXY t1 = tileSource.latLonToTileXY(topLeft.toCoordinate(), zoom); 1419 TileXY t2 = tileSource.latLonToTileXY(botRight.toCoordinate(), zoom); 1400 */ 1401 protected TileSet getTileSet(ProjectionBounds bounds, int zoom) { 1402 EastNorth topLeftUnshifted = coordinateConverter.shiftDisplayToServer(bounds.getMin()); 1403 EastNorth botRightUnshifted = coordinateConverter.shiftDisplayToServer(bounds.getMax()); 1404 TileXY t1 = tileSource.projectedToTileXY(topLeftUnshifted.toProjected(), zoom); 1405 TileXY t2 = tileSource.projectedToTileXY(botRightUnshifted.toProjected(), zoom); 1420 1406 return new TileSet(t1, t2, zoom); 1421 1407 } … … 1472 1458 TileSet ts = tileSets[zoom-minZoom]; 1473 1459 if (ts == null) { 1474 ts = AbstractTileSourceLayer.this.getTileSet(bounds .getMin(), bounds.getMax(), zoom);1460 ts = AbstractTileSourceLayer.this.getTileSet(bounds, zoom); 1475 1461 tileSets[zoom-minZoom] = ts; 1476 1462 } … … 1657 1643 Main.debug("getTileForPixelpos("+px+", "+py+')'); 1658 1644 } 1659 MapView mv = Main.map.mapView;1660 1645 Point clicked = new Point(px, py); 1661 EastNorth topLeft = mv.getEastNorth(0, 0); 1662 EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight()); 1663 TileSet ts = getTileSet(topLeft, botRight, currentZoomLevel); 1646 TileSet ts = getVisibleTileSet(); 1664 1647 1665 1648 if (!ts.tooLarge()) {
Note:
See TracChangeset
for help on using the changeset viewer.