增加道路名显示和详细信息功能
This commit is contained in:
@@ -31,6 +31,7 @@ import com.navinfo.omqs.ui.activity.BaseActivity
|
||||
import com.navinfo.omqs.ui.fragment.console.ConsoleFragment
|
||||
import com.navinfo.omqs.ui.fragment.offlinemap.OfflineMapFragment
|
||||
import com.navinfo.omqs.ui.fragment.qsrecordlist.QsRecordListFragment
|
||||
import com.navinfo.omqs.ui.fragment.sign.RoadNameInfoFragment
|
||||
import com.navinfo.omqs.ui.fragment.tasklist.TaskManagerFragment
|
||||
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
||||
import com.navinfo.omqs.util.FlowEventBus
|
||||
@@ -56,6 +57,7 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
private var leftFragment: Fragment? = null
|
||||
|
||||
|
||||
/**
|
||||
* 是否开启右侧面板
|
||||
*/
|
||||
@@ -150,8 +152,6 @@ class MainActivity : BaseActivity() {
|
||||
checkIntent.action = TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
|
||||
someActivityResultLauncher.launch(checkIntent)
|
||||
|
||||
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
||||
|
||||
//初始化地图
|
||||
@@ -184,12 +184,12 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
v?.onTouchEvent(event) ?: true
|
||||
}
|
||||
|
||||
//捕捉列表变化回调
|
||||
viewModel.liveDataQsRecordIdList.observe(this) {
|
||||
//处理页面跳转
|
||||
viewModel.navigationRightFragment(this, it)
|
||||
}
|
||||
|
||||
//右上角菜单是否被点击
|
||||
viewModel.liveDataMenuState.observe(this) {
|
||||
binding.mainActivityMenu.isSelected = it
|
||||
if (it == true) {
|
||||
@@ -198,6 +198,17 @@ class MainActivity : BaseActivity() {
|
||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
//道路绑定,名称变化
|
||||
viewModel.liveDataRoadName.observe(this) {
|
||||
if (it != null && it.isNotEmpty()) {
|
||||
binding.mainActivityRoadName.text = it[0].name
|
||||
if (binding.mainActivityRoadName.visibility != View.VISIBLE)
|
||||
binding.mainActivityRoadName.visibility = View.VISIBLE
|
||||
} else {
|
||||
if (binding.mainActivityRoadName.visibility != View.GONE)
|
||||
binding.mainActivityRoadName.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
//道路属性面板
|
||||
binding.mainActivityTopSignRecyclerview.layoutManager = LinearLayoutManager(
|
||||
@@ -228,6 +239,7 @@ class MainActivity : BaseActivity() {
|
||||
viewModel.liveDataTopSignList.observe(this) {
|
||||
topSignAdapter.refreshData(it)
|
||||
}
|
||||
|
||||
//监听地图中点变化
|
||||
viewModel.liveDataCenterPoint.observe(this) {
|
||||
Log.e("qj", "${it.longitude}")
|
||||
@@ -533,4 +545,17 @@ class MainActivity : BaseActivity() {
|
||||
.replace(R.id.main_activity_left_fragment, leftFragment!!).commit()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开道路名称属性看板
|
||||
*/
|
||||
fun openRoadNameFragment() {
|
||||
val fragment =
|
||||
supportFragmentManager.findFragmentById(R.id.main_activity_sign_more_info_fragment)
|
||||
if (fragment !is RoadNameInfoFragment) {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.main_activity_sign_more_info_fragment, RoadNameInfoFragment())
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.bean.ImportConfig
|
||||
import com.navinfo.omqs.bean.RoadNameBean
|
||||
import com.navinfo.omqs.bean.SignBean
|
||||
import com.navinfo.omqs.db.RealmOperateHelper
|
||||
import com.navinfo.omqs.ui.dialog.CommonDialog
|
||||
@@ -76,6 +77,8 @@ class MainViewModel @Inject constructor(
|
||||
//顶部看板数据
|
||||
val liveDataTopSignList = MutableLiveData<List<SignBean>>()
|
||||
|
||||
//道路名
|
||||
val liveDataRoadName = MutableLiveData<List<RoadNameBean>?>()
|
||||
// var testPoint = GeoPoint(0, 0)
|
||||
|
||||
//uuid标识,用于记录轨迹组
|
||||
@@ -107,8 +110,8 @@ class MainViewModel @Inject constructor(
|
||||
init {
|
||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
when (e) {
|
||||
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT ->
|
||||
liveDataCenterPoint.value = mapPosition
|
||||
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT -> liveDataCenterPoint.value =
|
||||
mapPosition
|
||||
}
|
||||
})
|
||||
|
||||
@@ -213,6 +216,7 @@ class MainViewModel @Inject constructor(
|
||||
val linkList = realmOperateHelper.queryLink(
|
||||
point = point,
|
||||
)
|
||||
var hisRoadName = false
|
||||
if (linkList.isNotEmpty()) {
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
@@ -225,11 +229,17 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
if (linkIdCache != linkId) {
|
||||
|
||||
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
for (element in elementList) {
|
||||
|
||||
if (element.code == 2011) {
|
||||
hisRoadName = true
|
||||
liveDataRoadName.postValue(SignUtil.getRoadNameList(element))
|
||||
continue
|
||||
}
|
||||
|
||||
val distance = GeometryTools.distanceToDouble(
|
||||
point, GeometryTools.createGeoPoint(element.geometry)
|
||||
)
|
||||
@@ -246,7 +256,7 @@ class MainViewModel @Inject constructor(
|
||||
elementCode = element.code,
|
||||
moreText = SignUtil.getMoreInfoText(element)
|
||||
)
|
||||
|
||||
Log.e("jingo", "捕捉到的数据code ${element.code}")
|
||||
when (element.code) {
|
||||
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||
signBean
|
||||
@@ -260,27 +270,20 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val entity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RESTRICTION")
|
||||
.and()
|
||||
.equalTo(
|
||||
"properties['linkIn']",
|
||||
it
|
||||
.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(
|
||||
.equalTo("table", "OMDB_RD_LINK").and().equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
).findFirst()
|
||||
if (linkOutEntity != null) {
|
||||
mapController.lineHandler.linksLayer.addLine(
|
||||
linkOutEntity.geometry,
|
||||
0x7DFF0000
|
||||
linkOutEntity.geometry, 0x7DFF0000
|
||||
)
|
||||
Log.e("jingo", "捕捉到的linkid $outLink ${linkOutEntity.geometry}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,6 +300,10 @@ class MainViewModel @Inject constructor(
|
||||
mapController.lineHandler.removeLine()
|
||||
linkIdCache = ""
|
||||
}
|
||||
//如果没有捕捉到道路名
|
||||
if (!hisRoadName) {
|
||||
liveDataRoadName.postValue(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user