Commit 96172cb1 authored by Vytor Calixto's avatar Vytor Calixto 👾
Browse files

Novos métodos em TilesProvider

parent ab955ab8
...@@ -10,6 +10,7 @@ import android.content.Context; ...@@ -10,6 +10,7 @@ import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Rect;
import ufpr.inf.pet.geoloc.TileDbContract.FeedEntry; import ufpr.inf.pet.geoloc.TileDbContract.FeedEntry;
...@@ -21,12 +22,18 @@ public class TilesProvider { ...@@ -21,12 +22,18 @@ public class TilesProvider {
public Hashtable<String, Tile> tiles; public Hashtable<String, Tile> tiles;
TileDbHelper tDbHelper; TileDbHelper tDbHelper;
public TilesProvider(String db) {
tilesDb = SQLiteDatabase.openDatabase(db, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS | SQLiteDatabase.OPEN_READONLY);
}
public TilesProvider(Context context) { public TilesProvider(Context context) {
tDbHelper = new TileDbHelper(context); tDbHelper = new TileDbHelper(context);
} }
public void fetchTiles(){ public void fetchTiles(Rect rect, int zoom){
// String query = "SELECT x,y,image FROM tiles WHERE " +
// "x >= " + rect.left + " AND x <= " + rect.right +
// " AND y >=" + rect.top + " AND y <= " + rect.bottom + " AND z = " + zoom;
} }
public Hashtable<String, Tile> select(String[] selectTile) throws Exception { public Hashtable<String, Tile> select(String[] selectTile) throws Exception {
...@@ -63,4 +70,12 @@ public class TilesProvider { ...@@ -63,4 +70,12 @@ public class TilesProvider {
public Hashtable<String, Tile> getTiles() { public Hashtable<String, Tile> getTiles() {
return tiles; return tiles;
} }
public void close() {
tilesDb.close();
}
public void clear() {
tiles.clear();
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment