Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
蒋波涛
/
landsurvey
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f878e201
authored
2018-03-26 16:36:51 +0800
by
chiangbt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update2
1 parent
2c22ae85
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
.idea/misc.xml
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
app/src/main/java/com/pashanhoo/landsurvey/layers/tianditu/TianDiTuLocalTiledMapServiceLayer.java
app/src/main/java/com/pashanhoo/landsurvey/utils/AppInfo.java
.idea/misc.xml
View file @
f878e20
...
...
@@ -24,7 +24,7 @@
</value>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
View file @
f878e20
...
...
@@ -95,8 +95,8 @@ public class MainActivity extends AppCompatActivity {
t_cva
=
new
TianDiTuTiledMapServiceLayer
(
TianDiTuTiledMapServiceType
.
CVA_C
);
mapView
.
addLayer
(
t_cva
);
// t_local = new TianDiTuLocalTiledMapServiceLayer("my.mbtiles
");
//
mapView.addLayer(t_local);
t_local
=
new
TianDiTuLocalTiledMapServiceLayer
(
"my.db"
,
"IMG_C
"
);
mapView
.
addLayer
(
t_local
);
t_img
=
new
TianDiTuTiledMapServiceLayer
(
TianDiTuTiledMapServiceType
.
IMG_C
);
t_img
.
setVisible
(
false
);
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/tianditu/TianDiTuLocalTiledMapServiceLayer.java
View file @
f878e20
package
com
.
pashanhoo
.
landsurvey
.
layers
.
tianditu
;
import
android.content.res.Resources
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Color
;
import
android.os.Environment
;
import
android.util.Log
;
...
...
@@ -9,6 +13,7 @@ import com.esri.android.map.TiledServiceLayer;
import
com.esri.core.geometry.Envelope
;
import
com.esri.core.geometry.Point
;
import
com.esri.core.geometry.SpatialReference
;
import
com.pashanhoo.landsurvey.R
;
import
com.pashanhoo.landsurvey.utils.AppInfo
;
import
java.util.concurrent.RejectedExecutionException
;
...
...
@@ -21,10 +26,12 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
String
sqlitedb
=
""
;
private
TileInfo
tiandituTileInfo
;
private
String
layername
=
""
;
public
TianDiTuLocalTiledMapServiceLayer
(
String
url
)
{
public
TianDiTuLocalTiledMapServiceLayer
(
String
url
,
String
layername
)
{
super
(
url
);
this
.
sqlitedb
=
url
;
this
.
layername
=
layername
;
try
{
getServiceExecutor
().
submit
(
new
Runnable
()
{
...
...
@@ -72,11 +79,8 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
byte
[]
result
=
null
;
Log
.
i
(
"local"
,
level
+
":"
+
col
+
":"
+
row
);
Log
.
i
(
"local"
,
String
.
valueOf
(
Math
.
pow
(
2
,
level
)));
row
=
(
int
)
(
Math
.
pow
(
2
,
level
)
-
col
-
row
);
Log
.
i
(
"local"
,
level
+
":"
+
col
+
":"
+
row
);
Log
.
i
(
"local"
,
"---------------------"
);
String
sql
=
"select * from tiles where zoom_level = "
+
level
+
" and tile_column = "
+
col
+
" and tile_row = "
+
row
;
// row = (int) (Math.pow(2, level) - col - row);
String
sql
=
"select * from "
+
this
.
layername
+
" where TILELEVEL = "
+
level
+
" and TILECOL = "
+
col
+
" and TILEROW = "
+
row
;
Cursor
mCursor
=
SQLiteDatabase
.
openOrCreateDatabase
(
Environment
.
getExternalStorageDirectory
()+
"/keymapinfo/"
+
this
.
sqlitedb
,
null
)
...
...
@@ -89,7 +93,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
if
(
hasData
)
{
//数据库中有数据
try
{
if
(
mCursor
.
moveToFirst
())
{
result
=
mCursor
.
getBlob
(
mCursor
.
getColumnIndex
(
"
tile_data
"
));
result
=
mCursor
.
getBlob
(
mCursor
.
getColumnIndex
(
"
TILEDATA
"
));
}
mCursor
.
close
();
}
catch
(
Exception
e
)
{
...
...
app/src/main/java/com/pashanhoo/landsurvey/utils/AppInfo.java
View file @
f878e20
...
...
@@ -21,7 +21,7 @@ public class AppInfo {
public
static
Point
initPoint
=
new
Point
(
121.56
,
29.862149
);
public
static
double
initRes
=
TDTTileinfo
.
getRes4490
()[
12
];
public
static
double
initRes
=
TDTTileinfo
.
getRes4490
()[
6
];
public
static
void
Settings
(){
// 新建地图缓存数据库,不要试图新建多级目录,切记切记,如keymapinfo/cache
...
...
Please
register
or
sign in
to post a comment