fix: 合并代码

This commit is contained in:
xiaoyan 2023-08-25 14:46:54 +08:00
commit f6c52e649a
24 changed files with 739 additions and 554 deletions

View File

@ -63,9 +63,12 @@ class RealmOperateHelper() {
// 查询realm中对应tile号的数据
val realm = getRealmDefaultInstance()
val realmList =
getRealmTools(RenderEntity::class.java,false).and().equalTo("table", "OMDB_RD_LINK")
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
getRealmTools(RenderEntity::class.java, false)
.equalTo("table", "OMDB_RD_LINK")
.greaterThanOrEqualTo("tileX", xStart)
.lessThanOrEqualTo("tileX", xEnd)
.greaterThanOrEqualTo("tileY", yStart)
.lessThanOrEqualTo("tileY", yEnd)
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList)
@ -125,10 +128,12 @@ class RealmOperateHelper() {
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
// 查询realm中对应tile号的数据
val realm = getRealmDefaultInstance()
val realmList = getRealmTools(RenderEntity::class.java, true).and()
val realmList = getRealmTools(RenderEntity::class.java, true)
.equalTo("table", table)
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.greaterThanOrEqualTo("tileX", xStart)
.lessThanOrEqualTo("tileX", xEnd)
.greaterThanOrEqualTo("tileY", yStart)
.lessThanOrEqualTo("tileY", yEnd)
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList)
@ -187,8 +192,8 @@ class RealmOperateHelper() {
var link: RenderEntity? = null
val realm = getRealmDefaultInstance()
val realmR =
getRealmTools(RenderEntity::class.java, true).and().equalTo("table", "OMDB_RD_LINK")
.and().equalTo("properties['${LinkTable.linkPid}']", linkPid).findFirst()
getRealmTools(RenderEntity::class.java, true).equalTo("table", "OMDB_RD_LINK")
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findFirst()
if (realmR != null) {
link = realm.copyFromRealm(realmR)
}
@ -202,8 +207,8 @@ class RealmOperateHelper() {
suspend fun queryQcRecordBean(markId: String): QsRecordBean? {
var qsRecordBean: QsRecordBean? = null
val realm = getRealmDefaultInstance()
val realmR = getRealmTools(QsRecordBean::class.java, false).and()
.equalTo("table", "QsRecordBean").and().equalTo("id", markId).findFirst()
val realmR = getRealmTools(QsRecordBean::class.java, false)
.equalTo("table", "QsRecordBean").equalTo("id", markId).findFirst()
if (realmR != null) {
qsRecordBean = realm.copyFromRealm(realmR)
}
@ -215,7 +220,7 @@ class RealmOperateHelper() {
val realm = getRealmDefaultInstance()
val realmR = getRealmTools(RenderEntity::class.java, true).and()
val realmR = getRealmTools(RenderEntity::class.java, true)
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findAll()
val dataList = realm.copyFromRealm(realmR)
@ -257,10 +262,12 @@ class RealmOperateHelper() {
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
val realm = getRealmDefaultInstance()
// 查询realm中对应tile号的数据
val realmList = getRealmTools(RenderEntity::class.java, false).and()
val realmList = getRealmTools(RenderEntity::class.java, false)
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.greaterThanOrEqualTo("tileX", xStart)
.lessThanOrEqualTo("tileX", xEnd)
.greaterThanOrEqualTo("tileY", yStart)
.lessThanOrEqualTo("tileY", yEnd)
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val queryResult = realmList?.stream()?.filter {
@ -287,10 +294,9 @@ class RealmOperateHelper() {
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
val result = mutableListOf<RenderEntity>()
val realm = getRealmDefaultInstance()
val realmList = getRealmTools(RenderEntity::class.java, false).and()
val realmList = getRealmTools(RenderEntity::class.java, false)
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
.and()
.equalTo("properties['${LinkTable.linkPid}']", linkPid).and()
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
.findAll()
result.addAll(realm.copyFromRealm(realmList))
return result
@ -383,14 +389,15 @@ class RealmOperateHelper() {
}
fun getRealmDefaultInstance(): Realm {
if(isUpdate){
if (isUpdate) {
Log.e("jingo", "数据库更新")
Realm.getDefaultInstance().refresh()
isUpdate = false;
}
return Realm.getDefaultInstance()
}
fun updateRealmDefaultInstance(){
fun updateRealmDefaultInstance() {
isUpdate = true
}
}

View File

@ -524,7 +524,7 @@ class MainActivity : BaseActivity() {
/**
* 开始测量
*/
private fun measuringToolOn() {
fun measuringToolOn() {
val root = binding.mainActivityMeasuringTool.root
val valueView = root.findViewById<TextView>(R.id.measuring_tool_value)
val unitView = root.findViewById<TextView>(R.id.measuring_tool_value_unit)
@ -533,6 +533,7 @@ class MainActivity : BaseActivity() {
mapController.measureLayerHandler.measureValueLiveData.observe(this) {
valueView.text = it.valueString
unitView.text = it.unit
ClipboardUtils.copyText("${it.valueString}${it.unit}")
}
mapController.measureLayerHandler.tempMeasureValueLiveData.observe(this)
{
@ -672,12 +673,6 @@ class MainActivity : BaseActivity() {
viewModel.onClickMenu()
}
/**
* 点击测速
*/
fun onClickCalcDistance() {
measuringToolOn()
}
/**
* 点击轨迹

View File

@ -8,7 +8,6 @@ import android.graphics.drawable.AnimationDrawable
import android.graphics.drawable.BitmapDrawable
import android.os.Build
import android.os.Bundle
import android.provider.ContactsContract.Data
import android.text.TextUtils
import android.util.Log
import android.view.Gravity
@ -45,7 +44,7 @@ import com.navinfo.omqs.http.NetworkService
import com.navinfo.omqs.ui.dialog.CommonDialog
import com.navinfo.omqs.ui.manager.TakePhotoManager
import com.navinfo.omqs.ui.other.BaseToast
import com.navinfo.omqs.ui.widget.SignUtil
import com.navinfo.omqs.util.SignUtil
import com.navinfo.omqs.util.DateTimeUtil
import com.navinfo.omqs.util.ShareUtil
import com.navinfo.omqs.util.SoundMeter
@ -53,11 +52,11 @@ import com.navinfo.omqs.util.SpeakMode
import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm
import io.realm.RealmSet
import io.realm.kotlin.where
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.locationtech.jts.geom.Geometry
import org.oscim.core.GeoPoint
import org.oscim.core.MapPosition
import org.oscim.map.Map
@ -905,6 +904,19 @@ class MainViewModel @Inject constructor(
fun showSignMoreInfo(data: RenderEntity) {
liveDataSignMoreInfo.value = data
if (data.wkt != null) {
mapController.markerHandle.removeMarker("moreInfo")
mapController.lineHandler.removeLine()
when (data.wkt!!.geometryType) {
Geometry.TYPENAME_POINT -> {
val geoPoint = GeometryTools.createGeoPoint(data.wkt!!.toText())
mapController.markerHandle.addMarker(geoPoint, "moreInfo")
}
Geometry.TYPENAME_LINESTRING -> {
mapController.lineHandler.showLine(data.wkt!!.toText())
}
}
}
}
fun sendServerCommand(

View File

@ -13,7 +13,7 @@ import com.navinfo.omqs.databinding.AdapterSignBinding
import com.navinfo.omqs.databinding.AdapterSignLaneinfoBinding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
import com.navinfo.omqs.ui.widget.SignUtil
import com.navinfo.omqs.util.SignUtil
interface OnSignAdapterClickListener {
fun onItemClick(signBean: SignBean)

View File

@ -22,6 +22,7 @@ import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.databinding.FragmentEvaluationResultBinding
import com.navinfo.omqs.ui.activity.map.MainActivity
import com.navinfo.omqs.ui.dialog.FirstDialog
import com.navinfo.omqs.ui.fragment.BaseFragment
import com.navinfo.omqs.ui.other.shareViewModels
@ -101,6 +102,10 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
mDialog.show()
}
//测距按钮
binding.evaluationBarMeasuring.setOnClickListener {
(activity as MainActivity).measuringToolOn()
}
//保存事件
binding.evaluationBarSave.setOnClickListener {
viewModel.saveData()
@ -194,12 +199,16 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
viewModel.liveDataToastMessage.observe(viewLifecycleOwner) {
Toast.makeText(requireContext(), it, Toast.LENGTH_SHORT).show()
}
viewModel.liveDataQsRecordBean.observe(viewLifecycleOwner){
binding.evaluationId.text = it.id
}
}
override fun onDestroyView() {
activity?.run {
findNavController(R.id.main_activity_middle_fragment).navigateUp()
(this as MainActivity).measuringToolOff()
}
super.onDestroyView()
}
@ -304,6 +313,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
return true
}
private fun takePhoto() {
try {
val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)

View File

@ -398,6 +398,9 @@ class EvaluationResultViewModel @Inject constructor(
} else if (taskBean.cause.isEmpty()) {
liveDataToastMessage.postValue("请选择初步分析原因!")
return@launch
} else if (taskBean.linkId.isEmpty()) {
liveDataToastMessage.postValue("没有绑定到任何link请选择")
return@launch
}
val realm = Realm.getDefaultInstance()

View File

@ -10,6 +10,9 @@ import com.navinfo.omqs.ui.other.BaseViewHolder
class ItemAdapter(private var itemListener: ((Int, RenderEntity) -> Unit?)? = null) :
BaseRecyclerViewAdapter<RenderEntity>() {
var selectPosition = -1
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
val viewBinding =
AdapterItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
@ -19,9 +22,15 @@ class ItemAdapter(private var itemListener: ((Int, RenderEntity) -> Unit?)? = nu
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val binding = holder.viewBinding as AdapterItemBinding
var renderEntity = data[position]
binding.root.isSelected = selectPosition == position
binding.name.text = DataCodeEnum.findTableNameByCode(renderEntity.code)
binding.root.setOnClickListener {
if (selectPosition != position) {
notifyItemChanged(selectPosition)
selectPosition = position
notifyItemChanged(position)
}
if (itemListener != null) {
itemListener!!.invoke(position, renderEntity)
}

View File

@ -14,7 +14,7 @@ import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.databinding.FragmentSignInfoBinding
import com.navinfo.omqs.ui.activity.map.MainViewModel
import com.navinfo.omqs.ui.fragment.BaseFragment
import com.navinfo.omqs.ui.widget.SignUtil
import com.navinfo.omqs.util.SignUtil
class SignMoreInfoFragment : BaseFragment() {
@ -38,15 +38,22 @@ class SignMoreInfoFragment : BaseFragment() {
binding.signInfoRecyclerview.layoutManager = layoutManager
viewModel.liveDataSignMoreInfo.observe(viewLifecycleOwner) {
binding.signInfoTitle.text = it.name
val drawable = resources.getDrawable(R.drawable.icon_main_moreinfo_text_left, null);
drawable.setBounds(
val drawableLeft = resources.getDrawable(R.drawable.icon_main_moreinfo_text_left, null);
val drawableRight = resources.getDrawable(R.drawable.baseline_edit_note_48, null);
drawableLeft.setBounds(
0,
0,
drawable.minimumWidth,
drawable.minimumHeight
);//必须设置图片大小,否则不显示
drawableLeft.minimumWidth,
drawableLeft.minimumHeight
)//必须设置图片大小,否则不显示
drawableRight.setBounds(
0,
0,
drawableRight.minimumWidth,
drawableRight.minimumHeight
)
binding.signInfoTitle.setCompoundDrawables(
drawable, null, null, null
drawableLeft, null, drawableRight, null
)
when (it.code) {
@ -62,7 +69,7 @@ class SignMoreInfoFragment : BaseFragment() {
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getLaneBoundaryTypeInfo(it))
}
DataCodeEnum.OMDB_INTERSECTION.code->{
DataCodeEnum.OMDB_INTERSECTION.code -> {
val adapter = LaneBoundaryAdapter()
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getIntersectionInfo(it))
@ -77,7 +84,7 @@ class SignMoreInfoFragment : BaseFragment() {
drawable.minimumHeight
);//必须设置图片大小,否则不显示
binding.signInfoTitle.setCompoundDrawables(
drawable, null, null, null
drawable, null, drawableRight, null
)
val adapter = TwoItemAdapter()
binding.signInfoRecyclerview.adapter = adapter

View File

@ -2,6 +2,7 @@ package com.navinfo.omqs.ui.fragment.tasklist
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
import com.navinfo.omqs.R
@ -13,6 +14,7 @@ import com.navinfo.omqs.ui.other.BaseViewHolder
interface TaskAdapterCallback {
fun itemOnClick(bean: HadLinkDvoBean)
fun editOnClick(position: Int, bean: HadLinkDvoBean)
fun scrollPosition(position: Int)
}
/**
@ -38,10 +40,12 @@ class TaskAdapter(
val binding: AdapterTaskBinding =
holder.viewBinding as AdapterTaskBinding
val bean = data[position]
if(bean.linkStatus==1){
binding.taskHead.background = binding.root.context.getDrawable(R.drawable.selector_task_head)
}else{
binding.taskHead.background = binding.root.context.getDrawable(R.drawable.selector_task_head_add_link)
if (bean.linkStatus == 1) {
binding.taskHead.background =
binding.root.context.getDrawable(R.drawable.selector_task_head)
} else {
binding.taskHead.background =
binding.root.context.getDrawable(R.drawable.selector_task_head_add_link)
}
binding.taskLinkPid.text = "PID:${bean.linkPid}"
binding.taskMesh.text = "mesh:${bean.mesh}"
@ -58,7 +62,11 @@ class TaskAdapter(
callback.itemOnClick(bean)
}
}
binding.taskEdit.isSelected = bean.reason != ""
if (bean.reason == "") {
binding.taskBadge.visibility = View.GONE
} else {
binding.taskBadge.visibility = View.VISIBLE
}
binding.taskEdit.setOnClickListener {
callback.editOnClick(position, bean)
}
@ -68,6 +76,21 @@ class TaskAdapter(
fun resetSelect() {
selectPosition = -1
}
fun setSelectTag(tag: String) {
for (i in data.indices) {
if (data[i].linkPid == tag) {
if (selectPosition > -1)
notifyItemChanged(selectPosition)
selectPosition = i
notifyItemChanged(i)
if (callback != null) {
callback.scrollPosition(i)
}
break
}
}
}
}

View File

@ -48,6 +48,10 @@ class TaskFragment : BaseFragment() {
override fun editOnClick(position: Int, bean: HadLinkDvoBean) {
showLinkEditDialog(position, bean)
}
override fun scrollPosition(position: Int) {
binding.taskRecyclerview.scrollToPosition(position)
}
})
}
@ -120,6 +124,9 @@ class TaskFragment : BaseFragment() {
}
})
viewModel.liveDataSelectLink.observe(viewLifecycleOwner){
adapter.setSelectTag(it)
}
}

View File

@ -5,6 +5,7 @@ import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.os.Build
import android.view.View
import androidx.annotation.RequiresApi
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@ -66,6 +67,11 @@ class TaskViewModel @Inject constructor(
*/
val liveDataToastMessage = MutableLiveData<String>()
/**
* 点击地图选中的link
*/
val liveDataSelectLink = MutableLiveData<String>()
/**
* 当前选中的任务
*/
@ -85,6 +91,79 @@ class TaskViewModel @Inject constructor(
init {
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
@RequiresApi(Build.VERSION_CODES.N)
override fun onMapClick(tag: String, point: GeoPoint) {
if (tag == TAG) {
if (liveDataSelectNewLink.value == true) {
viewModelScope.launch(Dispatchers.Default) {
if (currentSelectTaskBean == null) {
liveDataToastMessage.postValue("还没有开启任何任务")
} else {
val links = realmOperateHelper.queryLink(
point = point,
)
if (links.isNotEmpty()) {
val l = links[0]
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
if (link.linkPid == l.properties["linkPid"]) {
return@launch
}
}
val hadLinkDvoBean = HadLinkDvoBean(
taskId = currentSelectTaskBean!!.id,
linkPid = l.properties["linkPid"]!!,
geometry = l.geometry,
linkStatus = 2
)
currentSelectTaskBean!!.hadLinkDvoList.add(
hadLinkDvoBean
)
val realm = Realm.getDefaultInstance()
realm.executeTransaction { r ->
r.copyToRealmOrUpdate(hadLinkDvoBean)
r.copyToRealmOrUpdate(currentSelectTaskBean!!)
}
//根据Link数据查询对应数据上要素对要素进行显示重置
l.properties["linkPid"]?.let {
realmOperateHelper.queryLinkToMutableRenderEntityList(it)
?.forEach { renderEntity ->
if (renderEntity.enable != 1) {
renderEntity.enable = 1
realm.executeTransaction { r ->
r.copyToRealmOrUpdate(renderEntity)
}
}
}
}
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
mapController.mMapView.vtmMap.updateMap(true)
}
}
}
}else {
viewModelScope.launch(Dispatchers.IO) {
val links = realmOperateHelper.queryLink(
point = point,
)
if (links.isNotEmpty()) {
val l = links[0]
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
if (link.linkPid == l.properties["linkPid"]) {
liveDataSelectLink.postValue(link.linkPid)
mapController.lineHandler.showLine(link.geometry)
break
}
}
}
}
}
}
}
})
}
/**
@ -106,10 +185,9 @@ class TaskViewModel @Inject constructor(
val nowTime: Long = DateTimeUtil.getNowDate().time
val beginNowTime: Long = nowTime - 90 * 3600 * 24 * 1000L
val syncUpload: Int = FileManager.Companion.FileUploadStatus.DONE
val objects =
realm.where(TaskBean::class.java).notEqualTo("syncStatus", syncUpload).or()
.between("operationTime", beginNowTime, nowTime)
.equalTo("syncStatus", syncUpload).findAll().sort("id")
val objects = realm.where(TaskBean::class.java).notEqualTo("syncStatus", syncUpload).or()
.between("operationTime", beginNowTime, nowTime).equalTo("syncStatus", syncUpload)
.findAll().sort("id")
val taskList = realm.copyFromRealm(objects)
for (item in taskList) {
FileManager.checkOMDBFileInfo(item)
@ -187,8 +265,7 @@ class TaskViewModel @Inject constructor(
//重新加载轨迹
viewModelScope.launch(Dispatchers.IO) {
val list: List<NiLocation>? = TraceDataBase.getDatabase(
mapController.mMapView.context,
Constant.USER_DATA_PATH
mapController.mMapView.context, Constant.USER_DATA_PATH
).niLocationDao.findToTaskIdAll(taskBean.id.toString())
list!!.forEach {
mapController.markerHandle.addNiLocationMarkerItem(it)
@ -216,6 +293,7 @@ class TaskViewModel @Inject constructor(
}
override fun onCleared() {
mapController.mMapView.removeOnNIMapClickListener(TAG)
mapController.lineHandler.removeLine()
sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
super.onCleared()
@ -245,18 +323,12 @@ class TaskViewModel @Inject constructor(
* 筛选任务列表
*/
fun filterTaskList(key: String) {
if (filterTaskListJob != null)
filterTaskListJob!!.cancel()
if (filterTaskListJob != null) filterTaskListJob!!.cancel()
filterTaskListJob = viewModelScope.launch(Dispatchers.IO) {
delay(500)
val realm = Realm.getDefaultInstance()
val list = realm.where(TaskBean::class.java)
.contains("evaluationTaskName", key)
.or()
.contains("dataVersion", key)
.or()
.contains("cityName", key)
.findAll()
val list = realm.where(TaskBean::class.java).contains("evaluationTaskName", key).or()
.contains("dataVersion", key).or().contains("cityName", key).findAll()
liveDataTaskList.postValue(realm.copyFromRealm(list))
}
}
@ -265,17 +337,14 @@ class TaskViewModel @Inject constructor(
* 筛选link
*/
fun filterTask(pidKey: String) {
if (currentSelectTaskBean == null)
return
if (currentSelectTaskBean == null) return
if (filterTaskJob != null)
filterTaskJob!!.cancel()
if (filterTaskJob != null) filterTaskJob!!.cancel()
filterTaskJob = viewModelScope.launch(Dispatchers.Default) {
delay(500)
val list = mutableListOf<HadLinkDvoBean>()
for (item in currentSelectTaskBean!!.hadLinkDvoList) {
if (item.linkPid.contains(pidKey))
list.add(item)
if (item.linkPid.contains(pidKey)) list.add(item)
}
liveDataTaskLinks.postValue(list)
}
@ -295,8 +364,8 @@ class TaskViewModel @Inject constructor(
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
realm.executeTransaction {
val objects = it.where(TaskBean::class.java)
.equalTo("id", taskBean.id).findFirst()
val objects =
it.where(TaskBean::class.java).equalTo("id", taskBean.id).findFirst()
objects?.deleteFromRealm()
}
//遍历删除对应的数据
@ -317,10 +386,10 @@ class TaskViewModel @Inject constructor(
val nowTime: Long = DateTimeUtil.getNowDate().time
val beginNowTime: Long = nowTime - 90 * 3600 * 24 * 1000L
val syncUpload: Int = FileManager.Companion.FileUploadStatus.DONE
val objects = realm.where(TaskBean::class.java)
.notEqualTo("syncStatus", syncUpload).or()
.between("operationTime", beginNowTime, nowTime)
.equalTo("syncStatus", syncUpload).findAll()
val objects =
realm.where(TaskBean::class.java).notEqualTo("syncStatus", syncUpload).or()
.between("operationTime", beginNowTime, nowTime)
.equalTo("syncStatus", syncUpload).findAll()
val taskList = realm.copyFromRealm(objects)
for (item in taskList) {
FileManager.checkOMDBFileInfo(item)
@ -342,9 +411,9 @@ class TaskViewModel @Inject constructor(
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
val objects = realm.where(QsRecordBean::class.java)
.equalTo("linkId", hadLinkDvoBean.linkPid).and()
.equalTo("taskId", hadLinkDvoBean.taskId).findAll()
val objects =
realm.where(QsRecordBean::class.java).equalTo("linkId", hadLinkDvoBean.linkPid)
.and().equalTo("taskId", hadLinkDvoBean.taskId).findAll()
val map: MutableMap<TaskBean, Boolean> = HashMap<TaskBean, Boolean>()
if (objects.isEmpty() && hadLinkDvoBean.reason.isEmpty()) {
withContext(Dispatchers.Main) {
@ -388,68 +457,67 @@ class TaskViewModel @Inject constructor(
*/
fun setSelectLink(selected: Boolean) {
liveDataSelectNewLink.value = selected
//开始捕捉
if (selected) {
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
override fun onMapClick(tag: String, point: GeoPoint) {
if (tag == TAG) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
viewModelScope.launch(Dispatchers.Default) {
if (currentSelectTaskBean == null) {
liveDataToastMessage.postValue("还没有开启任何任务")
} else {
val links = realmOperateHelper.queryLink(
point = point,
)
if (links.isNotEmpty()) {
val l = links[0]
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
if (link.linkPid == l.properties["linkPid"]) {
return@launch
}
}
val hadLinkDvoBean = HadLinkDvoBean(
taskId = currentSelectTaskBean!!.id,
linkPid = l.properties["linkPid"]!!,
geometry = l.geometry,
linkStatus = 2
)
currentSelectTaskBean!!.hadLinkDvoList.add(
hadLinkDvoBean
)
val realm = Realm.getDefaultInstance()
realm.executeTransaction { r ->
r.copyToRealmOrUpdate(hadLinkDvoBean)
r.copyToRealmOrUpdate(currentSelectTaskBean!!)
}
//根据Link数据查询对应数据上要素对要素进行显示重置
l.properties["linkPid"]?.let {
realmOperateHelper.queryLinkToMutableRenderEntityList(it)
?.forEach { renderEntity ->
if(renderEntity.enable!=1){
renderEntity.enable = 1
realm.executeTransaction { r ->
r.copyToRealmOrUpdate(renderEntity)
}
}
}
}
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
mapController.mMapView.vtmMap.updateMap(true)
}
}
}
}
}
}
})
} else {
mapController.mMapView.removeOnNIMapClickListener(TAG)
mapController.lineHandler.removeLine()
}
// //开始捕捉
// if (selected) {
// mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
// override fun onMapClick(tag: String, point: GeoPoint) {
// if (tag == TAG) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// viewModelScope.launch(Dispatchers.Default) {
// if (currentSelectTaskBean == null) {
// liveDataToastMessage.postValue("还没有开启任何任务")
// } else {
// val links = realmOperateHelper.queryLink(
// point = point,
// )
// if (links.isNotEmpty()) {
// val l = links[0]
// for (link in currentSelectTaskBean!!.hadLinkDvoList) {
// if (link.linkPid == l.properties["linkPid"]) {
// return@launch
// }
// }
// val hadLinkDvoBean = HadLinkDvoBean(
// taskId = currentSelectTaskBean!!.id,
// linkPid = l.properties["linkPid"]!!,
// geometry = l.geometry,
// linkStatus = 2
// )
// currentSelectTaskBean!!.hadLinkDvoList.add(
// hadLinkDvoBean
// )
// val realm = Realm.getDefaultInstance()
// realm.executeTransaction { r ->
// r.copyToRealmOrUpdate(hadLinkDvoBean)
// r.copyToRealmOrUpdate(currentSelectTaskBean!!)
// }
// //根据Link数据查询对应数据上要素对要素进行显示重置
// l.properties["linkPid"]?.let {
// realmOperateHelper.queryLinkToMutableRenderEntityList(it)
// ?.forEach { renderEntity ->
// if (renderEntity.enable != 1) {
// renderEntity.enable = 1
// realm.executeTransaction { r ->
// r.copyToRealmOrUpdate(renderEntity)
// }
// }
// }
// }
// liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
// mapController.lineHandler.addTaskLink(hadLinkDvoBean)
// mapController.layerManagerHandler.updateOMDBVectorTileLayer()
// mapController.mMapView.vtmMap.updateMap(true)
// }
// }
// }
// }
// }
// }
// })
// } else {
// mapController.mMapView.removeOnNIMapClickListener(TAG)
// mapController.lineHandler.removeLine()
// }
}
/**
@ -480,10 +548,10 @@ class TaskViewModel @Inject constructor(
val realm = Realm.getDefaultInstance()
//重置数据为隐藏
if(hadLinkDvoBean.linkStatus==2){
if (hadLinkDvoBean.linkStatus == 2) {
realmOperateHelper.queryLinkToMutableRenderEntityList(hadLinkDvoBean.linkPid)
?.forEach { renderEntity ->
if(renderEntity.enable==1){
if (renderEntity.enable == 1) {
renderEntity.enable = 0
realm.executeTransaction { r ->
r.copyToRealmOrUpdate(renderEntity)
@ -505,9 +573,8 @@ class TaskViewModel @Inject constructor(
.equalTo("linkPid", hadLinkDvoBean.linkPid).findFirst()
?.deleteFromRealm()
val markers = realm.where(QsRecordBean::class.java)
.equalTo("linkId", hadLinkDvoBean.linkPid)
.and().equalTo("taskId", hadLinkDvoBean.taskId)
.findAll()
.equalTo("linkId", hadLinkDvoBean.linkPid).and()
.equalTo("taskId", hadLinkDvoBean.taskId).findAll()
if (markers != null) {
for (marker in markers) {
mapController.markerHandle.removeQsRecordMark(marker)

View File

@ -1,4 +1,4 @@
package com.navinfo.omqs.ui.widget
package com.navinfo.omqs.util
import android.util.Log
import com.navinfo.collect.library.data.entity.RenderEntity
@ -23,27 +23,65 @@ class SignUtil {
fun getSignIconText(data: RenderEntity): String {
return when (data.code) {
//道路功能等级
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code -> getLinkFunctionClassText(data)
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code -> {
"FC${data.properties["functionClass"]}"
}
//道路种别
DataCodeEnum.OMDB_RD_LINK_KIND.code -> getKindText(data)
DataCodeEnum.OMDB_RD_LINK_KIND.code -> {
"${data.properties["kind"]}"
}
//道路方向
DataCodeEnum.OMDB_LINK_DIRECT.code -> getRoadDirectionText(data)
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
when (data.properties["direct"]) {
"0" -> return "不应用"
"1" -> return ""
"2" -> return ""
"3" -> return ""
else -> ""
}
}
//常规线限速
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.code -> getLineSpeedLimitText(data)
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.code -> {
"${data.properties["maxSpeed"]}"
}
//全封闭
DataCodeEnum.OMDB_CON_ACCESS.code -> getConAccessText(data)
DataCodeEnum.OMDB_CON_ACCESS.code -> {
if (data.properties["conAccess"] === "1") "全封闭" else ""
}
//匝道
DataCodeEnum.OMDB_RAMP.code -> getRampText(data)
DataCodeEnum.OMDB_RAMP.code -> {
when (data.properties["formOfWay"]) {
"93" -> "普通匝"
"98" -> "高入匝"
"99" -> "高出匝"
"100" -> "高连匝"
"102" -> "直入匝"
"103" -> "直出匝"
"104" -> "出入匝"
else -> ""
}
}
//车道数
DataCodeEnum.OMDB_LANE_NUM.code -> getLaneNumText(data)
DataCodeEnum.OMDB_LANE_NUM.code -> {
"${data.properties["laneNum"]}|${data.properties["laneS2e"]}|${data.properties["laneE2s"]}"
}
//常规点限速,条件点限速
DataCodeEnum.OMDB_SPEEDLIMIT.code, DataCodeEnum.OMDB_SPEEDLIMIT_COND.code -> getSpeedLimitMaxText(
data
)
//上下线分离
DataCodeEnum.OMDB_MULTI_DIGITIZED.code -> getMultiDigitized(data)
DataCodeEnum.OMDB_MULTI_DIGITIZED.code -> {
if (data.properties["multiDigitized"] == "1") "上下线" else " "
}
//桥
DataCodeEnum.OMDB_BRIDGE.code -> getBridgeType(data)
DataCodeEnum.OMDB_BRIDGE.code -> {
when (data.properties["bridgeType"]) {
"1" -> return "固定桥"
"2" -> return "可移桥"
"3" -> return "跨线桥"
else -> ""
}
}
//隧道
DataCodeEnum.OMDB_TUNNEL.code -> "隧道"
//环岛
@ -73,101 +111,12 @@ class SignUtil {
DataCodeEnum.OMDB_LINK_FORM2_12.code -> "测试路"
DataCodeEnum.OMDB_LINK_FORM2_13.code -> "驾考路"
DataCodeEnum.OMDB_VIADUCT.code -> "高架"
DataCodeEnum.OMDB_LINK_CONSTRUCTION.code -> "道路施工"
DataCodeEnum.OMDB_LANE_CONSTRUCTION.code -> "车道施工"
else -> ""
}
}
/**
* 获取桥的类型值
*/
private fun getBridgeType(data: RenderEntity): String {
val bridgeType = data.properties["bridgeType"]
try {
when (bridgeType?.toInt()) {
1 -> return "固定桥"
2 -> return "可移桥"
3 -> return "跨线桥"
}
} catch (e: Throwable) {
}
return ""
}
/**
* 常规线限速值
*/
private fun getLineSpeedLimitText(data: RenderEntity): String {
return "${data.properties["maxSpeed"]}"
}
/**
* 获取全封闭值
*/
private fun getConAccessText(data: RenderEntity): String {
val conAccess = data.properties["conAccess"]
try {
if (conAccess?.toInt() == 1)
return "全封闭"
} catch (e: Throwable) {
}
return ""
}
/**
* 获取匝道值
*/
private fun getRampText(data: RenderEntity): String {
try {
val ramp = data.properties["formOfWay"]
return when (ramp?.toInt()) {
93 -> "普通匝"
98 -> "高入匝"
99 -> "高出匝"
100 -> "高连匝"
102 -> "直入匝"
103 -> "直出匝"
104 -> "出入匝"
else -> {
""
}
}
} catch (e: Throwable) {
}
return ""
}
/**
*获取道路功能等级文字
*/
private fun getLinkFunctionClassText(data: RenderEntity): String {
return "FC${data.properties["functionClass"]}"
}
/**
* 获取道路方向文字
*/
private fun getRoadDirectionText(data: RenderEntity): String {
val direct = data.properties["direct"]
when (direct?.toInt()) {
0 -> return "不应用"
1 -> return ""
2 -> return ""
3 -> return ""
}
return ""
}
/**
* 获取车道数展示文字
*/
private fun getLaneNumText(data: RenderEntity): String {
return "${data.properties["laneNum"]}|${data.properties["laneS2e"]}|${data.properties["laneE2s"]}"
}
/**
* 获取要素名称
*/
@ -235,15 +184,193 @@ class SignUtil {
DataCodeEnum.OMDB_LINK_FORM2_13.code -> "道路形态"
DataCodeEnum.OMDB_VIADUCT.code -> "高架"
DataCodeEnum.OMDB_LINK_CONSTRUCTION.code -> "道路施工"
DataCodeEnum.OMDB_LANE_CONSTRUCTION.code -> "车道施工"
else -> ""
}
}
/**
* 获取更多信息
*/
fun getMoreInfoAdapter(data: RenderEntity): TwoItemAdapter {
val adapter = TwoItemAdapter()
val list = mutableListOf<TwoItemAdapterItem>()
when (data.code) {
//可变线限速
DataCodeEnum.OMDB_LINK_SPEEDLIMIT_VAR.code ->
list.addAll(getChangeLimitSpeedInfo(data))
//常规点限速
DataCodeEnum.OMDB_SPEEDLIMIT.code ->
list.addAll(getSpeedLimitMoreInfoText(data))
//条件点限速
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code ->
list.addAll(getConditionLimitMoreInfoText(data))
//到路线
DataCodeEnum.OMDB_RD_LINK.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "起点号码", text = "${data.properties["snodePid"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "终点号码", text = "${data.properties["enodePid"]}"
)
)
}
//种别
DataCodeEnum.OMDB_RD_LINK_KIND.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
try {
list.add(
TwoItemAdapterItem(
title = "种别",
text = "${getKindType(data.properties["kind"]!!.toInt())}"
)
)
} catch (e: Throwable) {
}
}
//道路方向
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
try {
list.add(
TwoItemAdapterItem(
title = "通行方向",
text = "${getRoadDirectionType(data.properties["direct"]!!.toInt())}"
)
)
} catch (e: Throwable) {
}
}
//普通交限
DataCodeEnum.OMDB_RESTRICTION.code -> {
list.add(
TwoItemAdapterItem(
title = "linkIn",
text = "${data.properties["linkIn"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "linkOut",
text = "${data.properties["linkOut"]}"
)
)
}
//道路功能等级
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code -> {
list.add(
TwoItemAdapterItem(
title = "功能等级",
text = "等级${data.properties["functionClass"]}"
)
)
}
//常规线限速
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.code -> {
list.addAll(getLinkSpeedLimitMoreInfo(data))
}
//车道数
DataCodeEnum.OMDB_LANE_NUM.code -> {
list.add(
TwoItemAdapterItem(
title = "车道总数",
text = "${data.properties["laneNum"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "顺方向车道数",
text = "${data.properties["laneS2e"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "逆方向车道数",
text = "${data.properties["laneE2s"]}"
)
)
var str = when (data.properties["laneClass"]) {
"0" -> "未赋值"
"1" -> "一条车道"
"2" -> "两或三条"
"3" -> "四条及以上"
"-99" -> "参考PA"
else -> ""
}
list.add(
TwoItemAdapterItem(
title = "车道数等级",
text = str
)
)
}
//路口
DataCodeEnum.OMDB_INTERSECTION.code -> {
val type = when (data.properties["type"]) {
"0" -> "简单路口"
"1" -> "复合路口"
else -> ""
}
list.add(
TwoItemAdapterItem(
title = "路口类型",
text = type
)
)
}
//道路施工
DataCodeEnum.OMDB_LINK_CONSTRUCTION.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
val validPeriod = data.properties["validPeriod"]
if(validPeriod != null){
}
}
//车道施工
DataCodeEnum.OMDB_LANE_CONSTRUCTION.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
}
}
adapter.data = list
return adapter
}
/**
* 获取路口详细信息
*/
fun getIntersectionInfo(renderEntity: RenderEntity): List<LaneBoundaryItem> {
val list = mutableListOf<LaneBoundaryItem>()
list.add(
@ -526,12 +653,6 @@ class SignUtil {
return "0"
}
/**
* 获取种别名称
*/
private fun getKindText(data: RenderEntity): String {
return data.properties["kind"].toString()
}
/**
* 常规点限速更多信息
@ -572,37 +693,6 @@ class SignUtil {
return list
}
/**
* 限速图标
*/
private fun getSpeedLimitIcon(data: RenderEntity): Int {
try {
//限速标志 0 限速开始 1 限速解除
return when (data.properties["speedFlag"]) {
"1" -> return R.drawable.icon_speed_limit_off
else -> return R.drawable.icon_speed_limit
}
} catch (e: Exception) {
Log.e("jingo", "获取限速面板ICON出错2 $e")
}
return 0
}
/**
* 条件限速图标
*/
private fun getConditionalSpeedLimitIcon(data: RenderEntity): Int {
try {
//限速标志 0 限速开始 1 限速解除
return when (data.properties["speedFlag"]) {
"1" -> return R.drawable.icon_conditional_speed_limit_off
else -> return R.drawable.icon_conditional_speed_limit
}
} catch (e: Exception) {
Log.e("jingo", "获取限速面板ICON出错2 $e")
}
return 0
}
/**
* 获取看板图标
@ -617,9 +707,21 @@ class SignUtil {
// //车道数
// 2041 -> getLaneNumIcon(data)
//普通点限速
DataCodeEnum.OMDB_SPEEDLIMIT.code -> getSpeedLimitIcon(data)
DataCodeEnum.OMDB_SPEEDLIMIT.code -> {
//限速标志 0 限速开始 1 限速解除
when (data.properties["speedFlag"]) {
"1" -> return R.drawable.icon_speed_limit_off
else -> return R.drawable.icon_speed_limit
}
}
//条件点限速
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code -> getConditionalSpeedLimitIcon(data)
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code -> {
//限速标志 0 限速开始 1 限速解除
when (data.properties["speedFlag"]) {
"1" -> return R.drawable.icon_conditional_speed_limit_off
else -> return R.drawable.icon_conditional_speed_limit
}
}
//可变点限速
DataCodeEnum.OMDB_SPEEDLIMIT_VAR.code -> R.drawable.icon_change_limit
//电子眼
@ -631,7 +733,6 @@ class SignUtil {
}
/**
* 获取种别图标
*/
@ -832,11 +933,43 @@ class SignUtil {
*/
fun getElectronicEyeMoreInfo(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
val list = mutableListOf<TwoItemAdapterItem>()
val dir = when (renderEntity.properties["direct"]) {
"2" -> "顺方向"
"3" -> "逆方向"
else -> ""
}
if (dir != "") {
list.add(
TwoItemAdapterItem(
title = "作用方向",
text = dir
)
)
}
val kindUp = when (renderEntity.properties["kindUp"]) {
"0" -> "未调查"
"1" -> "限速电子眼"
"4" -> "区间测速电子眼"
"5" -> "交通信号灯电子眼"
"6" -> "专用车道电子眼"
"7" -> "违章电子眼"
"11" -> "路况监控电子眼"
"19" -> "交通标线电子眼"
"20" -> "专用功能电子眼"
else -> ""
}
list.add(TwoItemAdapterItem(title = "电子眼类型大分类", text = kindUp))
val kindCode = renderEntity.properties["kind"]!!.toInt()
val kind = TwoItemAdapterItem(
title = "电子眼类型", text = getElectronicEyeKindType(kindCode)
list.add(
TwoItemAdapterItem(
title = "电子眼类型", text = getElectronicEyeKindType(kindCode)
)
)
list.add(kind)
when (kindCode) {
1, 2, 3, 4, 5, 6, 20, 21 -> {
list.add(
@ -870,6 +1003,11 @@ class SignUtil {
)
)
}
list.add(
TwoItemAdapterItem(
title = "照射角度", text = "${renderEntity.properties["angle"]}"
)
)
return list
}
@ -1031,237 +1169,95 @@ class SignUtil {
}
}
/**
* 获取更多信息
*/
fun getMoreInfoAdapter(data: RenderEntity): TwoItemAdapter {
val adapter = TwoItemAdapter()
//常规线限速详细信息
private fun getLinkSpeedLimitMoreInfo(data: RenderEntity): List<TwoItemAdapterItem> {
val list = mutableListOf<TwoItemAdapterItem>()
when (data.code) {
DataCodeEnum.OMDB_LINK_SPEEDLIMIT_VAR.code ->
list.addAll(getChangeLimitSpeedInfo(data))
//常规点限速
DataCodeEnum.OMDB_SPEEDLIMIT.code ->
list.addAll(getSpeedLimitMoreInfoText(data))
//条件点限速
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code ->
list.addAll(getConditionLimitMoreInfoText(data))
//到路线
DataCodeEnum.OMDB_RD_LINK.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "起点号码", text = "${data.properties["snodePid"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "终点号码", text = "${data.properties["enodePid"]}"
)
)
}
//种别
DataCodeEnum.OMDB_RD_LINK_KIND.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
try {
list.add(
TwoItemAdapterItem(
title = "种别",
text = "${getKindType(data.properties["kind"]!!.toInt())}"
)
)
} catch (e: Throwable) {
}
}
//道路方向
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
)
)
try {
list.add(
TwoItemAdapterItem(
title = "通行方向",
text = "${getRoadDirectionType(data.properties["direct"]!!.toInt())}"
)
)
} catch (e: Throwable) {
}
}
DataCodeEnum.OMDB_RESTRICTION.code -> {
list.add(
TwoItemAdapterItem(
title = "linkIn",
text = "${data.properties["linkIn"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "linkOut",
text = "${data.properties["linkOut"]}"
)
)
}
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code -> {
list.add(
TwoItemAdapterItem(
title = "功能等级",
text = "等级${data.properties["functionClass"]}"
)
)
}
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.code -> {
val direction = data.properties["direction"]
var dir = ""
if (direction == "2") {
dir = "顺方向"
} else if (direction == "3") {
dir = "逆方向"
}
if (dir != "") {
list.add(
TwoItemAdapterItem(
title = "限速方向",
text = dir
)
)
}
list.add(
TwoItemAdapterItem(
title = "最高限速值(km/h)",
text = "${data.properties["maxSpeed"]}"
)
)
var maxStr = when (data.properties["maxSpeedSource"]) {
"0" -> {
"不应用"
}
"1" -> {
"现场"
}
"2" -> {
"理论"
}
else -> ""
}
if (maxStr != "") {
list.add(
TwoItemAdapterItem(
title = "最高限速来源",
text = maxStr
)
)
}
list.add(
TwoItemAdapterItem(
title = "最低限速值(km/h)",
text = "${data.properties["minSpeed"]}"
)
)
var minStr = when (data.properties["minSpeedSource"]) {
"0" -> {
"不应用"
}
"1" -> {
"现场"
}
"2" -> {
"理论"
}
else -> ""
}
if (minStr != "") {
list.add(
TwoItemAdapterItem(
title = "最低限速来源",
text = minStr
)
)
}
var isLaneDependent = when (data.properties["isLaneDependent"]) {
"0" -> {
""
}
"1" -> {
""
}
else -> ""
}
if (isLaneDependent != "") {
list.add(
TwoItemAdapterItem(
title = "是否车道依赖",
text = isLaneDependent
)
)
}
}
DataCodeEnum.OMDB_LANE_NUM.code -> {
list.add(
TwoItemAdapterItem(
title = "车道总数",
text = "${data.properties["laneNum"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "顺方向车道数",
text = "${data.properties["laneS2e"]}"
)
)
list.add(
TwoItemAdapterItem(
title = "逆方向车道数",
text = "${data.properties["laneE2s"]}"
)
)
var str = when (data.properties["laneClass"]) {
"0" -> "未赋值"
"1" -> "一条车道"
"2" -> "两或三条"
"3" -> "四条及以上"
"-99" -> "参考PA"
else -> ""
}
list.add(
TwoItemAdapterItem(
title = "车道数等级",
text = str
)
)
}
DataCodeEnum.OMDB_INTERSECTION.code -> {
val type = when (data.properties["type"]) {
"0" -> "简单路口"
"1" -> "复合路口"
else -> ""
}
list.add(
TwoItemAdapterItem(
title = "路口类型",
text = type
)
)
}
val dir = when (data.properties["direction"]) {
"2" -> "顺方向"
"3" -> "逆方向"
else -> ""
}
adapter.data = list
return adapter
if (dir != "") {
list.add(
TwoItemAdapterItem(
title = "限速方向",
text = dir
)
)
}
list.add(
TwoItemAdapterItem(
title = "最高限速值(km/h)",
text = "${data.properties["maxSpeed"]}"
)
)
var maxStr = when (data.properties["maxSpeedSource"]) {
"0" -> {
"不应用"
}
"1" -> {
"现场"
}
"2" -> {
"理论"
}
else -> ""
}
if (maxStr != "") {
list.add(
TwoItemAdapterItem(
title = "最高限速来源",
text = maxStr
)
)
}
list.add(
TwoItemAdapterItem(
title = "最低限速值(km/h)",
text = "${data.properties["minSpeed"]}"
)
)
var minStr = when (data.properties["minSpeedSource"]) {
"0" -> {
"不应用"
}
"1" -> {
"现场"
}
"2" -> {
"理论"
}
else -> ""
}
if (minStr != "") {
list.add(
TwoItemAdapterItem(
title = "最低限速来源",
text = minStr
)
)
}
var isLaneDependent = when (data.properties["isLaneDependent"]) {
"0" -> {
""
}
"1" -> {
""
}
else -> ""
}
if (isLaneDependent != "") {
list.add(
TwoItemAdapterItem(
title = "是否车道依赖",
text = isLaneDependent
)
)
}
return list
}
}
}

View File

@ -55,20 +55,22 @@ class SpeakMode(private val context: Context) : TextToSpeech.OnInitListener {
fun setData(json: String?) {}
override fun onInit(status: Int) {
this.status = status
val result = mTextToSpeech.setLanguage(Locale.CHINESE)
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED
) {
if (context != null) {
val firstDialog = FirstDialog(context)
firstDialog.setTitle("提示")
firstDialog.setMessage("设备不支持语音播报,请先下载语音助手。")
firstDialog.setConfirmListener { dialog, _ -> dialog.dismiss() }
firstDialog.setNegativeView(View.GONE)
firstDialog.show()
if(mTextToSpeech != null) {
val result = mTextToSpeech.setLanguage(Locale.CHINESE)
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED
) {
if (context != null) {
val firstDialog = FirstDialog(context)
firstDialog.setTitle("提示")
firstDialog.setMessage("设备不支持语音播报,请先下载语音助手。")
firstDialog.setConfirmListener { dialog, _ -> dialog.dismiss() }
firstDialog.setNegativeView(View.GONE)
firstDialog.show()
}
}
Log.i("TextToSpeechDemo", status.toString())
}
Log.i("TextToSpeechDemo", status.toString())
}
//读语音处理

View File

@ -0,0 +1,6 @@
package com.navinfo.omqs.util
data class TimePeriod(
val child: TimePeriod? = null
)

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/default_blue_text_color" />
<item android:color="@color/black" />
<item android:color="#15141F" />
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#2E38D2" />
<item android:color="@color/gray_121" />
</selector>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/red" />
</shape>

View File

@ -141,7 +141,7 @@
<ImageButton
android:id="@+id/main_activity_calc_distance"
style="@style/top_right_drawer_btns_style"
android:onClick="@{()->mainActivity.onClickCalcDistance()}"
android:onClick="@{()->mainActivity.measuringToolOn()}"
android:src="@drawable/icon_calc_disance" />
<ImageButton

View File

@ -3,6 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/selector_adapter_item_select_bg"
android:padding="5dp">
<TextView
@ -10,6 +11,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="name"
android:textColor="@color/black"
android:textColor="@color/selector_black_blue_color"
android:textSize="16sp" />
</FrameLayout>

View File

@ -27,7 +27,7 @@
android:layout_marginRight="30dp"
android:layout_toRightOf="@id/task_head"
android:text="linkPID"
android:textColor="#15141F"
android:textColor="@color/selector_black_blue_color"
android:textSize="14sp" />
<TextView
@ -39,7 +39,7 @@
android:layout_alignLeft="@id/task_link_pid"
android:layout_marginTop="5dp"
android:text="mesh"
android:textColor="@color/gray_121"
android:textColor="@color/selector_gray_blue_color"
android:textSize="13sp" />
<ImageView
@ -49,4 +49,15 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/selector_task_link_edit_icon" />
<ImageView
android:id="@+id/task_badge"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginTop="10dp"
android:layout_marginRight="4dp"
android:visibility="gone"
android:layout_alignTop="@id/task_edit"
android:layout_alignRight="@id/task_edit"
android:background="@drawable/shape_oval_red_bg" />
</RelativeLayout>

View File

@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:layout_toRightOf="@id/task_list_head"
android:text="任务名称"
android:textColor="#15141F"
android:textColor="@color/selector_black_blue_color"
android:textSize="14sp" />
@ -47,7 +47,7 @@
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:text="版本号"
android:textColor="@color/gray_121"
android:textColor="@color/selector_gray_blue_color"
android:textSize="13sp" />
<TextView
@ -58,7 +58,7 @@
android:layout_below="@id/task_data_version"
android:layout_alignLeft="@id/task_name"
android:text="省市名称"
android:textColor="@color/gray_121"
android:textColor="@color/selector_gray_blue_color"
android:textSize="13sp" />
<com.navinfo.omqs.ui.widget.TextProgressButtonBar

View File

@ -44,29 +44,27 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/evaluation_bar_cancel"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:background="@color/transparent"
android:src="@drawable/icon_fragment_close"
android:visibility="gone"
app:layout_constraintRight_toLeftOf="@id/evaluation_bar_save"
app:layout_constraintTop_toTopOf="@id/evaluation_bar_save" />
<ImageButton
android:id="@+id/evaluation_bar_delete"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerInParent="true"
android:layout_marginRight="5dp"
android:background="@color/transparent"
android:src="@drawable/icon_delete"
app:layout_constraintRight_toLeftOf="@id/evaluation_bar_cancel"
app:layout_constraintTop_toTopOf="@id/evaluation_bar_save" />
app:layout_constraintRight_toLeftOf="@id/evaluation_bar_save"
app:layout_constraintTop_toTopOf="@id/evaluation_bar_save"
app:layout_constraintBottom_toBottomOf="@id/evaluation_bar_save" />
<ImageButton
android:id="@+id/evaluation_bar_measuring"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@color/transparent"
android:src="@drawable/measuring_tool_distance"
app:layout_constraintRight_toLeftOf="@id/evaluation_bar_delete"
app:layout_constraintTop_toTopOf="@id/evaluation_bar_save"
app:layout_constraintBottom_toBottomOf="@id/evaluation_bar_save"/>
<androidx.core.widget.NestedScrollView
android:layout_width="0dp"
@ -86,6 +84,23 @@
android:layout_height="match_parent"
android:layout_marginBottom="7dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:orientation="horizontal">
<TextView
style="@style/evaluation_fragment_title_text_style"
android:text="ID" />
<TextView
android:id="@+id/evaluation_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"

View File

@ -10,10 +10,12 @@
<TextView
android:id="@+id/sign_info_title"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/icon_main_moreinfo_text_left"
android:layout_toLeftOf="@id/sign_info_cancel"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:layout_marginRight="5dp"
android:text="电子眼"
android:textColor="@color/orange" />

View File

@ -67,7 +67,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
//新增marker图标样式
val mDefaultBitmap =
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.marker))
mDefaultBitmap.scaleTo(150, 150)
val markerSymbol = MarkerSymbol(
mDefaultBitmap,
MarkerSymbol.HotspotPlace.CENTER