b9cc8134 by chiangbt

update2

1 parent f878e201
......@@ -14,6 +14,7 @@ import android.view.MenuItem;
import com.esri.android.map.LocationDisplayManager;
import com.esri.android.map.MapView;
import com.esri.android.map.event.OnStatusChangedListener;
import com.esri.android.map.event.OnZoomListener;
import com.esri.android.runtime.ArcGISRuntime;
import com.esri.core.geometry.Point;
import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo;
......@@ -118,6 +119,20 @@ public class MainActivity extends AppCompatActivity {
}
}
});
mapView.setOnZoomListener(new OnZoomListener() {
@Override
public void preAction(float v, float v1, double v2) {
}
@Override
public void postAction(float v, float v1, double v2) {
Log.i("map", String.valueOf(TDTTileinfo.getCurrentLevel(mapView.getResolution())));
int level = TDTTileinfo.getCurrentLevel(mapView.getResolution());
if(level > 7 || level < 10){
t_local.clearTiles();
}
}
});
// GPS
locationDisplayManager = mapView.getLocationDisplayManager();
......
......@@ -141,4 +141,13 @@ public class TDTTileinfo {
public static int getTileHeight() {
return tileHeight;
}
public static int getCurrentLevel(double resolution){
for(int i=0; i< res4490.length;i++){
if((res4490[i] -resolution)<0.001){
return i;
}
}
return 0;
}
}
......
......@@ -78,7 +78,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
private byte[] getOfflineCacheDB(int level, int col, int row) throws Exception {
byte[] result = null;
Log.i("local", level + ":"+ col + ":" + row);
// Log.i("local", level + ":"+ col + ":" + row);
// row = (int) (Math.pow(2, level) - col - row);
String sql = "select * from " + this.layername + " where TILELEVEL = " + level + " and TILECOL = " + col + " and TILEROW = " + row;
......