Ignore:
Timestamp:
2016-02-18T21:41:08+01:00 (9 years ago)
Author:
wiktorn
Message:

Improvements for native scales.

  • make ScaleList immutable object
  • reduce number of ScaleList object creation
  • use ScaleList.snapZoom for getBestZoom in WMTS

See: #12350

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r9818 r9825  
    4747import org.openstreetmap.josm.data.projection.Projections;
    4848import org.openstreetmap.josm.gui.ExtendedDialog;
    49 import org.openstreetmap.josm.gui.layer.NativeScaleLayer.Scale;
    5049import org.openstreetmap.josm.gui.layer.NativeScaleLayer.ScaleList;
    5150import org.openstreetmap.josm.io.CachedFile;
     
    246245    private TransferMode transferMode;
    247246
     247    private ScaleList nativeScaleList;
     248
    248249    /**
    249250     * Creates a tile source based on imagery info
     
    631632
    632633        this.crsScale = getTileSize() * 0.28e-03 / proj.getMetersPerUnit();
     634
     635        Collection<Double> scales = new ArrayList<>(currentTileMatrixSet.tileMatrix.size());
     636        if (currentTileMatrixSet != null) {
     637            for (TileMatrix tileMatrix : currentTileMatrixSet.tileMatrix) {
     638                scales.add(tileMatrix.scaleDenominator * 0.28e-03);
     639            }
     640        }
     641        this.nativeScaleList = new ScaleList(scales);
    633642    }
    634643
     
    919928     */
    920929    public ScaleList getNativeScales() {
    921         ScaleList scales = new ScaleList();
    922         if (currentTileMatrixSet != null) {
    923             for (TileMatrix tileMatrix : currentTileMatrixSet.tileMatrix) {
    924                 scales.add(new Scale(tileMatrix.scaleDenominator * 0.28e-03));
    925             }
    926         }
    927         return scales;
     930        return nativeScaleList;
    928931    }
    929932
Note: See TracChangeset for help on using the changeset viewer.