Ignore:
Timestamp:
2009-11-14T19:27:50+01:00 (15 years ago)
Author:
jttt
Message:

Updated to new MapViewPaintable.paint arguments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java

    r18590 r18593  
    55import java.awt.Color;
    66import java.awt.Component;
    7 import java.awt.Dimension;
    87import java.awt.Graphics;
     8import java.awt.Graphics2D;
    99import java.awt.Image;
    1010import java.awt.Point;
     
    1616import java.awt.image.ImageObserver;
    1717import java.util.ArrayList;
    18 import java.util.Comparator;
    19 import java.util.Enumeration;
    20 import java.util.Hashtable;
     18import java.util.HashSet;
     19import java.util.LinkedList;
    2120import java.util.List;
    22 import java.util.LinkedList;
    23 import java.util.HashSet;
    2421
    2522import javax.swing.AbstractAction;
    2623import javax.swing.Icon;
     24import javax.swing.JCheckBoxMenuItem;
    2725import javax.swing.JMenuItem;
    28 import javax.swing.JCheckBoxMenuItem;
    2926import javax.swing.JPopupMenu;
    3027import javax.swing.JSeparator;
    3128import javax.swing.SwingUtilities;
    3229
     30import org.openstreetmap.gui.jmapviewer.JobDispatcher;
     31import org.openstreetmap.gui.jmapviewer.MemoryTileCache;
     32import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader;
     33import org.openstreetmap.gui.jmapviewer.Tile;
     34import org.openstreetmap.gui.jmapviewer.interfaces.TileCache;
     35import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
     36import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
     37import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
    3338import org.openstreetmap.josm.Main;
    3439import org.openstreetmap.josm.actions.RenameLayerAction;
     40import org.openstreetmap.josm.data.Bounds;
    3541import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    3642import org.openstreetmap.josm.data.coor.LatLon;
     
    4147import org.openstreetmap.josm.gui.layer.Layer;
    4248import 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;
    4749
    4850/**
     
    501503        //int otherZooms[] = {-5, -4, -3, 2, -2, 1, -1};
    502504        int otherZooms[] = { -1, 1, -2, 2, -3, -4, -5};
    503         int painted = 0;;
     505        int painted = 0;
    504506        debug = true;
    505507        for (int zoomOff : otherZooms) {
     
    604606    // The "border" tile tells us the boundaries of where we may
    605607    // 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,
    607609    // border is null and we draw the entire tile set.
    608610    List<Tile> paintTileImages(Graphics g, TileSet ts, int zoom, Tile border) {
     
    616618            if (img == null) {
    617619                if (debug)
    618                     out("missed tile: " + tile); 
     620                    out("missed tile: " + tile);
    619621                missedTiles.add(tile);
    620622                continue;
     
    808810     */
    809811    @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();
    812814        LatLon topLeft = mv.getLatLon(0, 0);
    813815        LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
    814         Graphics oldg = g;
     816        Graphics2D oldg = g;
    815817
    816818        if (botRight.lon() == 0.0 || botRight.lat() == 0) {
     
    834836        lastBotRight = botRight;
    835837        bufferImage = mv.createImage(mv.getWidth(), mv.getHeight());
    836         g = bufferImage.getGraphics();
     838        g = (Graphics2D) bufferImage.getGraphics();
    837839
    838840        int zoom = currentZoomLevel;
     
    844846                    out("too many tiles, decreasing zoom from " + currentZoomLevel);
    845847                if (decreaseZoomLevel())
    846                     this.paint(oldg, mv);
     848                    this.paint(oldg, mv, bounds);
    847849                return;
    848850            }
     
    852854                        + "), increasing zoom from " + currentZoomLevel);
    853855                if (increaseZoomLevel())
    854                      this.paint(oldg, mv);
     856                     this.paint(oldg, mv, bounds);
    855857                return;
    856858            }
     
    899901            this.paintTileText(ts, t, g, mv, currentZoomLevel, t);
    900902        }
    901         float fadeBackground = SlippyMapPreferences.getFadeBackground();
    902903        oldg.drawImage(bufferImage, 0, 0, null);
    903904
     
    909910                    out("autozoom increase: scale: " + lastImageScale);
    910911                increaseZoomLevel();
    911                 this.paint(oldg, mv);
     912                this.paint(oldg, mv, bounds);
    912913            // If each source image pixel is being squished into > 0.32
    913914            // of a drawn pixels, zoom out.
     
    916917                    out("autozoom decrease: scale: " + lastImageScale);
    917918                decreaseZoomLevel();
    918                 this.paint(oldg, mv);
     919                this.paint(oldg, mv, bounds);
    919920            }
    920921        }
Note: See TracChangeset for help on using the changeset viewer.