This commit is contained in:
qiji4215
2023-09-06 09:32:13 +08:00
10 changed files with 75 additions and 470 deletions

View File

@@ -498,11 +498,6 @@
"vlib": "generateAddWidthLine()"
}
]
},
"5002":{
"table": "OMDB_AREA",
"code": 5002,
"name": "面测试"
}
}
},

View File

@@ -33,7 +33,7 @@ class Code2NameMap {
29 to "鸣笛",
30 to "年检",
31 to "尾气",
32 to "交通灯",
32 to "ETC",
33 to "专用",
34 to "标线",
35 to "违章",

View File

@@ -168,15 +168,16 @@ class ImportOMDBHelper @AssistedInject constructor(
// 遍历解压后的文件,读取该数据返回
for (importConfig in importConfigList) {
val realm = Realm.getDefaultInstance()
try {
for ((index, currentEntry) in importConfig.tableMap.entries.withIndex()) {
realm.beginTransaction()
val currentConfig = currentEntry.value
val txtFile = unZipFiles.find {
it.name == currentConfig.table
}
// 将listResult数据插入到Realm数据库中
val realm = Realm.getDefaultInstance()
val listResult = mutableListOf<RenderEntity>()
// val listResult = mutableListOf<RenderEntity>()
currentConfig?.let {
val list = FileIOUtils.readFile2List(txtFile, "UTF-8")
Log.d("ImportOMDBHelper", "开始解析:${txtFile?.name}")
@@ -317,28 +318,28 @@ class ImportOMDBHelper @AssistedInject constructor(
}
}
//交限增加相同LinkIn与LinkOut过滤原则
if (renderEntity.code == DataCodeEnum.OMDB_RESTRICTION.code) {
if (renderEntity.properties.containsKey("linkIn") && renderEntity.properties.containsKey(
"linkOut"
)
) {
var linkIn = renderEntity.properties["linkIn"]
var linkOut = renderEntity.properties["linkOut"]
if (linkIn != null && linkOut != null) {
var checkMsg = "$linkIn$linkOut"
if (resHashMap.containsKey(checkMsg)) {
Log.e(
"qj",
"${renderEntity.name}==过滤交限linkin与linkout相同且存在多条数据"
)
continue
} else {
resHashMap.put(checkMsg, renderEntity)
}
}
}
}
// //交限增加相同LinkIn与LinkOut过滤原则
// if (renderEntity.code == DataCodeEnum.OMDB_RESTRICTION.code) {
// if (renderEntity.properties.containsKey("linkIn") && renderEntity.properties.containsKey(
// "linkOut"
// )
// ) {
// var linkIn = renderEntity.properties["linkIn"]
// var linkOut = renderEntity.properties["linkOut"]
// if (linkIn != null && linkOut != null) {
// var checkMsg = "$linkIn$linkOut"
// if (resHashMap.containsKey(checkMsg)) {
// Log.e(
// "qj",
// "${renderEntity.name}==过滤交限linkin与linkout相同且存在多条数据"
// )
// continue
// } else {
// resHashMap.put(checkMsg, renderEntity)
// }
// }
// }
// }
//遍历判断只显示与任务Link相关的任务数据
if (currentConfig.checkLinkId) {
@@ -609,24 +610,23 @@ class ImportOMDBHelper @AssistedInject constructor(
renderEntity.properties["startTime"] = "null"
}
}
listResult.add(renderEntity)
// listResult.add(renderEntity)
realm.insert(renderEntity)
}
}
}
}
// // 如果当前解析的是OMDB_RD_LINK数据将其缓存在预处理类中以便后续处理其他要素时使用
// if (currentConfig.table == "OMDB_RD_LINK") {
// importConfig.preProcess.cacheRdLink =
// listResult.associateBy { it.properties["linkPid"] }
// }
realm.commitTransaction()
// 1个文件发送一次flow流
emit("${++processIndex}/${tableNum}")
realm.beginTransaction()
realm.insert(listResult)
realm.commitTransaction()
realm.close()
// 如果当前解析的是OMDB_RD_LINK数据将其缓存在预处理类中以便后续处理其他要素时使用
if (currentConfig.table == "OMDB_RD_LINK") {
importConfig.preProcess.cacheRdLink =
listResult.associateBy { it.properties["linkPid"] }
}
}
} catch (e: Exception) {
realm.cancelTransaction()
throw e
}
}

View File

