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

View File

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