Changeset 11844 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-04-05T20:38:08+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java
r11830 r11844 2 2 package org.openstreetmap.josm.data.coor; 3 3 4 import org.openstreetmap.gui.jmapviewer.Projected; 4 5 import org.openstreetmap.gui.jmapviewer.interfaces.IProjected; 5 6 … … 181 182 } 182 183 184 public IProjected toProjected() { 185 return new Projected(east(), north()); 186 } 187 183 188 @Override 184 189 public String toString() { -
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()) { -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileCoordinateConverter.java
r11841 r11844 48 48 private MapViewPoint pos(IProjected p) { 49 49 return mapView.getState().getPointFor(new EastNorth(p)).add(settings.getDisplacement()); 50 } 51 52 /** 53 * Apply reverse shift to EastNorth coordinate. 54 * 55 * @param en EastNorth coordinate representing a pixel on screen 56 * @return EastNorth coordinate as it would e.g. be sent to a WMS server 57 */ 58 public EastNorth shiftDisplayToServer(EastNorth en) { 59 return en.subtract(settings.getDisplacement()); 50 60 } 51 61
Note:
See TracChangeset
for help on using the changeset viewer.