Changeset 4330 in josm for trunk


Ignore:
Timestamp:
2011-08-21T17:53:28+02:00 (13 years ago)
Author:
hansendc
Message:

renane TileSet.allTiles()

The previous bug with paintAllImages() shows that allTiles() is
badly named. It really has two incarnations: one that creates
tiles and one that does not. Make this clear in the function
names, and do not epose allTiles(bool) any longer.

File:
1 edited

Legend:

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

    r4329 r4330  
    827827        List<Tile> missedTiles = new LinkedList<Tile>();
    828828        // The callers of this code *require* that we return any tiles
    829         // that we do not draw in missedTiles.  ts.allTiles() by default
    830         // will only return already-existing tiles.  However, we need
    831         // to return *all* tiles to the callers, so force creation here.
     829        // that we do not draw in missedTiles.  ts.allExistingTiles() by
     830        // default will only return already-existing tiles.  However, we
     831        // need to return *all* tiles to the callers, so force creation
     832        // here.
    832833        boolean forceTileCreation = true;
    833         for (Tile tile : ts.allTiles(forceTileCreation)) {
     834        for (Tile tile : ts.allTilesCreate()) {
    834835            Image img = getLoadedTileImage(tile);
    835836            if (img == null || tile.hasError()) {
     
    10121013         * already in the tileCache.
    10131014         */
    1014         List<Tile> allTiles()
     1015        List<Tile> allExistingTiles()
    10151016        {
    1016             return this.allTiles(false);
    1017         }
    1018         private List<Tile> allTiles(boolean create)
     1017            return this.__allTiles(false);
     1018        }
     1019        List<Tile> allTilesCreate()
     1020        {
     1021            return this.__allTiles(true);
     1022        }
     1023        private List<Tile> __allTiles(boolean create)
    10191024        {
    10201025            // Tileset is either empty or too large
     
    10401045        {
    10411046            List<Tile> ret = new ArrayList<Tile>();
    1042             for (Tile t : this.allTiles()) {
     1047            for (Tile t : this.allExistingTiles()) {
    10431048                if (t.isLoaded())
    10441049                    ret.add(t);
     
    10511056            if (!autoLoad && !force)
    10521057                return;
    1053             for (Tile t : this.allTiles(true)) {
     1058            for (Tile t : this.allTilesCreate()) {
    10541059                loadTile(t, false);
    10551060            }
     
    10601065            if (!autoLoad && !force)
    10611066                return;
    1062             for (Tile t : this.allTiles(true)) {
     1067            for (Tile t : this.allTilesCreate()) {
    10631068                if (t.hasError()) {
    10641069                    loadTile(t, true);
     
    10761081
    10771082    private static TileSetInfo getTileSetInfo(TileSet ts) {
    1078         List<Tile> allTiles = ts.allTiles();
     1083        List<Tile> allTiles = ts.allExistingTiles();
    10791084        TileSetInfo result = new TileSetInfo();
    10801085        result.hasLoadingTiles = allTiles.size() < ts.size();
     
    12521257        // The current zoom tileset is guaranteed to have all of
    12531258        // its tiles
    1254         for (Tile t : ts.allTiles()) {
     1259        for (Tile t : ts.allExistingTiles()) {
    12551260            this.paintTileText(ts, t, g, mv, displayZoomLevel, t);
    12561261        }
     
    13401345        }
    13411346        Tile clickedTile = null;
    1342         for (Tile t1 : ts.allTiles()) {
     1347        for (Tile t1 : ts.allExistingTiles()) {
    13431348            Tile t2 = tempCornerTile(t1);
    13441349            Rectangle r = new Rectangle(pixelPos(t1));
Note: See TracChangeset for help on using the changeset viewer.