Changeset 11860 in josm for trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java
- Timestamp:
- 2017-04-09T13:52:57+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java
r11858 r11860 18 18 /** 19 19 * Tile class that stores a reprojected version of the original tile. 20 * @since 11858 20 21 */ 21 22 public class ReprojectionTile extends Tile { … … 25 26 protected boolean maxZoomReached; 26 27 28 /** 29 * Constructs a new {@code ReprojectionTile}. 30 * @param source sourec tile 31 * @param xtile X coordinate 32 * @param ytile Y coordinate 33 * @param zoom zoom level 34 */ 27 35 public ReprojectionTile(TileSource source, int xtile, int ytile, int zoom) { 28 36 super(source, xtile, ytile, zoom); … … 50 58 return true; 51 59 } 52 60 53 61 @Override 54 62 public void setImage(BufferedImage image) { … … 100 108 Dimension dim = getDimension(pbTargetAligned, scaleMapView); 101 109 Integer scaleFix = limitScale(source.getTileSize(), Math.sqrt(dim.getWidth() * dim.getHeight())); 102 double scale = scaleFix == null ? scaleMapView : scaleMapView * scaleFix;110 double scale = scaleFix == null ? scaleMapView : (scaleMapView * scaleFix); 103 111 104 112 ImageWarp.PointTransform pointTransform = pt -> { … … 153 161 */ 154 162 protected Integer limitScale(double lenOrig, double lenNow) { 155 double LIMIT= 3;156 if (lenNow > LIMIT* lenOrig) {157 int n = (int) Math.ceil((Math.log(lenNow) - Math.log( LIMIT* lenOrig)) / Math.log(2));163 final double limit = 3; 164 if (lenNow > limit * lenOrig) { 165 int n = (int) Math.ceil((Math.log(lenNow) - Math.log(limit * lenOrig)) / Math.log(2)); 158 166 int f = 1 << n; 159 167 double lenNowFixed = lenNow / f; 160 if ( !(lenNowFixed <= LIMIT * lenOrig)) throw new AssertionError();161 if ( !(lenNowFixed > LIMIT * lenOrig / 2)) thrownew AssertionError();168 if (lenNowFixed > limit * lenOrig) throw new AssertionError(); 169 if (lenNowFixed <= limit * lenOrig / 2) throw new AssertionError(); 162 170 return f; 163 171 } 164 if (lenNow > LIMIT* lenOrig / 2)172 if (lenNow > limit * lenOrig / 2) 165 173 return 1; 166 174 return null;
Note:
See TracChangeset
for help on using the changeset viewer.