Commit 1fced44e authored by p x's avatar p x
Browse files

不让用户传入mapreadyView

parent aeb35fb4
package com.sd.demo.ui
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.minedata.minenavi.SDKInitializer
import com.minedata.minenavi.SDKInitializer.InitListener
import com.minedata.minenavi.map.MineMap
import com.sd.api.maps.MethodAdv
import com.sd.api.maps.WmsLayer
import com.sd.api.ui.MapMultiView.OnMapReadyLis
import com.sd.api.ui.MapReadyView
import com.sd.demo.databinding.ActivityWmtsBinding
/****
* 加载wms
*/
class WmsActivity : AppCompatActivity() {
// override fun onPause() {
// super.onPause()
// binding.mapView.onPause()
// }
//
// override fun onResume() {
// super.onResume()
// binding.mapView.onResume()
// }
//
// override fun onDestroy() {
// super.onDestroy()
// binding.mapView.onDestroy()
// }
lateinit var binding: ActivityWmtsBinding
var mapReadView: MapReadyView? = null
var url = "http://192.168.60.73:9999/tiles/{z}/{x}/{y}.png?layer=yizhuang:yizhuang_avp"
var aMapurl = "http://192.168.59.216:8080/smartmap/wms?layers=yizhuang:yizhuang_avp"
// var url = "http://192.168.59.216:8080/smartmap/gwc/demo/yizhuang_avp?gridSet=EPSG:4326&format=image/png"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityWmtsBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.mapMultiView.addMapRenderCallback(object : OnMapReadyLis {
override fun onMapReady(mapReadyView: MapReadyView) {
this@WmsActivity.mapReadView = mapReadyView
// SDKInitializer.setStyleUrl(MineMap.UrlType.satellite, url)
WmsLayer.loadWmsLayer(aMapurl)
//改变地图中心点,第二个参数是纬度,第三个参数是经度
// MethodAdv.setMapCenter(mapReadView, 39.80913878, 116.50166926)
}
})
// initMap()
binding.bt1.setOnClickListener {
MethodAdv.setMapCenter(39.80913878, 116.50166926)
}
}
fun initMap() {
var url = "http://192.168.60.73:9999/tiles/{z}/{x}/{y}.png?layer=yizhuang:yizhuang_avp"
SDKInitializer.debug(false)
// 隐私合规接口
SDKInitializer.setAgreePrivacy(true)
SDKInitializer.setStyleUrl(MineMap.UrlType.satellite, url)
SDKInitializer.initialize(this, object : InitListener {
override fun onInitSuccess() {
// println("---Map onInitSuccess")
setUpMap()
}
override fun onInitFailed(msg: String?) {
}
})
}
private fun setUpMap() {
// binding.mapView.addMapRenderCallback(object : MapView.OnMapReadyListener {
// override fun onMapReady(mineMap: MineMap?) {
//
// mineMap?.setZoomLevel(14f)
// //设置中心点
// val point = Tools.latLngToPoint(LatLng(39.80913878, 116.50166926))
// mineMap?.setPointToCenter(point.x, point.y)
// }
// })
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/bt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="显示指南针" />
<Button
android:id="@+id/bt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="显示比例尺" />
<Button
android:id="@+id/bt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="显示我的位置" />
</LinearLayout>
<com.sd.api.ui.MapMultiView
android:id="@+id/mapMultiView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="开始导航" /> android:text="开始导航" />
<Button
android:id="@+id/simnai"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="模拟导航" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/bt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="加载"/>
</LinearLayout>
<com.sd.api.ui.MapMultiView
android:id="@+id/mapMultiView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 小地图-->
<!-- <com.minedata.minenavi.map.MapView-->
<!-- android:id="@+id/mapView"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent" />-->
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<external-path
name="external-path"
path="." />
</paths>
</resources>
\ No newline at end of file
...@@ -11,18 +11,6 @@ ...@@ -11,18 +11,6 @@
<application> <application>
<!-- android:supportsRtl="true"> -->
<!-- <meta-data-->
<!-- android:name="com.minedata.minenavi.apikey"-->
<!-- android:value="57ac7a0d56494912a0c28e651fa4a40a" />-->
<!-- <meta-data-->
<!-- android:name="com.amap.api.v2.apikey"-->
<!-- android:value="3b7d009011b97dcc3815a93e8ddfcd77" />-->
<uses-library
android:name="org.apache.http.legacy"
android:required="false" /> <!-- 定位需要的服务 使用2.0的定位需要加上这个 -->
<service android:name="com.amap.api.location.APSService" />
<activity <activity
android:name=".ui.MineNaiDirActivity" android:name=".ui.MineNaiDirActivity"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment