Merge branch 'navinfo-20231018'
# Conflicts: # app/src/main/java/com/navinfo/omqs/ui/activity/login/LoginViewModel.kt # app/src/main/java/com/navinfo/omqs/util/NaviEngine.kt # collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileDataSource.java
This commit is contained in:
commit
9cf39d476c
@ -1,7 +1,16 @@
|
||||
[
|
||||
{
|
||||
"tableGroupName": "普通图层",
|
||||
"tableMap" : {
|
||||
"tableMap": {
|
||||
"2001": {
|
||||
"table": "OMDB_RD_LINK",
|
||||
"code": 2001,
|
||||
"name": "道路线",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"catch": true,
|
||||
"checkLinkId": false
|
||||
},
|
||||
"1007": {
|
||||
"table": "OMDB_NODE_FORM",
|
||||
"code": 1007,
|
||||
@ -24,19 +33,10 @@
|
||||
"table": "OMDB_CHECKPOINT",
|
||||
"code": 1012,
|
||||
"name": "检查点",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"2001": {
|
||||
"table": "OMDB_RD_LINK",
|
||||
"code": 2001,
|
||||
"name": "道路线",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"catch":true,
|
||||
"checkLinkId": false
|
||||
},
|
||||
"2002": {
|
||||
"table": "OMDB_RD_LINK_FUNCTION_CLASS",
|
||||
"code": 2002,
|
||||
@ -50,7 +50,7 @@
|
||||
"name": "道路种别",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"catch":false,
|
||||
"catch": false,
|
||||
"checkLinkId": false
|
||||
},
|
||||
"2010": {
|
||||
@ -59,7 +59,15 @@
|
||||
"name": "道路方向",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"checkLinkId": false
|
||||
"checkLinkId": false,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "addRdLinkDirect()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2011": {
|
||||
"table": "OMDB_LINK_NAME",
|
||||
@ -85,7 +93,7 @@
|
||||
"zoomMax": 20,
|
||||
"checkLinkId": false,
|
||||
"filterData": true,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
@ -99,7 +107,7 @@
|
||||
"table": "OMDB_LINK_CONSTRUCTION",
|
||||
"code": 2017,
|
||||
"name": "道路施工",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
@ -125,12 +133,12 @@
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2041":{
|
||||
"2041": {
|
||||
"table": "OMDB_LANE_NUM",
|
||||
"code": 2041,
|
||||
"name": "车道数"
|
||||
},
|
||||
"2083":{
|
||||
"2083": {
|
||||
"table": "OMDB_RDBOUND_BOUNDARYTYPE",
|
||||
"code": 2083,
|
||||
"name": "道路边界类型",
|
||||
@ -138,22 +146,22 @@
|
||||
"filterData": true,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
"catch":true
|
||||
"catch": true
|
||||
},
|
||||
"2090":{
|
||||
"2090": {
|
||||
"table": "OMDB_LANE_CONSTRUCTION",
|
||||
"code": 2090,
|
||||
"name": "车道施工",
|
||||
"existSubCode": true,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"2201":{
|
||||
"2201": {
|
||||
"table": "OMDB_BRIDGE",
|
||||
"code": 2201,
|
||||
"name": "桥",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"existSubCode": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
@ -166,13 +174,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"2202":{
|
||||
"2202": {
|
||||
"table": "OMDB_TUNNEL",
|
||||
"code": 2202,
|
||||
"name": "隧道",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
@ -182,13 +190,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"3001":{
|
||||
"3001": {
|
||||
"table": "OMDB_OBJECT_OH_STRUCT",
|
||||
"code": 3001,
|
||||
"name": "上方障碍物",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"checkLinkId": false,
|
||||
"transformer": [
|
||||
{
|
||||
@ -199,34 +207,34 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"3002":{
|
||||
"3002": {
|
||||
"table": "OMDB_OBJECT_TEXT",
|
||||
"code": 3002,
|
||||
"name": "文字",
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"checkLinkId": false,
|
||||
"transformer": []
|
||||
},
|
||||
"3003":{
|
||||
"3003": {
|
||||
"table": "OMDB_OBJECT_SYMBOL",
|
||||
"code": 3003,
|
||||
"name": "符号",
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"transformer": []
|
||||
},
|
||||
"3004":{
|
||||
"3004": {
|
||||
"table": "OMDB_OBJECT_ARROW",
|
||||
"code": 3004,
|
||||
"name": "箭头",
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
@ -236,14 +244,14 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"3005":{
|
||||
"3005": {
|
||||
"table": "OMDB_TRAFFIC_SIGN",
|
||||
"code": 3005,
|
||||
"name": "交通标牌",
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
"is3D": true,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
@ -253,12 +261,12 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"3006":{
|
||||
"3006": {
|
||||
"table": "OMDB_POLE",
|
||||
"code": 3006,
|
||||
"name": "杆状物",
|
||||
"is3D": true,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"filterData": true,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
@ -271,39 +279,39 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"3012":{
|
||||
"3012": {
|
||||
"table": "OMDB_FILL_AREA",
|
||||
"code": 3012,
|
||||
"name": "导流区",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"3014":{
|
||||
"3014": {
|
||||
"table": "OMDB_CROSS_WALK",
|
||||
"code": 3014,
|
||||
"name": "人行横道",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"3016":{
|
||||
"3016": {
|
||||
"table": "OMDB_OBJECT_STOPLOCATION",
|
||||
"code": 3016,
|
||||
"name": "停止位置",
|
||||
"checkLinkId": false,
|
||||
"filterData": true,
|
||||
"zoomMin": 18,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"3027":{
|
||||
"3027": {
|
||||
"table": "OMDB_OBJECT_REFUGE_ISLAND",
|
||||
"code": 3027,
|
||||
"name": "路口内交通岛",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20
|
||||
@ -314,7 +322,7 @@
|
||||
"name": "路口",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
@ -328,7 +336,7 @@
|
||||
"table": "OMDB_SPEEDLIMIT",
|
||||
"code": 4002,
|
||||
"name": "常规点限速",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -346,11 +354,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"4003":{
|
||||
"4003": {
|
||||
"table": "OMDB_SPEEDLIMIT_COND",
|
||||
"code": 4003,
|
||||
"name": "条件点限速",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -362,11 +370,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"4004":{
|
||||
"4004": {
|
||||
"table": "OMDB_SPEEDLIMIT_VAR",
|
||||
"code": 4004,
|
||||
"name": "可变点限速",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -396,8 +404,8 @@
|
||||
"name": "普通交限",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"filterData":true,
|
||||
"catch":true,
|
||||
"filterData": true,
|
||||
"catch": true,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
@ -431,11 +439,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"4009":{
|
||||
"4009": {
|
||||
"table": "OMDB_WARNINGSIGN",
|
||||
"code": 4009,
|
||||
"name": "警示信息",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -465,11 +473,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"4010":{
|
||||
"4010": {
|
||||
"table": "OMDB_ELECTRONICEYE",
|
||||
"code": 4010,
|
||||
"name": "电子眼",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -503,7 +511,7 @@
|
||||
"table": "OMDB_TRAFFICLIGHT",
|
||||
"code": 4022,
|
||||
"name": "交通灯",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -513,17 +521,17 @@
|
||||
"table": "OMDB_TOLLGATE",
|
||||
"code": 4023,
|
||||
"name": "收费站",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
]
|
||||
},
|
||||
"4601":{
|
||||
"4601": {
|
||||
"table": "OMDB_LANEINFO",
|
||||
"code": 4601,
|
||||
"name": "车信",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"transformer": [
|
||||
@ -547,11 +555,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"5001":{
|
||||
"5001": {
|
||||
"table": "OMDB_LANE_LINK_LG",
|
||||
"code": 5001,
|
||||
"name": "车道中心线",
|
||||
"catch":false,
|
||||
"catch": false,
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
@ -568,13 +576,13 @@
|
||||
},
|
||||
{
|
||||
"tableGroupName": "道路形态",
|
||||
"tableMap" : {
|
||||
"tableMap": {
|
||||
"2004": {
|
||||
"table": "OMDB_LINK_ATTRIBUTE",
|
||||
"code": 2004,
|
||||
"name": "道路属性",
|
||||
"existSubCode": true,
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"transformer": [
|
||||
@ -608,17 +616,17 @@
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2204":{
|
||||
"2204": {
|
||||
"table": "OMDB_ROUNDABOUT",
|
||||
"code": 2204,
|
||||
"name": "环岛",
|
||||
"catch":true,
|
||||
"catch": true,
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17,
|
||||
"transformer": [
|
||||
]
|
||||
},
|
||||
"2205":{
|
||||
"2205": {
|
||||
"table": "OMDB_LINK_FORM1",
|
||||
"code": 2205,
|
||||
"name": "道路形态1",
|
||||
@ -626,7 +634,7 @@
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
},
|
||||
"2206":{
|
||||
"2206": {
|
||||
"table": "OMDB_LINK_FORM2",
|
||||
"code": 2206,
|
||||
"existSubCode": true,
|
||||
@ -634,7 +642,6 @@
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 17
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
]
|
@ -11,6 +11,7 @@ import com.blankj.utilcode.util.ZipUtils
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.collect.library.data.entity.LinkRelation
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||
@ -36,7 +37,9 @@ import org.locationtech.jts.geom.LineString
|
||||
import org.locationtech.jts.geom.MultiLineString
|
||||
import org.spatialite.database.SQLiteDatabase
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.streams.toList
|
||||
|
||||
/**
|
||||
@ -180,28 +183,27 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
var tableImportTime = System.currentTimeMillis()
|
||||
//总表要素统计时间
|
||||
var dataImportTime = System.currentTimeMillis()
|
||||
|
||||
Realm.getInstance(currentInstallTaskConfig).beginTransaction()
|
||||
|
||||
val realm = Realm.getInstance(currentInstallTaskConfig)
|
||||
realm.beginTransaction()
|
||||
for (importConfig in importConfigList) {
|
||||
tableNum += importConfig.tableMap.size
|
||||
}
|
||||
//缓存任务link信息,便于下面与数据进行任务link匹配
|
||||
val hashMap: HashMap<Long, HadLinkDvoBean> = HashMap<Long, HadLinkDvoBean>()
|
||||
|
||||
val lineList = arrayOfNulls<LineString>(task.hadLinkDvoList.size)
|
||||
var index = 0
|
||||
// val lineList = arrayOfNulls<LineString>(task.hadLinkDvoList.size)
|
||||
// var index = 0
|
||||
task.hadLinkDvoList.forEach {
|
||||
hashMap[it.linkPid.toLong()] = it
|
||||
lineList[index] = GeometryTools.createGeometry(it.geometry) as LineString
|
||||
index++
|
||||
// lineList[index] = GeometryTools.createGeometry(it.geometry) as LineString
|
||||
// index++
|
||||
}
|
||||
|
||||
val resHashMap: HashMap<String, RenderEntity> =
|
||||
HashMap<String, RenderEntity>() //define empty hashmap
|
||||
try {
|
||||
|
||||
var multipLine = MultiLineString(lineList, GeometryFactory())
|
||||
// var multipLine = MultiLineString(lineList, GeometryFactory())
|
||||
|
||||
|
||||
// 遍历解压后的文件,读取该数据返回
|
||||
@ -257,6 +259,26 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
renderEntity.taskId = task.id
|
||||
renderEntity.zoomMin = map["qi_zoomMin"].toString().toInt()
|
||||
renderEntity.zoomMax = map["qi_zoomMax"].toString().toInt()
|
||||
// 在外层记录当前数据的linkPid
|
||||
if (map.containsKey("linkPid")) {
|
||||
renderEntity.linkPid =
|
||||
map["linkPid"].toString().split(",")
|
||||
?.get(0)
|
||||
.toString()
|
||||
} else if (map.containsKey("linkList")) {
|
||||
val linkList =
|
||||
map["linkList"].toString()
|
||||
if (!linkList.isNullOrEmpty() && linkList != "null") {
|
||||
val list: List<LinkList> = gson.fromJson(
|
||||
linkList,
|
||||
object :
|
||||
TypeToken<List<LinkList>>() {}.type
|
||||
)
|
||||
if (list != null) {
|
||||
renderEntity.linkPid = list[0].linkPid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderEntity.geometry = map["geometry"].toString()
|
||||
Log.d("ImportOMDBHelper", "解析===1处理3D")
|
||||
@ -748,9 +770,24 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
if (renderEntity.properties.containsKey("geometry")) {
|
||||
renderEntity.properties.remove("geometry")
|
||||
}
|
||||
|
||||
// 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
||||
if (currentConfig.code == DataCodeEnum.OMDB_RD_LINK.code.toInt()) {
|
||||
if (renderEntity.linkRelation == null) {
|
||||
renderEntity.linkRelation = LinkRelation()
|
||||
}
|
||||
renderEntity.linkRelation!!.sNodeId =
|
||||
renderEntity.properties["snodePid"]
|
||||
renderEntity.linkRelation!!.eNodeId =
|
||||
renderEntity.properties["enodePid"]
|
||||
// 同时尝试更新RD_link的relation记录中的名称字段
|
||||
renderEntity.linkRelation!!.linkPid =
|
||||
renderEntity.properties["linkPid"]
|
||||
?: UUID.randomUUID().toString()
|
||||
}
|
||||
|
||||
Log.d("ImportOMDBHelper", "解析===1insert")
|
||||
Realm.getInstance(currentInstallTaskConfig)
|
||||
.insert(renderEntity)
|
||||
realm.insert(renderEntity)
|
||||
Log.d("ImportOMDBHelper", "解析===2insert")
|
||||
}
|
||||
if (currentConfig.code == DataCodeEnum.OMDB_RD_LINK.code.toInt()) {
|
||||
@ -762,8 +799,9 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
|
||||
// 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
||||
if (currentConfig.code == DataCodeEnum.OMDB_RD_LINK.code.toInt()) {
|
||||
importConfig.preProcess.cacheRdLink =
|
||||
listResult.associateBy { it.properties["linkPid"] }
|
||||
// importConfig.preProcess.cacheRdLink =
|
||||
// listResult.associateBy { it.properties["linkPid"] }
|
||||
// 将sNodeId和eNodeId放在外层关联对象中,优化查询效率
|
||||
}
|
||||
// 1个文件发送一次flow流
|
||||
emit("${processIndex}/${tableNum}")
|
||||
@ -774,30 +812,33 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
)
|
||||
elementIndex = 0
|
||||
tableImportTime = System.currentTimeMillis()
|
||||
if (insertIndex % 20000 == 0) {
|
||||
if (insertIndex % 20000 == 0 || currentEntry.value.table == DataCodeEnum.OMDB_RD_LINK.name) {
|
||||
Log.d(
|
||||
"ImportOMDBHelper",
|
||||
"表解析===结束用时时间===事物开始"
|
||||
)
|
||||
Realm.getInstance(currentInstallTaskConfig).commitTransaction()
|
||||
Realm.getInstance(currentInstallTaskConfig).beginTransaction()
|
||||
realm.commitTransaction()
|
||||
realm.refresh()
|
||||
realm.beginTransaction()
|
||||
Log.d(
|
||||
"ImportOMDBHelper",
|
||||
"表解析===结束用时时间===事物结束"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Realm.getInstance(currentInstallTaskConfig).commitTransaction()
|
||||
Realm.getInstance(currentInstallTaskConfig).close()
|
||||
realm.commitTransaction()
|
||||
realm.close()
|
||||
Log.d(
|
||||
"ImportOMDBHelper",
|
||||
"表解析===结束用时时间${(System.currentTimeMillis() - dataImportTime)}===$dataIndex===插入$insertIndex"
|
||||
)
|
||||
Log.e("qj", "安装结束")
|
||||
} catch (e: Exception) {
|
||||
if (Realm.getInstance(currentInstallTaskConfig).isInTransaction) {
|
||||
Realm.getInstance(currentInstallTaskConfig).cancelTransaction()
|
||||
if (realm.isInTransaction) {
|
||||
realm.cancelTransaction()
|
||||
realm.close()
|
||||
}
|
||||
throw e
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.navinfo.omqs.db
|
||||
|
||||
import android.util.Log
|
||||
import com.navinfo.collect.library.data.entity.LinkRelation
|
||||
import com.navinfo.collect.library.data.entity.ReferenceEntity
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.omqs.Constant
|
||||
import io.realm.Realm
|
||||
@ -13,19 +15,33 @@ import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.locationtech.jts.io.WKTWriter
|
||||
import org.oscim.core.GeoPoint
|
||||
import java.util.*
|
||||
|
||||
|
||||
class ImportPreProcess {
|
||||
val code2NameMap = Code2NameMap()
|
||||
lateinit var cacheRdLink: Map<String?, RenderEntity>
|
||||
// lateinit var cacheRdLink: Map<String?, RenderEntity>
|
||||
val defaultTranslateDistance = 3.0
|
||||
val testFlag: Boolean = false
|
||||
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]
|
||||
// // 根据linkIn和linkOut获取对应的link数据
|
||||
// val linkInEntity = cacheRdLink[linkInId]
|
||||
// val linkOutEntity = cacheRdLink[linkOutId]
|
||||
|
||||
// 根据linkIn和linkOut从数据库获取对应的link数据
|
||||
Realm.getInstance(Constant.currentInstallTaskConfig)
|
||||
.use { realm ->
|
||||
val linkInEntity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("code", DataCodeEnum.OMDB_RD_LINK.code)
|
||||
.and().equalTo("linkPid", linkInId)
|
||||
.findFirst()
|
||||
val linkOutEntity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("code", DataCodeEnum.OMDB_RD_LINK.code)
|
||||
.and().equalTo("linkPid", linkOutId)
|
||||
.findFirst()
|
||||
|
||||
Log.d(
|
||||
"checkCircleRoad",
|
||||
"LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")},LinkOutEntity: ${linkOutId}- ${
|
||||
@ -38,6 +54,7 @@ class ImportPreProcess {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@ -568,6 +585,29 @@ class ImportPreProcess {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过rdDirect对象向rdLink的relation字段
|
||||
* */
|
||||
fun addRdLinkDirect(renderEntity: RenderEntity) {
|
||||
// 尝试更新RD_link的relation记录中的方向字段
|
||||
val rdLinkEntity = queryRdLink(renderEntity.properties["linkPid"]!!)
|
||||
if (rdLinkEntity?.linkRelation == null) {
|
||||
rdLinkEntity?.linkRelation = LinkRelation()
|
||||
}
|
||||
rdLinkEntity?.linkRelation?.direct = renderEntity.properties["direct"]!!.toInt()
|
||||
Realm.getInstance(Constant.currentInstallTaskConfig).insertOrUpdate(rdLinkEntity)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定的Rdlink数据
|
||||
* */
|
||||
fun queryRdLink(rdLinkId: String): RenderEntity? {
|
||||
return Realm.getInstance(Constant.currentInstallTaskConfig).where(RenderEntity::class.java)
|
||||
.equalTo("code", DataCodeEnum.OMDB_RD_LINK.code)
|
||||
.and().equalTo("linkPid", rdLinkId)
|
||||
.findFirst()
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成电子眼对应的渲染名称
|
||||
* */
|
||||
|
@ -178,7 +178,8 @@ class RealmOperateHelper() {
|
||||
)
|
||||
val realm = getRealmDefaultInstance()
|
||||
try {
|
||||
val realmList = realm.where(HadLinkDvoBean::class.java).equalTo("taskId", taskId).findAll()
|
||||
val realmList =
|
||||
realm.where(HadLinkDvoBean::class.java).equalTo("taskId", taskId).findAll()
|
||||
var linkBean: HadLinkDvoBean? = null
|
||||
var nearLast: Double = 99999.99
|
||||
for (link in realmList) {
|
||||
@ -333,7 +334,7 @@ class RealmOperateHelper() {
|
||||
val result = mutableListOf<RenderEntity>()
|
||||
val realmList = getSelectTaskRealmTools(realm, RenderEntity::class.java, false)
|
||||
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
|
||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
||||
.equalTo("linkPid", linkPid)
|
||||
.findAll()
|
||||
result.addAll(realm.copyFromRealm(realmList))
|
||||
return result
|
||||
|
@ -8,10 +8,13 @@ import android.widget.Toast
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.blankj.utilcode.util.FileIOUtils
|
||||
import com.blankj.utilcode.util.ResourceUtils
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.navinfo.collect.library.data.entity.LinkRelation
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
@ -27,6 +30,8 @@ import com.navinfo.omqs.util.DateTimeUtil
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
import io.realm.RealmMigration
|
||||
import io.realm.RealmSchema
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
@ -432,7 +437,8 @@ class LoginViewModel @Inject constructor(
|
||||
.name("OMQS.realm")
|
||||
.encryptionKey(Constant.PASSWORD)
|
||||
// .allowQueriesOnUiThread(true)
|
||||
.schemaVersion(2)
|
||||
.schemaVersion(3)
|
||||
// .migration(migration)
|
||||
.build()
|
||||
Realm.setDefaultConfiguration(config)
|
||||
// 拷贝配置文件到用户目录下
|
||||
@ -458,4 +464,17 @@ class LoginViewModel @Inject constructor(
|
||||
private fun byteArrayToHexString(byteArray: ByteArray): String {
|
||||
return byteArray.joinToString("") { "%02x".format(it) }
|
||||
}
|
||||
|
||||
val migration : RealmMigration = RealmMigration {
|
||||
realm, oldVersion, newVersion -> {
|
||||
if (oldVersion == 2L && newVersion == 3L) {
|
||||
// DynamicRealm exposes an editable schema
|
||||
val schema: RealmSchema = realm.schema
|
||||
if (!schema.get("RenderEntity")!!.hasField("linkPid")) {
|
||||
schema.get("RenderEntity")
|
||||
?.addField("linkPid", String::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -852,8 +852,12 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
val newLineString = GeometryTools.createLineString(linePoints)
|
||||
linkId?.let {
|
||||
val time = System.currentTimeMillis()
|
||||
val elementList = realmOperateHelper.queryLinkByLinkPid(realm, it)
|
||||
Log.e("jingo", "捕捉到数据 ${elementList.size} 个")
|
||||
Log.e(
|
||||
"jingo",
|
||||
"捕捉到数据 ${elementList.size} 个 ${System.currentTimeMillis() - time}"
|
||||
)
|
||||
for (element in elementList) {
|
||||
if (element.code == DataCodeEnum.OMDB_LINK_NAME.code) {
|
||||
hisRoadName = true
|
||||
|
@ -182,7 +182,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
||||
// 定位到指定位置
|
||||
niMapController.mMapView.vtmMap.animator()
|
||||
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
|
||||
.animateTo(GeoPoint(40.07245537956604, 116.239638575623))
|
||||
.animateTo(GeoPoint(40.0882756, 116.3033581))
|
||||
}
|
||||
|
||||
R.id.personal_center_menu_open_all_layer -> {
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.navinfo.collect.library.data.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import io.realm.RealmDictionary
|
||||
import io.realm.RealmObject
|
||||
import io.realm.RealmSet
|
||||
import io.realm.annotations.Ignore
|
||||
import io.realm.annotations.Index
|
||||
import io.realm.annotations.PrimaryKey
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.oscim.core.MercatorProjection
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* 渲染要素对应的实体
|
||||
* */
|
||||
@Parcelize
|
||||
open class LinkRelation() : RealmObject(), Parcelable {
|
||||
@PrimaryKey
|
||||
var linkPid:String = UUID.randomUUID().toString()
|
||||
@Index
|
||||
var sNodeId: String? = null
|
||||
@Index
|
||||
var eNodeId: String? = null
|
||||
|
||||
var direct: Int = 0
|
||||
|
||||
constructor(direct: Int) : this() {
|
||||
this.direct = direct
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import io.realm.RealmDictionary
|
||||
import io.realm.RealmObject
|
||||
import io.realm.RealmSet
|
||||
import io.realm.annotations.Ignore
|
||||
import io.realm.annotations.Index
|
||||
import io.realm.annotations.PrimaryKey
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
@ -64,7 +65,9 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
||||
return field
|
||||
}
|
||||
var properties: RealmDictionary<String> = RealmDictionary()
|
||||
@Ignore
|
||||
var tileX: RealmSet<Int> = RealmSet() // x方向的tile编码
|
||||
@Ignore
|
||||
var tileY: RealmSet<Int> = RealmSet() // y方向的tile编码
|
||||
var tileXMin:Int =0
|
||||
var tileXMax:Int = 0
|
||||
@ -75,6 +78,9 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
||||
var zoomMax: Int = 23 //显示最大级别
|
||||
var enable:Int = 0 // 默认0不是显示 1为渲染显示 2为常显
|
||||
var catchEnable:Int = 0 // 0不捕捉 1捕捉
|
||||
@Index
|
||||
lateinit var linkPid: String // RenderEntity关联的linkPid集合(可能会关联多个)
|
||||
var linkRelation: LinkRelation? = null
|
||||
|
||||
constructor(name: String) : this() {
|
||||
this.name = name
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.navinfo.collect.library.map.source;
|
||||
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
|
||||
import org.oscim.map.Viewport;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.OverzoomTileDataSource;
|
||||
|
||||
public class OMDBReferenceTileSource extends RealmDBTileSource {
|
||||
private OMDBReferenceDataSource omdbReferenceTileSource;
|
||||
@ -18,7 +15,8 @@ public class OMDBReferenceTileSource extends RealmDBTileSource {
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
//return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM);
|
||||
return new OverzoomTileDataSource(omdbReferenceTileSource, Constant.OVER_ZOOM);
|
||||
// return new OverzoomTileDataSource(omdbReferenceTileSource, Constant.OVER_ZOOM);
|
||||
return omdbReferenceTileSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,11 +3,9 @@ package com.navinfo.collect.library.map.source;
|
||||
import android.util.Log;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
|
||||
import org.oscim.map.Viewport;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.OverzoomTileDataSource;
|
||||
|
||||
import io.realm.Realm;
|
||||
|
||||
@ -23,7 +21,8 @@ public class OMDBTileSource extends RealmDBTileSource {
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
// return new OverzoomTileDataSource(new OMDBTileDataSource(), Constant.OVER_ZOOM);
|
||||
return new OverzoomTileDataSource(omdbTileDataSource, Constant.OVER_ZOOM);
|
||||
// return new OverzoomTileDataSource(omdbTileDataSource, Constant.OVER_ZOOM);
|
||||
return omdbTileDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
2
vtm
2
vtm
@ -1 +1 @@
|
||||
Subproject commit c046e788f5c739612a31c308639fca2de639669a
|
||||
Subproject commit 6a6bb9ab5eaf6bb4c05b3110c612c32ef4c6ef3d
|
Loading…
x
Reference in New Issue
Block a user