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
be21d1b2
authored
2018-04-02 16:28:05 +0800
by
chiangbt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修正了lod中的一个问题
1 parent
ba979c7f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
57 deletions
app/src/main/java/com/pashanhoo/landsurvey/BaiduMapActivity.java
app/src/main/java/com/pashanhoo/landsurvey/GoogleMapActivity.java
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
app/src/main/java/com/pashanhoo/landsurvey/layers/baidu/BaiduMapsTiledServiceLayer.java
app/src/main/java/com/pashanhoo/landsurvey/layers/gaode/GaodeMapsTiledServiceLayer.java
app/src/main/java/com/pashanhoo/landsurvey/layers/geoq/GeoQMapsTiledServiceLayer.java
app/src/main/java/com/pashanhoo/landsurvey/layers/google/GoogleMapsTiledServiceLayer.java
app/src/main/java/com/pashanhoo/landsurvey/layers/tencent/TencentMapsTiledServiceLayer.java
app/src/main/java/com/pashanhoo/landsurvey/layers/tianditu/TianDiTuTiledMapServiceLayer.java
app/src/main/res/layout/activity_google_map.xml
app/src/main/java/com/pashanhoo/landsurvey/BaiduMapActivity.java
View file @
be21d1b
package
com
.
pashanhoo
.
landsurvey
;
import
android.graphics.Color
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.support.v7.app.AppCompatActivity
;
import
com.esri.android.map.GraphicsLayer
;
import
com.esri.android.map.LocationDisplayManager
;
...
...
@@ -54,7 +52,7 @@ public class BaiduMapActivity extends AppCompatActivity {
if
(
status
==
STATUS
.
INITIALIZED
)
{
Point
curPt
=
JZLocationConverter
.
wgs84ToBd09
(
new
Point
(
121.540614
,
29.872488
));
Point
pt
=
GISHelper
.
lonLat2Mercator
(
curPt
);
mapView
.
zoomToResolution
(
new
Point
(
pt
.
getX
()
+
offsetX
,
pt
.
getY
()
+
offsetY
),
GoogleMapsTiledServiceLayer
.
getRes
(
)[
10
]
);
mapView
.
zoomToResolution
(
new
Point
(
pt
.
getX
()
+
offsetX
,
pt
.
getY
()
+
offsetY
),
GoogleMapsTiledServiceLayer
.
getRes
(
10
)
);
SimpleMarkerSymbol
sms
=
new
SimpleMarkerSymbol
(
Color
.
RED
,
15
,
SimpleMarkerSymbol
.
STYLE
.
CIRCLE
);
Graphic
graphic
=
new
Graphic
(
new
Point
(
pt
.
getX
()
+
offsetX
,
pt
.
getY
()
+
offsetY
),
sms
);
...
...
app/src/main/java/com/pashanhoo/landsurvey/GoogleMapActivity.java
View file @
be21d1b
...
...
@@ -85,8 +85,8 @@ public class GoogleMapActivity extends AppCompatActivity {
mapView
.
addLayer
(
gaodeMapsTiledServiceLayer
);
//---------------------------------------------------------------------------------------------------------------------
TencentMapsTiledServiceLayer
tencentMapsTiledServiceLayer
=
new
TencentMapsTiledServiceLayer
(
TencentMapLayerTypes
.
TENCENT_MAP_VECTOR
);
mapView
.
addLayer
(
tencentMapsTiledServiceLayer
);
//
TencentMapsTiledServiceLayer tencentMapsTiledServiceLayer = new TencentMapsTiledServiceLayer(TencentMapLayerTypes.TENCENT_MAP_VECTOR);
//
mapView.addLayer(tencentMapsTiledServiceLayer);
//---------------------------------------------------------------------------------------------------------------------
// GeoQMapsTiledServiceLayer geoQMapsTiledServiceLayer = new GeoQMapsTiledServiceLayer(GeoQMapLayerTypes.ChinaOnlineCommunity_Mobile);
...
...
@@ -102,7 +102,7 @@ public class GoogleMapActivity extends AppCompatActivity {
Point
curPt
=
JZLocationConverter
.
wgs84ToGcj02
(
AppInfo
.
initPoint
);
Point
pt
=
GISHelper
.
lonLat2Mercator
(
curPt
);
mapView
.
zoomToResolution
(
pt
,
GoogleMapsTiledServiceLayer
.
getRes
(
)[
17
]
);
mapView
.
zoomToResolution
(
pt
,
GoogleMapsTiledServiceLayer
.
getRes
(
17
)
);
locationDisplayManager
=
mapView
.
getLocationDisplayManager
();
locationDisplayManager
.
setShowLocation
(
true
);
...
...
@@ -114,7 +114,7 @@ public class GoogleMapActivity extends AppCompatActivity {
Point
pt
=
new
Point
(
location
.
getLongitude
(),
location
.
getLatitude
());
Point
gcjPt
=
JZLocationConverter
.
wgs84ToGcj02
(
pt
);
mapView
.
zoomToResolution
(
GISHelper
.
lonLat2Mercator
(
gcjPt
),
GoogleMapsTiledServiceLayer
.
getRes
(
)[
18
]
);
GoogleMapsTiledServiceLayer
.
getRes
(
18
)
);
}
@Override
...
...
@@ -140,7 +140,7 @@ public class GoogleMapActivity extends AppCompatActivity {
}
else
{
locationDisplayManager
.
start
();
mapView
.
zoomToResolution
(
GISHelper
.
lonLat2Mercator
(
locationDisplayManager
.
getPoint
()),
GoogleMapsTiledServiceLayer
.
getRes
(
)[
18
]
);
GoogleMapsTiledServiceLayer
.
getRes
(
18
)
);
Point
cupt
=
GISHelper
.
mercator2lonLat
(
mapView
.
getCenter
());
Toast
.
makeText
(
GoogleMapActivity
.
this
,
...
...
@@ -158,7 +158,7 @@ public class GoogleMapActivity extends AppCompatActivity {
POISuggestion
colorSuggestion
=
(
POISuggestion
)
searchSuggestion
;
Point
poipt
=
new
Point
(
colorSuggestion
.
getLng
(),
colorSuggestion
.
getLat
());
mapView
.
zoomToResolution
(
GISHelper
.
lonLat2Mercator
(
poipt
),
gaodeMapsTiledServiceLayer
.
getRes
(
)[
19
]
);
mapView
.
zoomToResolution
(
GISHelper
.
lonLat2Mercator
(
poipt
),
gaodeMapsTiledServiceLayer
.
getRes
(
18
)
);
graphicsLayer
.
addGraphic
(
new
Graphic
(
GISHelper
.
lonLat2Mercator
(
poipt
),
new
PictureMarkerSymbol
(
getResources
().
getDrawable
(
R
.
mipmap
.
locator
)).
setOffsetY
(
16
)));
...
...
app/src/main/java/com/pashanhoo/landsurvey/MainActivity.java
View file @
be21d1b
...
...
@@ -128,7 +128,7 @@ public class MainActivity extends AppCompatActivity {
locationDisplayManager
.
stop
();
}
else
{
locationDisplayManager
.
start
();
mapView
.
zoomToResolution
(
locationDisplayManager
.
getPoint
(),
t_vec
.
getRes
(
)[
18
]
);
mapView
.
zoomToResolution
(
locationDisplayManager
.
getPoint
(),
t_vec
.
getRes
(
18
)
);
mapinfoView
.
setText
(
"当前地图级别为:"
+
String
.
valueOf
(
t_vec
.
getCurrentLevel
()));
}
}
...
...
@@ -173,8 +173,8 @@ public class MainActivity extends AppCompatActivity {
graphicsLayer
=
new
GraphicsLayer
();
mapView
.
addLayer
(
graphicsLayer
);
// 设置地图的最小和最大分辨率
mapView
.
setMaxResolution
(
t_vec
.
getRes
(
)[
2
]
);
mapView
.
setMinResolution
(
t_vec
.
getRes
(
)[
19
]
);
mapView
.
setMaxResolution
(
t_vec
.
getRes
(
2
)
);
mapView
.
setMinResolution
(
t_vec
.
getRes
(
19
)
);
// 监听地图状态变化事件
mapView
.
setOnStatusChangedListener
(
new
OnStatusChangedListener
()
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -213,7 +213,7 @@ public class MainActivity extends AppCompatActivity {
locationDisplayManager
.
setLocationListener
(
new
LocationListener
()
{
@Override
public
void
onLocationChanged
(
Location
location
)
{
mapView
.
zoomToResolution
(
new
Point
(
location
.
getLongitude
(),
location
.
getLatitude
()),
t_vec
.
getRes
(
)[
18
]
);
mapView
.
zoomToResolution
(
new
Point
(
location
.
getLongitude
(),
location
.
getLatitude
()),
t_vec
.
getRes
(
18
)
);
mapinfoView
.
setText
(
"当前地图级别为:"
+
t_vec
.
getCurrentLevel
());
}
...
...
@@ -238,7 +238,7 @@ public class MainActivity extends AppCompatActivity {
POISuggestion
colorSuggestion
=
(
POISuggestion
)
searchSuggestion
;
Point
poipt
=
new
Point
(
colorSuggestion
.
getLng
(),
colorSuggestion
.
getLat
());
mapView
.
zoomToResolution
(
poipt
,
t_vec
.
getRes
(
)[
19
]
);
mapView
.
zoomToResolution
(
poipt
,
t_vec
.
getRes
(
19
)
);
graphicsLayer
.
addGraphic
(
new
Graphic
(
poipt
,
new
PictureMarkerSymbol
(
getResources
().
getDrawable
(
R
.
mipmap
.
locator
)).
setOffsetY
(
16
)));
mapinfoView
.
setText
(
"当前地图级别为:"
+
t_vec
.
getCurrentLevel
());
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/baidu/BaiduMapsTiledServiceLayer.java
View file @
be21d1b
...
...
@@ -12,8 +12,6 @@ import com.esri.core.geometry.Point;
import
com.esri.core.geometry.SpatialReference
;
import
com.esri.core.internal.io.handler.ResponseListener
;
import
com.esri.core.internal.io.handler.a
;
import
com.esri.core.io.UserCredentials
;
import
com.pashanhoo.landsurvey.layers.tencent.TencentMapLayerTypes
;
import
com.pashanhoo.landsurvey.utils.AppInfo
;
import
com.pashanhoo.landsurvey.utils.GADBHelper
;
...
...
@@ -29,7 +27,8 @@ public class BaiduMapsTiledServiceLayer extends TiledServiceLayer {
private
static
final
double
xmax
=
22041257.773878
;
private
static
final
double
ymax
=
20851350.0432886
;
private
static
final
double
[]
res
=
{
156543.03392800014
,
private
static
final
double
[]
res
=
{
156543.03392800014
,
78271.516963999937
,
39135.758482000092
,
19567.879240999919
,
...
...
@@ -50,7 +49,8 @@ public class BaiduMapsTiledServiceLayer extends TiledServiceLayer {
0.59716428355981721
,
0.29858214164761665
};
private
static
final
double
[]
scale
=
{
591657527.591555
,
private
static
final
double
[]
scale
=
{
591657527.591555
,
295828763.79577702
,
147914381.89788899
,
73957190.948944002
,
...
...
@@ -101,8 +101,8 @@ public class BaiduMapsTiledServiceLayer extends TiledServiceLayer {
}
}
public
static
double
[]
getRes
(
)
{
return
res
;
public
static
double
getRes
(
int
level
)
{
return
res
[
level
]
;
}
protected
void
initLayer
()
{
...
...
@@ -135,23 +135,19 @@ public class BaiduMapsTiledServiceLayer extends TiledServiceLayer {
switch
(
baiduMapLayerTypes
)
{
case
BAIDU_VECTOR:
url
=
"http://online"
+
((
col
+
row
)
%
8
+
1
)
+
".map.bdimg.com/onlinelabel/?qt=tile"
+
"&x="
+
(
col
-
offsetV
)
+
"&y="
+
(
offsetV
-
row
-
1
)
+
"&z="
+
(
level
+
1
)
+
"&styles=pl"
;
+
"&x="
+
(
col
-
offsetV
)
+
"&y="
+
(
offsetV
-
row
-
1
)
+
"&z="
+
(
level
+
1
)
+
"&styles=pl"
;
break
;
case
BAIDU_IMAGE:
url
=
"http://shangetu"
+
((
col
+
row
)
%
8
+
1
)
+
".map.bdimg.com/it/u="
+
"x="
+
(
col
-
offsetV
)
+
";y="
+
(
offsetV
-
row
-
1
)
+
";z="
+
(
level
+
1
)
+
";v=009;type=sate&fm=46"
;
+
"x="
+
(
col
-
offsetV
)
+
";y="
+
(
offsetV
-
row
-
1
)
+
";z="
+
(
level
+
1
)
+
";v=009;type=sate&fm=46"
;
break
;
case
BAIDU_ROAD:
url
=
"http://online"
+
((
col
+
row
)
%
8
+
1
)
+
".map.bdimg.com/onlinelabel/?qt=tile"
+
"&x="
+
(
col
-
offsetV
)
+
"&y="
+
(
offsetV
-
row
-
1
)
+
"&z="
+
(
level
+
1
)
+
"&styles=sl"
;
+
"&x="
+
(
col
-
offsetV
)
+
"&y="
+
(
offsetV
-
row
-
1
)
+
"&z="
+
(
level
+
1
)
+
"&styles=sl"
;
break
;
case
BAIDU_TRAFFIC:
url
=
"http://its.map.baidu.com:8002/traffic/TrafficTileService?"
+
"level="
+
(
level
+
1
)
+
"&x="
+
(
col
-
offsetV
)
+
"&y="
+
(
offsetV
-
row
-
1
)
+
"&time="
+
System
.
currentTimeMillis
();
+
"level="
+
(
level
+
1
)
+
"&x="
+
(
col
-
offsetV
)
+
"&y="
+
(
offsetV
-
row
-
1
)
+
"&time="
+
System
.
currentTimeMillis
();
break
;
}
try
{
...
...
@@ -188,9 +184,6 @@ public class BaiduMapsTiledServiceLayer extends TiledServiceLayer {
}
}
public
void
reinitializeLayer
(
UserCredentials
usercredentials
)
{
}
public
void
reinitializeLayer
(
String
appID
)
{
super
.
reinitializeLayer
(
null
);
}
...
...
@@ -198,7 +191,8 @@ public class BaiduMapsTiledServiceLayer extends TiledServiceLayer {
private
byte
[]
getOfflineCacheDB
(
int
level
,
int
col
,
int
row
)
throws
Exception
{
byte
[]
result
=
null
;
String
sql
=
"select * from "
+
this
.
baiduMapLayerTypes
.
getName
()
+
" where TILELEVEL = "
+
level
+
" and TILECOL = "
+
col
+
" and TILEROW = "
+
row
;
String
sql
=
"select * from "
+
this
.
baiduMapLayerTypes
.
getName
()
+
" where TILELEVEL = "
+
level
+
" and TILECOL = "
+
col
+
" and TILEROW = "
+
row
;
Cursor
mCursor
=
AppInfo
.
mapcachedb
.
rawQuery
(
sql
,
null
);
boolean
hasData
=
false
;
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/gaode/GaodeMapsTiledServiceLayer.java
View file @
be21d1b
...
...
@@ -31,12 +31,8 @@ public class GaodeMapsTiledServiceLayer extends TiledServiceLayer {
private
static
final
double
xmax
=
22041257.773878
;
private
static
final
double
ymax
=
20851350.0432886
;
private
static
final
double
XMin
=
110.35992000000005
;
private
static
final
double
YMin
=
31.382360000000062
;
private
static
final
double
XMax
=
116.65036000000009
;
private
static
final
double
YMax
=
36.36647000000005
;
private
static
final
double
[]
res
=
{
156543.03392800014
,
private
static
final
double
[]
res
=
{
156543.03392800014
,
78271.516963999937
,
39135.758482000092
,
19567.879240999919
,
...
...
@@ -57,7 +53,8 @@ public class GaodeMapsTiledServiceLayer extends TiledServiceLayer {
0.59716428355981721
,
0.29858214164761665
};
private
static
final
double
[]
scale
=
{
591657527.591555
,
private
static
final
double
[]
scale
=
{
591657527.591555
,
295828763.79577702
,
147914381.89788899
,
73957190.948944002
,
...
...
@@ -108,8 +105,8 @@ public class GaodeMapsTiledServiceLayer extends TiledServiceLayer {
}
}
public
static
double
[]
getRes
(
)
{
return
res
;
public
static
double
getRes
(
int
level
)
{
return
res
[
level
]
;
}
protected
void
initLayer
()
{
...
...
@@ -203,7 +200,8 @@ public class GaodeMapsTiledServiceLayer extends TiledServiceLayer {
private
byte
[]
getOfflineCacheDB
(
int
level
,
int
col
,
int
row
)
throws
Exception
{
byte
[]
result
=
null
;
String
sql
=
"select * from "
+
this
.
gaodeMapLayerTypes
.
getName
()
+
" where TILELEVEL = "
+
level
+
" and TILECOL = "
+
col
+
" and TILEROW = "
+
row
;
String
sql
=
"select * from "
+
this
.
gaodeMapLayerTypes
.
getName
()
+
" where TILELEVEL = "
+
level
+
" and TILECOL = "
+
col
+
" and TILEROW = "
+
row
;
Cursor
mCursor
=
AppInfo
.
mapcachedb
.
rawQuery
(
sql
,
null
);
boolean
hasData
=
false
;
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/geoq/GeoQMapsTiledServiceLayer.java
View file @
be21d1b
...
...
@@ -33,7 +33,8 @@ public class GeoQMapsTiledServiceLayer extends TiledServiceLayer {
private
static
final
double
XMax
=
116.65036000000009
;
private
static
final
double
YMax
=
36.36647000000005
;
private
static
final
double
[]
res
=
{
156543.03392800014
,
private
static
final
double
[]
res
=
{
156543.03392800014
,
78271.516963999937
,
39135.758482000092
,
19567.879240999919
,
...
...
@@ -54,7 +55,8 @@ public class GeoQMapsTiledServiceLayer extends TiledServiceLayer {
0.59716428355981721
,
0.29858214164761665
};
private
static
final
double
[]
scale
=
{
591657527.591555
,
private
static
final
double
[]
scale
=
{
591657527.591555
,
295828763.79577702
,
147914381.89788899
,
73957190.948944002
,
...
...
@@ -105,8 +107,8 @@ public class GeoQMapsTiledServiceLayer extends TiledServiceLayer {
}
}
public
static
double
[]
getRes
(
)
{
return
res
;
public
static
double
getRes
(
int
level
)
{
return
res
[
level
]
;
}
protected
void
initLayer
()
{
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/google/GoogleMapsTiledServiceLayer.java
View file @
be21d1b
...
...
@@ -33,7 +33,8 @@ public class GoogleMapsTiledServiceLayer extends TiledServiceLayer {
private
static
final
double
XMax
=
116.65036000000009
;
private
static
final
double
YMax
=
36.36647000000005
;
private
static
final
double
[]
res
=
{
156543.03392800014
,
private
static
final
double
[]
res
=
{
156543.03392800014
,
78271.516963999937
,
39135.758482000092
,
19567.879240999919
,
...
...
@@ -54,7 +55,8 @@ public class GoogleMapsTiledServiceLayer extends TiledServiceLayer {
0.59716428355981721
,
0.29858214164761665
};
private
static
final
double
[]
scale
=
{
591657527.591555
,
private
static
final
double
[]
scale
=
{
591657527.591555
,
295828763.79577702
,
147914381.89788899
,
73957190.948944002
,
...
...
@@ -105,8 +107,8 @@ public class GoogleMapsTiledServiceLayer extends TiledServiceLayer {
}
}
public
static
double
[]
getRes
(
)
{
return
res
;
public
static
double
getRes
(
int
level
)
{
return
res
[
level
]
;
}
protected
void
initLayer
()
{
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/tencent/TencentMapsTiledServiceLayer.java
View file @
be21d1b
...
...
@@ -106,8 +106,8 @@ public class TencentMapsTiledServiceLayer extends TiledServiceLayer {
}
}
public
static
double
[]
getRes
(
)
{
return
res
;
public
static
double
getRes
(
int
level
)
{
return
res
[
level
]
;
}
protected
void
initLayer
()
{
...
...
app/src/main/java/com/pashanhoo/landsurvey/layers/tianditu/TianDiTuTiledMapServiceLayer.java
View file @
be21d1b
...
...
@@ -118,8 +118,8 @@ public class TianDiTuTiledMapServiceLayer extends TiledServiceLayer {
}
}
public
static
double
[]
getRes
(
)
{
return
res
;
public
static
double
getRes
(
int
level
)
{
return
res
[
level
]
;
}
public
TianDiTuLayerTypes
getMapType
()
{
...
...
app/src/main/res/layout/activity_google_map.xml
View file @
be21d1b
...
...
@@ -16,6 +16,7 @@
android:layout_width=
"300dp"
android:layout_height=
"match_parent"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"16dp"
android:layout_marginLeft=
"16dp"
android:layout_marginBottom=
"16dp"
android:visibility=
"visible"
...
...
@@ -29,15 +30,16 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:layout_marginTop=
"
76
dp"
android:layout_marginTop=
"
10
dp"
android:layout_marginLeft=
"16dp"
android:layout_marginRight=
"16dp"
android:layout_marginBottom=
"16dp"
android:layout_gravity=
"top|start"
>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/gps"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"
top|start
"
android:layout_gravity=
"
bottom|end
"
android:layout_marginTop=
"0dp"
android:layout_marginLeft=
"0dp"
app:srcCompat=
"@mipmap/ic_my_location_white_48dp"
/>
...
...
Please
register
or
sign in
to post a comment