报错信息:
//初始化天地图
val workspace = Workspace()
binding.mapView.mapControl.map.workspace = workspace
val info2 = DatasourceConnectionInfo()
info2.alias = "TianDiWX"
info2.engineType = EngineType.OGC
info2.driver = "WMTS"
info2.server = mTiandituUrl2
dataset2 = workspace.datasources.open(info2).datasets[0]
info = DatasourceConnectionInfo()
info?.alias = "TianDi"
info?.engineType = EngineType.OGC
info?.driver = "WMTS"
info?.server = mTiandituUrl
dataset = workspace.datasources.open(info).datasets[0]
binding.mapView.mapControl.map.layers.add(dataset2, true)
binding.mapView.mapControl.gestureDetector = GestureDetector(gestureListener)
binding.mapView.mapControl.map.isFullScreenDrawModel = true
binding.mapView.mapControl.map.refresh()
diyDraw = Draw(binding.mapView.mapControl)
info2.dispose()
info?.dispose()
binding.mapView.mapControl.isMagnifierEnabled = true
binding.mapView.mapControl.addMeasureListener(this)
binding.mapView.mapControl.addGeometrySelectedListener(this)
绘制轨迹代码与官方demo中的track目录下代码一致,执行到creatDataset时报错
fun startLocation(){
var data = binding.mapView.mapControl.map.workspace.datasources.get(0)
var dataset = track?.createDataset(data,"track")
track?.startTrack()
m_EnableLocationService = false
track?.dataset = dataset
var layers = binding.mapView.mapControl.map.layers
layers.add(dataset,true)
m_EnableLocationService = true
binding.mapView.mapControl.map.refresh()
locating()
}