Changeset 24686 in osm


Ignore:
Timestamp:
2010-12-10T16:00:47+01:00 (14 years ago)
Author:
upliner
Message:

show red tiles when on errors in TMS layers

Location:
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery
Files:
3 edited

Legend:

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

    r24672 r24686  
    11package org.openstreetmap.josm.plugins.imagery;
    22
     3import static org.openstreetmap.josm.tools.I18n.tr;
    34import static org.openstreetmap.josm.tools.I18n.trc;
    45
     6import java.awt.Color;
    57import java.awt.Component;
    68import java.awt.Container;
     9import java.awt.Font;
     10import java.awt.Graphics;
    711import java.awt.Toolkit;
    812import java.awt.event.ActionEvent;
     
    177181        return op.filter(tmp, null);
    178182    }
     183
     184    public void drawErrorTile(BufferedImage img) {
     185        Graphics g = img.getGraphics();
     186        g.setColor(Color.RED);
     187        g.fillRect(0, 0, img.getWidth(), img.getHeight());
     188        g.setFont(g.getFont().deriveFont(Font.PLAIN).deriveFont(36.0f));
     189        g.setColor(Color.BLACK);
     190        g.drawString(tr("ERROR"), 30, img.getHeight()/2);
     191    }
    179192}
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java

    r24684 r24686  
    1616import java.awt.font.TextAttribute;
    1717import java.awt.geom.Rectangle2D;
     18import java.awt.image.BufferedImage;
    1819import java.awt.image.ImageObserver;
    1920import java.io.IOException;
     
    8081    public synchronized void tileLoadingFinished(Tile tile, boolean success)
    8182    {
     83        if (!success) {
     84            BufferedImage img = new BufferedImage(tileSource.getTileSize(),tileSource.getTileSize(), BufferedImage.TYPE_INT_RGB);
     85            drawErrorTile(img);
     86            tile.setImage(img);
     87        }
    8288        tile.setLoaded(true);
    8389        needRedraw = true;
    8490        Main.map.repaint(100);
    8591        tileRequestsOutstanding.remove(tile);
    86         if (sharpenLevel != 0) tile.setImage(sharpenImage(tile.getImage()));
     92        if (sharpenLevel != 0 && success) tile.setImage(sharpenImage(tile.getImage()));
    8793        if (debug)
    8894            out("tileLoadingFinished() tile: " + tile + " success: " + success);
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/GeorefImage.java

    r24615 r24686  
    7272        {
    7373            BufferedImage img = createImage();
    74             Graphics g = img.getGraphics();
    75             g.setColor(Color.RED);
    76             g.fillRect(0, 0, img.getWidth(), img.getHeight());
    77             g.setFont(g.getFont().deriveFont(Font.PLAIN).deriveFont(36.0f));
    78             g.setColor(Color.BLACK);
    79             g.drawString(tr("Exception occurred"), 10, img.getHeight()/2);
     74            layer.drawErrorTile(img);
    8075            this.image = img;
    8176            break;
Note: See TracChangeset for help on using the changeset viewer.