diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt index 5605bd4..8e5c5ac 100644 --- a/app/src/main/java/com/casic/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt @@ -271,32 +271,36 @@ ) as ArrayList } - val latitudeList = ArrayList() - val longitudeList = ArrayList() + if (labelBeans.isEmpty()) { + "无法查到相关数据信息,请检查您的查询条件".show(context) + } else { + val latitudeList = ArrayList() + val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.lat - val longitude = it.lng - if (latitude.isNotBlank() && longitude.isNotBlank()) { - if (CoordinateConverter.isAMapDataAvailable( - latitude.toDouble(), longitude.toDouble() - ) - ) { - //分别缓存经、纬度 - latitudeList.add(latitude.toDouble()) - longitudeList.add(longitude.toDouble()) + labelBeans.forEach { + val latitude = it.lat + val longitude = it.lng + if (latitude.isNotBlank() && longitude.isNotBlank()) { + if (CoordinateConverter.isAMapDataAvailable( + latitude.toDouble(), longitude.toDouble() + ) + ) { + //分别缓存经、纬度 + latitudeList.add(latitude.toDouble()) + longitudeList.add(longitude.toDouble()) + } } } - } - if (latitudeList.isNotEmpty() && longitudeList.isNotEmpty()) { - //移动地图到所有labelBeans的第一个点 - val center = LatLng(latitudeList.first(), longitudeList.first()) - //移动到指定经纬度 - aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(center, 16f)) - } + if (latitudeList.isNotEmpty() && longitudeList.isNotEmpty()) { + //移动地图到所有labelBeans的第一个点 + val center = LatLng(latitudeList.first(), longitudeList.first()) + //移动到指定经纬度 + aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(center, 16f)) + } - showLabelsOnMap() + showLabelsOnMap() + } } } @@ -1612,7 +1616,8 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 - val taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") + val taskBean = + DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") // taskBean?.apply { // /** // * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键