Changeset 24682 in osm for applications/editors/josm


Ignore:
Timestamp:
2010-12-10T15:20:03+01:00 (14 years ago)
Author:
upliner
Message:

remove loading text and TMS layer buffering since buffering is already done in MapView.paint()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java

    r24670 r24682  
    8181    {
    8282        tile.setLoaded(true);
    83         needRedraw = true;
    8483        Main.map.repaint(100);
    8584        tileRequestsOutstanding.remove(tile);
     
    106105    public int currentZoomLevel;
    107106
    108     EastNorth lastTopLeft;
    109     EastNorth lastBotRight;
    110     private Image bufferImage;
    111107    private Tile clickedTile;
    112     private boolean needRedraw;
    113108    private JPopupMenu tileOptionMenu;
    114109    JCheckBoxMenuItem autoZoomPopup;
     
    131126    void redraw()
    132127    {
    133         needRedraw = true;
    134128        Main.map.repaint();
    135129    }
     
    158152        //tileloader = new OsmTileLoader(this);
    159153        tileLoader = new OsmFileCacheTileLoader(this);
    160     }
    161 
    162     @Override
    163     public void setOffset(double dx, double dy) {
    164         super.setOffset(dx, dy);
    165         needRedraw = true;
    166154    }
    167155
     
    364352        if (debug)
    365353            out("zoomChanged(): " + currentZoomLevel);
    366         needRedraw = true;
    367354        jobDispatcher.cancelOutstandingJobs();
    368355        tileRequestsOutstanding.clear();
     
    513500    public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
    514501        boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);
    515         needRedraw = true;
    516502        if (debug)
    517503            out("imageUpdate() done: " + done + " calling repaint");
     
    754740
    755741        String tileStatus = tile.getStatus();
    756         if (!tile.isLoaded()) {
     742        if (!tile.isLoaded() && TMSPreferences.PROP_DRAW_DEBUG.get()) {
    757743            g.drawString(tr("image " + tileStatus), p.x + 2, texty);
    758744            texty += 1 + fontHeight;
     
    911897        EastNorth topLeft = mv.getEastNorth(0, 0);
    912898        EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight());
    913         Graphics2D oldg = g;
    914899
    915900        if (botRight.east() == 0.0 || botRight.north() == 0) {
     
    918903            return;
    919904        }
    920 
    921         if (lastTopLeft != null && lastBotRight != null && topLeft.equals(lastTopLeft)
    922                 && botRight.equals(lastBotRight) && bufferImage != null
    923                 && mv.getWidth() == bufferImage.getWidth(null) && mv.getHeight() == bufferImage.getHeight(null)
    924                 && !needRedraw) {
    925 
    926             if (debug)
    927                 out("drawing buffered image");
    928             g.drawImage(bufferImage, 0, 0, null);
    929             return;
    930         }
    931 
    932         needRedraw = false;
    933         lastTopLeft = topLeft;
    934         lastBotRight = botRight;
    935         bufferImage = mv.createImage(mv.getWidth(), mv.getHeight());
    936         g = (Graphics2D) bufferImage.getGraphics();
    937905
    938906        int zoom = currentZoomLevel;
     
    944912                    out("too many tiles, decreasing zoom from " + currentZoomLevel);
    945913                if (decreaseZoomLevel())
    946                     this.paint(oldg, mv, bounds);
     914                    this.paint(g, mv, bounds);
    947915                return;
    948916            }
     
    964932                az_disable = true;
    965933                if (increaseZoomLevel())
    966                      this.paint(oldg, mv, bounds);
     934                     this.paint(g, mv, bounds);
    967935                az_disable = tmp;
    968936                return;
     
    10571025        }
    10581026
    1059         oldg.drawImage(bufferImage, 0, 0, null);
    1060 
    10611027        if (autoZoomEnabled() && lastImageScale != null) {
    10621028            // If each source image pixel is being stretched into > 3
     
    10661032                    out("autozoom increase: scale: " + lastImageScale);
    10671033                increaseZoomLevel();
    1068                 this.paint(oldg, mv, bounds);
     1034                this.paint(g, mv, bounds);
    10691035            // If each source image pixel is being squished into > 0.32
    10701036            // of a drawn pixels, zoom out.
     
    10731039                    out("autozoom decrease: scale: " + lastImageScale);
    10741040                decreaseZoomLevel();
    1075                 this.paint(oldg, mv, bounds);
     1041                this.paint(g, mv, bounds);
    10761042            }
    10771043        }
    10781044        //g.drawString("currentZoomLevel=" + currentZoomLevel, 120, 120);
    1079         oldg.setColor(Color.black);
     1045        g.setColor(Color.black);
    10801046        if (ts.insane()) {
    1081             oldg.drawString("zoom in to load any tiles", 120, 120);
     1047            g.drawString("zoom in to load any tiles", 120, 120);
    10821048        } else if (ts.tooLarge()) {
    1083             oldg.drawString("zoom in to load more tiles", 120, 120);
     1049            g.drawString("zoom in to load more tiles", 120, 120);
    10841050        } else if (ts.tooSmall()) {
    1085             oldg.drawString("increase zoom level to see more detail", 120, 120);
     1051            g.drawString("increase zoom level to see more detail", 120, 120);
    10861052        }
    10871053    }// end of paint method
Note: See TracChangeset for help on using the changeset viewer.