Changeset 12620 in josm for trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
- Timestamp:
- 2017-08-22T22:26:32+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r12603 r12620 115 115 import org.openstreetmap.josm.io.WMSLayerImporter; 116 116 import org.openstreetmap.josm.tools.GBC; 117 import org.openstreetmap.josm.tools.Logging; 117 118 import org.openstreetmap.josm.tools.MemoryManager; 118 119 import org.openstreetmap.josm.tools.MemoryManager.MemoryHandle; … … 275 276 } catch (MalformedURLException e) { 276 277 // ignore, assume that this is not a file 277 if (Main.isDebugEnabled()) { 278 Main.debug(e.getMessage()); 279 } 278 Logging.log(Logging.LEVEL_DEBUG, e); 280 279 } 281 280 … … 294 293 tile.setLoaded(success); 295 294 invalidateLater(); 296 if (Main.isDebugEnabled()) { 297 Main.debug("tileLoadingFinished() tile: " + tile + " success: " + success); 298 } 295 Logging.debug("tileLoadingFinished() tile: {0} success: {1}", tile, success); 299 296 } 300 297 … … 437 434 } catch (IOException e) { 438 435 // silence exceptions 439 Main.trace(e);436 Logging.trace(e); 440 437 } 441 438 … … 595 592 Math.pow(2d, ZOOM_OFFSET.get()) * visibileTiles // use offset to decide, how many tiles are visible 596 593 * 4); 597 Main.info("AbstractTileSourceLayer: estimated visible tiles: {0}, estimated cache size: {1}", visibileTiles, ret);594 Logging.info("AbstractTileSourceLayer: estimated visible tiles: {0}, estimated cache size: {1}", visibileTiles, ret); 598 595 return ret; 599 596 } … … 702 699 703 700 private void zoomChanged(boolean invalidate) { 704 if (Main.isDebugEnabled()) { 705 Main.debug("zoomChanged(): " + currentZoomLevel); 706 } 701 Logging.debug("zoomChanged(): {0}", currentZoomLevel); 707 702 if (tileLoader instanceof TMSCachedTileLoader) { 708 703 ((TMSCachedTileLoader) tileLoader).cancelOutstandingTasks(); … … 733 728 public boolean zoomIncreaseAllowed() { 734 729 boolean zia = currentZoomLevel < this.getMaxZoomLvl(); 735 if (Main.isDebugEnabled()) { 736 Main.debug("zoomIncreaseAllowed(): " + zia + ' ' + currentZoomLevel + " vs. " + this.getMaxZoomLvl()); 737 } 730 Logging.debug("zoomIncreaseAllowed(): {0} {1} vs. {2}", zia, currentZoomLevel, this.getMaxZoomLvl()); 738 731 return zia; 739 732 } … … 747 740 if (zoomIncreaseAllowed()) { 748 741 currentZoomLevel++; 749 if (Main.isDebugEnabled()) { 750 Main.debug("increasing zoom level to: " + currentZoomLevel); 751 } 742 Logging.debug("increasing zoom level to: {0}", currentZoomLevel); 752 743 zoomChanged(); 753 744 } else { 754 Main.warn("Current zoom level ("+currentZoomLevel+") could not be increased. "+745 Logging.warn("Current zoom level ("+currentZoomLevel+") could not be increased. "+ 755 746 "Max.zZoom Level "+this.getMaxZoomLvl()+" reached."); 756 747 return false; … … 793 784 public boolean zoomDecreaseAllowed() { 794 785 boolean zda = currentZoomLevel > this.getMinZoomLvl(); 795 if (Main.isDebugEnabled()) { 796 Main.debug("zoomDecreaseAllowed(): " + zda + ' ' + currentZoomLevel + " vs. " + this.getMinZoomLvl()); 797 } 786 Logging.debug("zoomDecreaseAllowed(): {0} {1} vs. {2}", zda, currentZoomLevel, this.getMinZoomLvl()); 798 787 return zda; 799 788 } … … 806 795 public boolean decreaseZoomLevel() { 807 796 if (zoomDecreaseAllowed()) { 808 if (Main.isDebugEnabled()) { 809 Main.debug("decreasing zoom level to: " + currentZoomLevel); 810 } 797 Logging.debug("decreasing zoom level to: {0}", currentZoomLevel); 811 798 currentZoomLevel--; 812 799 zoomChanged(); … … 879 866 // if there is more than 18 tiles on screen in any direction, do not load all tiles! 880 867 if (ts.tooLarge()) { 881 Main.warn("Not downloading all tiles because there is more than 18 tiles on an axis!");868 Logging.warn("Not downloading all tiles because there is more than 18 tiles on an axis!"); 882 869 return; 883 870 } … … 900 887 public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { 901 888 boolean done = (infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0; 902 if (Main.isDebugEnabled()) { 903 Main.debug("imageUpdate() done: " + done + " calling repaint"); 904 } 889 Logging.debug("imageUpdate() done: {0} calling repaint", done); 905 890 906 891 if (done) { … … 1136 1121 } 1137 1122 1138 if ( Main.isDebugEnabled()) {1123 if (Logging.isDebugEnabled()) { 1139 1124 // draw tile outline in semi-transparent red 1140 1125 g.setColor(new Color(255, 0, 0, 50)); … … 1495 1480 missedTiles = newlyMissedTiles; 1496 1481 } 1497 if ( Main.isDebugEnabled() && !missedTiles.isEmpty()) {1498 Main.debug("still missed "+missedTiles.size()+" in the end");1482 if (Logging.isDebugEnabled() && !missedTiles.isEmpty()) { 1483 Logging.debug("still missed {0} in the end", missedTiles.size()); 1499 1484 } 1500 1485 g.setColor(Color.red); … … 1523 1508 myDrawString(g, tr("No tiles at this zoom level"), 120, 120); 1524 1509 } 1525 if ( Main.isDebugEnabled()) {1510 if (Logging.isDebugEnabled()) { 1526 1511 myDrawString(g, tr("Current zoom: {0}", currentZoomLevel), 50, 140); 1527 1512 myDrawString(g, tr("Display zoom: {0}", displayZoomLevel), 50, 155); … … 1547 1532 */ 1548 1533 private Tile getTileForPixelpos(int px, int py) { 1549 if (Main.isDebugEnabled()) { 1550 Main.debug("getTileForPixelpos("+px+", "+py+')'); 1551 } 1534 Logging.debug("getTileForPixelpos({0}, {1})", px, py); 1552 1535 TileXY xy = coordinateConverter.getTileforPixel(px, py, currentZoomLevel); 1553 1536 return getTile(xy.getXIndex(), xy.getYIndex(), currentZoomLevel); … … 1729 1712 this.progressMonitor.setCustomText(tr("Downloaded {0}/{1} tiles", processed, totalCount)); 1730 1713 } else { 1731 Main.warn("Tile loading failure: " + tile + " - " + tile.getErrorMessage());1714 Logging.warn("Tile loading failure: " + tile + " - " + tile.getErrorMessage()); 1732 1715 } 1733 1716 } … … 1825 1808 memory = manager.allocateMemory("tile source layer", getEstimatedCacheSize(), Object::new); 1826 1809 } catch (NotEnoughMemoryException e) { 1827 Main.warn("Could not allocate tile source memory", e);1810 Logging.warn("Could not allocate tile source memory", e); 1828 1811 } 1829 1812 }
Note:
See TracChangeset
for help on using the changeset viewer.