优化数据安装效率,更换第三方库

This commit is contained in:
qiji4215
2023-10-31 15:02:21 +08:00
parent 584eea6928
commit 0f97c08b44
7 changed files with 86 additions and 46 deletions

View File

@@ -150,7 +150,7 @@
"code": 2092,
"name": "车道类型",
"catch": true,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"zoomMin": 18,
"zoomMax": 20,
"transformer": [
@@ -173,7 +173,7 @@
"name": "桥",
"catch": true,
"existSubCode": true,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"zoomMin": 15,
"zoomMax": 20,
"transformer": [
@@ -350,7 +350,7 @@
"code": 4001,
"name": "路口",
"zoomMin": 15,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"zoomMax": 17,
"catch": true,
"transformer": [
@@ -452,7 +452,7 @@
"zoomMin": 15,
"zoomMax": 17,
"filterData": true,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"catch": true,
"transformer": [
{
@@ -492,7 +492,7 @@
"code": 4009,
"name": "警示信息",
"catch": true,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"zoomMin": 15,
"zoomMax": 20,
"transformer": [
@@ -581,7 +581,7 @@
"code": 4601,
"name": "车信",
"catch": true,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"zoomMin": 15,
"zoomMax": 17,
"transformer": [
@@ -610,7 +610,7 @@
"code": 5001,
"name": "车道中心线",
"catch": false,
"isDependOnOtherTable": true,
"isDependOnOtherTable": false,
"checkLinkId": false,
"zoomMin": 18,
"zoomMax": 20,

View File

@@ -247,11 +247,11 @@ class ImportOMDBHelper @AssistedInject constructor(
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "数据安装", "安装结束")
Constant.INSTALL_DATA = false
} catch (e: Exception) {
Log.e("jingo", "安装报错1 ${e.message}")
return false
}finally {
Constant.INSTALL_DATA = false
}
return true
}
@@ -294,12 +294,15 @@ class ImportOMDBHelper @AssistedInject constructor(
continue
}
newTime = System.currentTimeMillis()
Log.e(
"jingo",
"安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size} ${newTime - time}"
)
if(elementIndex%50==0){
Log.e("jingo", "安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size} ${newTime - time}")
}
time = newTime
elementIndex += 1
val map = gson.fromJson<Map<String, Any>>(
line, object : TypeToken<Map<String, Any>>() {}.type
).toMutableMap()
@@ -488,6 +491,8 @@ class ImportOMDBHelper @AssistedInject constructor(
// 对renderEntity做预处理后再保存
val resultEntity = importConfig.transformProperties(renderEntity, realm)
//车道中心线不在主表写入
if (resultEntity != null) {
//对code编码需要特殊处理 存在多个属性值时渲染优先级SA>PA,存在多个属性值时渲染优先级FRONTAGE>MAIN_SIDE_A CCESS
@@ -697,6 +702,7 @@ class ImportOMDBHelper @AssistedInject constructor(
renderEntity.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(renderEntity.properties))
listRenderEntity.add(renderEntity)
}
if (listRenderEntity.size > 20000) {

View File

@@ -242,8 +242,9 @@ class ImportPreProcess {
startEndReference.properties["type"] = "s_2_e"
val listResult = mutableListOf<ReferenceEntity>()
startEndReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(startEndReference.properties))
listResult.add(startEndReference)
insertData(listResult)
renderEntity.referenceEntitys?.add(startEndReference)
//listResult.add(startEndReference)
//insertData(listResult)
}
/**
@@ -292,9 +293,9 @@ class ImportPreProcess {
endReference.properties["qi_table"] = renderEntity.table
endReference.properties["type"] = "e_2_p"
endReference.properties["geometry"] = endReference.geometry
listResult.add(endReference)
insertData(listResult)
renderEntity.referenceEntitys?.add(endReference)
//listResult.add(endReference)
//insertData(listResult)
}
}
@@ -379,9 +380,10 @@ class ImportPreProcess {
}
endReference.properties["geometry"] = endReference.geometry
endReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(endReference.properties))
listResult.add(endReference)
renderEntity.referenceEntitys?.add(endReference)
//listResult.add(endReference)
Log.e("qj", "generateS2EReferencePoint===4")
insertData(listResult)
//insertData(listResult)
}
/**
@@ -477,9 +479,10 @@ class ImportPreProcess {
angleReference.properties["qi_table"] = renderEntity.table
angleReference.properties["type"] = "angle"
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
listResult.add(angleReference)
renderEntity.referenceEntitys?.add(angleReference)
//listResult.add(angleReference)
}
insertData(listResult)
//insertData(listResult)
}
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
@@ -634,9 +637,10 @@ class ImportPreProcess {
"assets:omdb/4601/${type}/1301_${referenceEntity.properties["currentDirect"]}.svg"
Log.d("unpackingLaneInfo", referenceEntity.properties["symbol"].toString())
referenceEntity.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(referenceEntity.properties))
listResult.add(referenceEntity)
renderEntity.referenceEntitys?.add(referenceEntity)
//listResult.add(referenceEntity)
}
insertData(listResult)
//insertData(listResult)
}
}
}
@@ -744,8 +748,9 @@ class ImportPreProcess {
angleReference.enable = renderEntity.enable
val listResult = mutableListOf<ReferenceEntity>()
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
listResult.add(angleReference)
insertData(listResult)
renderEntity.referenceEntitys?.add(angleReference)
//listResult.add(angleReference)
//insertData(listResult)
}
@@ -775,9 +780,10 @@ class ImportPreProcess {
intersectionReference.properties["qi_table"] = renderEntity.table
intersectionReference.properties["type"] = "node"
intersectionReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(intersectionReference.properties))
listResult.add(intersectionReference)
renderEntity.referenceEntitys?.add(intersectionReference)
//listResult.add(intersectionReference)
}
insertData(listResult)
//insertData(listResult)
}
}
@@ -944,9 +950,10 @@ class ImportPreProcess {
val code = renderEntity.properties[codeName]
dynamicSrcReference.properties["src"] = "${prefix}${code}${suffix}"
dynamicSrcReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(dynamicSrcReference.properties))
listResult.add(dynamicSrcReference)
renderEntity.referenceEntitys?.add(dynamicSrcReference)
//listResult.add(dynamicSrcReference)
}
insertData(listResult)
//insertData(listResult)
}
private fun insertData(list: List<RealmModel>) {

View File

@@ -854,7 +854,7 @@ class MainViewModel @Inject constructor(
*/
private suspend fun captureLink(point: GeoPoint) {
if (captureLinkState) {
if (captureLinkState||Constant.INSTALL_DATA) {
return
}