b9cc8134 by chiangbt

update2

1 parent f878e201
...@@ -14,6 +14,7 @@ import android.view.MenuItem; ...@@ -14,6 +14,7 @@ import android.view.MenuItem;
14 import com.esri.android.map.LocationDisplayManager; 14 import com.esri.android.map.LocationDisplayManager;
15 import com.esri.android.map.MapView; 15 import com.esri.android.map.MapView;
16 import com.esri.android.map.event.OnStatusChangedListener; 16 import com.esri.android.map.event.OnStatusChangedListener;
17 import com.esri.android.map.event.OnZoomListener;
17 import com.esri.android.runtime.ArcGISRuntime; 18 import com.esri.android.runtime.ArcGISRuntime;
18 import com.esri.core.geometry.Point; 19 import com.esri.core.geometry.Point;
19 import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo; 20 import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo;
...@@ -118,6 +119,20 @@ public class MainActivity extends AppCompatActivity { ...@@ -118,6 +119,20 @@ public class MainActivity extends AppCompatActivity {
118 } 119 }
119 } 120 }
120 }); 121 });
122 mapView.setOnZoomListener(new OnZoomListener() {
123 @Override
124 public void preAction(float v, float v1, double v2) {
125 }
126
127 @Override
128 public void postAction(float v, float v1, double v2) {
129 Log.i("map", String.valueOf(TDTTileinfo.getCurrentLevel(mapView.getResolution())));
130 int level = TDTTileinfo.getCurrentLevel(mapView.getResolution());
131 if(level > 7 || level < 10){
132 t_local.clearTiles();
133 }
134 }
135 });
121 136
122 // GPS 137 // GPS
123 locationDisplayManager = mapView.getLocationDisplayManager(); 138 locationDisplayManager = mapView.getLocationDisplayManager();
......
...@@ -141,4 +141,13 @@ public class TDTTileinfo { ...@@ -141,4 +141,13 @@ public class TDTTileinfo {
141 public static int getTileHeight() { 141 public static int getTileHeight() {
142 return tileHeight; 142 return tileHeight;
143 } 143 }
144
145 public static int getCurrentLevel(double resolution){
146 for(int i=0; i< res4490.length;i++){
147 if((res4490[i] -resolution)<0.001){
148 return i;
149 }
150 }
151 return 0;
152 }
144 } 153 }
......
...@@ -78,7 +78,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { ...@@ -78,7 +78,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
78 private byte[] getOfflineCacheDB(int level, int col, int row) throws Exception { 78 private byte[] getOfflineCacheDB(int level, int col, int row) throws Exception {
79 79
80 byte[] result = null; 80 byte[] result = null;
81 Log.i("local", level + ":"+ col + ":" + row); 81 // Log.i("local", level + ":"+ col + ":" + row);
82 // row = (int) (Math.pow(2, level) - col - row); 82 // row = (int) (Math.pow(2, level) - col - row);
83 String sql = "select * from " + this.layername + " where TILELEVEL = " + level + " and TILECOL = " + col + " and TILEROW = " + row; 83 String sql = "select * from " + this.layername + " where TILELEVEL = " + level + " and TILECOL = " + col + " and TILEROW = " + row;
84 84
......