修改定位无效问题

This commit is contained in:
qiji4215
2023-07-18 17:08:07 +08:00
parent 53275472f4
commit 0378378dec
3 changed files with 15 additions and 32 deletions

View File

@@ -270,21 +270,10 @@ class MainViewModel @Inject constructor(
*/
@RequiresApi(Build.VERSION_CODES.N)
private fun initLocation() {
//用于定位点存储到数据库
viewModelScope.launch(Dispatchers.Default) {
//用于定位点捕捉道路
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
if (!isSelectRoad() && !GeometryTools.isCheckError(
location.longitude, location.latitude
)
) {
captureLink(
GeoPoint(
location.latitude, location.longitude
)
)
}
}
mapController.locationLayerHandler.niLocationFlow.collect { location ->
//过滤掉无效点
@@ -335,23 +324,23 @@ class MainViewModel @Inject constructor(
}
}
}
}
//用于定位点捕捉道路
viewModelScope.launch(Dispatchers.Default) {
//用于定位点捕捉道路
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
if (!isSelectRoad() && !GeometryTools.isCheckError(
location.longitude,
location.latitude
location.longitude, location.latitude
)
) captureLink(
GeoPoint(
location.latitude,
location.longitude
) {
captureLink(
GeoPoint(
location.latitude, location.longitude
)
)
)
}
}
}
//显示轨迹图层
mapController.layerManagerHandler.showNiLocationLayer()