feat: 增加道路形态图层分组
This commit is contained in:
parent
f388f7c986
commit
58dfe64227
@ -1,4 +1,6 @@
|
||||
[
|
||||
{
|
||||
"tableGroupName": "普通图层",
|
||||
"tableMap" : {
|
||||
"1012": {
|
||||
"table": "OMDB_CHECKPOINT",
|
||||
@ -22,21 +24,6 @@
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2004": {
|
||||
"table": "OMDB_LINK_ATTRIBUTE",
|
||||
"code": 2004,
|
||||
"name": "道路属性",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 19,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "generateRoadText()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2008": {
|
||||
"table": "OMDB_RD_LINK_KIND",
|
||||
"code": 2008,
|
||||
@ -106,21 +93,6 @@
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2022": {
|
||||
"table": "OMDB_CON_ACCESS",
|
||||
"code": 2022,
|
||||
"name": "全封闭"
|
||||
},
|
||||
"2037": {
|
||||
"table": "OMDB_RAMP",
|
||||
"code": 2037,
|
||||
"name": "匝道"
|
||||
},
|
||||
"2040": {
|
||||
"table": "OMDB_MULTI_DIGITIZED",
|
||||
"code": 2040,
|
||||
"name": "上下线分离"
|
||||
},
|
||||
"2041":{
|
||||
"table": "OMDB_LANE_NUM",
|
||||
"code": 2041,
|
||||
@ -157,36 +129,6 @@
|
||||
"zoomMax": 20,
|
||||
"transformer2Code": ""
|
||||
},
|
||||
"2204":{
|
||||
"table": "OMDB_ROUNDABOUT",
|
||||
"code": 2204,
|
||||
"name": "环岛",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "generateS2EReferencePoint()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2205":{
|
||||
"table": "OMDB_LINK_FORM1",
|
||||
"code": 2205,
|
||||
"name": "道路形态1",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2206":{
|
||||
"table": "OMDB_LINK_FORM2",
|
||||
"code": 2206,
|
||||
"name": "道路形态2",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"transformer2Code": ""
|
||||
},
|
||||
"3012":{
|
||||
"table": "OMDB_FILL_AREA",
|
||||
"code": 3012,
|
||||
@ -401,4 +343,71 @@
|
||||
"name": "面测试"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tableGroupName": "道路形态",
|
||||
"tableMap" : {
|
||||
"2004": {
|
||||
"table": "OMDB_LINK_ATTRIBUTE",
|
||||
"code": 2004,
|
||||
"name": "道路属性",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 19,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "generateRoadText()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2022": {
|
||||
"table": "OMDB_CON_ACCESS",
|
||||
"code": 2022,
|
||||
"name": "全封闭"
|
||||
},
|
||||
"2037": {
|
||||
"table": "OMDB_RAMP",
|
||||
"code": 2037,
|
||||
"name": "匝道"
|
||||
},
|
||||
"2040": {
|
||||
"table": "OMDB_MULTI_DIGITIZED",
|
||||
"code": 2040,
|
||||
"name": "上下线分离"
|
||||
},
|
||||
"2204":{
|
||||
"table": "OMDB_ROUNDABOUT",
|
||||
"code": 2204,
|
||||
"name": "环岛",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "generateS2EReferencePoint()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2205":{
|
||||
"table": "OMDB_LINK_FORM1",
|
||||
"code": 2205,
|
||||
"name": "道路形态1",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2206":{
|
||||
"table": "OMDB_LINK_FORM2",
|
||||
"code": 2206,
|
||||
"name": "道路形态2",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"transformer2Code": ""
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
]
|
@ -102,7 +102,7 @@ class Constant {
|
||||
const val SELECT_TAKEPHOTO_OR_RECORD = "select_takephoto_or_record"
|
||||
|
||||
const val OMDB_CONFIG = "omdb_config.json"
|
||||
const val OTHER_CONFIG = "other_config.json"
|
||||
// const val OTHER_CONFIG = "other_config.json"
|
||||
|
||||
val OMDB_LAYER_VISIBLE_LIST: MutableList<String> = mutableListOf() // 记录OMDB数据显示的图层名称列表
|
||||
|
||||
|
@ -50,16 +50,23 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
private val configFile: File =
|
||||
File("${Constant.USER_DATA_PATH}", Constant.OMDB_CONFIG)
|
||||
|
||||
private val importConfig by lazy {
|
||||
private val importConfigList by lazy {
|
||||
openConfigFile()
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取config的配置文件
|
||||
* */
|
||||
fun openConfigFile(): ImportConfig {
|
||||
fun openConfigFile(): List<ImportConfig> {
|
||||
val resultList = mutableListOf<ImportConfig>()
|
||||
val configStr = configFile.readText()
|
||||
return gson.fromJson(configStr, ImportConfig::class.java)
|
||||
val type = object : TypeToken<List<ImportConfig>>() {}.type
|
||||
return try {
|
||||
val result = gson.fromJson<List<ImportConfig>>(configStr, type)
|
||||
result ?: resultList
|
||||
} catch (e: Exception) {
|
||||
resultList
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,9 +142,16 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
val unZipFiles = ZipUtils.unzipFile(omdbZipFile, unZipFolder)
|
||||
// 将listResult数据插入到Realm数据库中
|
||||
val realm = Realm.getDefaultInstance()
|
||||
// 先获取当前配置的所有图层的个数,方便后续计算数据解析进度
|
||||
var tableNum = 0
|
||||
for (importConfig in importConfigList) {
|
||||
tableNum += importConfig.tableMap.size
|
||||
}
|
||||
|
||||
realm.beginTransaction()
|
||||
try {
|
||||
// 遍历解压后的文件,读取该数据返回
|
||||
for (importConfig in importConfigList) {
|
||||
for ((index, currentEntry) in importConfig.tableMap.entries.withIndex()) {
|
||||
val currentConfig = currentEntry.value
|
||||
val txtFile = unZipFiles.find {
|
||||
@ -386,13 +400,14 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
// 1个文件发送一次flow流
|
||||
emit("${index + 1}/${importConfig.tableMap.size}")
|
||||
emit("${index + 1}/${tableNum}")
|
||||
// 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
||||
if (currentConfig.table == "OMDB_RD_LINK") {
|
||||
importConfig.preProcess.cacheRdLink =
|
||||
listResult.associateBy { it.properties["linkPid"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
realm.commitTransaction()
|
||||
realm.close()
|
||||
} catch (e: Exception) {
|
||||
|
@ -6,12 +6,12 @@ import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.bean.ImportConfig
|
||||
import com.navinfo.omqs.tools.LayerConfigUtils.Companion.gson
|
||||
import java.io.File
|
||||
|
||||
class LayerConfigUtils {
|
||||
companion object {
|
||||
private val omdbConfigFile = File("${Constant.USER_DATA_PATH}", Constant.OMDB_CONFIG)
|
||||
private val otherConfigFile = File("${Constant.USER_DATA_PATH}", Constant.OTHER_CONFIG)
|
||||
private val gson = Gson()
|
||||
|
||||
fun getLayerConfigList(): List<ImportConfig> {
|
||||
@ -20,29 +20,19 @@ class LayerConfigUtils {
|
||||
Constant.LAYER_CONFIG_LIST = getLayerConfigListFromAssetsFile()
|
||||
}
|
||||
return Constant.LAYER_CONFIG_LIST!!
|
||||
// return SPStaticUtils.getString(Constant.EVENT_LAYER_MANAGER_CHANGE, null).let {
|
||||
// if (it != null) {
|
||||
// val result: List<ImportConfig> =
|
||||
// gson.fromJson(it, object : TypeToken<List<ImportConfig>>() {}.type)
|
||||
// result
|
||||
// } else {
|
||||
// LayerConfigUtils.getLayerConfigListFromAssetsFile()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private fun getLayerConfigListFromAssetsFile(): List<ImportConfig> {
|
||||
val resultList = mutableListOf<ImportConfig>()
|
||||
if (omdbConfigFile.exists()) {
|
||||
val omdbConfiStr = FileIOUtils.readFile2String(omdbConfigFile)
|
||||
val omdbConfig = gson.fromJson<ImportConfig>(omdbConfiStr, ImportConfig::class.java)
|
||||
resultList.add(omdbConfig)
|
||||
val type = object : TypeToken<List<ImportConfig>>() {}.type
|
||||
return try {
|
||||
val result = gson.fromJson<List<ImportConfig>>(omdbConfiStr, type)
|
||||
result ?: resultList
|
||||
} catch (e: Exception) {
|
||||
resultList
|
||||
}
|
||||
if (otherConfigFile.exists()) {
|
||||
val otherConfiStr = FileIOUtils.readFile2String(otherConfigFile)
|
||||
val otherConfig =
|
||||
gson.fromJson<ImportConfig>(otherConfiStr, ImportConfig::class.java)
|
||||
resultList.add(otherConfig)
|
||||
}
|
||||
return resultList
|
||||
}
|
||||
|
@ -742,15 +742,16 @@ class MainViewModel @Inject constructor(
|
||||
fun refreshOMDBLayer(layerConfigList: List<ImportConfig>) {
|
||||
// 根据获取到的配置信息,筛选未勾选的图层名称
|
||||
if (layerConfigList != null && !layerConfigList.isEmpty()) {
|
||||
val omdbVisibleList = layerConfigList.filter { importConfig ->
|
||||
importConfig.tableGroupName == "OMDB数据"
|
||||
}.first().tableMap.filter { entry ->
|
||||
val omdbVisibleList = mutableListOf<String>()
|
||||
layerConfigList.forEach {
|
||||
omdbVisibleList.addAll(it.tableMap.filter { entry ->
|
||||
val tableInfo = entry.value
|
||||
!tableInfo.checked
|
||||
}.map { entry ->
|
||||
val tableInfo = entry.value
|
||||
tableInfo.table
|
||||
}.toList()
|
||||
}.toList())
|
||||
}
|
||||
com.navinfo.collect.library.system.Constant.HAD_LAYER_INVISIABLE_ARRAY =
|
||||
omdbVisibleList.toTypedArray()
|
||||
// 刷新地图
|
||||
|
@ -2277,7 +2277,7 @@
|
||||
|
||||
<!-- 导流区 -->
|
||||
<m v="OMDB_FILL_AREA">
|
||||
<area use="obj-area" repeat="false" src="assets:omdb/tex_fill_area_with_text_3012.png"></area>
|
||||
<area use="obj-area" repeat="false" src="assets:omdb/tex_fill_area_3012.png"></area>
|
||||
<text use="area-name"></text>
|
||||
</m>
|
||||
</m>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
Loading…
x
Reference in New Issue
Block a user