Ticket #1905: Allow Reloading Error Tiles.patch

File Allow Reloading Error Tiles.patch, 2.2 KB (added by xeen, 17 years ago)
  • src/wmsplugin/GeorefImage.java

     
    2626    private Dimension reImgHash = new Dimension(0, 0);
    2727    public EastNorth min, max;
    2828    public boolean downloadingStarted;
     29    public boolean failed = false;
    2930
    3031    public GeorefImage(boolean downloadingStarted) {
    3132        this.downloadingStarted = downloadingStarted;
  • src/wmsplugin/Grabber.java

     
    5252        g.setColor(Color.BLACK);
    5353        g.drawString(tr("Exception occurred"), 10, height()/2);
    5454        image.image = img;
     55        image.failed = true;
    5556        g.setFont(font);
    5657    }
    5758
  • src/wmsplugin/WMSLayer.java

     
    203203                startstop,
    204204                alphaChannel,
    205205                new JMenuItem(new changeResolutionAction()),
     206                new JMenuItem(new reloadErrorTilesAction()),
    206207                new JMenuItem(new downloadAction()),
    207208                new JSeparator(),
    208209                new JMenuItem(new LayerListPopup.InfoAction(this))
     
    239240        }
    240241    }
    241242   
     243    public class reloadErrorTilesAction extends AbstractAction {
     244        public reloadErrorTilesAction() {
     245            super(tr("Reload erroneous tiles"));
     246        }
     247        public void actionPerformed(ActionEvent ev) {
     248            for (int x = 0; x < dax; ++x) {
     249                for (int y = 0; y < day; ++y) {
     250                    GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
     251                    img.image = null;
     252                    img.downloadingStarted = false;
     253                    img.failed = false;
     254                    mv.repaint();
     255                }
     256            }
     257        }
     258    }
     259   
    242260    public class ToggleAlphaAction extends AbstractAction {
    243261        public ToggleAlphaAction() {
    244262            super(tr("Alpha channel"));