Changeset 35224 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2019-11-04T23:17:38+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r35190 r35224 298 298 int xMax = Integer.MIN_VALUE; 299 299 int yMax = Integer.MIN_VALUE; 300 int mapZoomMax = tileController.getTileSource().getMaxZoom(); 300 /* 301 * Cap mapZoomMax at highest level that prevents overflowing int in X and Y coordinates. As int is from -2^31..2^31. 302 * Log_2(TileSize) is how many bits are used due to tile size. Math.log(TileSize) / Math.log(2) gives Log_2(TileSize) 303 * So 31 - tileSizeBits gives maximum zoom that can be handled without overflowing. 304 * It means 23 for 256 tile size or 22 for 512 tile size 305 */ 306 int tileSizeBits = (int) (Math.log(tileController.getTileSource().getDefaultTileSize()) / Math.log(2)); 307 int mapZoomMax = Math.min(31 - tileSizeBits, tileController.getTileSource().getMaxZoom()); 301 308 302 309 if (markers && mapMarkerList != null) {
Note:
See TracChangeset
for help on using the changeset viewer.