merge code

This commit is contained in:
qiji4215 2023-07-18 10:43:41 +08:00
parent 07c0103de1
commit dfbea188ea
2 changed files with 15 additions and 30 deletions

View File

@ -81,7 +81,7 @@ class MainViewModel @Inject constructor(
val liveDataNoteIdList = MutableLiveData<List<String>>()
//地图点击捕捉到的轨迹列表
val liveDataNILocationList = MutableLiveData<List<NiLocation>>()
val liveDataNILocationList = MutableLiveData<NiLocation>()
//左侧看板数据
val liveDataSignList = MutableLiveData<List<SignBean>>()
@ -163,8 +163,8 @@ class MainViewModel @Inject constructor(
liveDataNoteIdList.value = list
}
override fun onNiLocationList(list: MutableList<NiLocation>) {
liveDataNILocationList.value = list
override fun onNiLocation(item: NiLocation) {
liveDataNILocationList.value = item
}
})
@ -293,8 +293,8 @@ class MainViewModel @Inject constructor(
//相距差距大于2.5米以上进行存储
if (disance > 2.5) {
traceDataBase.niLocationDao.insert(location)
/* mapController.markerHandle.addNiLocationMarkerItem(location)
mapController.mMapView.vtmMap.updateMap(true)*/
mapController.markerHandle.addNiLocationMarkerItem(location)
mapController.mMapView.vtmMap.updateMap(true)
lastNiLocaion = location
}
} else {

View File

@ -157,7 +157,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
/**
* 评测数据marker 图层
*/
private val niLocationItemizedLayer: MyItemizedLayer by lazy {
private val niLocationItemizedLayer: ItemizedLayer by lazy {
niLocationBitmap =
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.icon_gps))
@ -172,39 +172,24 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
)
)
val layer = MyItemizedLayer(
mMapView.vtmMap,
val layer = ItemizedLayer(
mapView.vtmMap,
mutableListOf(),
markerRendererFactory,
object : MyItemizedLayer.OnItemGestureListener {
override fun onItemSingleTapUp(
list: MutableList<Int>,
nearest: Int
): Boolean {
object : OnItemGestureListener<MarkerInterface> {
override fun onItemSingleTapUp(index: Int, item: MarkerInterface?): Boolean {
itemListener?.let {
val idList = mutableListOf<NiLocation>()
if (list.size == 0) {
} else {
for (i in list) {
val markerInterface: MarkerInterface =
niLocationItemizedLayer.itemList[i]
if (markerInterface is MarkerItem) {
idList.add(markerInterface.uid as NiLocation)
}
}
it.onNiLocationList(idList.distinct().toMutableList())
}
it.onNiLocation((niLocationItemizedLayer.itemList[index] as MarkerItem).uid as NiLocation)
}
return true
}
override fun onItemLongPress(
list: MutableList<Int>?,
nearest: Int
): Boolean {
override fun onItemLongPress(index: Int, item: MarkerInterface?): Boolean {
return true
}
})
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
layer
}
@ -814,5 +799,5 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
interface OnQsRecordItemClickListener {
fun onQsRecordList(list: MutableList<String>)
fun onNoteList(list: MutableList<String>)
fun onNiLocationList(list: MutableList<NiLocation>)
fun onNiLocation(it: NiLocation)
}