merge code
This commit is contained in:
parent
7ebdfc93ff
commit
108c6daa2f
@ -220,6 +220,12 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//捕捉列表变化回调
|
||||||
|
viewModel.liveDataNILocationList.observe(this) {
|
||||||
|
Toast.makeText(this,"轨迹被点击了",Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
|
||||||
//右上角菜单是否被点击
|
//右上角菜单是否被点击
|
||||||
viewModel.liveDataMenuState.observe(this) {
|
viewModel.liveDataMenuState.observe(this) {
|
||||||
binding.mainActivityMenu.isSelected = it
|
binding.mainActivityMenu.isSelected = it
|
||||||
|
@ -3,6 +3,7 @@ package com.navinfo.omqs.ui.activity.map
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.graphics.drawable.AnimationDrawable
|
import android.graphics.drawable.AnimationDrawable
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -15,13 +16,13 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.PopupWindow
|
import android.widget.PopupWindow
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.constraintlayout.widget.Group
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||||
|
import com.navinfo.collect.library.data.entity.NiLocation
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
@ -31,7 +32,6 @@ import com.navinfo.collect.library.utils.GeometryToolsKt
|
|||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
import com.navinfo.omqs.bean.RoadNameBean
|
|
||||||
import com.navinfo.omqs.bean.SignBean
|
import com.navinfo.omqs.bean.SignBean
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.ui.dialog.CommonDialog
|
import com.navinfo.omqs.ui.dialog.CommonDialog
|
||||||
@ -59,11 +59,13 @@ import javax.inject.Inject
|
|||||||
* 创建Activity全局viewmode
|
* 创建Activity全局viewmode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class MainViewModel @Inject constructor(
|
class MainViewModel @Inject constructor(
|
||||||
private val mapController: NIMapController,
|
private val mapController: NIMapController,
|
||||||
private val traceDataBase: TraceDataBase,
|
private val traceDataBase: TraceDataBase,
|
||||||
private val realmOperateHelper: RealmOperateHelper,
|
private val realmOperateHelper: RealmOperateHelper,
|
||||||
|
private val sharedPreferences: SharedPreferences,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
private var mCameraDialog: CommonDialog? = null
|
private var mCameraDialog: CommonDialog? = null
|
||||||
@ -74,6 +76,9 @@ class MainViewModel @Inject constructor(
|
|||||||
//地图点击捕捉到的标签ID列表
|
//地图点击捕捉到的标签ID列表
|
||||||
val liveDataNoteIdList = MutableLiveData<List<String>>()
|
val liveDataNoteIdList = MutableLiveData<List<String>>()
|
||||||
|
|
||||||
|
//地图点击捕捉到的轨迹列表
|
||||||
|
val liveDataNILocationList = MutableLiveData<List<NiLocation>>()
|
||||||
|
|
||||||
//左侧看板数据
|
//左侧看板数据
|
||||||
val liveDataSignList = MutableLiveData<List<SignBean>>()
|
val liveDataSignList = MutableLiveData<List<SignBean>>()
|
||||||
|
|
||||||
@ -117,6 +122,8 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
private var linkIdCache = ""
|
private var linkIdCache = ""
|
||||||
|
|
||||||
|
private var lastNiLocaion: NiLocation? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||||
when (e) {
|
when (e) {
|
||||||
@ -135,6 +142,10 @@ class MainViewModel @Inject constructor(
|
|||||||
override fun onNoteList(list: MutableList<String>) {
|
override fun onNoteList(list: MutableList<String>) {
|
||||||
liveDataNoteIdList.value = list
|
liveDataNoteIdList.value = list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onNiLocationList(list: MutableList<NiLocation>) {
|
||||||
|
liveDataNILocationList.value = list
|
||||||
|
}
|
||||||
})
|
})
|
||||||
initLocation()
|
initLocation()
|
||||||
//处理地图点击操作
|
//处理地图点击操作
|
||||||
@ -154,29 +165,26 @@ class MainViewModel @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 初始话任务高亮高亮
|
* 初始话任务高亮高亮
|
||||||
*/
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
private fun initTaskData() {
|
private fun initTaskData() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
viewModelScope.launch {
|
||||||
viewModelScope.launch {
|
val realm = Realm.getDefaultInstance()
|
||||||
val realm = Realm.getDefaultInstance()
|
val results = realm.where(TaskBean::class.java).findAll()
|
||||||
val results = realm.where(TaskBean::class.java).findAll()
|
val list = realm.copyFromRealm(results)
|
||||||
val list = realm.copyFromRealm(results)
|
results.addChangeListener { changes ->
|
||||||
results.addChangeListener { changes ->
|
val list2 = realm.copyFromRealm(changes)
|
||||||
val list2 = realm.copyFromRealm(changes)
|
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
|
||||||
for (item in list2) {
|
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||||
for (item in list) {
|
for (item in list2) {
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
// mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
|
|
||||||
// }
|
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// realm.close()
|
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||||
|
for (item in list) {
|
||||||
|
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initLocation() {
|
private fun initLocation() {
|
||||||
@ -206,8 +214,27 @@ class MainViewModel @Inject constructor(
|
|||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
traceDataBase.niLocationDao.insert(location)
|
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
location.taskId = id.toString()
|
||||||
|
//增加间距判断
|
||||||
|
if (lastNiLocaion != null) {
|
||||||
|
val disance = GeometryTools.distanceToDouble(
|
||||||
|
GeoPoint(location.latitude, location.longitude), GeoPoint(
|
||||||
|
lastNiLocaion!!.latitude, lastNiLocaion!!.longitude
|
||||||
|
)
|
||||||
|
)
|
||||||
|
//相距差距大于0.5米以上进行存储
|
||||||
|
if (disance > 0.5) {
|
||||||
|
traceDataBase.niLocationDao.insert(location)
|
||||||
|
mapController.markerHandle.addNiLocationMarkerItem(location)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
traceDataBase.niLocationDao.insert(location)
|
||||||
|
mapController.markerHandle.addNiLocationMarkerItem(location)
|
||||||
|
}
|
||||||
|
|
||||||
|
lastNiLocaion = location
|
||||||
|
//mapController.mMapView.vtmMap.updateMap(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//用于定位点捕捉道路
|
//用于定位点捕捉道路
|
||||||
@ -217,6 +244,18 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//加载轨迹数据
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||||
|
val list: List<NiLocation>? = TraceDataBase.getDatabase(
|
||||||
|
mapController.mMapView.context,
|
||||||
|
Constant.USER_DATA_PATH
|
||||||
|
).niLocationDao.findToTaskIdAll(id.toString())
|
||||||
|
list!!.forEach {
|
||||||
|
mapController.markerHandle.addNiLocationMarkerItem(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//显示轨迹图层
|
//显示轨迹图层
|
||||||
mapController.layerManagerHandler.showNiLocationLayer()
|
mapController.layerManagerHandler.showNiLocationLayer()
|
||||||
|
|
||||||
@ -225,102 +264,104 @@ class MainViewModel @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 捕获道路和面板
|
* 捕获道路和面板
|
||||||
*/
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
private suspend fun captureLink(point: GeoPoint) {
|
private suspend fun captureLink(point: GeoPoint) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
val linkList = realmOperateHelper.queryLink(
|
|
||||||
point = point,
|
|
||||||
)
|
|
||||||
var hisRoadName = false
|
|
||||||
if (linkList.isNotEmpty()) {
|
|
||||||
//看板数据
|
|
||||||
val signList = mutableListOf<SignBean>()
|
|
||||||
val topSignList = mutableListOf<SignBean>()
|
|
||||||
mapController.lineHandler.linksLayer.clear()
|
|
||||||
|
|
||||||
val link = linkList[0]
|
val linkList = realmOperateHelper.queryLink(
|
||||||
|
point = point,
|
||||||
|
)
|
||||||
|
var hisRoadName = false
|
||||||
|
if (linkList.isNotEmpty()) {
|
||||||
|
//看板数据
|
||||||
|
val signList = mutableListOf<SignBean>()
|
||||||
|
val topSignList = mutableListOf<SignBean>()
|
||||||
|
mapController.lineHandler.linksLayer.clear()
|
||||||
|
|
||||||
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
val link = linkList[0]
|
||||||
|
|
||||||
if (linkIdCache != linkId) {
|
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||||
|
|
||||||
mapController.lineHandler.showLine(link.geometry)
|
if (linkIdCache != linkId) {
|
||||||
linkId?.let {
|
|
||||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
|
||||||
for (element in elementList) {
|
|
||||||
|
|
||||||
if (element.code == 2011) {
|
mapController.lineHandler.showLine(link.geometry)
|
||||||
hisRoadName = true
|
linkId?.let {
|
||||||
liveDataRoadName.postValue(element)
|
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||||
continue
|
for (element in elementList) {
|
||||||
}
|
|
||||||
|
|
||||||
val distance = GeometryTools.distanceToDouble(
|
|
||||||
point, GeometryTools.createGeoPoint(element.geometry)
|
|
||||||
)
|
|
||||||
|
|
||||||
val signBean = SignBean(
|
|
||||||
iconId = SignUtil.getSignIcon(element),
|
|
||||||
iconText = SignUtil.getSignIconText(element),
|
|
||||||
distance = distance.toInt(),
|
|
||||||
linkId = linkId,
|
|
||||||
name = SignUtil.getSignNameText(element),
|
|
||||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
|
||||||
renderEntity = element,
|
|
||||||
isMoreInfo = SignUtil.isMoreInfo(element),
|
|
||||||
index = SignUtil.getRoadInfoIndex(element)
|
|
||||||
)
|
|
||||||
Log.e("jingo", "捕捉到的数据code ${element.code}")
|
|
||||||
when (element.code) {
|
|
||||||
//车道数,种别,功能等级,线限速,道路方向
|
|
||||||
2041, 2008, 2002, 2019, 2010 -> topSignList.add(
|
|
||||||
signBean
|
|
||||||
)
|
|
||||||
4002, 4003, 4004, 4010, 4022, 4601 -> signList.add(
|
|
||||||
signBean
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (element.code == 2011) {
|
||||||
|
hisRoadName = true
|
||||||
|
liveDataRoadName.postValue(element)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
val realm = Realm.getDefaultInstance()
|
val distance = GeometryTools.distanceToDouble(
|
||||||
val entity = realm.where(RenderEntity::class.java)
|
point, GeometryTools.createGeoPoint(element.geometry)
|
||||||
.equalTo("table", "OMDB_RESTRICTION").and().equalTo(
|
)
|
||||||
"properties['linkIn']", it
|
|
||||||
|
val signBean = SignBean(
|
||||||
|
iconId = SignUtil.getSignIcon(element),
|
||||||
|
iconText = SignUtil.getSignIconText(element),
|
||||||
|
distance = distance.toInt(),
|
||||||
|
linkId = linkId,
|
||||||
|
name = SignUtil.getSignNameText(element),
|
||||||
|
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||||
|
renderEntity = element,
|
||||||
|
isMoreInfo = SignUtil.isMoreInfo(element),
|
||||||
|
index = SignUtil.getRoadInfoIndex(element)
|
||||||
|
)
|
||||||
|
Log.e("jingo", "捕捉到的数据code ${element.code}")
|
||||||
|
when (element.code) {
|
||||||
|
//车道数,种别,功能等级,线限速,道路方向
|
||||||
|
2041, 2008, 2002, 2019, 2010 -> topSignList.add(
|
||||||
|
signBean
|
||||||
|
)
|
||||||
|
|
||||||
|
4002, 4003, 4004, 4010, 4022, 4601 -> signList.add(
|
||||||
|
signBean
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
val realm = Realm.getDefaultInstance()
|
||||||
|
val entity = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("table", "OMDB_RESTRICTION").and().equalTo(
|
||||||
|
"properties['linkIn']", it
|
||||||
|
).findFirst()
|
||||||
|
if (entity != null) {
|
||||||
|
val outLink = entity.properties["linkOut"]
|
||||||
|
val linkOutEntity = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("table", "OMDB_RD_LINK").and().equalTo(
|
||||||
|
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||||
|
outLink
|
||||||
).findFirst()
|
).findFirst()
|
||||||
if (entity != null) {
|
if (linkOutEntity != null) {
|
||||||
val outLink = entity.properties["linkOut"]
|
mapController.lineHandler.linksLayer.addLine(
|
||||||
val linkOutEntity = realm.where(RenderEntity::class.java)
|
linkOutEntity.geometry, 0x7DFF0000
|
||||||
.equalTo("table", "OMDB_RD_LINK").and().equalTo(
|
)
|
||||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
|
||||||
outLink
|
|
||||||
).findFirst()
|
|
||||||
if (linkOutEntity != null) {
|
|
||||||
mapController.lineHandler.linksLayer.addLine(
|
|
||||||
linkOutEntity.geometry, 0x7DFF0000
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
|
||||||
.sortedBy { it.index })
|
|
||||||
|
|
||||||
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
|
||||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
|
||||||
withContext(Dispatchers.Main) {
|
|
||||||
speakMode?.speakText(speechText)
|
|
||||||
}
|
|
||||||
linkIdCache = linkId ?: ""
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
mapController.lineHandler.removeLine()
|
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||||
linkIdCache = ""
|
.sortedBy { it.index })
|
||||||
}
|
|
||||||
//如果没有捕捉到道路名
|
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
||||||
if (!hisRoadName) {
|
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||||
liveDataRoadName.postValue(null)
|
withContext(Dispatchers.Main) {
|
||||||
|
speakMode?.speakText(speechText)
|
||||||
|
}
|
||||||
|
linkIdCache = linkId ?: ""
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mapController.lineHandler.removeLine()
|
||||||
|
linkIdCache = ""
|
||||||
}
|
}
|
||||||
|
//如果没有捕捉到道路名
|
||||||
|
if (!hisRoadName) {
|
||||||
|
liveDataRoadName.postValue(null)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,9 @@ import androidx.annotation.RequiresApi
|
|||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||||
|
import com.navinfo.collect.library.data.entity.NiLocation
|
||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
@ -164,6 +166,8 @@ class TaskViewModel @Inject constructor(
|
|||||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||||
|
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||||
|
mapController.markerHandle.clearNiLocationLayer()
|
||||||
|
|
||||||
if (taskBean.hadLinkDvoList.isNotEmpty()) {
|
if (taskBean.hadLinkDvoList.isNotEmpty()) {
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
|
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
|
||||||
var maxX = 0.0
|
var maxX = 0.0
|
||||||
@ -195,6 +199,17 @@ class TaskViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//重新加载轨迹
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val list: List<NiLocation>? = TraceDataBase.getDatabase(
|
||||||
|
mapController.mMapView.context,
|
||||||
|
Constant.USER_DATA_PATH
|
||||||
|
).niLocationDao.findToTaskIdAll(taskBean.id.toString())
|
||||||
|
list!!.forEach {
|
||||||
|
mapController.markerHandle.addNiLocationMarkerItem(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,4 +46,7 @@ public interface INiLocationDao {
|
|||||||
|
|
||||||
@Query("SELECT * FROM niLocation")
|
@Query("SELECT * FROM niLocation")
|
||||||
List<NiLocation> findAll();
|
List<NiLocation> findAll();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM niLocation where taskId =:taskId")
|
||||||
|
List<NiLocation> findToTaskIdAll(String taskId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.collect.library.map.handler
|
package com.navinfo.collect.library.map.handler
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
@ -8,6 +9,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.navinfo.collect.library.R
|
import com.navinfo.collect.library.R
|
||||||
|
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||||
import com.navinfo.collect.library.data.entity.NiLocation
|
import com.navinfo.collect.library.data.entity.NiLocation
|
||||||
import com.navinfo.collect.library.data.entity.NoteBean
|
import com.navinfo.collect.library.data.entity.NoteBean
|
||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
@ -235,7 +237,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加或更新marker
|
* 增加或更新marker
|
||||||
*/
|
*/
|
||||||
@ -449,17 +450,17 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
nearest: Int
|
nearest: Int
|
||||||
): Boolean {
|
): Boolean {
|
||||||
itemListener?.let {
|
itemListener?.let {
|
||||||
val idList = mutableListOf<String>()
|
val idList = mutableListOf<NiLocation>()
|
||||||
if (list.size == 0) {
|
if (list.size == 0) {
|
||||||
} else {
|
} else {
|
||||||
for (i in list) {
|
for (i in list) {
|
||||||
val markerInterface: MarkerInterface =
|
val markerInterface: MarkerInterface =
|
||||||
itemizedLayer.itemList[i]
|
niLocationItemizedLayer.itemList[i]
|
||||||
if (markerInterface is MarkerItem) {
|
if (markerInterface is MarkerItem) {
|
||||||
idList.add(markerInterface.title)
|
idList.add(markerInterface.uid as NiLocation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.onQsRecordList(idList.distinct().toMutableList())
|
it.onNiLocationList(idList.distinct().toMutableList())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -473,11 +474,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
addLayer(niLocationItemizedLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
addLayer(niLocationItemizedLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||||
mContext.lifecycleScope.launch(Dispatchers.IO) {
|
|
||||||
var list = mutableListOf<QsRecordBean>()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -544,8 +540,8 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
/**
|
/**
|
||||||
* 添加质检数据marker
|
* 添加质检数据marker
|
||||||
*/
|
*/
|
||||||
private suspend fun addNiLocationMarkerItem(niLocation: NiLocation) {
|
public suspend fun addNiLocationMarkerItem(niLocation: NiLocation) {
|
||||||
val item = MarkerItem(niLocation.id, "", GeoPoint(niLocation.latitude, niLocation.longitude))
|
val item = MarkerItem(niLocation, niLocation.id, "", GeoPoint(niLocation.latitude, niLocation.longitude))
|
||||||
var itemizedLayer: ItemizedLayer? = null
|
var itemizedLayer: ItemizedLayer? = null
|
||||||
val direction: Double = niLocation.direction
|
val direction: Double = niLocation.direction
|
||||||
//角度
|
//角度
|
||||||
@ -800,21 +796,11 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加质检数据marker
|
* 移除轨迹图层
|
||||||
*/
|
*/
|
||||||
private suspend fun createTrackMarkerItem(item: NiLocation) {
|
fun clearNiLocationLayer() {
|
||||||
for (item in itemizedLayer.itemList) {
|
niLocationItemizedLayer.removeAllItems()
|
||||||
if (item is MarkerItem) {
|
niLocationItemizedLayer.update()
|
||||||
if (item.title == item.uid) {
|
|
||||||
itemizedLayer.itemList.remove(item)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//createMarkerItem(data)
|
|
||||||
withContext(Dispatchers.Main) {
|
|
||||||
mMapView.updateMap(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -822,4 +808,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>)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user