Changeset 16461 in osm for applications/editors/josm/plugins/slippymap
- Timestamp:
- 2009-07-12T20:30:29+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
r16460 r16461 495 495 int z12x0, z12x1, z12y0, z12y1; 496 496 int zoom; 497 497 int tileMax; 498 498 TileSet(LatLon topLeft, LatLon botRight, int zoom) { 499 499 this.zoom = zoom; 500 z12x0 = lonToTileX(topLeft.lon(), zoom) ;501 z12 x1 = lonToTileX(botRight.lon(), zoom);502 z12 y0 = latToTileY(topLeft.lat(), zoom);503 z12y1 = latToTileY(botRight.lat(), zoom) ;500 z12x0 = lonToTileX(topLeft.lon(), zoom) - 1; 501 z12y0 = latToTileY(topLeft.lat(), zoom) - 1; 502 z12x1 = lonToTileX(botRight.lon(), zoom) + 1; 503 z12y1 = latToTileY(botRight.lat(), zoom) + 1; 504 504 if (z12x0 > z12x1) { 505 505 int tmp = z12x0; … … 512 512 z12y1 = tmp; 513 513 } 514 tileMax = (int)Math.pow(2.0, zoom); 515 if (z12x0 < 0) z12x0 = 0; 516 if (z12y0 < 0) z12y0 = 0; 517 if (z12x1 > tileMax) z12x1 = tileMax; 518 if (z12y1 > tileMax) z12y1 = tileMax; 514 519 } 515 520 … … 527 532 { 528 533 List<Tile> ret = new ArrayList<Tile>(); 529 int tileMax = (int)Math.pow(2.0, zoom); 530 for (int x = z12x0 - 1; x <= z12x1 + 1; x++) { 531 if (x < 0) 532 continue; 533 for (int y = z12y0 - 1; y <= z12y1 + 1; y++) { 534 if (y < 0) 535 continue; 534 for (int x = z12x0; x <= z12x1; x++) { 535 for (int y = z12y0; y <= z12y1; y++) { 536 536 Tile t = new Tile(x % tileMax, y % tileMax); 537 537 ret.add(t); … … 542 542 543 543 boolean topTile(Tile t) { 544 if (t.y == z12y0 - 1)544 if (t.y == z12y0 ) 545 545 return true; 546 546 return false; … … 548 548 549 549 boolean leftTile(Tile t) { 550 if (t.x == z12x0 - 1)550 if (t.x == z12x0 ) 551 551 return true; 552 552 return false;
Note:
See TracChangeset
for help on using the changeset viewer.