Changeset 16459 in osm
- Timestamp:
- 2009-07-12T20:27:28+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java
r16458 r16459 180 180 * @return true, if zoom increasing was successfull, false othervise 181 181 */ 182 public boolean increaseZoomLevel() { 183 if (currentZoomLevel < SlippyMapPreferences.getMaxZoomLvl()) { 182 public boolean zoomIncreaseAllowed() 183 { 184 return currentZoomLevel < SlippyMapPreferences.getMaxZoomLvl(); 185 } 186 public boolean increaseZoomLevel() { 187 if (zoomIncreaseAllowed()) { 184 188 currentZoomLevel++; 185 189 Main.debug("increasing zoom level to: " + currentZoomLevel); … … 198 202 * @return true, if zoom increasing was successfull, false othervise 199 203 */ 200 public boolean decreaseZoomLevel() { 201 if (currentZoomLevel > SlippyMapPreferences.getMinZoomLvl()) { 204 public boolean zoomDecreaseAllowed() 205 { 206 return currentZoomLevel > SlippyMapPreferences.getMinZoomLvl(); 207 } 208 public boolean decreaseZoomLevel() { 209 int minZoom = SlippyMapPreferences.getMinZoomLvl(); 210 if (zoomDecreaseAllowed()) { 202 211 Main.debug("decreasing zoom level to: " + currentZoomLevel); 203 212 currentZoomLevel--; 204 213 needRedraw = true; 205 214 } else { 206 System.err.println("current zoom lvl couldnt be decreased. MinZoomLvl reached.");215 System.err.println("current zoom lvl couldnt be decreased. MinZoomLvl("+minZoom+") reached."); 207 216 return false; 208 217 } … … 213 222 // when max zoom lvl is begin saved, this method is called and probably 214 223 // the setting isnt saved yet. 215 int maxZoom = 30; //SlippyMapPreferences.getMaxZoomLvl();224 int maxZoom = SlippyMapPreferences.getMaxZoomLvl(); 216 225 tileStorage = new Hashtable<SlippyMapKey, SlippyMapTile>(); 217 218 226 checkTileStorage(); 219 227 } … … 518 526 { 519 527 List<Tile> ret = new ArrayList<Tile>(); 528 int tileMax = (int)Math.pow(2.0, zoom); 520 529 for (int x = z12x0 - 1; x <= z12x1 + 1; x++) { 521 530 if (x < 0) … … 524 533 if (y < 0) 525 534 continue; 526 Tile t = new Tile(x , y);535 Tile t = new Tile(x % tileMax, y % tileMax); 527 536 ret.add(t); 528 537 } … … 575 584 int zoom = currentZoomLevel; 576 585 577 if ( ts.tilesSpanned() > (18*18)) {578 System.out.println("too many tiles, decreasing zoom from " + currentZoomLevel);586 if (zoomDecreaseAllowed() && (ts.tilesSpanned() > (18*18))) { 587 this.debug("too many tiles, decreasing zoom from " + currentZoomLevel); 579 588 if (decreaseZoomLevel()) 580 589 this.paint(oldg, mv); 581 582 583 584 if (ts.tilesSpanned() <= 0) {585 System.out.println("doesn't even cover one tile, increasing zoom from " + currentZoomLevel);590 return; 591 } 592 if (zoomIncreaseAllowed() && (ts.tilesSpanned() <= 0)) { 593 this.debug("doesn't even cover one tile (" + ts.tilesSpanned() 594 + "), increasing zoom from " + currentZoomLevel); 586 595 if (increaseZoomLevel()) 587 596 this.paint(oldg, mv); … … 638 647 // If each source image pixel is being stretched into > 3 639 648 // drawn pixels, zoom in... getting too pixelated 640 if (imageScale > 3 ) {649 if (imageScale > 3 && zoomIncreaseAllowed()) { 641 650 if (SlippyMapPreferences.getAutozoom()) { 642 651 Main.debug("autozoom increase: scale: " + imageScale); … … 648 657 // If each source image pixel is being squished into > 0.32 649 658 // of a drawn pixels, zoom out. 650 if ( imageScale < 0.32) {659 if ((imageScale < 0.32) && (imageScale > 0) && zoomDecreaseAllowed()) { 651 660 if (SlippyMapPreferences.getAutozoom()) { 652 661 Main.debug("autozoom decrease: scale: " + imageScale);
Note:
See TracChangeset
for help on using the changeset viewer.