Ignore:
Timestamp:
2010-03-19T21:59:29+01:00 (10 years ago)
Author:
jttt
Message:

Do not keep width at QBLevel, simplify QuadTilling.index

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java

    r3083 r3145  
    77    public static double WORLD_PARTS = (1 << NR_LEVELS);
    88
    9     public static int MAX_OBJECTS_PER_LEVEL = 16;
    10     // has to be a power of 2
    11     public static int TILES_PER_LEVEL_SHIFT = 2;
     9    public static int TILES_PER_LEVEL_SHIFT = 2; // Has to be 2. Other parts of QuadBuckets code rely on it
    1210    public static int TILES_PER_LEVEL = 1<<TILES_PER_LEVEL_SHIFT;
    1311    static public int X_PARTS = 360;
     
    9795        return (int)(mask & (quad >> total_shift));
    9896    }
    99     static public int index(LatLon coor, int level)
    100     {
     97    static public int index(LatLon coor, int level) {
    10198        // The nodes that don't return coordinates will all get
    10299        // stuck in a single tile.  Hopefully there are not too
     
    104101        if (coor == null)
    105102            return 0;
    106         long quad = coorToTile(coor);
    107         return index(level, quad);
     103
     104        long x = lon2x(coor.lon());
     105        long y = lat2y(coor.lat());
     106        int shift = NR_LEVELS-level-1;
     107        return (int)((x >> shift & 1) * 2 + (y >> shift & 1));
    108108    }
    109109}
Note: See TracChangeset for help on using the changeset viewer.