Changeset 18593 in osm for applications/editors/josm/plugins/slippymap/src
- Timestamp:
- 2009-11-14T19:27:50+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java
r18590 r18593 5 5 import java.awt.Color; 6 6 import java.awt.Component; 7 import java.awt.Dimension;8 7 import java.awt.Graphics; 8 import java.awt.Graphics2D; 9 9 import java.awt.Image; 10 10 import java.awt.Point; … … 16 16 import java.awt.image.ImageObserver; 17 17 import java.util.ArrayList; 18 import java.util.Comparator; 19 import java.util.Enumeration; 20 import java.util.Hashtable; 18 import java.util.HashSet; 19 import java.util.LinkedList; 21 20 import java.util.List; 22 import java.util.LinkedList;23 import java.util.HashSet;24 21 25 22 import javax.swing.AbstractAction; 26 23 import javax.swing.Icon; 24 import javax.swing.JCheckBoxMenuItem; 27 25 import javax.swing.JMenuItem; 28 import javax.swing.JCheckBoxMenuItem;29 26 import javax.swing.JPopupMenu; 30 27 import javax.swing.JSeparator; 31 28 import javax.swing.SwingUtilities; 32 29 30 import org.openstreetmap.gui.jmapviewer.JobDispatcher; 31 import org.openstreetmap.gui.jmapviewer.MemoryTileCache; 32 import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader; 33 import org.openstreetmap.gui.jmapviewer.Tile; 34 import org.openstreetmap.gui.jmapviewer.interfaces.TileCache; 35 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 36 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener; 37 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 33 38 import org.openstreetmap.josm.Main; 34 39 import org.openstreetmap.josm.actions.RenameLayerAction; 40 import org.openstreetmap.josm.data.Bounds; 35 41 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 36 42 import org.openstreetmap.josm.data.coor.LatLon; … … 41 47 import org.openstreetmap.josm.gui.layer.Layer; 42 48 import org.openstreetmap.josm.tools.ImageProvider; 43 44 import org.openstreetmap.gui.jmapviewer.*;45 import org.openstreetmap.gui.jmapviewer.interfaces.*;46 import org.openstreetmap.gui.jmapviewer.Tile;47 49 48 50 /** … … 501 503 //int otherZooms[] = {-5, -4, -3, 2, -2, 1, -1}; 502 504 int otherZooms[] = { -1, 1, -2, 2, -3, -4, -5}; 503 int painted = 0; ;505 int painted = 0; 504 506 debug = true; 505 507 for (int zoomOff : otherZooms) { … … 604 606 // The "border" tile tells us the boundaries of where we may 605 607 // draw. It will not be from the zoom level that is being 606 // drawn currently. If drawing the currentZoomLevel, 608 // drawn currently. If drawing the currentZoomLevel, 607 609 // border is null and we draw the entire tile set. 608 610 List<Tile> paintTileImages(Graphics g, TileSet ts, int zoom, Tile border) { … … 616 618 if (img == null) { 617 619 if (debug) 618 out("missed tile: " + tile); 620 out("missed tile: " + tile); 619 621 missedTiles.add(tile); 620 622 continue; … … 808 810 */ 809 811 @Override 810 public void paint(Graphics g, MapView mv) {811 long start = System.currentTimeMillis();812 public void paint(Graphics2D g, MapView mv, Bounds bounds) { 813 //long start = System.currentTimeMillis(); 812 814 LatLon topLeft = mv.getLatLon(0, 0); 813 815 LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight()); 814 Graphics oldg = g;816 Graphics2D oldg = g; 815 817 816 818 if (botRight.lon() == 0.0 || botRight.lat() == 0) { … … 834 836 lastBotRight = botRight; 835 837 bufferImage = mv.createImage(mv.getWidth(), mv.getHeight()); 836 g = bufferImage.getGraphics();838 g = (Graphics2D) bufferImage.getGraphics(); 837 839 838 840 int zoom = currentZoomLevel; … … 844 846 out("too many tiles, decreasing zoom from " + currentZoomLevel); 845 847 if (decreaseZoomLevel()) 846 this.paint(oldg, mv );848 this.paint(oldg, mv, bounds); 847 849 return; 848 850 } … … 852 854 + "), increasing zoom from " + currentZoomLevel); 853 855 if (increaseZoomLevel()) 854 this.paint(oldg, mv );856 this.paint(oldg, mv, bounds); 855 857 return; 856 858 } … … 899 901 this.paintTileText(ts, t, g, mv, currentZoomLevel, t); 900 902 } 901 float fadeBackground = SlippyMapPreferences.getFadeBackground();902 903 oldg.drawImage(bufferImage, 0, 0, null); 903 904 … … 909 910 out("autozoom increase: scale: " + lastImageScale); 910 911 increaseZoomLevel(); 911 this.paint(oldg, mv );912 this.paint(oldg, mv, bounds); 912 913 // If each source image pixel is being squished into > 0.32 913 914 // of a drawn pixels, zoom out. … … 916 917 out("autozoom decrease: scale: " + lastImageScale); 917 918 decreaseZoomLevel(); 918 this.paint(oldg, mv );919 this.paint(oldg, mv, bounds); 919 920 } 920 921 }
Note:
See TracChangeset
for help on using the changeset viewer.