Changeset 4306 in josm for trunk/src


Ignore:
Timestamp:
2011-08-10T16:51:15+02:00 (13 years ago)
Author:
stoecker
Message:

add TMS menu entry to reload error tiles

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r4301 r4306  
    337337        TileSource source = getTileSource(info);
    338338        if (source == null)
    339             throw new IllegalStateException("cannot create TMSLayer with non-TMS ImageryInfo");
     339            throw new IllegalStateException("Cannot create TMSLayer with non-TMS ImageryInfo");
    340340        initTileSource(source);
    341341
     
    379379            public void actionPerformed(ActionEvent ae) {
    380380                if (clickedTile != null) {
    381                     loadTile(clickedTile);
     381                    loadTile(clickedTile, true);
    382382                    redraw();
    383383                }
     
    413413            public void actionPerformed(ActionEvent ae) {
    414414                loadAllTiles(true);
     415                redraw();
     416            }
     417        }));
     418
     419        tileOptionMenu.add(new JMenuItem(new AbstractAction(
     420                tr("Load All Error Tiles")) {
     421            @Override
     422            public void actionPerformed(ActionEvent ae) {
     423                loadAllErrorTiles(true);
    415424                redraw();
    416425            }
     
    644653    }
    645654
    646     synchronized boolean loadTile(Tile tile)
     655    synchronized boolean loadTile(Tile tile, boolean force)
    647656    {
    648657        if (tile == null)
    649658            return false;
    650         if (tile.hasError())
    651             return false;
    652         if (tile.isLoaded())
     659        if (!force && (tile.hasError() || tile.isLoaded()))
    653660            return false;
    654661        if (tile.isLoading())
     
    672679        // load all tiles!
    673680        if (ts.tooLarge()) {
    674             System.out.println("Not downloading all tiles because there is more than 18 tiles on an axis!");
     681            Main.warn("Not downloading all tiles because there is more than 18 tiles on an axis!");
    675682            return;
    676683        }
    677684        ts.loadAllTiles(force);
     685    }
     686
     687    void loadAllErrorTiles(boolean force) {
     688        MapView mv = Main.map.mapView;
     689        EastNorth topLeft = mv.getEastNorth(0, 0);
     690        EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight());
     691
     692        TileSet ts = new TileSet(topLeft, botRight, currentZoomLevel);
     693
     694        ts.loadAllErrorTiles(force);
    678695    }
    679696
     
    10141031        void loadAllTiles(boolean force)
    10151032        {
    1016             List<Tile> tiles = this.allTiles(true);
    10171033            if (!autoLoad && !force)
    10181034                return;
    1019             int nr_queued = 0;
    1020             for (Tile t : tiles) {
    1021                 if (loadTile(t)) {
    1022                     nr_queued++;
     1035            for (Tile t : this.allTiles(true)) {
     1036                loadTile(t, false);
     1037            }
     1038        }
     1039
     1040        void loadAllErrorTiles(boolean force)
     1041        {
     1042            if (!autoLoad && !force)
     1043                return;
     1044            for (Tile t : this.allTiles(true)) {
     1045                if (t.hasError()) {
     1046                    loadTile(t, true);
    10231047                }
    10241048            }
    1025             /*if (debug)
    1026                 if (nr_queued > 0) {
    1027                     Main.debug("queued to load: " + nr_queued + "/" + tiles.size() + " tiles at zoom: " + zoom);
    1028                 }*/
    10291049        }
    10301050    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r4146 r4306  
    802802                        String toolbar = (String) tb;
    803803                        Action r = actions.get(toolbar);
    804                         if(r != null &&  r != action) {
     804                        if(r != null && r != action && !toolbar.startsWith("imagery_")) {
    805805                            System.out.println(tr("Toolbar action {0} overwritten: {1} gets {2}",
    806806                            toolbar, r.getClass().getName(), action.getClass().getName()));
Note: See TracChangeset for help on using the changeset viewer.