Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt app/src/main/res/layout/adapter_sign.xml
This commit is contained in:
@@ -76,7 +76,7 @@ class LoginViewModel @Inject constructor(
|
||||
var jobLogin: Job? = null;
|
||||
|
||||
init {
|
||||
loginUser.value = LoginUserBean(userCode = "02911", passWord = "123456")
|
||||
loginUser.value = LoginUserBean(userCode = "haofuyue00213", passWord = "123456")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,11 +79,12 @@ class MainActivity : BaseActivity() {
|
||||
* 提前显示要素看板
|
||||
*/
|
||||
private val signAdapter by lazy {
|
||||
SignAdapter { position, signBean ->
|
||||
SignAdapter { position, autoSave,signBean ->
|
||||
rightController.currentDestination?.let {
|
||||
if (it.id == R.id.RightEmptyFragment) {
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable("SignBean", signBean)
|
||||
bundle.putBoolean("AutoSave", autoSave)
|
||||
rightController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||
}
|
||||
}
|
||||
@@ -264,7 +265,7 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
//开启定位
|
||||
mapController.locationLayerHandler.startLocation()
|
||||
|
||||
mapController.mMapView.setLogoVisable(View.GONE)
|
||||
//启动轨迹存储
|
||||
// viewModel.startSaveTraceThread(this)
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
//录音图标
|
||||
var volume: ImageView? = null
|
||||
|
||||
var mSoundMeter: SoundMeter? = null
|
||||
|
||||
var menuState: Boolean = false
|
||||
@@ -98,6 +99,8 @@ class MainViewModel @Inject constructor(
|
||||
*/
|
||||
private var bSelectRoad = false
|
||||
|
||||
private var linkIdCache = ""
|
||||
|
||||
init {
|
||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
when (e) {
|
||||
@@ -210,45 +213,50 @@ class MainViewModel @Inject constructor(
|
||||
val linkList = realmOperateHelper.queryLink(
|
||||
point = point,
|
||||
)
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
val topSignList = mutableListOf<SignBean>()
|
||||
mapController.lineHandler.linksLayer.clear()
|
||||
if (linkList.isNotEmpty()) {
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
val topSignList = mutableListOf<SignBean>()
|
||||
mapController.lineHandler.linksLayer.clear()
|
||||
|
||||
val link = linkList[0]
|
||||
|
||||
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
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(),
|
||||
elementId = element.id,
|
||||
linkId = linkId,
|
||||
geometry = element.geometry,
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
elementCode = element.code
|
||||
)
|
||||
if(linkIdCache!=linkId){
|
||||
|
||||
when (element.code) {
|
||||
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||
signBean
|
||||
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
for (element in elementList) {
|
||||
val distance = GeometryTools.distanceToDouble(
|
||||
point, GeometryTools.createGeoPoint(element.geometry)
|
||||
)
|
||||
4002, 4003, 4004, 4022 -> signList.add(
|
||||
signBean
|
||||
|
||||
val signBean = SignBean(
|
||||
iconId = SignUtil.getSignIcon(element),
|
||||
iconText = SignUtil.getSignIconText(element),
|
||||
distance = distance.toInt(),
|
||||
elementId = element.id,
|
||||
linkId = linkId,
|
||||
geometry = element.geometry,
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
elementCode = element.code
|
||||
)
|
||||
|
||||
when (element.code) {
|
||||
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||
signBean
|
||||
)
|
||||
4002, 4003, 4004, 4022 -> signList.add(
|
||||
signBean
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val entity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RESTRICTION")
|
||||
@@ -275,17 +283,18 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
|
||||
liveDataSignList.postValue(signList.distinctBy { it.elementCode })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
withContext(Dispatchers.Main) {
|
||||
speakMode?.speakText(speechText)
|
||||
}
|
||||
Log.e("jingo", "自动捕捉数据 共${signList.size}条")
|
||||
}else{
|
||||
mapController.lineHandler.removeLine()
|
||||
}
|
||||
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
|
||||
liveDataSignList.postValue(signList.distinctBy { it.elementCode })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
withContext(Dispatchers.Main) {
|
||||
speakMode?.speakText(speechText)
|
||||
}
|
||||
linkIdCache = linkId ?: ""
|
||||
Log.e("jingo", "自动捕捉数据 共${signList.size}条")
|
||||
}else{
|
||||
mapController.lineHandler.removeLine()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +478,8 @@ class MainViewModel @Inject constructor(
|
||||
*/
|
||||
fun setSelectRoad(select: Boolean) {
|
||||
bSelectRoad = select
|
||||
//去掉缓存
|
||||
linkIdCache = ""
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.lineHandler.removeLine()
|
||||
liveDataSignList.value = mutableListOf()
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.navinfo.omqs.databinding.AdapterSignBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null) :
|
||||
class SignAdapter(private var itemListener: ((Int, Boolean, SignBean) -> Unit?)? = null) :
|
||||
BaseRecyclerViewAdapter<SignBean>() {
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.adapter_sign
|
||||
@@ -27,9 +27,12 @@ class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null)
|
||||
bd.signMainIconBg.setImageResource(item.iconId)
|
||||
bd.signMainIcon.text = item.iconText
|
||||
bd.signBottomText.text = item.name
|
||||
bd.signMainFastError.setOnClickListener{
|
||||
itemListener?.invoke(position, true,item)
|
||||
}
|
||||
bd.signBottomRightText.text = item.bottomRightText
|
||||
bd.root.setOnClickListener {
|
||||
itemListener?.invoke(position, item)
|
||||
itemListener?.invoke(position, false,item)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user