public TileResultSet queryByTileGrid ( TileGrid tileGrid , long zoomLevel , String orderBy ) { TileResultSet tileCursor = null ; if ( tileGrid != null ) { StringBuilder where = new StringBuilder ( ) ; where . append ( buildWhere ( TileTable . COLUMN_ZOOM_LEVEL , zoomLevel ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( TileTable . COLUMN_TILE_COLUMN , tileGrid . getMinX ( ) , ">=" ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( TileTable . COLUMN_TILE_COLUMN , tileGrid . getMaxX ( ) , "<=" ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( TileTable . COLUMN_TILE_ROW , tileGrid . getMinY ( ) , ">=" ) ) ; where . append ( " AND " ) ; where . append ( buildWhere ( TileTable . COLUMN_TILE_ROW , tileGrid . getMaxY ( ) , "<=" ) ) ; String [ ] whereArgs = buildWhereArgs ( new Object [ ] { zoomLevel , tileGrid . getMinX ( ) , tileGrid . getMaxX ( ) , tileGrid . getMinY ( ) , tileGrid . getMaxY ( ) } ) ; tileCursor = query ( where . toString ( ) , whereArgs , null , null , orderBy ) ; } return tileCursor ; }
Query by tile grid and zoom level