@@ -20,23 +20,23 @@ class ImportPreProcess {
val defaultTranslateDistance = 3.0
val testFlag:Boolean = true
fun checkCircleRoad(renderEntity: RenderEntity): Boolean {
val linkInId = renderEntity.properties["linkIn"]
val linkOutId = renderEntity.properties["linkOut"]
// 根据linkIn和linkOut获取对应的link数据
val linkInEntity = cacheRdLink[linkInId]
val linkOutEntity = cacheRdLink[linkOutId]
Log.d(
"checkCircleRoad",
"LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")}LinkOutEntity: ${linkOutId}- ${
linkOutEntity?.properties?.get("enodePid")
}"
)
// 查询linkIn的sNode和linkOut的eNode是否相同如果相同认为数据是环形路口返回false
if (linkInEntity != null && linkOutEntity != null) {
if (linkInEntity.properties["snodePid"] == linkOutEntity.properties["enodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["snodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["enodePid"]) {
return false
}
}
// val linkInId = renderEntity.properties["linkIn"]
// val linkOutId = renderEntity.properties["linkOut"]
// // 根据linkIn和linkOut获取对应的link数据
// val linkInEntity = cacheRdLink[linkInId]
// val linkOutEntity = cacheRdLink[linkOutId]
// Log.d(
// "checkCircleRoad",
// "LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")}LinkOutEntity: ${linkOutId}- ${
// linkOutEntity?.properties?.get("enodePid")
// }"
// )
// // 查询linkIn的sNode和linkOut的eNode是否相同如果相同认为数据是环形路口返回false
// if (linkInEntity != null && linkOutEntity != null) {
// if (linkInEntity.properties["snodePid"] == linkOutEntity.properties["enodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["snodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["enodePid"]) {
// return false
// }
// }
return true
}
@@ -58,7 +58,7 @@ class ImportPreProcess {
)!=null) {
var angle = renderEntity?.properties?.get("angle")?.toDouble()!!
// angle角度为与正北方向的顺时针夹角将其转换为与X轴正方向的逆时针夹角即为正东方向的夹角
angle = (450 - angle) % 360
angle = -((450 - angle) % 360)
radian = Math.toRadians(angle)
} else {
var isReverse = false // 是否为逆向
@@ -135,7 +135,7 @@ class ImportPreProcess {
// angle += 180
// }
// angle角度为与正北方向的顺时针夹角将其转换为与X轴正方向的逆时针夹角即为正东方向的夹角
angle = (450 - angle) % 360
angle = -((450 - angle) % 360)
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
var coordinates = geometry.coordinates
@@ -309,7 +309,7 @@ class ImportPreProcess {
"angle"
)?.toDouble()!!
// angle角度为与正北方向的顺时针夹角将其转换为与X轴正方向的逆时针夹角即为正东方向的夹角
angle = (450 - angle) % 360
angle = -((450 - angle) % 360)
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
var coordinates = geometry.coordinates
@@ -333,7 +333,7 @@ class ImportPreProcess {
}
} else renderEntity?.properties?.get("angle")?.toDouble()!!
angle = (450 - angle) % 360
angle = -((450 - angle) % 360)
radian = Math.toRadians(angle)
}
@@ -460,9 +460,10 @@ class ImportPreProcess {
referenceEntity.properties["currentDirect"] =
laneInfoDirectArray[i].toString().split(",").distinct().joinToString("_")
referenceEntity.properties["currentType"] =
laneInfoTypeArray[i].toString().split(",").distinct().joinToString("_")
laneInfoTypeArray[i].toString()
val type = if (referenceEntity.properties["currentType"]=="0") "normal" else if (referenceEntity.properties["currentType"]=="1") "extend" else "bus"
referenceEntity.properties["symbol"] =
"assets:omdb/4601/bus/1301_" + referenceEntity.properties["currentDirect"] + ".svg"
"assets:omdb/4601/${type}/1301_${referenceEntity.properties["currentDirect"]}.svg"
Log.d("unpackingLaneInfo", referenceEntity.properties["symbol"].toString())
Realm.getDefaultInstance().insert(referenceEntity)
}
@@ -696,7 +697,7 @@ class ImportPreProcess {
"angle"
)?.toDouble()!!
// angle角度为与正北方向的顺时针夹角将其转换为与X轴正方向的逆时针夹角即为正东方向的夹角
angle = (450 - angle) % 360
angle = -((450 - angle) % 360)
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
var coordinates = geometry.coordinates
@@ -717,7 +718,7 @@ class ImportPreProcess {
}
} else renderEntity?.properties?.get("angle")?.toDouble()!!
angle = (450 - angle) % 360
angle = -((450 - angle) % 360)
radian = Math.toRadians(angle)
}

View File

@@ -129,7 +129,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
// 定位到指定位置
niMapController.mMapView.vtmMap.animator()
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
.animateTo(GeoPoint( 40.50755634913162,115.80235967728436 ))
.animateTo(GeoPoint(40.51850916836801,115.78801387178642))
}
R.id.personal_center_menu_open_all_layer -> {
MapParamUtils.setDataLayerEnum(DataLayerEnum.SHOW_ALL_LAYERS)