注释掉测试代码

This commit is contained in:
squallzhjch 2023-11-10 15:15:30 +08:00
parent c2e2d33025
commit bd024342d2
8 changed files with 305 additions and 83 deletions

View File

@ -562,6 +562,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,

View File

@ -754,10 +754,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
@ -1218,7 +1218,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.name = "${renderEntity.name}参考点" zLevelReference.name = "${renderEntity.name}参考点"
zLevelReference.code = renderEntity.code zLevelReference.code = renderEntity.code
zLevelReference.table = renderEntity.table zLevelReference.table = renderEntity.table

View File

@ -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",

View File

@ -371,37 +371,37 @@ class MainViewModel @Inject constructor(
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 { // naviEngineNew.let {
// naviMutex.lock() //// naviMutex.lock()
if (testRealm == null) //// if (testRealm == null)
testRealm = realmOperateHelper.getSelectTaskRealmInstance() //// testRealm = realmOperateHelper.getSelectTaskRealmInstance()
if (currentTaskBean != null) { // if (currentTaskBean != null) {
naviEngineNew.bindingRoute( // naviEngineNew.bindingRoute(
taskBean = currentTaskBean!!, // taskBean = currentTaskBean!!,
geoPoint = point, // geoPoint = point,
realm = testRealm!! //// realm = testRealm!!
) // )
} // }
// it.bindingRoute(null, point) //// it.bindingRoute(null, point)
// naviMutex.unlock() //// 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(2000)
} // }
} // }
/** /**
* 获取当前任务 * 获取当前任务
@ -1069,7 +1069,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
} }
/** /**

View File

@ -1,17 +1,17 @@
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.data.entity.TaskBean
import com.navinfo.collect.library.enums.DataCodeEnum import com.navinfo.collect.library.enums.DataCodeEnum
import com.navinfo.collect.library.utils.GeometryTools import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.omqs.bean.NaviRoute
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基本信息列表
@ -22,63 +22,162 @@ class NaviEngineNew(
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
/**
* 局部匹配时的路段
*/
var tempRoutList = mutableListOf<NaviRoute>()
suspend fun bindingRoute( suspend fun bindingRoute(
niLocation: NiLocation? = null, niLocation: NiLocation? = null,
taskBean: TaskBean, taskBean: TaskBean,
geoPoint: GeoPoint, geoPoint: GeoPoint,
realm:Realm ): Boolean {
) { val realm = realmOperateHelper.getSelectTaskRealmInstance()
var latestRoute: HadLinkDvoBean? = null if (latestRoute == null) {
var lastDis = -1.0
for (link in taskBean.hadLinkDvoList) { val time = System.currentTimeMillis()
val linkGeometry = GeometryTools.createGeometry(link.geometry) for (link in taskBean.hadLinkDvoList) {
val footAndDistance = GeometryTools.pointToLineDistance(geoPoint, linkGeometry) val linkGeometry = GeometryTools.createGeometry(link.geometry)
val meterD = footAndDistance.getMeterDistance() val footAndDistance = GeometryTools.pointToLineDistance(geoPoint, linkGeometry)
if (meterD < 15 && (lastDis < 0 || lastDis > meterD)) { val meterD = footAndDistance.getMeterDistance()
latestRoute = link if (lastDis > meterD) {
lastDis = meterD if (meterD < 15)
latestRoute = link
lastDis = meterD
}
} }
} Log.e("jingo", "定位匹配 ${System.currentTimeMillis() - time} $lastDis")
latestRoute?.let {
val naviRoute = getNaviRouteByLinkPid(realm, it.linkPid)
if (naviRoute != null) {
tempRoutList.add(naviRoute)
var bDirectOk = false
//反方向调转方向
if (naviRoute.direct == 2) {
bDirectOk = true
}
if (naviRoute.direct == 3) {
bDirectOk = true
naviRoute.pointList.reverse()
val sNode = naviRoute.eNode
naviRoute.eNode = naviRoute.sNode
naviRoute.sNode = sNode
}
var length = naviRoute.length
//是不是没有能连接的路了
var bHisNextNode = true
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) {
latestRoute?.let { }
}
val res2 = }
realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST) }
.equalTo("linkPid", it.linkPid).findAll()
if (res2 != null) {
for (entity in res2) {
when (entity.code) {
DataCodeEnum.OMDB_RD_LINK.code -> {
val snodePid = entity.properties["snodePid"]
if (snodePid != null) {
} else { } else {
bHisNextNode = false
} }
val enodePid = entity.properties["enodePid"]
if (enodePid != null) {
} else {
}
}
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
val direct = entity.properties["direct"]
if (direct != null) {
}
}
DataCodeEnum.OMDB_LINK_NAME.code -> {
// var name = realm.copyFromRealm(res4)
} }
} }
} 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
} }
} }

View File

@ -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
} }

View File

@ -37,6 +37,7 @@ enum class DataCodeEnum(var tableName: String, var code: String) {
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"),
@ -61,7 +62,7 @@ enum class DataCodeEnum(var tableName: String, var code: String) {
OMDB_LINK_FORM2_11("风景路线", "2206-11"), OMDB_LINK_FORM2_11("风景路线", "2206-11"),
OMDB_LINK_FORM2_12("车辆测试路段", "2206-12"), OMDB_LINK_FORM2_12("车辆测试路段", "2206-12"),
OMDB_LINK_FORM2_13("驾照考试路段", "2206-13"), OMDB_LINK_FORM2_13("驾照考试路段", "2206-13"),
OMDB_OBJECT_OH_STRUCT("上方障碍物","3001"), OMDB_OBJECT_OH_STRUCT("上方障碍物", "3001"),
OMDB_OBJECT_TEXT("文字", "3002"), OMDB_OBJECT_TEXT("文字", "3002"),
OMDB_OBJECT_SYMBOL("符号", "3003"), OMDB_OBJECT_SYMBOL("符号", "3003"),
OMDB_OBJECT_ARROW("箭头", "3004"), OMDB_OBJECT_ARROW("箭头", "3004"),
@ -70,14 +71,16 @@ 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"),

2
vtm

@ -1 +1 @@
Subproject commit ee88167c7de989b3f7c71ae00d9580ff91fd3bf6 Subproject commit c046e788f5c739612a31c308639fca2de639669a