Changeset 11143 in josm
- Timestamp:
- 2016-10-18T10:33:11+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java
r10181 r11143 49 49 } 50 50 51 static long xy2tile(long x, long y) {52 long tile = 0;53 int i;54 for (i = NR_LEVELS-1; i >= 0; i--) {55 long xbit = (x >> i) & 1;56 long ybit = (y >> i) & 1;57 tile <<= 2;58 // Note that x is the MSB59 tile |= (xbit << 1) | ybit;60 }61 return tile;62 }63 64 51 static long lon2x(double lon) { 65 52 long ret = (long) ((lon + 180.0) * WORLD_PARTS / 360.0); … … 76 63 } 77 64 return ret; 78 }79 80 public static long quadTile(LatLon coor) {81 return xy2tile(lon2x(coor.lon()), lat2y(coor.lat()));82 }83 84 public static int index(int level, long quad) {85 long mask = 0x00000003;86 int totalShift = TILES_PER_LEVEL_SHIFT*(NR_LEVELS-level-1);87 return (int) (mask & (quad >> totalShift));88 }89 90 /**91 * Returns quad tiling index for given coordinates and level.92 *93 * @param coor coordinates94 * @param level level95 *96 * @return quad tiling index for given coordinates and level.97 * @since 226398 */99 public static int index(LatLon coor, int level) {100 // The nodes that don't return coordinates will all get stuck in a single tile.101 // Hopefully there are not too many of them102 if (coor == null)103 return 0;104 105 return index(coor.lat(), coor.lon(), level);106 65 } 107 66 -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r10901 r11143 501 501 private QBLevel<T> currentNode; 502 502 private int contentIndex; 503 private int iteratedOver;504 503 QuadBuckets<T> qb; 505 504 … … 522 521 currentNode = nextContentNode(qb.root); 523 522 } 524 iteratedOver = 0;525 523 this.qb = qb; 526 524 } … … 554 552 throw new NoSuchElementException(); 555 553 contentIndex++; 556 iteratedOver++;557 554 return ret; 558 555 }
Note:
See TracChangeset
for help on using the changeset viewer.