Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
This commit is contained in:
commit
167cbdc4d3
@ -622,6 +622,24 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"4016": {
|
||||||
|
"table": "OMDB_ZLEVEL",
|
||||||
|
"code": 4016,
|
||||||
|
"name": "立交",
|
||||||
|
"zoomMin": 15,
|
||||||
|
"zoomMax": 20,
|
||||||
|
"filterData": true,
|
||||||
|
"catch": true,
|
||||||
|
"checkLinkId": false,
|
||||||
|
"transformer": [
|
||||||
|
{
|
||||||
|
"k": "geometry",
|
||||||
|
"v": "~",
|
||||||
|
"klib": "geometry",
|
||||||
|
"vlib": "obtainZLevelReference()"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"4022": {
|
"4022": {
|
||||||
"table": "OMDB_TRAFFICLIGHT",
|
"table": "OMDB_TRAFFICLIGHT",
|
||||||
"code": 4022,
|
"code": 4022,
|
||||||
|
@ -23,7 +23,13 @@ data class NaviRoute(
|
|||||||
var startIndexInPath: Int = -1,
|
var startIndexInPath: Int = -1,
|
||||||
//当前link在整段路径中的终点
|
//当前link在整段路径中的终点
|
||||||
var endIndexIntPath: Int = -1,
|
var endIndexIntPath: Int = -1,
|
||||||
var itemList: MutableList<NaviRouteItem>? = null
|
var itemList: MutableList<NaviRouteItem>? = null,
|
||||||
|
//种别
|
||||||
|
var kind: String = "",
|
||||||
|
//除导航退出线外的其他拓扑link
|
||||||
|
var otherTopologyLinks: MutableList<String> = mutableListOf(),
|
||||||
|
//线限速
|
||||||
|
var speedLimit: String = "0"
|
||||||
) {
|
) {
|
||||||
var pointList: MutableList<GeoPoint> = mutableListOf()
|
var pointList: MutableList<GeoPoint> = mutableListOf()
|
||||||
get() {
|
get() {
|
||||||
@ -39,5 +45,7 @@ data class NaviRouteItem(
|
|||||||
var index: Int,
|
var index: Int,
|
||||||
val data: RenderEntity,
|
val data: RenderEntity,
|
||||||
val linkId: String,
|
val linkId: String,
|
||||||
var distance: Int = -1
|
var distance: Int = -1,
|
||||||
|
var voiceText: String = "",
|
||||||
|
var isVoicePlayed: Boolean = false
|
||||||
)
|
)
|
||||||
|
@ -232,7 +232,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
OnComplete->{
|
OnComplete->{
|
||||||
processIndex ++
|
processIndex ++
|
||||||
callback.onResult("$processIndex|$tableNum")
|
callback.onResult("$processIndex|$tableNum")
|
||||||
Log.e("jingo", "安装==$processIndex===$tableNum")
|
// Log.e("jingo", "安装==$processIndex===$tableNum")
|
||||||
if(tableNum-processIndex==listDependOnEntry.size){
|
if(tableNum-processIndex==listDependOnEntry.size){
|
||||||
for ((currentEntry, importConfig) in listDependOnEntry) {
|
for ((currentEntry, importConfig) in listDependOnEntry) {
|
||||||
processIndex++
|
processIndex++
|
||||||
@ -315,7 +315,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
val cancellable= importData(f,unZipFiles,currentEntry,task,importConfig,hashMap,isEmit,object :MultiPathsCallback<String>{
|
val cancellable= importData(f,unZipFiles,currentEntry,task,importConfig,hashMap,isEmit,object :MultiPathsCallback<String>{
|
||||||
override fun onProgress(value: Int) {
|
override fun onProgress(value: Int) {
|
||||||
trySendBlocking(OnProgress(value))
|
trySendBlocking(OnProgress(value))
|
||||||
Log.e("jingo","=====$value")
|
// Log.e("jingo","=====$value")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
@ -379,12 +379,12 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
newTime = System.currentTimeMillis()
|
newTime = System.currentTimeMillis()
|
||||||
|
|
||||||
if (elementIndex % 50 == 0) {
|
// if (elementIndex % 50 == 0) {
|
||||||
Log.e(
|
// Log.e(
|
||||||
"jingo",
|
// "jingo",
|
||||||
"安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size} ${newTime - time}"
|
// "安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size} ${newTime - time}"
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
|
||||||
time = newTime
|
time = newTime
|
||||||
|
|
||||||
@ -805,10 +805,10 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (listRenderEntity.size > 20000) {
|
if (listRenderEntity.size > 20000) {
|
||||||
Log.e(
|
// Log.e(
|
||||||
"jingo",
|
// "jingo",
|
||||||
"安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size}"
|
// "安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size}"
|
||||||
)
|
// )
|
||||||
if (isEmit) {
|
if (isEmit) {
|
||||||
f.send(listRenderEntity)
|
f.send(listRenderEntity)
|
||||||
delay(20)
|
delay(20)
|
||||||
@ -852,7 +852,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.e("jingo", "完成 ${currentConfig.table}")
|
// Log.e("jingo", "完成 ${currentConfig.table}")
|
||||||
|
|
||||||
callback?.onComplete()
|
callback?.onComplete()
|
||||||
|
|
||||||
|
@ -782,10 +782,10 @@ class ImportPreProcess {
|
|||||||
angleReference.name = "${renderEntity.name}车道中线面"
|
angleReference.name = "${renderEntity.name}车道中线面"
|
||||||
angleReference.table = renderEntity.table
|
angleReference.table = renderEntity.table
|
||||||
angleReference.code = renderEntity.code
|
angleReference.code = renderEntity.code
|
||||||
Log.e("jingo", "几何转换开始")
|
// Log.e("jingo", "几何转换开始")
|
||||||
//angleReference.geometry = renderEntity.geometry
|
//angleReference.geometry = renderEntity.geometry
|
||||||
angleReference.geometry = GeometryTools.computeLine(0.000035,0.000035,renderEntity.geometry)
|
angleReference.geometry = GeometryTools.computeLine(0.000035,0.000035,renderEntity.geometry)
|
||||||
Log.e("jingo", "几何转换结束")
|
// Log.e("jingo", "几何转换结束")
|
||||||
angleReference.properties["qi_table"] = renderEntity.table
|
angleReference.properties["qi_table"] = renderEntity.table
|
||||||
angleReference.properties["widthProperties"] = "3"
|
angleReference.properties["widthProperties"] = "3"
|
||||||
angleReference.zoomMin = renderEntity.zoomMin
|
angleReference.zoomMin = renderEntity.zoomMin
|
||||||
@ -1261,6 +1261,7 @@ class ImportPreProcess {
|
|||||||
|
|
||||||
private fun createZLevelReference(renderEntity: RenderEntity): ReferenceEntity {
|
private fun createZLevelReference(renderEntity: RenderEntity): ReferenceEntity {
|
||||||
val zLevelReference = ReferenceEntity()
|
val zLevelReference = ReferenceEntity()
|
||||||
|
// zLevelReference.renderEntityId = renderEntity.id
|
||||||
//zLevelReference.renderEntityId = renderEntity.id
|
//zLevelReference.renderEntityId = renderEntity.id
|
||||||
zLevelReference.name = "${renderEntity.name}参考点"
|
zLevelReference.name = "${renderEntity.name}参考点"
|
||||||
zLevelReference.code = renderEntity.code
|
zLevelReference.code = renderEntity.code
|
||||||
|
@ -162,7 +162,7 @@ class OfflineMapDownloadScope(
|
|||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
downloadManager.mapController.layerManagerHandler.loadBaseMap()
|
downloadManager.mapController.layerManagerHandler.loadBaseMap()
|
||||||
}
|
}
|
||||||
}catch (e:Throwable){
|
} catch (e: Throwable) {
|
||||||
Log.e("jingo", "下载离线地图 load map ${e.message}")
|
Log.e("jingo", "下载离线地图 load map ${e.message}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +125,13 @@ class TaskDownloadScope(
|
|||||||
it.errMsg = taskBean.errMsg
|
it.errMsg = taskBean.errMsg
|
||||||
//赋值时间,用于查询过滤
|
//赋值时间,用于查询过滤
|
||||||
it.operationTime = taskBean.operationTime
|
it.operationTime = taskBean.operationTime
|
||||||
|
Log.e("jingo","文件下载1,状态 ${it.status}")
|
||||||
r.copyToRealmOrUpdate(it)
|
r.copyToRealmOrUpdate(it)
|
||||||
taskBean = realm.copyFromRealm(it)
|
taskBean = realm.copyFromRealm(it)
|
||||||
|
Log.e("jingo","文件下载2,状态 ${taskBean.status}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
realm.refresh()
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +168,7 @@ class TaskDownloadScope(
|
|||||||
this,
|
this,
|
||||||
object : MultiPathsCallback<String> {
|
object : MultiPathsCallback<String> {
|
||||||
override fun onProgress(value: Int) {
|
override fun onProgress(value: Int) {
|
||||||
Log.e("jingo", "安装====$value")
|
// Log.e("jingo", "安装====$value")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
override fun onError(t: Throwable) {
|
||||||
@ -189,10 +192,13 @@ class TaskDownloadScope(
|
|||||||
it.errMsg = taskBean.errMsg
|
it.errMsg = taskBean.errMsg
|
||||||
//赋值时间,用于查询过滤
|
//赋值时间,用于查询过滤
|
||||||
it.operationTime = taskBean.operationTime
|
it.operationTime = taskBean.operationTime
|
||||||
|
Log.e("jingo","文件下载安装1,状态 ${it.status}")
|
||||||
r.copyToRealmOrUpdate(it)
|
r.copyToRealmOrUpdate(it)
|
||||||
taskBean = realm.copyFromRealm(it)
|
taskBean = realm.copyFromRealm(it)
|
||||||
|
Log.e("jingo","文件下载安装2,状态 ${taskBean.status}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
realm.refresh()
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ class TaskUploadScope(
|
|||||||
it.errMsg = taskBean.errMsg
|
it.errMsg = taskBean.errMsg
|
||||||
//赋值时间,用于查询过滤
|
//赋值时间,用于查询过滤
|
||||||
it.operationTime = taskBean.operationTime
|
it.operationTime = taskBean.operationTime
|
||||||
|
Log.e("jingo","数据安装状态 ${it.status}")
|
||||||
r.copyToRealmOrUpdate(it)
|
r.copyToRealmOrUpdate(it)
|
||||||
taskBean = realm.copyFromRealm(it)
|
taskBean = realm.copyFromRealm(it)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class LoginActivity : CheckPermissionsActivity() {
|
|||||||
binding.lifecycleOwner = this
|
binding.lifecycleOwner = this
|
||||||
binding.activity = this
|
binding.activity = this
|
||||||
initView()
|
initView()
|
||||||
Log.e("jingo", getScreenParams())
|
// Log.e("jingo", getScreenParams())
|
||||||
UMConfigure.init(
|
UMConfigure.init(
|
||||||
this,
|
this,
|
||||||
"650bece7b2f6fa00ba573c7a",
|
"650bece7b2f6fa00ba573c7a",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -51,9 +51,7 @@ import io.realm.Realm
|
|||||||
import io.realm.RealmConfiguration
|
import io.realm.RealmConfiguration
|
||||||
import io.realm.RealmSet
|
import io.realm.RealmSet
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
|
||||||
import kotlinx.coroutines.flow.flow
|
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import org.locationtech.jts.geom.Geometry
|
import org.locationtech.jts.geom.Geometry
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
@ -184,6 +182,9 @@ class MainViewModel @Inject constructor(
|
|||||||
//状态
|
//状态
|
||||||
val liveIndoorToolsCommand: MutableLiveData<IndoorToolsCommand> = MutableLiveData()
|
val liveIndoorToolsCommand: MutableLiveData<IndoorToolsCommand> = MutableLiveData()
|
||||||
|
|
||||||
|
//播报语音流
|
||||||
|
private var voiceFlow = MutableSharedFlow<String>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是不是线选择模式
|
* 是不是线选择模式
|
||||||
*/
|
*/
|
||||||
@ -257,7 +258,7 @@ class MainViewModel @Inject constructor(
|
|||||||
//导航信息
|
//导航信息
|
||||||
private var naviEngine: NaviEngine? = null
|
private var naviEngine: NaviEngine? = null
|
||||||
|
|
||||||
private var naviEngineNew: NaviEngineNew = NaviEngineNew(realmOperateHelper)
|
// private var naviEngineNew: NaviEngineNew = NaviEngineNew(realmOperateHelper)
|
||||||
|
|
||||||
// 0:不导航 1:导航 2:暂停
|
// 0:不导航 1:导航 2:暂停
|
||||||
private var naviEngineStatus = 0
|
private var naviEngineStatus = 0
|
||||||
@ -290,10 +291,10 @@ class MainViewModel @Inject constructor(
|
|||||||
mapController.mMapView.addOnNIMapClickListener(TAG,
|
mapController.mMapView.addOnNIMapClickListener(TAG,
|
||||||
//处理地图点击操作
|
//处理地图点击操作
|
||||||
object : OnGeoPointClickListener {
|
object : OnGeoPointClickListener {
|
||||||
override fun onMapClick(tag: String, point: GeoPoint) {
|
override fun onMapClick(tag: String, point: GeoPoint, other: String) {
|
||||||
if (tag == TAG) {
|
if (tag == TAG) {
|
||||||
//数据安装时不允许操作数据
|
//数据安装时不允许操作数据
|
||||||
if(Constant.INSTALL_DATA){
|
if (Constant.INSTALL_DATA) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (bMeasuringTool) {
|
if (bMeasuringTool) {
|
||||||
@ -370,38 +371,32 @@ class MainViewModel @Inject constructor(
|
|||||||
.schemaVersion(2).build()
|
.schemaVersion(2).build()
|
||||||
MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig)
|
MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig)
|
||||||
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
||||||
|
//模拟定位,取屏幕中心点
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
// viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
//
|
||||||
naviTestFlow().collect { point ->
|
// naviTestFlow().collect { point ->
|
||||||
if (naviEngineStatus == 1) {
|
// if (naviEngineStatus == 1) {
|
||||||
naviEngineNew.let {
|
// naviMutex.lock()
|
||||||
// naviMutex.lock()
|
// naviEngine?.bindingRoute(null, point)
|
||||||
if (testRealm == null)
|
// naviMutex.unlock()
|
||||||
testRealm = realmOperateHelper.getSelectTaskRealmInstance()
|
// }
|
||||||
if (currentTaskBean != null) {
|
// }
|
||||||
naviEngineNew.bindingRoute(
|
// }
|
||||||
taskBean = currentTaskBean!!,
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
geoPoint = point,
|
voiceFlow.collect {
|
||||||
realm = testRealm!!
|
speakMode?.speakText(it)
|
||||||
)
|
|
||||||
}
|
|
||||||
// it.bindingRoute(null, point)
|
|
||||||
// naviMutex.unlock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun naviTestFlow(): Flow<GeoPoint> = flow {
|
// fun naviTestFlow(): Flow<GeoPoint> = flow {
|
||||||
|
//
|
||||||
while (true) {
|
// while (true) {
|
||||||
emit(mapController.mMapView.vtmMap.mapPosition.geoPoint)
|
// emit(mapController.mMapView.vtmMap.mapPosition.geoPoint)
|
||||||
delay(5000)
|
// delay(1000)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前任务
|
* 获取当前任务
|
||||||
@ -412,6 +407,7 @@ class MainViewModel @Inject constructor(
|
|||||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
currentTaskBean = realm.copyFromRealm(res)
|
currentTaskBean = realm.copyFromRealm(res)
|
||||||
|
Log.e("jingo", "获取任务 状态 ${currentTaskBean!!.status}")
|
||||||
}
|
}
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
@ -424,6 +420,23 @@ class MainViewModel @Inject constructor(
|
|||||||
naviMutex.lock()
|
naviMutex.lock()
|
||||||
getTaskBean()
|
getTaskBean()
|
||||||
if (currentTaskBean != null && currentTaskBean!!.status == FileManager.Companion.FileDownloadStatus.DONE) {
|
if (currentTaskBean != null && currentTaskBean!!.status == FileManager.Companion.FileDownloadStatus.DONE) {
|
||||||
|
if (currentTaskBean!!.navInfo == null) {
|
||||||
|
liveDataMessage.postValue("还没有设置路径的起终点,请先设置")
|
||||||
|
naviMutex.unlock()
|
||||||
|
return@launch
|
||||||
|
} else {
|
||||||
|
currentTaskBean!!.navInfo?.let {
|
||||||
|
if (it.naviStartLinkId.isEmpty() || it.naviStartNode.isEmpty()) {
|
||||||
|
liveDataMessage.postValue("还没有设置路径的起点,请先设置")
|
||||||
|
naviMutex.unlock()
|
||||||
|
return@launch
|
||||||
|
} else if (it.naviEndLinkId.isEmpty() || it.naviEndNode.isEmpty()) {
|
||||||
|
liveDataMessage.postValue("还没有设置路径的终点,请先设置")
|
||||||
|
naviMutex.unlock()
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
val naviOption = NaviOption(
|
val naviOption = NaviOption(
|
||||||
deviationCount = sharedPreferences.getInt(
|
deviationCount = sharedPreferences.getInt(
|
||||||
Constant.NAVI_DEVIATION_COUNT,
|
Constant.NAVI_DEVIATION_COUNT,
|
||||||
@ -443,21 +456,19 @@ class MainViewModel @Inject constructor(
|
|||||||
naviOption = naviOption,
|
naviOption = naviOption,
|
||||||
callback = object : OnNaviEngineCallbackListener {
|
callback = object : OnNaviEngineCallbackListener {
|
||||||
|
|
||||||
override fun planningPathStatus(
|
override suspend fun planningPathStatus(code: NaviStatus, message: String, linkId: String?, geometry: String?) {
|
||||||
status: NaviStatus, linkdId: String?,
|
Log.e("jingo", "路径计算 ${currentTaskBean!!.id} $code $message $linkId,$geometry")
|
||||||
geometry: String?
|
when (code) {
|
||||||
) {
|
|
||||||
when (status) {
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_PLANNING -> naviEngineStatus = 0
|
NaviStatus.NAVI_STATUS_PATH_PLANNING -> naviEngineStatus = 0
|
||||||
NaviStatus.NAVI_STATUS_PATH_ERROR_NODE -> naviEngineStatus = 0
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_ERROR_DIRECTION -> naviEngineStatus = 0
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED -> naviEngineStatus = 0
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_SUCCESS -> naviEngineStatus = 1
|
NaviStatus.NAVI_STATUS_PATH_SUCCESS -> naviEngineStatus = 1
|
||||||
NaviStatus.NAVI_STATUS_DISTANCE_OFF -> {
|
NaviStatus.NAVI_STATUS_DISTANCE_OFF -> {}
|
||||||
}
|
|
||||||
NaviStatus.NAVI_STATUS_DIRECTION_OFF -> {}
|
NaviStatus.NAVI_STATUS_DIRECTION_OFF -> {}
|
||||||
|
NaviStatus.NAVI_STATUS_DATA_ERROR, NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED, NaviStatus.NAVI_STATUS_NO_START_OR_END -> {
|
||||||
|
naviEngineStatus = 0
|
||||||
|
liveDataMessage.postValue("$message:$linkId")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
liveDataNaviStatus.postValue(status)
|
liveDataNaviStatus.postValue(code)
|
||||||
if (geometry != null) {
|
if (geometry != null) {
|
||||||
viewModelScope.launch(Dispatchers.Main) {
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
|
|
||||||
@ -469,7 +480,6 @@ class MainViewModel @Inject constructor(
|
|||||||
envelope.minX,
|
envelope.minX,
|
||||||
envelope.minY
|
envelope.minY
|
||||||
)
|
)
|
||||||
|
|
||||||
mapController.lineHandler.showLine(geometry)
|
mapController.lineHandler.showLine(geometry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,6 +506,20 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
liveDataSignList.postValue(signList)
|
liveDataSignList.postValue(signList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun voicePlay(text: String): Boolean {
|
||||||
|
speakMode?.let {
|
||||||
|
if (it.isSpeaking()) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
it.speakText(text)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
naviEngine!!.planningPath(currentTaskBean!!)
|
naviEngine!!.planningPath(currentTaskBean!!)
|
||||||
} else {
|
} else {
|
||||||
@ -587,14 +611,14 @@ class MainViewModel @Inject constructor(
|
|||||||
for (location in list) {
|
for (location in list) {
|
||||||
Constant.TRACE_COUNT++
|
Constant.TRACE_COUNT++
|
||||||
|
|
||||||
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_MORE_TIME==0){
|
if (Constant.TRACE_COUNT % Constant.TRACE_COUNT_MORE_TIME == 0) {
|
||||||
mapController.markerHandle.addNiLocationMarkerItemRough(location)
|
mapController.markerHandle.addNiLocationMarkerItemRough(location)
|
||||||
Log.e("qj","${Constant.TRACE_COUNT}===轨迹")
|
Log.e("qj", "${Constant.TRACE_COUNT}===轨迹")
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_TIME==0){
|
if (Constant.TRACE_COUNT % Constant.TRACE_COUNT_TIME == 0) {
|
||||||
mapController.markerHandle.addNiLocationMarkerItemSimple(location)
|
mapController.markerHandle.addNiLocationMarkerItemSimple(location)
|
||||||
Log.e("qj","${Constant.TRACE_COUNT}===轨迹")
|
Log.e("qj", "${Constant.TRACE_COUNT}===轨迹")
|
||||||
}
|
}
|
||||||
|
|
||||||
mapController.markerHandle.addNiLocationMarkerItem(location)
|
mapController.markerHandle.addNiLocationMarkerItem(location)
|
||||||
@ -607,7 +631,7 @@ class MainViewModel @Inject constructor(
|
|||||||
* 初始化定位信息
|
* 初始化定位信息
|
||||||
*/
|
*/
|
||||||
private fun initLocation() {
|
private fun initLocation() {
|
||||||
var gson = Gson();
|
val gson = Gson();
|
||||||
|
|
||||||
//用于定位点存储到数据库
|
//用于定位点存储到数据库
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
@ -663,21 +687,21 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
//室内整理工具时不能进行轨迹存储,判断轨迹间隔要超过6并小于60米
|
//室内整理工具时不能进行轨迹存储,判断轨迹间隔要超过6并小于60米
|
||||||
if (Constant.INDOOR_IP.isEmpty() && (disance == 0.0 || (disance > 6.0 && disance < 60))) {
|
if (Constant.INDOOR_IP.isEmpty() && (disance == 0.0 || (disance > 6.0 && disance < 60))) {
|
||||||
Log.e("jingo", "轨迹插入开始")
|
// Log.e("jingo", "轨迹插入开始")
|
||||||
CMLog.writeLogtoFile(MainViewModel::class.java.name,"insertTrace","开始")
|
CMLog.writeLogtoFile(MainViewModel::class.java.name, "insertTrace", "开始")
|
||||||
traceDataBase.niLocationDao.insert(location)
|
traceDataBase.niLocationDao.insert(location)
|
||||||
mapController.markerHandle.addNiLocationMarkerItem(location)
|
mapController.markerHandle.addNiLocationMarkerItem(location)
|
||||||
|
|
||||||
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_TIME==0){
|
if (Constant.TRACE_COUNT % Constant.TRACE_COUNT_TIME == 0) {
|
||||||
mapController.markerHandle.addNiLocationMarkerItemSimple(location)
|
mapController.markerHandle.addNiLocationMarkerItemSimple(location)
|
||||||
}
|
}
|
||||||
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_MORE_TIME==0){
|
if (Constant.TRACE_COUNT % Constant.TRACE_COUNT_MORE_TIME == 0) {
|
||||||
mapController.markerHandle.addNiLocationMarkerItemRough(location)
|
mapController.markerHandle.addNiLocationMarkerItemRough(location)
|
||||||
}
|
}
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
lastNiLocaion = location
|
lastNiLocaion = location
|
||||||
CMLog.writeLogtoFile(MainViewModel::class.java.name,"insertTrace",gson.toJson(location))
|
CMLog.writeLogtoFile(MainViewModel::class.java.name, "insertTrace", gson.toJson(location))
|
||||||
Log.e("jingo", "轨迹插入结束")
|
// Log.e("jingo", "轨迹插入结束")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,10 +860,10 @@ class MainViewModel @Inject constructor(
|
|||||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||||
.sortedBy { it.index })
|
.sortedBy { it.index })
|
||||||
|
|
||||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
// val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||||
withContext(Dispatchers.Main) {
|
// withContext(Dispatchers.Main) {
|
||||||
speakMode?.speakText(speechText)
|
// speakMode?.speakText(speechText)
|
||||||
}
|
// }
|
||||||
linkIdCache = route.linkId ?: ""
|
linkIdCache = route.linkId ?: ""
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
@ -854,7 +878,7 @@ class MainViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
private suspend fun captureLink(point: GeoPoint) {
|
private suspend fun captureLink(point: GeoPoint) {
|
||||||
|
|
||||||
if (captureLinkState||Constant.INSTALL_DATA) {
|
if (captureLinkState || Constant.INSTALL_DATA) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1037,10 +1061,10 @@ class MainViewModel @Inject constructor(
|
|||||||
.sortedBy { it.index })
|
.sortedBy { it.index })
|
||||||
|
|
||||||
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
||||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
// val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||||
withContext(Dispatchers.Main) {
|
// withContext(Dispatchers.Main) {
|
||||||
speakMode?.speakText(speechText)
|
// speakMode?.speakText(speechText)
|
||||||
}
|
// }
|
||||||
linkIdCache = linkId ?: ""
|
linkIdCache = linkId ?: ""
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1069,7 +1093,7 @@ class MainViewModel @Inject constructor(
|
|||||||
mapPosition.setBearing(0f) // 锁定角度,自动将地图旋转到正北方向
|
mapPosition.setBearing(0f) // 锁定角度,自动将地图旋转到正北方向
|
||||||
mapController.mMapView.vtmMap.mapPosition = mapPosition
|
mapController.mMapView.vtmMap.mapPosition = mapPosition
|
||||||
mapController.locationLayerHandler.animateToCurrentPosition()
|
mapController.locationLayerHandler.animateToCurrentPosition()
|
||||||
naviEngineStatus = 1
|
// naviEngineStatus = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +139,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
|
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
|
||||||
override fun onMapClick(tag: String, point: GeoPoint) {
|
override fun onMapClick(tag: String, point: GeoPoint,other:String) {
|
||||||
if (tag == TAG) {
|
if (tag == TAG) {
|
||||||
liveDataQsRecordBean.value!!.geometry =
|
liveDataQsRecordBean.value!!.geometry =
|
||||||
GeometryTools.createGeometry(point).toText()
|
GeometryTools.createGeometry(point).toText()
|
||||||
|
@ -1,30 +1,63 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.tasklist
|
package com.navinfo.omqs.ui.fragment.tasklist
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||||
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.databinding.AdapterTaskBinding
|
import com.navinfo.omqs.databinding.AdapterTaskBinding
|
||||||
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
|
||||||
interface TaskAdapterCallback {
|
interface TaskAdapterCallback {
|
||||||
|
/**
|
||||||
|
* 点击整体item
|
||||||
|
*/
|
||||||
fun itemOnClick(bean: HadLinkDvoBean)
|
fun itemOnClick(bean: HadLinkDvoBean)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击编辑不作业理由按钮
|
||||||
|
*/
|
||||||
fun editOnClick(position: Int, bean: HadLinkDvoBean)
|
fun editOnClick(position: Int, bean: HadLinkDvoBean)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图点击link,定位到项目条
|
||||||
|
*/
|
||||||
fun scrollPosition(position: Int)
|
fun scrollPosition(position: Int)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置起点
|
||||||
|
*/
|
||||||
|
fun setNaviStart(position: Int, bean: HadLinkDvoBean)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置终点
|
||||||
|
*/
|
||||||
|
fun setNaviEnd(position: Int, bean: HadLinkDvoBean)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置不参与路径计算的link
|
||||||
|
*/
|
||||||
|
fun setNavSkipLink(position: Int, bean: HadLinkDvoBean)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前任务适配器
|
* 当前任务适配器
|
||||||
*/
|
*/
|
||||||
class TaskAdapter(
|
class TaskAdapter(
|
||||||
|
private val realmOperateHelper: RealmOperateHelper,
|
||||||
|
private val coroutineScope: CoroutineScope,
|
||||||
private val callback: TaskAdapterCallback
|
private val callback: TaskAdapterCallback
|
||||||
) : BaseRecyclerViewAdapter<HadLinkDvoBean>() {
|
) : BaseRecyclerViewAdapter<HadLinkDvoBean>() {
|
||||||
private var selectPosition = -1
|
private var selectPosition = -1
|
||||||
|
private lateinit var taskBean: TaskBean
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||||
val viewBinding =
|
val viewBinding =
|
||||||
@ -39,29 +72,47 @@ class TaskAdapter(
|
|||||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||||
val binding: AdapterTaskBinding =
|
val binding: AdapterTaskBinding =
|
||||||
holder.viewBinding as AdapterTaskBinding
|
holder.viewBinding as AdapterTaskBinding
|
||||||
|
val context = binding.root.context
|
||||||
val bean = data[position]
|
val bean = data[position]
|
||||||
if (bean.linkStatus == 1) {
|
if (bean.linkStatus == 1) {
|
||||||
binding.taskHead.background =
|
binding.taskHead.background =
|
||||||
binding.root.context.getDrawable(R.drawable.selector_task_head)
|
context.getDrawable(R.drawable.selector_task_head)
|
||||||
} else {
|
} else {
|
||||||
binding.taskHead.background =
|
binding.taskHead.background =
|
||||||
binding.root.context.getDrawable(R.drawable.selector_task_head_add_link)
|
context.getDrawable(R.drawable.selector_task_head_add_link)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (taskBean.navInfo != null && taskBean.navInfo!!.naviStartLinkId == bean.linkPid) {
|
||||||
|
binding.taskNaviIcon.visibility = View.VISIBLE
|
||||||
|
binding.taskNaviIcon.background = context.getDrawable(R.drawable.navi_start_icon)
|
||||||
|
} else if (taskBean.navInfo != null && taskBean.navInfo!!.naviEndLinkId == bean.linkPid) {
|
||||||
|
binding.taskNaviIcon.visibility = View.VISIBLE
|
||||||
|
binding.taskNaviIcon.background = context.getDrawable(R.drawable.navi_end_icon)
|
||||||
|
} else if (!bean.isNavi) {
|
||||||
|
binding.taskNaviIcon.visibility = View.VISIBLE
|
||||||
|
binding.taskNaviIcon.background = context.getDrawable(R.drawable.navi_skip)
|
||||||
|
} else {
|
||||||
|
binding.taskNaviIcon.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.taskLinkPid.text = "PID:${bean.linkPid}"
|
binding.taskLinkPid.text = "PID:${bean.linkPid}"
|
||||||
binding.taskMesh.text = "mesh:${bean.mesh}"
|
binding.taskMesh.text = "mesh:${bean.mesh}"
|
||||||
binding.root.isSelected = selectPosition == position
|
binding.root.isSelected = selectPosition == position
|
||||||
binding.root.setOnClickListener {
|
//当前被选中
|
||||||
val pos = holder.adapterPosition
|
if (selectPosition != position) {
|
||||||
if (selectPosition != pos) {
|
binding.naviLayout.visibility = View.GONE
|
||||||
val lastPos = selectPosition
|
} else {
|
||||||
selectPosition = pos
|
binding.naviLayout.visibility = View.VISIBLE
|
||||||
if (lastPos > -1 && lastPos < itemCount) {
|
if (bean.isNavi) {
|
||||||
notifyItemChanged(lastPos)
|
binding.naviRouteSetSkip.text = "不参与路径计算"
|
||||||
}
|
} else {
|
||||||
binding.root.isSelected = true
|
binding.naviRouteSetSkip.text = "参与路径计算"
|
||||||
callback.itemOnClick(bean)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.root.setOnClickListener {
|
||||||
|
callback.itemOnClick(bean)
|
||||||
|
}
|
||||||
if (bean.reason == "") {
|
if (bean.reason == "") {
|
||||||
binding.taskBadge.visibility = View.GONE
|
binding.taskBadge.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
@ -70,6 +121,19 @@ class TaskAdapter(
|
|||||||
binding.taskEdit.setOnClickListener {
|
binding.taskEdit.setOnClickListener {
|
||||||
callback.editOnClick(position, bean)
|
callback.editOnClick(position, bean)
|
||||||
}
|
}
|
||||||
|
binding.naviRouteSetStartLink.setOnClickListener() {
|
||||||
|
callback.setNaviStart(position, bean)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.naviRouteSetEndLink.setOnClickListener() {
|
||||||
|
callback.setNaviEnd(position, bean)
|
||||||
|
}
|
||||||
|
binding.naviRouteSetSkip.setOnClickListener(){
|
||||||
|
bean.isNavi = !bean.isNavi
|
||||||
|
callback.setNavSkipLink(position,bean)
|
||||||
|
notifyItemChanged(position)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -80,9 +144,10 @@ class TaskAdapter(
|
|||||||
fun setSelectTag(tag: String) {
|
fun setSelectTag(tag: String) {
|
||||||
for (i in data.indices) {
|
for (i in data.indices) {
|
||||||
if (data[i].linkPid == tag) {
|
if (data[i].linkPid == tag) {
|
||||||
if (selectPosition > -1)
|
val lastPosition = selectPosition
|
||||||
notifyItemChanged(selectPosition)
|
|
||||||
selectPosition = i
|
selectPosition = i
|
||||||
|
if (lastPosition > -1)
|
||||||
|
notifyItemChanged(lastPosition)
|
||||||
notifyItemChanged(i)
|
notifyItemChanged(i)
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.scrollPosition(i)
|
callback.scrollPosition(i)
|
||||||
@ -91,6 +156,11 @@ class TaskAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setTaskBean(taskBean: TaskBean) {
|
||||||
|
this.taskBean = taskBean
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
@ -16,6 +17,8 @@ import com.google.android.material.tabs.TabLayout
|
|||||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.databinding.FragmentTaskBinding
|
import com.navinfo.omqs.databinding.FragmentTaskBinding
|
||||||
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
|
import com.navinfo.omqs.ui.activity.map.MainViewModel
|
||||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||||
import com.navinfo.omqs.ui.other.shareViewModels
|
import com.navinfo.omqs.ui.other.shareViewModels
|
||||||
import com.yanzhenjie.recyclerview.SwipeMenuBridge
|
import com.yanzhenjie.recyclerview.SwipeMenuBridge
|
||||||
@ -24,6 +27,7 @@ import com.yanzhenjie.recyclerview.SwipeMenuItem
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.videolan.vlc.Util
|
import org.videolan.vlc.Util
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前任务的道路列表
|
* 当前任务的道路列表
|
||||||
@ -37,9 +41,14 @@ class TaskFragment : BaseFragment() {
|
|||||||
* 和[TaskManagerFragment],[TaskListFragment],[TaskFragment]共用同一个viewModel
|
* 和[TaskManagerFragment],[TaskListFragment],[TaskFragment]共用同一个viewModel
|
||||||
*/
|
*/
|
||||||
private val viewModel by shareViewModels<TaskViewModel>("Task")
|
private val viewModel by shareViewModels<TaskViewModel>("Task")
|
||||||
|
private val mainViewModel by activityViewModels<MainViewModel>()
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var realmOperateHelper: RealmOperateHelper
|
||||||
|
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
private val adapter: TaskAdapter by lazy {
|
private val adapter: TaskAdapter by lazy {
|
||||||
TaskAdapter(object : TaskAdapterCallback {
|
TaskAdapter(realmOperateHelper, lifecycleScope, object : TaskAdapterCallback {
|
||||||
override fun itemOnClick(bean: HadLinkDvoBean) {
|
override fun itemOnClick(bean: HadLinkDvoBean) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
viewModel.showCurrentLink(bean)
|
viewModel.showCurrentLink(bean)
|
||||||
@ -51,7 +60,19 @@ class TaskFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun scrollPosition(position: Int) {
|
override fun scrollPosition(position: Int) {
|
||||||
binding.taskRecyclerview.scrollToPosition(position)
|
binding.taskRecyclerview.scrollToPosition(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setNaviStart(position: Int, bean: HadLinkDvoBean) {
|
||||||
|
viewModel.setNaviStartOrEnd(bean,true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setNaviEnd(position: Int, bean: HadLinkDvoBean) {
|
||||||
|
viewModel.setNaviStartOrEnd(bean,false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setNavSkipLink(position: Int, bean: HadLinkDvoBean) {
|
||||||
|
viewModel.setSkipLink(bean)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -76,11 +97,11 @@ class TaskFragment : BaseFragment() {
|
|||||||
binding.taskAddLink.isSelected = it
|
binding.taskAddLink.isSelected = it
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.liveDataAddLinkDialog.observe(viewLifecycleOwner){
|
viewModel.liveDataAddLinkDialog.observe(viewLifecycleOwner) {
|
||||||
viewModel.addTaskLink(requireContext(),it)
|
viewModel.addTaskLink(requireContext(), it)
|
||||||
}
|
}
|
||||||
viewModel.liveDataUpdateTask.observe(viewLifecycleOwner) {
|
viewModel.liveDataUpdateTask.observe(viewLifecycleOwner) {
|
||||||
|
adapter.setTaskBean(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
//注意:使用滑动菜单不能开启滑动删除,否则只有滑动删除没有滑动菜单
|
//注意:使用滑动菜单不能开启滑动删除,否则只有滑动删除没有滑动菜单
|
||||||
@ -132,8 +153,8 @@ class TaskFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
viewModel.liveDataSelectLink.observe(viewLifecycleOwner){
|
viewModel.liveDataSelectLink.observe(viewLifecycleOwner) {
|
||||||
adapter.setSelectTag(it)
|
adapter.setSelectTag(it.linkPid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +173,7 @@ class TaskFragment : BaseFragment() {
|
|||||||
requireContext()
|
requireContext()
|
||||||
).setTitle("标记原因").setView(view)
|
).setTitle("标记原因").setView(view)
|
||||||
var editText = view.findViewById<EditText>(R.id.dialog_edittext)
|
var editText = view.findViewById<EditText>(R.id.dialog_edittext)
|
||||||
view.findViewById<TabLayout>(R.id.search_tab_layout).visibility=View.GONE
|
view.findViewById<TabLayout>(R.id.search_tab_layout).visibility = View.GONE
|
||||||
editText.setText(bean.reason)
|
editText.setText(bean.reason)
|
||||||
inputDialog.setNegativeButton("取消") { dialog, _ ->
|
inputDialog.setNegativeButton("取消") { dialog, _ ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
@ -325,13 +325,13 @@ class TaskListAdapter(
|
|||||||
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.setText("安装中")
|
binding.taskDownloadBtn.setText("安装中")
|
||||||
Log.e("jingo", "更新进度条 ${taskBean.message}")
|
// Log.e("jingo", "更新进度条 ${taskBean.message}")
|
||||||
val split = taskBean.message.split("/")
|
val split = taskBean.message.split("/")
|
||||||
if (split.size == 2) {
|
if (split.size == 2) {
|
||||||
try {
|
try {
|
||||||
val index = split[0].toInt()
|
val index = split[0].toInt()
|
||||||
val count = split[1].toInt()
|
val count = split[1].toInt()
|
||||||
Log.e("jingo", "更新进度条 $index====$count")
|
// Log.e("jingo", "更新进度条 $index====$count")
|
||||||
binding.taskProgressText.text = "${index * 100 / count}%"
|
binding.taskProgressText.text = "${index * 100 / count}%"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("jingo", "更新进度条 $e")
|
Log.e("jingo", "更新进度条 $e")
|
||||||
|
@ -136,7 +136,7 @@ class TaskListFragment : BaseFragment() {
|
|||||||
|
|
||||||
viewModel.liveDataTaskList.observe(viewLifecycleOwner) {
|
viewModel.liveDataTaskList.observe(viewLifecycleOwner) {
|
||||||
loadFinish()
|
loadFinish()
|
||||||
adapter.initSelectTask(it, viewModel.currentSelectTaskBean?.id)
|
adapter.initSelectTask(it, viewModel.liveDataUpdateTask.value?.id)
|
||||||
var position = adapter.getSelectTaskPosition()
|
var position = adapter.getSelectTaskPosition()
|
||||||
if(position<0){
|
if(position<0){
|
||||||
position = 0
|
position = 0
|
||||||
|
@ -13,6 +13,7 @@ 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.dao.impl.TraceDataBase
|
||||||
import com.navinfo.collect.library.data.entity.*
|
import com.navinfo.collect.library.data.entity.*
|
||||||
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
@ -120,12 +121,12 @@ class TaskViewModel @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 点击地图选中的link
|
* 点击地图选中的link
|
||||||
*/
|
*/
|
||||||
val liveDataSelectLink = MutableLiveData<String>()
|
val liveDataSelectLink = MutableLiveData<HadLinkDvoBean>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前选中的任务
|
* 当前选中的任务
|
||||||
*/
|
*/
|
||||||
var currentSelectTaskBean: TaskBean? = null
|
// var currentSelectTaskBean: TaskBean? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务列表查询协程
|
* 任务列表查询协程
|
||||||
@ -134,6 +135,17 @@ class TaskViewModel @Inject constructor(
|
|||||||
|
|
||||||
private var filterTaskJob: Job? = null
|
private var filterTaskJob: Job? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否正在选择导航起点
|
||||||
|
*/
|
||||||
|
private var isSelectNaviStartPoint = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否正在选择导航终点
|
||||||
|
*/
|
||||||
|
private var isSelectNaviEndPoint = false
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否开启了道路选择
|
* 是否开启了道路选择
|
||||||
*/
|
*/
|
||||||
@ -148,12 +160,14 @@ class TaskViewModel @Inject constructor(
|
|||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
|
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
|
||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
override fun onMapClick(tag: String, point: GeoPoint) {
|
override fun onMapClick(tag: String, point: GeoPoint, other: String) {
|
||||||
if (tag == TAG) {
|
if (tag == TAG) {
|
||||||
if (liveDataSelectNewLink.value == true) {
|
if ((isSelectNaviStartPoint || isSelectNaviEndPoint) && other.isNotEmpty()) {
|
||||||
|
updateTaskNavInfo(other)
|
||||||
|
} else if (liveDataSelectNewLink.value == true) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
if (currentSelectTaskBean == null) {
|
if (liveDataUpdateTask.value == null) {
|
||||||
liveDataToastMessage.postValue("还没有开启任何任务")
|
liveDataToastMessage.postValue("还没有开启任何任务")
|
||||||
} else {
|
} else {
|
||||||
val links = realmOperateHelper.queryLink(
|
val links = realmOperateHelper.queryLink(
|
||||||
@ -162,7 +176,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
if (links.isNotEmpty()) {
|
if (links.isNotEmpty()) {
|
||||||
val l = links[0]
|
val l = links[0]
|
||||||
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
|
for (link in liveDataUpdateTask.value!!.hadLinkDvoList) {
|
||||||
if (link.linkPid == l.linkPid) {
|
if (link.linkPid == l.linkPid) {
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
@ -181,13 +195,17 @@ class TaskViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
if (links.isNotEmpty()) {
|
if (links.isNotEmpty()) {
|
||||||
val l = links[0]
|
val l = links[0]
|
||||||
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
|
liveDataUpdateTask.value?.let { value->
|
||||||
if (link.linkPid == l.linkPid) {
|
for (link in value.hadLinkDvoList) {
|
||||||
liveDataSelectLink.postValue(link.linkPid)
|
if (link.linkPid == l.linkPid) {
|
||||||
mapController.lineHandler.showLine(link.geometry)
|
|
||||||
break
|
liveDataSelectLink.postValue(link)
|
||||||
|
mapController.lineHandler.showLine(link.geometry)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
@ -312,10 +330,10 @@ class TaskViewModel @Inject constructor(
|
|||||||
if (id > -1) {
|
if (id > -1) {
|
||||||
for (item in taskList) {
|
for (item in taskList) {
|
||||||
if (item.id == id) {
|
if (item.id == id) {
|
||||||
currentSelectTaskBean = item
|
liveDataUpdateTask.postValue(item)
|
||||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
liveDataTaskLinks.postValue(item.hadLinkDvoList)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
showTaskLinks(currentSelectTaskBean!!)
|
showTaskLinks(liveDataUpdateTask.value!!)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -331,14 +349,14 @@ class TaskViewModel @Inject constructor(
|
|||||||
|
|
||||||
sharedPreferences.edit().putInt(Constant.SELECT_TASK_ID, taskBean.id).apply()
|
sharedPreferences.edit().putInt(Constant.SELECT_TASK_ID, taskBean.id).apply()
|
||||||
|
|
||||||
currentSelectTaskBean = taskBean
|
liveDataUpdateTask.value = taskBean
|
||||||
|
|
||||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||||
|
|
||||||
liveDataLoadTask.postValue(TaskLoadStatus.TASK_LOAD_STATUS_BEGIN)
|
liveDataLoadTask.postValue(TaskLoadStatus.TASK_LOAD_STATUS_BEGIN)
|
||||||
|
|
||||||
showTaskLinks(taskBean)
|
showTaskLinks(taskBean)
|
||||||
|
mapController.lineHandler.removeLine()
|
||||||
//重新加载轨迹
|
//重新加载轨迹
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
Constant.TRACE_COUNT = 0
|
Constant.TRACE_COUNT = 0
|
||||||
@ -347,13 +365,13 @@ class TaskViewModel @Inject constructor(
|
|||||||
).niLocationDao.findToTaskIdAll(taskBean.id.toString())
|
).niLocationDao.findToTaskIdAll(taskBean.id.toString())
|
||||||
list!!.forEach {
|
list!!.forEach {
|
||||||
|
|
||||||
Constant.TRACE_COUNT ++
|
Constant.TRACE_COUNT++
|
||||||
|
|
||||||
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_MORE_TIME==0){
|
if (Constant.TRACE_COUNT % Constant.TRACE_COUNT_MORE_TIME == 0) {
|
||||||
mapController.markerHandle.addNiLocationMarkerItemRough(it)
|
mapController.markerHandle.addNiLocationMarkerItemRough(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_TIME==0){
|
if (Constant.TRACE_COUNT % Constant.TRACE_COUNT_TIME == 0) {
|
||||||
mapController.markerHandle.addNiLocationMarkerItemSimple(it)
|
mapController.markerHandle.addNiLocationMarkerItemSimple(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +379,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
|
|
||||||
}
|
}
|
||||||
liveDataLoadTask.postValue(TaskLoadStatus.TASK_LOAD_STATUS_FISISH)
|
liveDataLoadTask.postValue(TaskLoadStatus.TASK_LOAD_STATUS_FISISH)
|
||||||
withContext(Dispatchers.Main){
|
withContext(Dispatchers.Main) {
|
||||||
MapParamUtils.setTaskId(taskBean.id)
|
MapParamUtils.setTaskId(taskBean.id)
|
||||||
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH + "/${taskBean.id}")
|
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH + "/${taskBean.id}")
|
||||||
Constant.currentSelectTaskConfig =
|
Constant.currentSelectTaskConfig =
|
||||||
@ -427,24 +445,193 @@ class TaskViewModel @Inject constructor(
|
|||||||
* 高亮当前选中的link
|
* 高亮当前选中的link
|
||||||
*/
|
*/
|
||||||
fun showCurrentLink(link: HadLinkDvoBean) {
|
fun showCurrentLink(link: HadLinkDvoBean) {
|
||||||
|
isSelectNaviStartPoint = false
|
||||||
|
isSelectNaviEndPoint = false
|
||||||
|
liveDataSelectLink.value = link
|
||||||
|
mapController.markerHandle.removeNaviMarkerLayer()
|
||||||
mapController.lineHandler.showLine(link.geometry)
|
mapController.lineHandler.showLine(link.geometry)
|
||||||
// mapController.lineHandler.omdbTaskLinkLayer.showSelectLine(link)
|
// mapController.lineHandler.omdbTaskLinkLayer.showSelectLine(link)
|
||||||
val geometry = GeometryTools.createGeometry(link.geometry)
|
val geometry = GeometryTools.createGeometry(link.geometry)
|
||||||
if (geometry != null) {
|
if (geometry != null) {
|
||||||
val envelope = geometry.envelopeInternal
|
val envelope = geometry.envelopeInternal
|
||||||
mapController.animationHandler.animateToBox(
|
mapController.animationHandler.animateToBox(
|
||||||
maxX = envelope.maxX,
|
maxX = envelope.maxX + 0.0005,
|
||||||
maxY = envelope.maxY,
|
maxY = envelope.maxY + 0.0005,
|
||||||
minX = envelope.minX,
|
minX = envelope.minX - 0.0005,
|
||||||
minY = envelope.minY
|
minY = envelope.minY - 0.0005
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
fun setSkipLink(bean: HadLinkDvoBean) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
|
realm.executeTransaction{
|
||||||
|
realm.copyToRealmOrUpdate(bean)
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置导航路径起始link
|
||||||
|
*/
|
||||||
|
fun setNaviStartOrEnd(bean: HadLinkDvoBean, bStart: Boolean) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
|
|
||||||
|
val resDir = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("linkPid", bean.linkPid)
|
||||||
|
.equalTo("table", DataCodeEnum.OMDB_LINK_DIRECT.name).findFirst()
|
||||||
|
if (resDir == null) {
|
||||||
|
realm.close()
|
||||||
|
liveDataToastMessage.postValue("link属性数据缺失,请先下载数据")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
val direct = resDir.properties["direct"]
|
||||||
|
val resRd = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("linkPid", bean.linkPid)
|
||||||
|
.equalTo("table", DataCodeEnum.OMDB_RD_LINK.name).findFirst()
|
||||||
|
|
||||||
|
var sNodeId: String? = null
|
||||||
|
var eNodeId: String? = null
|
||||||
|
resRd?.let { rd ->
|
||||||
|
sNodeId = rd.linkRelation!!.sNodeId
|
||||||
|
eNodeId = rd.linkRelation!!.eNodeId
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
if (sNodeId == null || eNodeId == null) {
|
||||||
|
liveDataToastMessage.postValue("link属性数据缺失,请先下载数据")
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
when (direct) {
|
||||||
|
"2" -> {
|
||||||
|
liveDataUpdateTask.value?.let { taskBean ->
|
||||||
|
if (taskBean.navInfo == null)
|
||||||
|
taskBean.navInfo = NavInfo(taskBean.id)
|
||||||
|
taskBean.navInfo?.let { navInfo ->
|
||||||
|
if (bStart) {
|
||||||
|
navInfo.naviStartLinkId = bean.linkPid
|
||||||
|
navInfo.naviStartNode = sNodeId!!
|
||||||
|
if (navInfo.naviEndLinkId == bean.linkPid) {
|
||||||
|
navInfo.naviEndLinkId = ""
|
||||||
|
navInfo.naviEndNode = ""
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navInfo.naviEndLinkId = bean.linkPid
|
||||||
|
navInfo.naviEndNode = eNodeId!!
|
||||||
|
if (navInfo.naviStartLinkId == bean.linkPid) {
|
||||||
|
navInfo.naviStartLinkId = ""
|
||||||
|
navInfo.naviStartNode = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
|
realm.executeTransaction {
|
||||||
|
it.copyToRealmOrUpdate(taskBean)
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
liveDataUpdateTask.postValue(taskBean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
liveDataUpdateTask.value?.let { taskBean ->
|
||||||
|
if (taskBean.navInfo == null)
|
||||||
|
taskBean.navInfo = NavInfo(taskBean.id)
|
||||||
|
taskBean.navInfo?.let { navInfo ->
|
||||||
|
if (bStart) {
|
||||||
|
navInfo.naviStartLinkId = bean.linkPid
|
||||||
|
navInfo.naviStartNode = eNodeId!!
|
||||||
|
if (navInfo.naviEndLinkId == bean.linkPid) {
|
||||||
|
navInfo.naviEndLinkId = ""
|
||||||
|
navInfo.naviEndNode = ""
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navInfo.naviEndLinkId = bean.linkPid
|
||||||
|
navInfo.naviEndNode = sNodeId!!
|
||||||
|
if (navInfo.naviStartLinkId == bean.linkPid) {
|
||||||
|
navInfo.naviStartLinkId = ""
|
||||||
|
navInfo.naviStartNode = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
|
realm.executeTransaction {
|
||||||
|
it.copyToRealmOrUpdate(taskBean)
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
liveDataUpdateTask.postValue(taskBean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
liveDataToastMessage.postValue("当前link为双方向道路,不能自动确定起终点,请选择")
|
||||||
|
val list = GeometryTools.getGeoPoints(bean.geometry)
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
if (bStart) {
|
||||||
|
isSelectNaviStartPoint = true
|
||||||
|
isSelectNaviEndPoint = false
|
||||||
|
} else {
|
||||||
|
isSelectNaviStartPoint = false
|
||||||
|
isSelectNaviEndPoint = true
|
||||||
|
}
|
||||||
|
mapController.markerHandle.showNaviStartOrEndLayer(list.first(), list.last(), sNodeId!!, eNodeId!!, bStart)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*更新导航配置信息
|
||||||
|
*/
|
||||||
|
fun updateTaskNavInfo(nodeId: String) {
|
||||||
|
liveDataSelectLink.value?.let { linkBean ->
|
||||||
|
liveDataUpdateTask.value?.let { taskBean ->
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
if (taskBean.navInfo == null)
|
||||||
|
taskBean.navInfo = NavInfo(taskBean.id)
|
||||||
|
taskBean.navInfo?.let { navInfo ->
|
||||||
|
if (isSelectNaviStartPoint) {
|
||||||
|
navInfo.naviStartLinkId = linkBean.linkPid
|
||||||
|
navInfo.naviStartNode = nodeId
|
||||||
|
if (navInfo.naviEndLinkId == linkBean.linkPid) {
|
||||||
|
navInfo.naviEndLinkId = ""
|
||||||
|
navInfo.naviEndNode = ""
|
||||||
|
}
|
||||||
|
} else if (isSelectNaviEndPoint) {
|
||||||
|
navInfo.naviEndLinkId = linkBean.linkPid
|
||||||
|
navInfo.naviEndNode = nodeId
|
||||||
|
if (navInfo.naviStartLinkId == linkBean.linkPid) {
|
||||||
|
navInfo.naviStartLinkId = ""
|
||||||
|
navInfo.naviStartNode = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
|
realm.executeTransaction {
|
||||||
|
it.copyToRealmOrUpdate(taskBean)
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
liveDataUpdateTask.postValue(taskBean)
|
||||||
|
}
|
||||||
|
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
mapController.markerHandle.removeNaviMarkerLayer()
|
||||||
|
}
|
||||||
|
isSelectNaviEndPoint = false
|
||||||
|
isSelectNaviStartPoint = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
mapController.mMapView.removeOnNIMapClickListener(TAG)
|
mapController.mMapView.removeOnNIMapClickListener(TAG)
|
||||||
mapController.lineHandler.removeAllLine()
|
mapController.lineHandler.removeAllLine()
|
||||||
|
mapController.markerHandle.removeNaviMarkerLayer()
|
||||||
sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
|
sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
|
||||||
super.onCleared()
|
super.onCleared()
|
||||||
}
|
}
|
||||||
@ -454,7 +641,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
suspend fun saveLinkReason(bean: HadLinkDvoBean, text: String) {
|
suspend fun saveLinkReason(bean: HadLinkDvoBean, text: String) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
currentSelectTaskBean?.let {
|
liveDataUpdateTask.value?.let {
|
||||||
for (item in it.hadLinkDvoList) {
|
for (item in it.hadLinkDvoList) {
|
||||||
if (item.linkPid == bean.linkPid) {
|
if (item.linkPid == bean.linkPid) {
|
||||||
item.reason = text
|
item.reason = text
|
||||||
@ -489,13 +676,13 @@ class TaskViewModel @Inject constructor(
|
|||||||
* 筛选link
|
* 筛选link
|
||||||
*/
|
*/
|
||||||
fun filterTask(pidKey: String) {
|
fun filterTask(pidKey: String) {
|
||||||
if (currentSelectTaskBean == null) return
|
if (liveDataUpdateTask.value == null) return
|
||||||
|
|
||||||
if (filterTaskJob != null) filterTaskJob!!.cancel()
|
if (filterTaskJob != null) filterTaskJob!!.cancel()
|
||||||
filterTaskJob = viewModelScope.launch(Dispatchers.Default) {
|
filterTaskJob = viewModelScope.launch(Dispatchers.Default) {
|
||||||
delay(500)
|
delay(500)
|
||||||
val list = mutableListOf<HadLinkDvoBean>()
|
val list = mutableListOf<HadLinkDvoBean>()
|
||||||
for (item in currentSelectTaskBean!!.hadLinkDvoList) {
|
for (item in liveDataUpdateTask.value!!.hadLinkDvoList) {
|
||||||
if (item.linkPid.contains(pidKey)) list.add(item)
|
if (item.linkPid.contains(pidKey)) list.add(item)
|
||||||
}
|
}
|
||||||
liveDataTaskLinks.postValue(list)
|
liveDataTaskLinks.postValue(list)
|
||||||
@ -547,7 +734,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
realm.close()
|
realm.close()
|
||||||
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_SUCCESS)
|
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_SUCCESS)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
if (taskBean.id == currentSelectTaskBean?.id ?: 0) {
|
if (taskBean.id == liveDataUpdateTask.value?.id ?: 0) {
|
||||||
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
} else {
|
} else {
|
||||||
setSelectTaskBean(taskBean)
|
setSelectTaskBean(taskBean)
|
||||||
@ -717,18 +904,18 @@ class TaskViewModel @Inject constructor(
|
|||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val hadLinkDvoBean = HadLinkDvoBean(
|
val hadLinkDvoBean = HadLinkDvoBean(
|
||||||
taskId = currentSelectTaskBean!!.id,
|
taskId = liveDataUpdateTask.value!!.id,
|
||||||
linkPid = data.linkPid,
|
linkPid = data.linkPid,
|
||||||
geometry = data.geometry,
|
geometry = data.geometry,
|
||||||
linkStatus = 2
|
linkStatus = 2
|
||||||
)
|
)
|
||||||
currentSelectTaskBean!!.hadLinkDvoList.add(
|
liveDataUpdateTask.value!!.hadLinkDvoList.add(
|
||||||
hadLinkDvoBean
|
hadLinkDvoBean
|
||||||
)
|
)
|
||||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
realm.executeTransaction { r ->
|
realm.executeTransaction { r ->
|
||||||
r.copyToRealmOrUpdate(hadLinkDvoBean)
|
r.copyToRealmOrUpdate(hadLinkDvoBean)
|
||||||
r.copyToRealmOrUpdate(currentSelectTaskBean!!)
|
r.copyToRealmOrUpdate(liveDataUpdateTask.value!!)
|
||||||
}
|
}
|
||||||
//根据Link数据查询对应数据上要素,对要素进行显示重置
|
//根据Link数据查询对应数据上要素,对要素进行显示重置
|
||||||
data.linkPid.let {
|
data.linkPid.let {
|
||||||
@ -742,7 +929,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
liveDataTaskLinks.postValue(liveDataUpdateTask.value!!.hadLinkDvoList)
|
||||||
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
|
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
|
||||||
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
@ -804,9 +991,9 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
|
for (link in liveDataUpdateTask.value!!.hadLinkDvoList) {
|
||||||
if (link.linkPid == hadLinkDvoBean.linkPid) {
|
if (link.linkPid == hadLinkDvoBean.linkPid) {
|
||||||
currentSelectTaskBean!!.hadLinkDvoList.remove(link)
|
liveDataUpdateTask.value!!.hadLinkDvoList.remove(link)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -823,9 +1010,9 @@ class TaskViewModel @Inject constructor(
|
|||||||
markers.deleteAllFromRealm()
|
markers.deleteAllFromRealm()
|
||||||
}
|
}
|
||||||
|
|
||||||
realm.copyToRealmOrUpdate(currentSelectTaskBean)
|
realm.copyToRealmOrUpdate(liveDataUpdateTask.value)
|
||||||
mapController.lineHandler.removeTaskLink(hadLinkDvoBean.linkPid)
|
mapController.lineHandler.removeTaskLink(hadLinkDvoBean.linkPid)
|
||||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
liveDataTaskLinks.postValue(liveDataUpdateTask.value!!.hadLinkDvoList)
|
||||||
}
|
}
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
@ -838,4 +1025,6 @@ class TaskViewModel @Inject constructor(
|
|||||||
mDialog.show()
|
mDialog.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.navinfo.omqs.util
|
package com.navinfo.omqs.util
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.navinfo.collect.library.data.entity.NiLocation
|
import com.navinfo.collect.library.data.entity.*
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
|
||||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
@ -11,27 +9,27 @@ import com.navinfo.omqs.bean.NaviRoute
|
|||||||
import com.navinfo.omqs.bean.NaviRouteItem
|
import com.navinfo.omqs.bean.NaviRouteItem
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import org.locationtech.jts.geom.Geometry
|
|
||||||
import org.locationtech.jts.geom.LineString
|
import org.locationtech.jts.geom.LineString
|
||||||
import org.locationtech.jts.geom.Point
|
import org.locationtech.jts.geom.Point
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
|
|
||||||
interface OnNaviEngineCallbackListener {
|
interface OnNaviEngineCallbackListener {
|
||||||
fun planningPathStatus(code: NaviStatus, linkdId: String? = null, geometry: String? = null)
|
suspend fun planningPathStatus(code: NaviStatus, message: String = "", linkId: String? = null, geometry: String? = null)
|
||||||
|
|
||||||
// fun planningPathError(errorCode: NaviStatus, errorMessage: String)
|
// fun planningPathError(errorCode: NaviStatus, errorMessage: String)
|
||||||
suspend fun bindingResults(route: NaviRoute?, list: List<NaviRouteItem>)
|
suspend fun bindingResults(route: NaviRoute?, list: List<NaviRouteItem>)
|
||||||
|
|
||||||
|
suspend fun voicePlay(text: String): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class NaviStatus {
|
enum class NaviStatus {
|
||||||
NAVI_STATUS_PATH_PLANNING, //路径规划中
|
NAVI_STATUS_PATH_PLANNING, //路径规划中
|
||||||
NAVI_STATUS_PATH_ERROR_NODE,//node点缺失
|
|
||||||
NAVI_STATUS_PATH_ERROR_DIRECTION,//缺少方向
|
|
||||||
NAVI_STATUS_PATH_ERROR_BLOCKED,//路径不通
|
NAVI_STATUS_PATH_ERROR_BLOCKED,//路径不通
|
||||||
NAVI_STATUS_PATH_SUCCESS,//路径规划成功
|
NAVI_STATUS_PATH_SUCCESS,//路径规划成功
|
||||||
NAVI_STATUS_DISTANCE_OFF,//距离偏离
|
NAVI_STATUS_DISTANCE_OFF,//距离偏离
|
||||||
NAVI_STATUS_DIRECTION_OFF,//方向偏离
|
NAVI_STATUS_DIRECTION_OFF,//方向偏离
|
||||||
|
NAVI_STATUS_DATA_ERROR,//数据错误
|
||||||
|
NAVI_STATUS_NO_START_OR_END,//没有设置起终点
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -88,6 +86,8 @@ class NaviEngine(
|
|||||||
DataCodeEnum.OMDB_RD_LINK.name,
|
DataCodeEnum.OMDB_RD_LINK.name,
|
||||||
DataCodeEnum.OMDB_LINK_DIRECT.name,
|
DataCodeEnum.OMDB_LINK_DIRECT.name,
|
||||||
DataCodeEnum.OMDB_LINK_NAME.name,
|
DataCodeEnum.OMDB_LINK_NAME.name,
|
||||||
|
DataCodeEnum.OMDB_RD_LINK_KIND.name,
|
||||||
|
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.name
|
||||||
)
|
)
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
@ -143,12 +143,12 @@ class NaviEngine(
|
|||||||
/**
|
/**
|
||||||
* 整条路的几何
|
* 整条路的几何
|
||||||
*/
|
*/
|
||||||
var geometry: LineString? = null
|
private var geometry: LineString? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 临时路径
|
* 临时路径
|
||||||
*/
|
*/
|
||||||
var tempGeometry: LineString? = null
|
private var tempGeometry: LineString? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定位点集合
|
* 定位点集合
|
||||||
@ -158,13 +158,14 @@ class NaviEngine(
|
|||||||
/**
|
/**
|
||||||
* 局部匹配时的路段
|
* 局部匹配时的路段
|
||||||
*/
|
*/
|
||||||
var tempRoutList = mutableListOf<NaviRoute>()
|
private var tempRoutList = mutableListOf<NaviRoute>()
|
||||||
|
|
||||||
|
private var currentRoadName = ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有路段集合
|
* 所有路段集合
|
||||||
*/
|
*/
|
||||||
var routeList = mutableListOf<NaviRoute>()
|
private var routeList = mutableListOf<NaviRoute>()
|
||||||
get() {
|
get() {
|
||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
@ -201,6 +202,109 @@ class NaviEngine(
|
|||||||
field = value
|
field = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询,反转link
|
||||||
|
*/
|
||||||
|
private suspend fun findNaviRouteByLinkId(realm: Realm, linkId: String, startNodeId: String? = null, endNodeId: String? = null): NaviRoute? {
|
||||||
|
val res = realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST)
|
||||||
|
.equalTo("linkPid", linkId).findAll()
|
||||||
|
if (res != null) {
|
||||||
|
/**
|
||||||
|
* 是不是有node点
|
||||||
|
*/
|
||||||
|
var bHasNode = false
|
||||||
|
var bHasDir = false
|
||||||
|
var bHasName = false
|
||||||
|
var bHasKind = false
|
||||||
|
val route = NaviRoute(
|
||||||
|
linkId = linkId,
|
||||||
|
)
|
||||||
|
|
||||||
|
for (entity in res) {
|
||||||
|
when (entity.code) {
|
||||||
|
DataCodeEnum.OMDB_RD_LINK.code -> {
|
||||||
|
bHasNode = true
|
||||||
|
val snodePid = entity.properties["snodePid"]
|
||||||
|
if (snodePid != null) {
|
||||||
|
route.sNode = snodePid
|
||||||
|
} else {
|
||||||
|
bHasNode = false
|
||||||
|
}
|
||||||
|
val enodePid = entity.properties["enodePid"]
|
||||||
|
if (enodePid != null) {
|
||||||
|
route.eNode = enodePid
|
||||||
|
} else {
|
||||||
|
bHasNode = false
|
||||||
|
}
|
||||||
|
route.pointList = GeometryTools.getGeoPoints(entity.geometry)
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
|
||||||
|
val direct = entity.properties["direct"]
|
||||||
|
if (direct != null) {
|
||||||
|
bHasDir = true
|
||||||
|
route.direct = direct.toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_LINK_NAME.code -> {
|
||||||
|
bHasName = true
|
||||||
|
route.name = realm.copyFromRealm(entity)
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.code -> {
|
||||||
|
route.speedLimit = "${entity.properties["maxSpeed"]}"
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_RD_LINK_KIND.code -> {
|
||||||
|
val kind = entity.properties["kind"]
|
||||||
|
if (kind != null) {
|
||||||
|
bHasKind = true
|
||||||
|
route.kind = kind
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!bHasNode) {
|
||||||
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DATA_ERROR, "link缺少node数据", linkId)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (!bHasDir) {
|
||||||
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DATA_ERROR, "link缺少方向数据", linkId)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (!bHasKind) {
|
||||||
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DATA_ERROR, "link缺少种别数据", linkId)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
//根据起终点反转方向
|
||||||
|
if (startNodeId != null) {
|
||||||
|
if (startNodeId == route.eNode) {
|
||||||
|
//顺方向,起点和终点还不一致的
|
||||||
|
if (route.direct == 2) {
|
||||||
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DATA_ERROR, "link为顺方向,与行进方向不符,请检查数据", linkId)
|
||||||
|
return null
|
||||||
|
} else {
|
||||||
|
route.pointList.reverse()
|
||||||
|
route.eNode = route.sNode
|
||||||
|
route.sNode = startNodeId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (endNodeId != null) {
|
||||||
|
if (endNodeId == route.sNode) {
|
||||||
|
//顺方向,起点和终点还不一致的
|
||||||
|
if (route.direct == 2) {
|
||||||
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DATA_ERROR, "link为顺方向,与行进方向不符,请检查数据", linkId)
|
||||||
|
return null
|
||||||
|
} else {
|
||||||
|
route.pointList.reverse()
|
||||||
|
val tempNode = route.sNode
|
||||||
|
route.sNode = route.eNode
|
||||||
|
route.eNode = tempNode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return route
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算路径
|
* 计算路径
|
||||||
*/
|
*/
|
||||||
@ -208,169 +312,127 @@ class NaviEngine(
|
|||||||
callback.planningPathStatus(NaviStatus.NAVI_STATUS_PATH_PLANNING)
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_PATH_PLANNING)
|
||||||
val pathList = mutableListOf<NaviRoute>()
|
val pathList = mutableListOf<NaviRoute>()
|
||||||
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
Log.e("jingo", "路径计算 条数 ${taskBean.hadLinkDvoList.size}")
|
//没有设置起终点
|
||||||
for (i in 0 until taskBean.hadLinkDvoList.size) {
|
if (taskBean.navInfo == null || (taskBean.navInfo!!.naviStartLinkId.isEmpty() || taskBean.navInfo!!.naviEndLinkId.isEmpty())) {
|
||||||
val link = taskBean.hadLinkDvoList[i]
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_NO_START_OR_END)
|
||||||
Log.e("jingo","获取 S E $i 总共 ${taskBean.hadLinkDvoList.size}")
|
return
|
||||||
//测线不参与导航
|
}
|
||||||
if (link!!.linkStatus == 3) {
|
/**
|
||||||
continue
|
* 是否起算路径结束
|
||||||
|
*/
|
||||||
|
var bFullPath = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起点线在哪个位置
|
||||||
|
*/
|
||||||
|
var pathImportIndex = 0
|
||||||
|
val hadLinkDvoListTemp: MutableList<HadLinkDvoBean> = taskBean.hadLinkDvoList.toMutableList()
|
||||||
|
while (bFullPath) {
|
||||||
|
if (pathList.isEmpty()) {
|
||||||
|
val startRoute =
|
||||||
|
findNaviRouteByLinkId(realm = realm, linkId = taskBean.navInfo!!.naviStartLinkId, startNodeId = taskBean.navInfo!!.naviStartNode)
|
||||||
|
?: return
|
||||||
|
pathList.add(startRoute)
|
||||||
|
pathImportIndex = pathList.size
|
||||||
|
|
||||||
|
val endRoute =
|
||||||
|
findNaviRouteByLinkId(realm = realm, linkId = taskBean.navInfo!!.naviEndLinkId, endNodeId = taskBean.navInfo!!.naviEndNode)
|
||||||
|
?: return
|
||||||
|
pathList.add(endRoute)
|
||||||
}
|
}
|
||||||
val route = NaviRoute(
|
val leftRoute = pathList[pathImportIndex - 1]
|
||||||
linkId = link.linkPid,
|
val rightRout = pathList[pathImportIndex]
|
||||||
)
|
//如果左侧nodeid和右侧nodeid 一直了,说明整个路径联通了
|
||||||
|
if (leftRoute.eNode == rightRout.sNode) {
|
||||||
|
bFullPath = false
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
//查询左侧node的拓扑link
|
||||||
|
val nodeLinks = realm.where(LinkRelation::class.java)
|
||||||
|
.beginGroup()
|
||||||
|
.equalTo("sNodeId", leftRoute.eNode).or()
|
||||||
|
.equalTo("eNodeId", leftRoute.eNode)
|
||||||
|
.endGroup().notEqualTo("linkPid", leftRoute.linkId).findAll()
|
||||||
|
val leftNodeLinks = nodeLinks.toMutableList()
|
||||||
|
if (leftNodeLinks.isEmpty()) {
|
||||||
|
callback.planningPathStatus(
|
||||||
|
NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED,
|
||||||
|
"该link终点方向,没有拓扑link,请检查数据",
|
||||||
|
leftRoute.linkId,
|
||||||
|
GeometryTools.getLineString(leftRoute.pointList)
|
||||||
|
)
|
||||||
|
bFullPath = false
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* 是否起点和终点已经闭合,规划结束
|
||||||
|
*/
|
||||||
|
var bPathOver = false
|
||||||
|
|
||||||
route.pointList = GeometryTools.getGeoPoints(link.geometry)
|
/**
|
||||||
|
* 任务link中,是不是有这段路的下一条link
|
||||||
|
*/
|
||||||
|
var bHasNextLink = false
|
||||||
|
for (link in leftNodeLinks) {
|
||||||
|
if (link!!.linkPid == rightRout.linkId) {
|
||||||
|
bPathOver = true
|
||||||
|
} else {
|
||||||
|
//记录其他拓扑关系
|
||||||
|
leftRoute.otherTopologyLinks.add(link.linkPid)
|
||||||
|
}
|
||||||
|
|
||||||
val res = realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST)
|
//找出哪条拓扑link是下一条
|
||||||
.equalTo("linkPid", link.linkPid).findAll()
|
if (!bPathOver && !bHasNextLink) {
|
||||||
var bHasNode = false
|
val iterator = hadLinkDvoListTemp.iterator()
|
||||||
var bHasDir = false
|
while (iterator.hasNext()) {
|
||||||
var bHasName = false
|
val linkBean = iterator.next()
|
||||||
if (res != null) {
|
if (!linkBean.isNavi) {
|
||||||
for (entity in res) {
|
iterator.remove()
|
||||||
when (entity.code) {
|
continue
|
||||||
DataCodeEnum.OMDB_RD_LINK.code -> {
|
}
|
||||||
bHasNode = true
|
if (linkBean.linkPid == link.linkPid) {
|
||||||
val snodePid = entity.properties["snodePid"]
|
bHasNextLink = true
|
||||||
if (snodePid != null) {
|
val route = findNaviRouteByLinkId(realm = realm, linkId = linkBean.linkPid, startNodeId = leftRoute.eNode)
|
||||||
route.sNode = snodePid
|
if (route == null) {
|
||||||
} else {
|
return
|
||||||
bHasNode = false
|
} else {
|
||||||
}
|
//插入左侧最后一根
|
||||||
val enodePid = entity.properties["enodePid"]
|
pathList.add(pathImportIndex, route)
|
||||||
if (enodePid != null) {
|
pathImportIndex++
|
||||||
route.eNode = enodePid
|
}
|
||||||
} else {
|
break
|
||||||
bHasNode = false
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
|
}
|
||||||
val direct = entity.properties["direct"]
|
if (!bHasNextLink) {
|
||||||
if (direct != null) {
|
callback.planningPathStatus(
|
||||||
bHasDir = true
|
code = NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED,
|
||||||
route.direct = direct.toInt()
|
"路径不通,找不到下一根link",
|
||||||
}
|
leftRoute.linkId,
|
||||||
}
|
GeometryTools.getLineString(leftRoute.pointList)
|
||||||
DataCodeEnum.OMDB_LINK_NAME.code -> {
|
)
|
||||||
bHasName = true
|
bFullPath = false
|
||||||
route.name = realm.copyFromRealm(entity)
|
return
|
||||||
}
|
}
|
||||||
|
if (bPathOver) {
|
||||||
|
bFullPath = false
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bHasNode) {
|
|
||||||
callback.planningPathStatus(
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_ERROR_NODE,
|
|
||||||
link.linkPid,
|
|
||||||
link.geometry
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!bHasDir) {
|
|
||||||
callback.planningPathStatus(
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_ERROR_DIRECTION,
|
|
||||||
link!!.linkPid,
|
|
||||||
link.geometry
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
pathList.add(route)
|
|
||||||
}
|
}
|
||||||
//用来存储最终的导航路径
|
|
||||||
val newRouteList = mutableListOf<NaviRoute>()
|
|
||||||
//比对路径排序用的
|
//比对路径排序用的
|
||||||
val tempRouteList = pathList.toMutableList()
|
val tempRouteList = pathList.toMutableList()
|
||||||
//先找到一根有方向的link,确定起终点
|
//先找到一根有方向的link,确定起终点
|
||||||
var routeStart: NaviRoute? = null
|
var routeStart: NaviRoute? = null
|
||||||
for (i in tempRouteList.indices) {
|
|
||||||
val route = pathList[i]
|
|
||||||
//只要时单方向的就行
|
|
||||||
if (route.direct == 2 || route.direct == 3) {
|
|
||||||
routeStart = route
|
|
||||||
tempRouteList.removeAt(i)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (routeStart == null) {
|
|
||||||
routeStart = tempRouteList[0]
|
|
||||||
tempRouteList.removeAt(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
var sNode = ""
|
|
||||||
var eNode = ""
|
|
||||||
//如果sNode,eNode是顺方向,geometry 不动,否则反转
|
|
||||||
if (routeStart.direct == 3) {
|
|
||||||
routeStart.pointList.reverse()
|
|
||||||
sNode = routeStart.eNode
|
|
||||||
eNode = routeStart.sNode
|
|
||||||
} else {
|
|
||||||
sNode = routeStart.sNode
|
|
||||||
eNode = routeStart.eNode
|
|
||||||
}
|
|
||||||
newRouteList.add(routeStart)
|
|
||||||
var bBreak = true
|
|
||||||
while (bBreak) {
|
|
||||||
//先找其实link的后续link
|
|
||||||
var bHasNext = false
|
|
||||||
for (route in tempRouteList) {
|
|
||||||
//如果是link 的e 对下个link的s,方向不用动,否则下个link的geometry反转
|
|
||||||
if (route.sNode != "" && eNode == route.sNode) {
|
|
||||||
newRouteList.add(route)
|
|
||||||
tempRouteList.remove(route)
|
|
||||||
eNode = route.eNode
|
|
||||||
bHasNext = true
|
|
||||||
break
|
|
||||||
} else if (route.eNode != "" && eNode == route.eNode) {
|
|
||||||
route.pointList.reverse()
|
|
||||||
newRouteList.add(route)
|
|
||||||
tempRouteList.remove(route)
|
|
||||||
eNode = route.sNode
|
|
||||||
bHasNext = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//先找其实link的起始link
|
|
||||||
var bHasLast = false
|
|
||||||
for (route in tempRouteList) {
|
|
||||||
//如果是link 的s 对上个link的e,方向不用动,否则下个link的geometry反转
|
|
||||||
if (route.eNode != "" && sNode == route.eNode) {
|
|
||||||
newRouteList.add(0, route)
|
|
||||||
tempRouteList.remove(route)
|
|
||||||
sNode = route.sNode
|
|
||||||
bHasLast = true
|
|
||||||
break
|
|
||||||
} else if (route.sNode != "" && sNode == route.sNode) {
|
|
||||||
route.pointList.reverse()
|
|
||||||
newRouteList.add(0, route)
|
|
||||||
tempRouteList.remove(route)
|
|
||||||
sNode = route.eNode
|
|
||||||
bHasLast = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tempRouteList.size == 0) {
|
|
||||||
bBreak = false
|
|
||||||
} else {
|
|
||||||
if (!bHasLast && !bHasNext) {
|
|
||||||
bBreak = false
|
|
||||||
callback.planningPathStatus(
|
|
||||||
NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED,
|
|
||||||
tempRouteList[0].linkId,
|
|
||||||
GeometryTools.getLineString(tempRouteList[0].pointList)
|
|
||||||
)
|
|
||||||
realm.close()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val itemMap: MutableMap<GeoPoint, MutableList<RenderEntity>> = mutableMapOf()
|
val itemMap: MutableMap<GeoPoint, MutableList<RenderEntity>> = mutableMapOf()
|
||||||
//查询每根link上的关联要素
|
//查询每根link上的关联要素
|
||||||
for (i in newRouteList.indices) {
|
for (i in pathList.indices) {
|
||||||
val route = newRouteList[i]
|
val route = pathList[i]
|
||||||
Log.e("jingo","获取 插入要素 $i 总共 ${newRouteList.size}")
|
Log.e("jingo", "获取 插入要素 $i 总共 ${pathList.size}")
|
||||||
itemMap.clear()
|
itemMap.clear()
|
||||||
//常规点限速
|
//常规点限速
|
||||||
val res = realm.where(RenderEntity::class.java)
|
val res = realm.where(RenderEntity::class.java)
|
||||||
@ -403,9 +465,17 @@ class NaviEngine(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
realm.close()
|
realm.close()
|
||||||
routeList = newRouteList
|
routeList = pathList
|
||||||
callback.planningPathStatus(NaviStatus.NAVI_STATUS_PATH_SUCCESS)
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_PATH_SUCCESS)
|
||||||
|
|
||||||
|
// val pointList = mutableListOf<GeoPoint>()
|
||||||
|
// for (l in pathList) {
|
||||||
|
// pointList.addAll(l.pointList)
|
||||||
|
// }
|
||||||
|
// withContext(Dispatchers.IO) {
|
||||||
|
// niMapController.lineHandler.showLine(GeometryTools.getLineString(pointList))
|
||||||
|
// }
|
||||||
|
// callback.planningPathStatus(NaviStatus.NAVI_STATUS_PATH_SUCCESS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -551,6 +621,7 @@ class NaviEngine(
|
|||||||
//下一个要素的起点游标
|
//下一个要素的起点游标
|
||||||
var tempIndex = footIndex - tempRoutList[0].startIndexInPath + 1
|
var tempIndex = footIndex - tempRoutList[0].startIndexInPath + 1
|
||||||
var currentRoute: NaviRoute? = null
|
var currentRoute: NaviRoute? = null
|
||||||
|
var bGoToPlay = false
|
||||||
for (route in tempRoutList) {
|
for (route in tempRoutList) {
|
||||||
// if (route.itemList != null) {
|
// if (route.itemList != null) {
|
||||||
// Log.e("jingo", "${route.linkId}我有${route.itemList!!.size}个要素 ")
|
// Log.e("jingo", "${route.linkId}我有${route.itemList!!.size}个要素 ")
|
||||||
@ -559,7 +630,11 @@ class NaviEngine(
|
|||||||
continue
|
continue
|
||||||
if (route.indexInPath == routeIndex) {
|
if (route.indexInPath == routeIndex) {
|
||||||
currentRoute = route
|
currentRoute = route
|
||||||
|
val voice = createRoadInfoVoiceText(route)
|
||||||
|
if (voice != null)
|
||||||
|
callback.voicePlay(voice)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (route.itemList != null && route.itemList!!.isNotEmpty()) {
|
if (route.itemList != null && route.itemList!!.isNotEmpty()) {
|
||||||
for (naviItem in route.itemList!!) {
|
for (naviItem in route.itemList!!) {
|
||||||
// Log.e(
|
// Log.e(
|
||||||
@ -577,6 +652,13 @@ class NaviEngine(
|
|||||||
// Log.e("jingo", "我的距离${distance} 下一个${tempIndex} 位置${rightI}")
|
// Log.e("jingo", "我的距离${distance} 下一个${tempIndex} 位置${rightI}")
|
||||||
if (distance < naviOption.farthestDisplayDistance && distance > -1) {
|
if (distance < naviOption.farthestDisplayDistance && distance > -1) {
|
||||||
naviItem.distance = distance.toInt()
|
naviItem.distance = distance.toInt()
|
||||||
|
if (!naviItem.isVoicePlayed && !bGoToPlay) {
|
||||||
|
naviItem.voiceText = createRenderEntityVoiceText(naviItem.data, naviItem.distance)
|
||||||
|
if (naviItem.voiceText.isNotEmpty() && callback.voicePlay(naviItem.voiceText)) {
|
||||||
|
naviItem.isVoicePlayed = true
|
||||||
|
bGoToPlay = true
|
||||||
|
}
|
||||||
|
}
|
||||||
bindingItemList.add(naviItem)
|
bindingItemList.add(naviItem)
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
@ -588,6 +670,7 @@ class NaviEngine(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback.bindingResults(currentRoute, bindingItemList)
|
callback.bindingResults(currentRoute, bindingItemList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -639,7 +722,7 @@ class NaviEngine(
|
|||||||
/**
|
/**
|
||||||
* 判断是否完全偏离
|
* 判断是否完全偏离
|
||||||
*/
|
*/
|
||||||
private fun deviationUp() {
|
private suspend fun deviationUp() {
|
||||||
errorCount++
|
errorCount++
|
||||||
if (errorCount >= naviOption.deviationCount) {
|
if (errorCount >= naviOption.deviationCount) {
|
||||||
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DISTANCE_OFF)
|
callback.planningPathStatus(NaviStatus.NAVI_STATUS_DISTANCE_OFF)
|
||||||
@ -665,4 +748,69 @@ class NaviEngine(
|
|||||||
locationList.clear()
|
locationList.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 道路属性语音
|
||||||
|
*/
|
||||||
|
private fun createRoadInfoVoiceText(route: NaviRoute): String? {
|
||||||
|
if (route.name != null && route.name!!.properties["name"] != currentRoadName) {
|
||||||
|
currentRoadName = "${route.name!!.properties["name"]}"
|
||||||
|
return "进入${currentRoadName},限速${route.speedLimit}"
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 要素语音内容
|
||||||
|
*/
|
||||||
|
private fun createRenderEntityVoiceText(renderEntity: RenderEntity, distance: Int): String {
|
||||||
|
val stringBuffer = StringBuffer()
|
||||||
|
stringBuffer.append("前方")
|
||||||
|
if (distance < 50) {
|
||||||
|
|
||||||
|
} else if (distance < 150) {
|
||||||
|
stringBuffer.append("100米")
|
||||||
|
} else if (distance < 200) {
|
||||||
|
stringBuffer.append("150米")
|
||||||
|
} else if (distance < 250) {
|
||||||
|
stringBuffer.append("200米")
|
||||||
|
} else if (distance < 350) {
|
||||||
|
stringBuffer.append("300米")
|
||||||
|
} else if (distance < 450) {
|
||||||
|
stringBuffer.append("400米")
|
||||||
|
} else if (distance < 550) {
|
||||||
|
stringBuffer.append("500米")
|
||||||
|
} else if (distance < 1500) {
|
||||||
|
stringBuffer.append("1公里")
|
||||||
|
} else {
|
||||||
|
val number = distance % 1000.0
|
||||||
|
stringBuffer.append("${"0.1f".format(number)}公里")
|
||||||
|
}
|
||||||
|
when (renderEntity.code) {
|
||||||
|
DataCodeEnum.OMDB_ELECTRONICEYE.code -> {
|
||||||
|
val maxSpeed = renderEntity.properties["maxSpeed"]
|
||||||
|
stringBuffer.append("有限速${maxSpeed}标牌")
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_SPEEDLIMIT.code,
|
||||||
|
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code,
|
||||||
|
DataCodeEnum.OMDB_SPEEDLIMIT_VAR.code -> {
|
||||||
|
val maxSpeed = renderEntity.properties["maxSpeed"]
|
||||||
|
stringBuffer.append("有限速${maxSpeed}标牌")
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_WARNINGSIGN.code -> {
|
||||||
|
val typeCode = renderEntity.properties["typeCode"]
|
||||||
|
stringBuffer.append(typeCode)
|
||||||
|
}
|
||||||
|
DataCodeEnum.OMDB_TOLLGATE.code -> {
|
||||||
|
stringBuffer.append("经过收费站")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
stringBuffer.append("有")
|
||||||
|
stringBuffer.append("${DataCodeEnum.findTableNameByCode(renderEntity.code)}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringBuffer.toString()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,84 +1,183 @@
|
|||||||
package com.navinfo.omqs.util
|
//package com.navinfo.omqs.util
|
||||||
|
//
|
||||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
//import android.util.Log
|
||||||
import com.navinfo.collect.library.data.entity.NiLocation
|
//import com.navinfo.collect.library.data.entity.*
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
//import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
//import com.navinfo.collect.library.utils.GeometryTools
|
||||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
//import com.navinfo.omqs.bean.NaviRoute
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
//import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
//import io.realm.Realm
|
||||||
import io.realm.Realm
|
//import org.oscim.core.GeoPoint
|
||||||
import org.oscim.core.GeoPoint
|
//
|
||||||
|
//class NaviEngineNew(
|
||||||
class NaviEngineNew(
|
// private val realmOperateHelper: RealmOperateHelper,
|
||||||
private val realmOperateHelper: RealmOperateHelper,
|
// var naviOption: NaviOption = NaviOption()
|
||||||
) {
|
//) {
|
||||||
/**
|
// /**
|
||||||
* 要查询的link基本信息列表
|
// * 要查询的link基本信息列表
|
||||||
*/
|
// */
|
||||||
private val QUERY_KEY_LINK_INFO_LIST = arrayOf(
|
// private val QUERY_KEY_LINK_INFO_LIST = arrayOf(
|
||||||
DataCodeEnum.OMDB_RD_LINK.name,
|
// DataCodeEnum.OMDB_RD_LINK.name,
|
||||||
DataCodeEnum.OMDB_LINK_DIRECT.name,
|
// DataCodeEnum.OMDB_LINK_DIRECT.name,
|
||||||
DataCodeEnum.OMDB_LINK_NAME.name,
|
// DataCodeEnum.OMDB_LINK_NAME.name,
|
||||||
)
|
// )
|
||||||
|
//
|
||||||
// private latestRoute
|
// var latestRoute: HadLinkDvoBean? = null
|
||||||
// private
|
//
|
||||||
|
// private val locationList = mutableListOf<NiLocation>()
|
||||||
private val locationList = mutableListOf<NiLocation>()
|
// var lastDis = 9999999.0
|
||||||
|
//
|
||||||
|
// /**
|
||||||
suspend fun bindingRoute(
|
// * 局部匹配时的路段
|
||||||
niLocation: NiLocation? = null,
|
// */
|
||||||
taskBean: TaskBean,
|
// var tempRoutList = mutableListOf<NaviRoute>()
|
||||||
geoPoint: GeoPoint,
|
//
|
||||||
realm:Realm
|
// suspend fun bindingRoute(
|
||||||
) {
|
// niLocation: NiLocation? = null,
|
||||||
var latestRoute: HadLinkDvoBean? = null
|
// taskBean: TaskBean,
|
||||||
var lastDis = -1.0
|
// geoPoint: GeoPoint,
|
||||||
|
// ): Boolean {
|
||||||
for (link in taskBean.hadLinkDvoList) {
|
// val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
val linkGeometry = GeometryTools.createGeometry(link.geometry)
|
// if (latestRoute == null) {
|
||||||
val footAndDistance = GeometryTools.pointToLineDistance(geoPoint, linkGeometry)
|
//
|
||||||
val meterD = footAndDistance.getMeterDistance()
|
// val time = System.currentTimeMillis()
|
||||||
if (meterD < 15 && (lastDis < 0 || lastDis > meterD)) {
|
// for (link in taskBean.hadLinkDvoList) {
|
||||||
latestRoute = link
|
// val linkGeometry = GeometryTools.createGeometry(link.geometry)
|
||||||
lastDis = meterD
|
// val footAndDistance = GeometryTools.pointToLineDistance(geoPoint, linkGeometry)
|
||||||
}
|
// val meterD = footAndDistance.getMeterDistance()
|
||||||
}
|
// if (lastDis > meterD) {
|
||||||
|
// if (meterD < 15)
|
||||||
latestRoute?.let {
|
// latestRoute = link
|
||||||
|
// lastDis = meterD
|
||||||
val res2 =
|
// }
|
||||||
realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST)
|
// }
|
||||||
.equalTo("linkPid", it.linkPid).findAll()
|
// Log.e("jingo", "定位匹配 ${System.currentTimeMillis() - time} $lastDis")
|
||||||
if (res2 != null) {
|
// latestRoute?.let {
|
||||||
for (entity in res2) {
|
// val naviRoute = getNaviRouteByLinkPid(realm, it.linkPid)
|
||||||
when (entity.code) {
|
// if (naviRoute != null) {
|
||||||
DataCodeEnum.OMDB_RD_LINK.code -> {
|
// tempRoutList.add(naviRoute)
|
||||||
val snodePid = entity.properties["snodePid"]
|
// var bDirectOk = false
|
||||||
if (snodePid != null) {
|
// //反方向调转方向
|
||||||
} else {
|
// if (naviRoute.direct == 2) {
|
||||||
}
|
// bDirectOk = true
|
||||||
val enodePid = entity.properties["enodePid"]
|
// }
|
||||||
if (enodePid != null) {
|
// if (naviRoute.direct == 3) {
|
||||||
} else {
|
// bDirectOk = true
|
||||||
}
|
// naviRoute.pointList.reverse()
|
||||||
}
|
// val sNode = naviRoute.eNode
|
||||||
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
|
// naviRoute.eNode = naviRoute.sNode
|
||||||
val direct = entity.properties["direct"]
|
// naviRoute.sNode = sNode
|
||||||
if (direct != null) {
|
// }
|
||||||
}
|
// var length = naviRoute.length
|
||||||
}
|
// //是不是没有能连接的路了
|
||||||
DataCodeEnum.OMDB_LINK_NAME.code -> {
|
// var bHisNextNode = true
|
||||||
// var name = realm.copyFromRealm(res4)
|
// while (length < naviOption.farthestDisplayDistance + 2000 && bHisNextNode) {
|
||||||
}
|
// val currentRoute = tempRoutList.last()
|
||||||
}
|
// if (bDirectOk) {
|
||||||
}
|
// val listPid =
|
||||||
|
// realm.where(LinkRelation::class.java)
|
||||||
}
|
// .beginGroup()
|
||||||
|
// .equalTo("sNodeId", currentRoute.eNode).or()
|
||||||
}
|
// .equalTo("eNodeId", currentRoute.eNode)
|
||||||
|
// .endGroup().notEqualTo("linkPid", currentRoute.linkId).findAll()
|
||||||
}
|
// if (listPid.isNotEmpty()) {
|
||||||
}
|
// var bHisNextNode2 = false
|
||||||
|
// for (linkPid in listPid) {
|
||||||
|
// val nextRoute = getNaviRouteByLinkPid(realm, linkPid as String)
|
||||||
|
// if (nextRoute != null) {
|
||||||
|
// //顺方向,snode 链接 enode
|
||||||
|
// if (nextRoute.sNode == currentRoute.eNode && nextRoute.direct == 2) {
|
||||||
|
// var bInHadList = false
|
||||||
|
// for (link in taskBean.hadLinkDvoList) {
|
||||||
|
// if (link.linkPid == nextRoute.linkId) {
|
||||||
|
// bInHadList = true
|
||||||
|
// tempRoutList.add(nextRoute)
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bInHadList) {
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// } else if (nextRoute.eNode == currentRoute.eNode && nextRoute.direct == 3) {
|
||||||
|
// var bInHadList = false
|
||||||
|
// for (link in taskBean.hadLinkDvoList) {
|
||||||
|
// if (link.linkPid == nextRoute.linkId) {
|
||||||
|
// bInHadList = true
|
||||||
|
// nextRoute.pointList.reverse()
|
||||||
|
// val sNode = nextRoute.eNode
|
||||||
|
// nextRoute.eNode = nextRoute.sNode
|
||||||
|
// nextRoute.sNode = sNode
|
||||||
|
// tempRoutList.add(nextRoute)
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bInHadList) {
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (nextRoute.sNode == currentRoute.eNode) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// bHisNextNode = false
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// "查询不到link的基础属性 ${it.linkPid}"
|
||||||
|
// realm.close()
|
||||||
|
// return false
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// realm.close()
|
||||||
|
// return true
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private fun getNaviRouteByLinkPid(realm: Realm, linkPid: String): NaviRoute? {
|
||||||
|
// val naviRoute = NaviRoute(linkId = linkPid)
|
||||||
|
// val res2 =
|
||||||
|
// realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST)
|
||||||
|
// .equalTo("linkPid", linkPid).findAll()
|
||||||
|
// if (res2 != null) {
|
||||||
|
// for (entity in res2) {
|
||||||
|
// when (entity.code) {
|
||||||
|
// //获取snode enode
|
||||||
|
// DataCodeEnum.OMDB_RD_LINK.code -> {
|
||||||
|
// if (entity.linkRelation != null) {
|
||||||
|
// if (entity.linkRelation!!.eNodeId == null || entity.linkRelation!!.sNodeId == null) {
|
||||||
|
// "读取不到link的Node点,${linkPid}"
|
||||||
|
// return null
|
||||||
|
// } else {
|
||||||
|
// naviRoute.eNode = entity.linkRelation!!.eNodeId!!
|
||||||
|
// naviRoute.sNode = entity.linkRelation!!.sNodeId!!
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //获取方向,geometry
|
||||||
|
// DataCodeEnum.OMDB_LINK_DIRECT.code -> {
|
||||||
|
// val direct = entity.properties["direct"]
|
||||||
|
// if (direct != null)
|
||||||
|
// naviRoute.direct = direct.toInt()
|
||||||
|
// else {
|
||||||
|
// "读取不到link的方向,${linkPid}"
|
||||||
|
// return null
|
||||||
|
// }
|
||||||
|
// naviRoute.pointList = GeometryTools.getGeoPoints(entity.geometry)
|
||||||
|
// naviRoute.length = GeometryTools.getDistance(naviRoute.pointList)
|
||||||
|
// }
|
||||||
|
// //获取名称
|
||||||
|
// DataCodeEnum.OMDB_LINK_NAME.code -> {
|
||||||
|
// naviRoute.name = realm.copyFromRealm(entity)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// return null
|
||||||
|
// }
|
||||||
|
// return naviRoute
|
||||||
|
// }
|
||||||
|
//}
|
@ -627,7 +627,7 @@ class SignUtil {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
//杆状物
|
//杆状物
|
||||||
DataCodeEnum.OMDB_POLE.code ->{
|
DataCodeEnum.OMDB_POLE.code -> {
|
||||||
list.add(
|
list.add(
|
||||||
TwoItemAdapterItem(
|
TwoItemAdapterItem(
|
||||||
title = "对象号码",
|
title = "对象号码",
|
||||||
@ -672,7 +672,7 @@ class SignUtil {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
//箭头
|
//箭头
|
||||||
DataCodeEnum.OMDB_OBJECT_ARROW.code ->{
|
DataCodeEnum.OMDB_OBJECT_ARROW.code -> {
|
||||||
list.add(
|
list.add(
|
||||||
TwoItemAdapterItem(
|
TwoItemAdapterItem(
|
||||||
title = "对象号码",
|
title = "对象号码",
|
||||||
@ -718,7 +718,8 @@ class SignUtil {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DataCodeEnum.OMDB_FILL_AREA.code->{
|
//导流区
|
||||||
|
DataCodeEnum.OMDB_FILL_AREA.code -> {
|
||||||
list.add(
|
list.add(
|
||||||
TwoItemAdapterItem(
|
TwoItemAdapterItem(
|
||||||
title = "对象号码",
|
title = "对象号码",
|
||||||
@ -740,6 +741,61 @@ class SignUtil {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
//物理车道数
|
||||||
|
DataCodeEnum.OMDB_PHY_LANENUM.code -> {
|
||||||
|
list.add(
|
||||||
|
TwoItemAdapterItem(
|
||||||
|
title = "linkPid", text = "${data.linkPid}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
list.add(
|
||||||
|
TwoItemAdapterItem(
|
||||||
|
title = "要素类型", text = when (data.properties["featureType"]) {
|
||||||
|
"1" -> "HAD_LINK"
|
||||||
|
"2" -> "HAD_LINK_PA"
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
list.add(
|
||||||
|
TwoItemAdapterItem(title = "顺方向车道数", text = "${data.properties["laneS2e"]}")
|
||||||
|
)
|
||||||
|
list.add(
|
||||||
|
TwoItemAdapterItem(title = "逆方向车道数", text = "${data.properties["laneE2s"]}")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
//车道点限速
|
||||||
|
DataCodeEnum.OMDB_LANE_SPEEDLIMIT.code -> {
|
||||||
|
list.add(TwoItemAdapterItem(title = "限速ID", text = "${data.properties["speedId"]}"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "NodeId", text = "${data.properties["laneNodePid"]}"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "最高限速", text = "${data.properties["maxSpeed"]}km/h"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "最低限速", text = "${data.properties["minSpeed"]}km/h"))
|
||||||
|
}
|
||||||
|
//立交
|
||||||
|
DataCodeEnum.OMDB_ZLEVEL.code -> {
|
||||||
|
list.add(TwoItemAdapterItem(title = "linkPid", text = "${data.linkPid}"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "立交号码", text = "${data.properties["zlevelId"]}"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "要素号码", text = "${data.properties["featurePid"]}"))
|
||||||
|
list.add(
|
||||||
|
TwoItemAdapterItem(
|
||||||
|
title = "要素类型", text = when (data.properties["featureType"]) {
|
||||||
|
"1" -> "HAD_LINK"
|
||||||
|
"2" -> "RW_LINK"
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
list.add(TwoItemAdapterItem(title = "形状点号", text = "${data.properties["shpSeqNum"]}"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "起终点标识", text = "${data.properties["startEnd"]}"))
|
||||||
|
list.add(TwoItemAdapterItem(title = "高度层次", text = "${data.properties["zlevel"]}"))
|
||||||
|
}
|
||||||
|
//车道类型
|
||||||
|
DataCodeEnum.OMDB_LANE_TYPE_ACCESS.code -> {
|
||||||
|
list.add(TwoItemAdapterItem(title = "车道中心线ID", text = "${data.properties["laneLinkPid"]}"))
|
||||||
|
|
||||||
|
list.add(TwoItemAdapterItem(title = "车道类型", text = getLaneType(data)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
adapter.data = list
|
adapter.data = list
|
||||||
return adapter
|
return adapter
|
||||||
@ -1130,6 +1186,45 @@ class SignUtil {
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车道类型
|
||||||
|
*/
|
||||||
|
|
||||||
|
private fun getLaneType(data: RenderEntity): String {
|
||||||
|
val stringBuffer = StringBuffer()
|
||||||
|
val dependent = data.properties["laneType"]
|
||||||
|
dependent?.let {
|
||||||
|
val dependentInt = it.toInt()
|
||||||
|
for (i in 31 downTo 0) {
|
||||||
|
val bit = (dependentInt shr i) and 1
|
||||||
|
if (bit == 1) {
|
||||||
|
when (i) {
|
||||||
|
0 -> stringBuffer.append("常规车道 ")
|
||||||
|
1 -> stringBuffer.append("复合车道 ")
|
||||||
|
2 -> stringBuffer.append("加速车道 ")
|
||||||
|
3 -> stringBuffer.append("减速车道 ")
|
||||||
|
4 -> stringBuffer.append("满载车道 ")
|
||||||
|
6 -> stringBuffer.append("慢车道 ")
|
||||||
|
8 -> stringBuffer.append("路肩车道 ")
|
||||||
|
10 -> stringBuffer.append("管制车道 ")
|
||||||
|
13 -> stringBuffer.append("可行使车道 ")
|
||||||
|
14 -> stringBuffer.append("可行使路肩车道 ")
|
||||||
|
17 -> stringBuffer.append("紧急停车道 ")
|
||||||
|
18 -> stringBuffer.append("公交车道 ")
|
||||||
|
19 -> stringBuffer.append("自行车道 ")
|
||||||
|
20 -> stringBuffer.append("转向车道 ")
|
||||||
|
21 -> stringBuffer.append("潮汐车道 ")
|
||||||
|
23 -> stringBuffer.append("避险车道 ")
|
||||||
|
24 -> stringBuffer.append("可变车道 ")
|
||||||
|
25 -> stringBuffer.append("停车车道 ")
|
||||||
|
26 -> stringBuffer.append("其他 ")
|
||||||
|
28 -> stringBuffer.append("自动驾驶专用道 ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stringBuffer.toString()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件点限速文字
|
* 条件点限速文字
|
||||||
@ -1852,6 +1947,10 @@ class SignUtil {
|
|||||||
*/
|
*/
|
||||||
fun getTrafficSignMoreInfo(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
|
fun getTrafficSignMoreInfo(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
|
||||||
val list = mutableListOf<TwoItemAdapterItem>()
|
val list = mutableListOf<TwoItemAdapterItem>()
|
||||||
|
|
||||||
|
list.add(TwoItemAdapterItem(title = "对象号码", text = "${renderEntity.properties["objectPid"]}"))
|
||||||
|
|
||||||
|
|
||||||
val trafsignShape = when (renderEntity.properties["trafsignShape"]) {
|
val trafsignShape = when (renderEntity.properties["trafsignShape"]) {
|
||||||
"1" -> "不规则形状"
|
"1" -> "不规则形状"
|
||||||
"2" -> "长方形"
|
"2" -> "长方形"
|
||||||
@ -1871,6 +1970,8 @@ class SignUtil {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.add(TwoItemAdapterItem("类型", "${renderEntity.properties["signType"]}"))
|
||||||
|
|
||||||
val color = when (renderEntity.properties["color"]) {
|
val color = when (renderEntity.properties["color"]) {
|
||||||
"0" -> "未验证"
|
"0" -> "未验证"
|
||||||
"1" -> "白色"
|
"1" -> "白色"
|
||||||
@ -1890,9 +1991,10 @@ class SignUtil {
|
|||||||
)
|
)
|
||||||
list.add(
|
list.add(
|
||||||
TwoItemAdapterItem(
|
TwoItemAdapterItem(
|
||||||
title = "正北夹角", text = "${renderEntity.properties["heading"]}"
|
title = "朝向", text = "${renderEntity.properties["heading"]}"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
list.add(TwoItemAdapterItem("对象高", "${renderEntity.properties["signType"]}"))
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,4 +109,8 @@ class SpeakMode(private val context: Context) : TextToSpeech.OnInitListener {
|
|||||||
stopSpeech()
|
stopSpeech()
|
||||||
mTextToSpeech.shutdown()
|
mTextToSpeech.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isSpeaking():Boolean{
|
||||||
|
return mTextToSpeech.isSpeaking
|
||||||
|
}
|
||||||
}
|
}
|
BIN
app/src/main/res/drawable-xhdpi/navi_skip.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/navi_skip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 998 B |
BIN
app/src/main/res/drawable-xxhdpi/navi_end_icon.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/navi_end_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/navi_start_icon.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/navi_start_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -42,6 +42,17 @@
|
|||||||
android:textColor="@color/selector_gray_blue_color"
|
android:textColor="@color/selector_gray_blue_color"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/task_navi_icon"
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_alignTop="@id/task_mesh"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginRight="6dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="@drawable/navi_start_icon" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/task_edit"
|
android:id="@+id/task_edit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -54,10 +65,41 @@
|
|||||||
android:id="@+id/task_badge"
|
android:id="@+id/task_badge"
|
||||||
android:layout_width="8dp"
|
android:layout_width="8dp"
|
||||||
android:layout_height="8dp"
|
android:layout_height="8dp"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginRight="4dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_alignTop="@id/task_edit"
|
android:layout_alignTop="@id/task_edit"
|
||||||
android:layout_alignRight="@id/task_edit"
|
android:layout_alignRight="@id/task_edit"
|
||||||
android:background="@drawable/shape_oval_red_bg" />
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="4dp"
|
||||||
|
android:background="@drawable/shape_oval_red_bg"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/navi_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/task_mesh"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/navi_route_set_start_link"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="设置为起点link" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/navi_route_set_end_link"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="设置为终点link" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/navi_route_set_skip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="不参与路径计算" />
|
||||||
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -1,7 +1,5 @@
|
|||||||
package com.navinfo.collect.library.data.entity
|
package com.navinfo.collect.library.data.entity
|
||||||
|
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
|
||||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
|
||||||
import io.realm.RealmObject
|
import io.realm.RealmObject
|
||||||
import io.realm.annotations.PrimaryKey
|
import io.realm.annotations.PrimaryKey
|
||||||
|
|
||||||
@ -45,4 +43,10 @@ open class HadLinkDvoBean @JvmOverloads constructor(
|
|||||||
* 长度(米)
|
* 长度(米)
|
||||||
*/
|
*/
|
||||||
var length: Double = 0.000,
|
var length: Double = 0.000,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这条link是不是参与到路径计算中
|
||||||
|
*/
|
||||||
|
var isNavi: Boolean = true
|
||||||
|
|
||||||
) : RealmObject()
|
) : RealmObject()
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.navinfo.collect.library.data.entity
|
||||||
|
|
||||||
|
import io.realm.RealmObject
|
||||||
|
import io.realm.annotations.PrimaryKey
|
||||||
|
|
||||||
|
open class NavInfo @JvmOverloads constructor(
|
||||||
|
@PrimaryKey
|
||||||
|
var id: Int = 0,
|
||||||
|
/**
|
||||||
|
* 起点link
|
||||||
|
*/
|
||||||
|
var naviStartLinkId: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终点link
|
||||||
|
*/
|
||||||
|
var naviEndLinkId: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起点NodeId
|
||||||
|
*/
|
||||||
|
var naviStartNode: String = "",
|
||||||
|
|
||||||
|
var naviEndNode: String = "",
|
||||||
|
|
||||||
|
) : RealmObject() {
|
||||||
|
}
|
@ -69,8 +69,11 @@ open class TaskBean @JvmOverloads constructor(
|
|||||||
var message: String = "",
|
var message: String = "",
|
||||||
@Ignore
|
@Ignore
|
||||||
var errMsg: String = "",
|
var errMsg: String = "",
|
||||||
var color: Int = 0xFF00AA
|
var color: Int = 0xFF00AA,
|
||||||
) : RealmObject() {
|
|
||||||
|
var navInfo: NavInfo? = null,
|
||||||
|
|
||||||
|
) : RealmObject() {
|
||||||
fun getDownLoadUrl(): String {
|
fun getDownLoadUrl(): String {
|
||||||
return "${Constant.SERVER_ADDRESS}devcp/downFile?fileStr=$id"
|
return "${Constant.SERVER_ADDRESS}devcp/downFile?fileStr=$id"
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ public enum class DataCodeEnum(var tableName: String, var code: String) {
|
|||||||
OMDB_RAMP_7("高速直连出口匝道高速出入口匝道", "2037-7"),
|
OMDB_RAMP_7("高速直连出口匝道高速出入口匝道", "2037-7"),
|
||||||
OMDB_MULTI_DIGITIZED("上下线分离", "2040"),
|
OMDB_MULTI_DIGITIZED("上下线分离", "2040"),
|
||||||
OMDB_LANE_NUM("车道数", "2041"),
|
OMDB_LANE_NUM("车道数", "2041"),
|
||||||
OMDB_LANE_TYPE_ACCESS("车道类型", "2092"),
|
|
||||||
OMDB_PHY_LANENUM("物理车道数", "2097"),
|
OMDB_PHY_LANENUM("物理车道数", "2097"),
|
||||||
OMDB_VIADUCT("高架", "2043"),
|
OMDB_VIADUCT("高架", "2043"),
|
||||||
OMDB_RDBOUND_BOUNDARYTYPE("道路边界类型", "2083"),
|
OMDB_RDBOUND_BOUNDARYTYPE("道路边界类型", "2083"),
|
||||||
OMDB_LANE_CONSTRUCTION("车道施工", "2090"),
|
OMDB_LANE_CONSTRUCTION("车道施工", "2090"),
|
||||||
|
OMDB_LANE_TYPE_ACCESS("车道类型","2092"),
|
||||||
OMDB_BRIDGE("桥", "2201"),
|
OMDB_BRIDGE("桥", "2201"),
|
||||||
OMDB_BRIDGE_1("固定桥", "2201-1"),
|
OMDB_BRIDGE_1("固定桥", "2201-1"),
|
||||||
OMDB_BRIDGE_2("可移动桥", "2201-2"),
|
OMDB_BRIDGE_2("可移动桥", "2201-2"),
|
||||||
@ -72,14 +72,16 @@ public enum class DataCodeEnum(var tableName: String, var code: String) {
|
|||||||
OMDB_FILL_AREA("导流区", "3012"),
|
OMDB_FILL_AREA("导流区", "3012"),
|
||||||
OMDB_CROSS_WALK("人行横道", "3014"),
|
OMDB_CROSS_WALK("人行横道", "3014"),
|
||||||
OMDB_OBJECT_STOPLOCATION("停止位置", "3016"),
|
OMDB_OBJECT_STOPLOCATION("停止位置", "3016"),
|
||||||
OMDB_OBJECT_REFUGE_ISLAND("路口内交通岛","3027"),
|
OMDB_OBJECT_REFUGE_ISLAND("路口内交通岛", "3027"),
|
||||||
OMDB_INTERSECTION("路口", "4001"),
|
OMDB_INTERSECTION("路口", "4001"),
|
||||||
OMDB_SPEEDLIMIT("常规点限速", "4002"),
|
OMDB_SPEEDLIMIT("常规点限速", "4002"),
|
||||||
OMDB_SPEEDLIMIT_COND("条件点限速", "4003"),
|
OMDB_SPEEDLIMIT_COND("条件点限速", "4003"),
|
||||||
OMDB_SPEEDLIMIT_VAR("可变点限速", "4004"),
|
OMDB_SPEEDLIMIT_VAR("可变点限速", "4004"),
|
||||||
|
OMDB_LANE_SPEEDLIMIT("车道点限速", "4005"),
|
||||||
OMDB_RESTRICTION("普通交限", "4006"),
|
OMDB_RESTRICTION("普通交限", "4006"),
|
||||||
OMDB_WARNINGSIGN("警示信息", "4009"),
|
OMDB_WARNINGSIGN("警示信息", "4009"),
|
||||||
OMDB_ELECTRONICEYE("电子眼", "4010"),
|
OMDB_ELECTRONICEYE("电子眼", "4010"),
|
||||||
|
OMDB_ZLEVEL("立交", "4016"),
|
||||||
OMDB_TRAFFICLIGHT("交通灯", "4022"),
|
OMDB_TRAFFICLIGHT("交通灯", "4022"),
|
||||||
OMDB_TOLLGATE("收费站", "4023"),
|
OMDB_TOLLGATE("收费站", "4023"),
|
||||||
OMDB_LANEINFO("车信", "4601"),
|
OMDB_LANEINFO("车信", "4601"),
|
||||||
|
@ -3,5 +3,5 @@ package com.navinfo.collect.library.map
|
|||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
|
|
||||||
interface OnGeoPointClickListener : BaseClickListener {
|
interface OnGeoPointClickListener : BaseClickListener {
|
||||||
fun onMapClick(tag: String, point: GeoPoint)
|
fun onMapClick(tag: String, point: GeoPoint, other: String = "")
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.util.Log
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import com.navinfo.collect.library.R
|
import com.navinfo.collect.library.R
|
||||||
@ -12,6 +13,7 @@ import com.navinfo.collect.library.data.entity.NoteBean
|
|||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
import com.navinfo.collect.library.map.BaseClickListener
|
import com.navinfo.collect.library.map.BaseClickListener
|
||||||
import com.navinfo.collect.library.map.NIMapView
|
import com.navinfo.collect.library.map.NIMapView
|
||||||
|
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
||||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerItem
|
import com.navinfo.collect.library.map.cluster.ClusterMarkerItem
|
||||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerRenderer
|
import com.navinfo.collect.library.map.cluster.ClusterMarkerRenderer
|
||||||
import com.navinfo.collect.library.map.layers.MyItemizedLayer
|
import com.navinfo.collect.library.map.layers.MyItemizedLayer
|
||||||
@ -37,7 +39,7 @@ import java.util.*
|
|||||||
/**
|
/**
|
||||||
* marker 操作
|
* marker 操作
|
||||||
*/
|
*/
|
||||||
class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
class MarkHandler(val context: AppCompatActivity, mapView: NIMapView) :
|
||||||
BaseHandler(context, mapView) {
|
BaseHandler(context, mapView) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,6 +75,8 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
*/
|
*/
|
||||||
private val canvas: org.oscim.backend.canvas.Canvas = CanvasAdapter.newCanvas()
|
private val canvas: org.oscim.backend.canvas.Canvas = CanvasAdapter.newCanvas()
|
||||||
|
|
||||||
|
private var mStartEndMarkerLayer: ItemizedLayer? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认marker图层
|
* 默认marker图层
|
||||||
*/
|
*/
|
||||||
@ -1015,6 +1019,68 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
|
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeNaviMarkerLayer() {
|
||||||
|
if (mStartEndMarkerLayer != null) {
|
||||||
|
removeLayer(mStartEndMarkerLayer!!)
|
||||||
|
mStartEndMarkerLayer = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示选择起点 终点
|
||||||
|
*/
|
||||||
|
fun showNaviStartOrEndLayer(sNodePoint: GeoPoint, eNodePoint: GeoPoint, sNodeId: String, eNodeId: String, bStart: Boolean) {
|
||||||
|
removeNaviMarkerLayer()
|
||||||
|
if (mStartEndMarkerLayer == null) {
|
||||||
|
val mDefaultBitmap = if(bStart) {
|
||||||
|
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.drawable.navi_set_start_point))
|
||||||
|
}else{
|
||||||
|
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.drawable.navi_set_end_point))
|
||||||
|
}
|
||||||
|
// mDefaultBitmap.scaleTo(150, 150)
|
||||||
|
val markerSymbol = MarkerSymbol(
|
||||||
|
mDefaultBitmap,
|
||||||
|
MarkerSymbol.HotspotPlace.BOTTOM_CENTER
|
||||||
|
)
|
||||||
|
mStartEndMarkerLayer = ItemizedLayer(
|
||||||
|
mMapView.vtmMap,
|
||||||
|
markerSymbol,
|
||||||
|
)
|
||||||
|
addLayer(mStartEndMarkerLayer!!, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||||
|
mStartEndMarkerLayer!!.setOnItemGestureListener(object : OnItemGestureListener<MarkerInterface> {
|
||||||
|
override fun onItemSingleTapUp(index: Int, item: MarkerInterface): Boolean {
|
||||||
|
val tag = mMapView.listenerTagList.last()
|
||||||
|
val listenerList = mMapView.listenerList[tag]
|
||||||
|
if (listenerList != null) {
|
||||||
|
for (listener in listenerList) {
|
||||||
|
if (listener is OnGeoPointClickListener) {
|
||||||
|
listener.onMapClick(tag, item.point, (item as MarkerItem).title)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onItemLongPress(index: Int, item: MarkerInterface): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
mStartEndMarkerLayer!!.removeAllItems()
|
||||||
|
}
|
||||||
|
mStartEndMarkerLayer!!.addItem(MarkerItem(sNodeId, "", sNodePoint))
|
||||||
|
mStartEndMarkerLayer!!.addItem(MarkerItem(eNodeId, "", eNodePoint))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clearNaviStartPoint() {
|
||||||
|
if (mStartEndMarkerLayer != null) {
|
||||||
|
removeLayer(mStartEndMarkerLayer!!)
|
||||||
|
mStartEndMarkerLayer = null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnQsRecordItemClickListener : BaseClickListener {
|
interface OnQsRecordItemClickListener : BaseClickListener {
|
||||||
|
BIN
collect-library/src/main/res/drawable/navi_set_end_point.png
Normal file
BIN
collect-library/src/main/res/drawable/navi_set_end_point.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
collect-library/src/main/res/drawable/navi_set_start_point.png
Normal file
BIN
collect-library/src/main/res/drawable/navi_set_start_point.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
2
vtm
2
vtm
@ -1 +1 @@
|
|||||||
Subproject commit 024159afee2b9e438dd6c2a6419e034df287a8db
|
Subproject commit c046e788f5c739612a31c308639fca2de639669a
|
Loading…
x
Reference in New Issue
Block a user