update2
Showing
4 changed files
with
15 additions
and
11 deletions
... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
24 | </value> | 24 | </value> |
25 | </option> | 25 | </option> |
26 | </component> | 26 | </component> |
27 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 27 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
28 | <output url="file://$PROJECT_DIR$/build/classes" /> | 28 | <output url="file://$PROJECT_DIR$/build/classes" /> |
29 | </component> | 29 | </component> |
30 | <component name="ProjectType"> | 30 | <component name="ProjectType"> | ... | ... |
... | @@ -95,8 +95,8 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -95,8 +95,8 @@ public class MainActivity extends AppCompatActivity { |
95 | t_cva = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.CVA_C); | 95 | t_cva = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.CVA_C); |
96 | mapView.addLayer(t_cva); | 96 | mapView.addLayer(t_cva); |
97 | 97 | ||
98 | // t_local = new TianDiTuLocalTiledMapServiceLayer("my.mbtiles"); | 98 | t_local = new TianDiTuLocalTiledMapServiceLayer("my.db", "IMG_C"); |
99 | // mapView.addLayer(t_local); | 99 | mapView.addLayer(t_local); |
100 | 100 | ||
101 | t_img = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.IMG_C); | 101 | t_img = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.IMG_C); |
102 | t_img.setVisible(false); | 102 | t_img.setVisible(false); | ... | ... |
1 | package com.pashanhoo.landsurvey.layers.tianditu; | 1 | package com.pashanhoo.landsurvey.layers.tianditu; |
2 | 2 | ||
3 | import android.content.res.Resources; | ||
3 | import android.database.Cursor; | 4 | import android.database.Cursor; |
4 | import android.database.sqlite.SQLiteDatabase; | 5 | import android.database.sqlite.SQLiteDatabase; |
6 | import android.graphics.Bitmap; | ||
7 | import android.graphics.BitmapFactory; | ||
8 | import android.graphics.Color; | ||
5 | import android.os.Environment; | 9 | import android.os.Environment; |
6 | import android.util.Log; | 10 | import android.util.Log; |
7 | 11 | ||
... | @@ -9,6 +13,7 @@ import com.esri.android.map.TiledServiceLayer; | ... | @@ -9,6 +13,7 @@ import com.esri.android.map.TiledServiceLayer; |
9 | import com.esri.core.geometry.Envelope; | 13 | import com.esri.core.geometry.Envelope; |
10 | import com.esri.core.geometry.Point; | 14 | import com.esri.core.geometry.Point; |
11 | import com.esri.core.geometry.SpatialReference; | 15 | import com.esri.core.geometry.SpatialReference; |
16 | import com.pashanhoo.landsurvey.R; | ||
12 | import com.pashanhoo.landsurvey.utils.AppInfo; | 17 | import com.pashanhoo.landsurvey.utils.AppInfo; |
13 | 18 | ||
14 | import java.util.concurrent.RejectedExecutionException; | 19 | import java.util.concurrent.RejectedExecutionException; |
... | @@ -21,10 +26,12 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { | ... | @@ -21,10 +26,12 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { |
21 | 26 | ||
22 | String sqlitedb = ""; | 27 | String sqlitedb = ""; |
23 | private TileInfo tiandituTileInfo; | 28 | private TileInfo tiandituTileInfo; |
29 | private String layername = ""; | ||
24 | 30 | ||
25 | public TianDiTuLocalTiledMapServiceLayer(String url) { | 31 | public TianDiTuLocalTiledMapServiceLayer(String url, String layername) { |
26 | super(url); | 32 | super(url); |
27 | this.sqlitedb = url; | 33 | this.sqlitedb = url; |
34 | this.layername = layername; | ||
28 | try { | 35 | try { |
29 | getServiceExecutor().submit(new Runnable() { | 36 | getServiceExecutor().submit(new Runnable() { |
30 | 37 | ||
... | @@ -72,11 +79,8 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { | ... | @@ -72,11 +79,8 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { |
72 | 79 | ||
73 | byte[] result = null; | 80 | byte[] result = null; |
74 | Log.i("local", level + ":"+ col + ":" + row); | 81 | Log.i("local", level + ":"+ col + ":" + row); |
75 | Log.i("local", String.valueOf(Math.pow(2, level))); | 82 | // row = (int) (Math.pow(2, level) - col - row); |
76 | row = (int) (Math.pow(2, level) - col - row); | 83 | String sql = "select * from " + this.layername + " where TILELEVEL = " + level + " and TILECOL = " + col + " and TILEROW = " + row; |
77 | Log.i("local", level + ":"+ col + ":" + row); | ||
78 | Log.i("local","---------------------"); | ||
79 | String sql = "select * from tiles where zoom_level = " + level + " and tile_column = " + col + " and tile_row = " + row; | ||
80 | 84 | ||
81 | Cursor mCursor = | 85 | Cursor mCursor = |
82 | SQLiteDatabase.openOrCreateDatabase(Environment.getExternalStorageDirectory()+"/keymapinfo/" + this.sqlitedb, null) | 86 | SQLiteDatabase.openOrCreateDatabase(Environment.getExternalStorageDirectory()+"/keymapinfo/" + this.sqlitedb, null) |
... | @@ -89,7 +93,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { | ... | @@ -89,7 +93,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer { |
89 | if (hasData) {//数据库中有数据 | 93 | if (hasData) {//数据库中有数据 |
90 | try { | 94 | try { |
91 | if (mCursor.moveToFirst()) { | 95 | if (mCursor.moveToFirst()) { |
92 | result = mCursor.getBlob(mCursor.getColumnIndex("tile_data")); | 96 | result = mCursor.getBlob(mCursor.getColumnIndex("TILEDATA")); |
93 | } | 97 | } |
94 | mCursor.close(); | 98 | mCursor.close(); |
95 | } catch (Exception e) { | 99 | } catch (Exception e) { | ... | ... |
... | @@ -21,7 +21,7 @@ public class AppInfo { | ... | @@ -21,7 +21,7 @@ public class AppInfo { |
21 | 21 | ||
22 | public static Point initPoint = new Point(121.56, 29.862149); | 22 | public static Point initPoint = new Point(121.56, 29.862149); |
23 | 23 | ||
24 | public static double initRes = TDTTileinfo.getRes4490()[12]; | 24 | public static double initRes = TDTTileinfo.getRes4490()[6]; |
25 | 25 | ||
26 | public static void Settings(){ | 26 | public static void Settings(){ |
27 | // 新建地图缓存数据库,不要试图新建多级目录,切记切记,如keymapinfo/cache | 27 | // 新建地图缓存数据库,不要试图新建多级目录,切记切记,如keymapinfo/cache | ... | ... |
-
Please register or sign in to post a comment