修改realm事物存储逻辑,解决OOM问题
This commit is contained in:
parent
dbe81f5bde
commit
30822c7937
@ -490,6 +490,7 @@
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20,
|
||||
"catch":false,
|
||||
"checkLinkId": false,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.navinfo.omqs
|
||||
|
||||
import com.navinfo.collect.library.utils.MapParamUtils
|
||||
import com.navinfo.omqs.bean.ImportConfig
|
||||
import io.realm.RealmConfiguration
|
||||
import java.io.File
|
||||
|
||||
class Constant {
|
||||
companion object {
|
||||
@ -37,6 +40,30 @@ class Constant {
|
||||
*/
|
||||
lateinit var USER_DATA_PATH: String
|
||||
|
||||
/**
|
||||
* 当前安装任务
|
||||
*/
|
||||
lateinit var installTaskid: String
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
val PASSWORD = "encryp".encodeToByteArray().copyInto(ByteArray(64))
|
||||
|
||||
/**
|
||||
* 当前安装的任务文件
|
||||
*/
|
||||
lateinit var currentInstallTaskFolder:File
|
||||
|
||||
lateinit var currentInstallTaskConfig:RealmConfiguration
|
||||
|
||||
/**
|
||||
* 当前选择的任务
|
||||
*/
|
||||
lateinit var currentSelectTaskFolder:File
|
||||
|
||||
lateinit var currentSelectTaskConfig:RealmConfiguration
|
||||
|
||||
/**
|
||||
* 用户附件数据目录
|
||||
*/
|
||||
@ -62,6 +89,8 @@ class Constant {
|
||||
*/
|
||||
var INDOOR_IP: String = ""
|
||||
|
||||
|
||||
|
||||
const val DEBUG = true
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.navinfo.omqs.bean
|
||||
|
||||
import android.util.Log
|
||||
import com.google.gson.annotations.Expose
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.omqs.db.ImportPreProcess
|
||||
@ -20,8 +21,10 @@ class ImportConfig {
|
||||
fun transformProperties(renderEntity: RenderEntity): RenderEntity? {
|
||||
val transformList = tableMap[renderEntity.code.toString()]?.transformer
|
||||
if (transformList.isNullOrEmpty()) {
|
||||
Log.e("qj", "子表转换为空===${renderEntity.code}")
|
||||
return renderEntity
|
||||
}
|
||||
Log.e("qj", "子表转换不为空===${renderEntity.code}")
|
||||
for (transform in transformList) {
|
||||
// 开始执行转换
|
||||
val key:String = transform.k
|
||||
|
@ -15,12 +15,16 @@ import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.Constant.Companion.currentInstallTaskConfig
|
||||
import com.navinfo.omqs.Constant.Companion.currentInstallTaskFolder
|
||||
import com.navinfo.omqs.Constant.Companion.installTaskid
|
||||
import com.navinfo.omqs.bean.ImportConfig
|
||||
import com.navinfo.omqs.db.deep.LinkList
|
||||
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedInject
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
@ -139,7 +143,18 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
* */
|
||||
suspend fun importOmdbZipFile(omdbZipFile: File, task: TaskBean): Flow<String> =
|
||||
withContext(Dispatchers.IO) {
|
||||
installTaskid = task.id.toString()
|
||||
currentInstallTaskFolder = File(Constant.USER_DATA_PATH + "/$installTaskid")
|
||||
if (!currentInstallTaskFolder.exists()) currentInstallTaskFolder.mkdirs()
|
||||
currentInstallTaskConfig = RealmConfiguration.Builder()
|
||||
.directory(currentInstallTaskFolder)
|
||||
.name("OMQS.realm")
|
||||
.encryptionKey(Constant.PASSWORD)
|
||||
.allowQueriesOnUiThread(true)
|
||||
.schemaVersion(2)
|
||||
.build()
|
||||
val unZipFolder = File(omdbZipFile.parentFile, "result")
|
||||
|
||||
flow {
|
||||
if (unZipFolder.exists()) {
|
||||
unZipFolder.deleteRecursively()
|
||||
@ -151,11 +166,13 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
// 先获取当前配置的所有图层的个数,方便后续计算数据解析进度
|
||||
var tableNum = 0
|
||||
var processIndex = 0
|
||||
var dataIndex = 0
|
||||
|
||||
Realm.getInstance(currentInstallTaskConfig).beginTransaction()
|
||||
|
||||
for (importConfig in importConfigList) {
|
||||
tableNum += importConfig.tableMap.size
|
||||
}
|
||||
|
||||
|
||||
//缓存任务link信息,便于下面与数据进行任务link匹配
|
||||
val hashMap: HashMap<String, HadLinkDvoBean> =
|
||||
HashMap<String, HadLinkDvoBean>() //define empty hashmap
|
||||
@ -165,19 +182,17 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
|
||||
val resHashMap: HashMap<String, RenderEntity> =
|
||||
HashMap<String, RenderEntity>() //define empty hashmap
|
||||
try {
|
||||
// 遍历解压后的文件,读取该数据返回
|
||||
for (importConfig in importConfigList) {
|
||||
|
||||
// 遍历解压后的文件,读取该数据返回
|
||||
for (importConfig in importConfigList) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
try {
|
||||
for ((index, currentEntry) in importConfig.tableMap.entries.withIndex()) {
|
||||
realm.beginTransaction()
|
||||
val listResult = mutableListOf<RenderEntity>()
|
||||
val currentConfig = currentEntry.value
|
||||
val txtFile = unZipFiles.find {
|
||||
it.name == currentConfig.table
|
||||
}
|
||||
// 将listResult数据插入到Realm数据库中
|
||||
// val listResult = mutableListOf<RenderEntity>()
|
||||
currentConfig?.let {
|
||||
val list = FileIOUtils.readFile2List(txtFile, "UTF-8")
|
||||
Log.d("ImportOMDBHelper", "开始解析:${txtFile?.name}")
|
||||
@ -201,7 +216,6 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
map["qi_zoomMax"] = currentConfig.zoomMax
|
||||
|
||||
// 先查询这个mesh下有没有数据,如果有则跳过即可
|
||||
// val meshEntity = Realm.getDefaultInstance().where(RenderEntity::class.java).equalTo("properties['mesh']", map["mesh"].toString()).findFirst()
|
||||
val renderEntity = RenderEntity()
|
||||
renderEntity.code = map["qi_code"].toString()
|
||||
renderEntity.name = map["qi_name"].toString()
|
||||
@ -318,28 +332,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) {
|
||||
@ -367,68 +381,52 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
} else if (renderEntity.code == DataCodeEnum.OMDB_INTERSECTION.code && renderEntity.properties.containsKey(
|
||||
"linkList"
|
||||
)
|
||||
) {
|
||||
}else if(renderEntity.code == DataCodeEnum.OMDB_INTERSECTION.code && renderEntity.properties.containsKey("linkList")){
|
||||
|
||||
if (renderEntity.properties["linkList"] != null) {
|
||||
|
||||
Log.e(
|
||||
"qj",
|
||||
"linkList==开始${renderEntity.name}==${renderEntity.properties["linkList"]}}"
|
||||
)
|
||||
Log.e("qj", "linkList==开始${renderEntity.name}==${renderEntity.properties["linkList"]}}")
|
||||
|
||||
val linkList =
|
||||
renderEntity.properties["linkList"]
|
||||
val linkList = renderEntity.properties["linkList"]
|
||||
|
||||
if (!linkList.isNullOrEmpty() && linkList != "null") {
|
||||
if (!linkList.isNullOrEmpty()&&linkList!="null") {
|
||||
|
||||
Log.e(
|
||||
"qj",
|
||||
"linkList==${renderEntity.name}==${renderEntity.properties["linkList"]}}"
|
||||
)
|
||||
Log.e("qj", "linkList==${renderEntity.name}==${renderEntity.properties["linkList"]}}")
|
||||
|
||||
val list: List<LinkList> = gson.fromJson(
|
||||
linkList,
|
||||
object :
|
||||
TypeToken<List<LinkList>>() {}.type
|
||||
)
|
||||
val list: List<LinkList> = gson.fromJson(linkList, object : TypeToken<List<LinkList>>() {}.type)
|
||||
|
||||
if (list != null) {
|
||||
m@ for (link in list) {
|
||||
m@for (link in list){
|
||||
if (hashMap.containsKey(link.linkPid)) {
|
||||
renderEntity.enable = 1
|
||||
Log.e("qj", "${renderEntity.name}==包括任务link")
|
||||
break@m
|
||||
Log.e(
|
||||
"qj",
|
||||
"${renderEntity.name}==包括任务link"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
renderEntity.enable = 2
|
||||
Log.e("qj", "简单路口")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
renderEntity.enable = 2
|
||||
}
|
||||
|
||||
//过滤掉非任务路线上的数据
|
||||
if (renderEntity.enable != 1) {
|
||||
Log.e(
|
||||
"qj",
|
||||
"${renderEntity.name}==不包括任务linkPid"
|
||||
"${renderEntity.name}==过滤不包括任务路线上的数据"
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
} else {
|
||||
renderEntity.enable = 2
|
||||
Log.e("qj", "${renderEntity.name}==不包括任务linkPid")
|
||||
}
|
||||
|
||||
// 对renderEntity做预处理后再保存
|
||||
val resultEntity =
|
||||
importConfig.transformProperties(renderEntity)
|
||||
val resultEntity = importConfig.transformProperties(renderEntity)
|
||||
|
||||
if (resultEntity != null) {
|
||||
|
||||
if (currentConfig.catch) {
|
||||
renderEntity.catchEnable = 0
|
||||
} else {
|
||||
@ -610,25 +608,41 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
renderEntity.properties["startTime"] = "null"
|
||||
}
|
||||
}
|
||||
// listResult.add(renderEntity)
|
||||
realm.insert(renderEntity)
|
||||
++dataIndex
|
||||
Log.e("qj", "统计==${dataIndex}")
|
||||
|
||||
//移除该字段,减少数据量
|
||||
if(renderEntity.properties.containsKey("geometry")){
|
||||
renderEntity.properties.remove("geometry")
|
||||
}
|
||||
|
||||
Realm.getInstance(currentInstallTaskConfig).insert(renderEntity)
|
||||
}
|
||||
|
||||
listResult.add(renderEntity)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
||||
// if (currentConfig.table == "OMDB_RD_LINK") {
|
||||
// importConfig.preProcess.cacheRdLink =
|
||||
// listResult.associateBy { it.properties["linkPid"] }
|
||||
// }
|
||||
realm.commitTransaction()
|
||||
|
||||
// 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
||||
if (currentConfig.table == "OMDB_RD_LINK") {
|
||||
importConfig.preProcess.cacheRdLink =
|
||||
listResult.associateBy { it.properties["linkPid"] }
|
||||
}
|
||||
// 1个文件发送一次flow流
|
||||
emit("${++processIndex}/${tableNum}")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
realm.cancelTransaction()
|
||||
throw e
|
||||
|
||||
}
|
||||
Realm.getInstance (currentInstallTaskConfig).commitTransaction()
|
||||
Realm.getInstance(currentInstallTaskConfig).close()
|
||||
Log.e("qj", "安装结束")
|
||||
} catch (e: Exception) {
|
||||
if (Realm.getInstance(currentInstallTaskConfig).isInTransaction) {
|
||||
Realm.getInstance(currentInstallTaskConfig).cancelTransaction()
|
||||
}
|
||||
throw e
|
||||
}
|
||||
emit("finish")
|
||||
}
|
||||
|
@ -4,7 +4,9 @@ import android.util.Log
|
||||
import com.navinfo.collect.library.data.entity.ReferenceEntity
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.omqs.Constant
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.locationtech.jts.algorithm.Angle
|
||||
@ -18,25 +20,25 @@ class ImportPreProcess {
|
||||
val code2NameMap = Code2NameMap()
|
||||
lateinit var cacheRdLink: Map<String?, RenderEntity>
|
||||
val defaultTranslateDistance = 3.0
|
||||
val testFlag:Boolean = true
|
||||
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]
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -45,7 +47,7 @@ class ImportPreProcess {
|
||||
* @param direction 判断当前数据是否为逆向,给定的应该是一个a=b的表达式,a为对应的properties的key,b为对应的值
|
||||
* */
|
||||
fun translateRight(renderEntity: RenderEntity, direction: String = "") {
|
||||
if(testFlag){
|
||||
if (testFlag) {
|
||||
return
|
||||
}
|
||||
// 获取当前renderEntity的geometry
|
||||
@ -55,7 +57,8 @@ class ImportPreProcess {
|
||||
// 如果数据属性中存在angle,则使用该值,否则需要根据line中的数据进行计算
|
||||
if (renderEntity?.properties?.get(
|
||||
"angle"
|
||||
)!=null) {
|
||||
) != null
|
||||
) {
|
||||
var angle = renderEntity?.properties?.get("angle")?.toDouble()!!
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = -((450 - angle) % 360)
|
||||
@ -112,7 +115,7 @@ class ImportPreProcess {
|
||||
* 向方向对应的反方向偏移
|
||||
* */
|
||||
fun translateBack(renderEntity: RenderEntity, direction: String = "") {
|
||||
if(testFlag){
|
||||
if (testFlag) {
|
||||
return
|
||||
}
|
||||
// 获取当前renderEntity的geometry
|
||||
@ -173,7 +176,7 @@ class ImportPreProcess {
|
||||
* 生成偏移后数据的起终点参考线
|
||||
* */
|
||||
fun generateS2EReferenceLine(renderEntity: RenderEntity) {
|
||||
if(testFlag){
|
||||
if (testFlag) {
|
||||
return
|
||||
}
|
||||
// 获取当前renderEntity的geometry,该坐标为偏移后坐标,即为终点
|
||||
@ -207,7 +210,9 @@ class ImportPreProcess {
|
||||
GeometryTools.createLineString(arrayOf<Coordinate>(pointStart, pointEnd)).toString()
|
||||
startEndReference.properties["qi_table"] = renderEntity.table
|
||||
startEndReference.properties["type"] = "s_2_e"
|
||||
Realm.getDefaultInstance().insert(startEndReference)
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
listResult.add(startEndReference)
|
||||
insertData(listResult)
|
||||
}
|
||||
|
||||
fun generateS2EReferencePoint(
|
||||
@ -219,6 +224,7 @@ class ImportPreProcess {
|
||||
|
||||
val pointEnd = geometry!!.coordinates[geometry.numPoints - 1] // 获取这个geometry对应的结束点坐标
|
||||
val pointStart = geometry!!.coordinates[0] // 获取这个geometry对应的起点
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
// 将这个起终点的线记录在数据中
|
||||
val startReference = ReferenceEntity()
|
||||
@ -232,26 +238,31 @@ class ImportPreProcess {
|
||||
startReference.enable = renderEntity.enable
|
||||
|
||||
// 起点坐标
|
||||
startReference.geometry = GeometryTools.createGeometry(GeoPoint(pointStart.y, pointStart.x)).toString()
|
||||
startReference.geometry =
|
||||
GeometryTools.createGeometry(GeoPoint(pointStart.y, pointStart.x)).toString()
|
||||
startReference.properties["qi_table"] = renderEntity.table
|
||||
Log.e("qj","generateS2EReferencePoint===$table===$proKey")
|
||||
Log.e("qj", "generateS2EReferencePoint===$table===$proKey")
|
||||
if (renderEntity.table == table) {
|
||||
Log.e("qj","generateS2EReferencePoint===开始")
|
||||
Log.e("qj", "generateS2EReferencePoint===开始")
|
||||
if (renderEntity.properties.containsKey(proKey)) {
|
||||
if(renderEntity.properties[proKey]!=""){
|
||||
if (renderEntity.properties[proKey] != "") {
|
||||
startReference.properties["type"] = "s_2_p_${renderEntity.properties[proKey]}"
|
||||
}else{
|
||||
} else {
|
||||
startReference.properties["type"] = "s_2_p_0"
|
||||
}
|
||||
Log.e("qj","generateS2EReferencePoint===s_2_p_${renderEntity.properties[proKey]}")
|
||||
Log.e("qj", "generateS2EReferencePoint===s_2_p_${renderEntity.properties[proKey]}")
|
||||
}
|
||||
} else {
|
||||
startReference.properties["type"] = "s_2_p"
|
||||
Log.e("qj","generateS2EReferencePoint===s_2_p${renderEntity.name}")
|
||||
Log.e("qj", "generateS2EReferencePoint===s_2_p${renderEntity.name}")
|
||||
}
|
||||
startReference.properties["geometry"] = startReference.geometry
|
||||
|
||||
Realm.getDefaultInstance().insert(startReference)
|
||||
Log.e("qj", "generateS2EReferencePoint===${startReference.geometry}")
|
||||
|
||||
startReference.properties["geometry"] = startReference.geometry
|
||||
listResult.add(startReference)
|
||||
|
||||
Log.e("qj", "generateS2EReferencePoint===1")
|
||||
|
||||
val endReference = ReferenceEntity()
|
||||
endReference.renderEntityId = renderEntity.id
|
||||
@ -263,23 +274,30 @@ class ImportPreProcess {
|
||||
endReference.taskId = renderEntity.taskId
|
||||
endReference.enable = renderEntity.enable
|
||||
|
||||
Log.e("qj", "generateS2EReferencePoint===2")
|
||||
|
||||
// 终点坐标
|
||||
endReference.geometry = GeometryTools.createGeometry(GeoPoint(pointEnd.y, pointEnd.x)).toString()
|
||||
endReference.geometry =
|
||||
GeometryTools.createGeometry(GeoPoint(pointEnd.y, pointEnd.x)).toString()
|
||||
Log.e("qj", "generateS2EReferencePoint===3")
|
||||
endReference.properties["qi_table"] = renderEntity.table
|
||||
if (renderEntity.table == table) {
|
||||
if (renderEntity.properties.containsKey(proKey)) {
|
||||
if(renderEntity.properties[proKey]!=""){
|
||||
if (renderEntity.properties[proKey] != "") {
|
||||
endReference.properties["type"] = "e_2_p_${renderEntity.properties[proKey]}"
|
||||
}else{
|
||||
} else {
|
||||
endReference.properties["type"] = "e_2_p_0"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
endReference.properties["type"] = "e_2_p"
|
||||
Log.e("qj","generateS2EReferencePoint===e_2_p${renderEntity.name}")
|
||||
Log.e("qj", "generateS2EReferencePoint===e_2_p${renderEntity.name}")
|
||||
}
|
||||
endReference.properties["geometry"] = endReference.geometry
|
||||
Realm.getDefaultInstance().insert(endReference)
|
||||
|
||||
listResult.add(endReference)
|
||||
Log.e("qj", "generateS2EReferencePoint===4")
|
||||
insertData(listResult)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -356,6 +374,7 @@ class ImportPreProcess {
|
||||
geometry?.coordinate?.y!!
|
||||
) * Math.sin(radian)
|
||||
}
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
for (pointStart in pointStartArray) {
|
||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
||||
@ -373,9 +392,9 @@ class ImportPreProcess {
|
||||
WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
|
||||
angleReference.properties["qi_table"] = renderEntity.table
|
||||
angleReference.properties["type"] = "angle"
|
||||
Realm.getDefaultInstance().insert(angleReference)
|
||||
listResult.add(angleReference)
|
||||
}
|
||||
|
||||
insertData(listResult)
|
||||
}
|
||||
|
||||
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
|
||||
@ -443,6 +462,7 @@ class ImportPreProcess {
|
||||
// 分别获取两个数组中的数据,取第一个作为主数据,另外两个作为辅助渲染数据
|
||||
val laneInfoDirectArray = JSONArray(laneinfoGroup[0].toString())
|
||||
val laneInfoTypeArray = JSONArray(laneinfoGroup[1].toString())
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
for (i in 0 until laneInfoDirectArray.length()) {
|
||||
// 根据后续的数据生成辅助表数据
|
||||
@ -461,12 +481,14 @@ class ImportPreProcess {
|
||||
laneInfoDirectArray[i].toString().split(",").distinct().joinToString("_")
|
||||
referenceEntity.properties["currentType"] =
|
||||
laneInfoTypeArray[i].toString()
|
||||
val type = if (referenceEntity.properties["currentType"]=="0") "normal" else if (referenceEntity.properties["currentType"]=="1") "extend" else "bus"
|
||||
val type =
|
||||
if (referenceEntity.properties["currentType"] == "0") "normal" else if (referenceEntity.properties["currentType"] == "1") "extend" else "bus"
|
||||
referenceEntity.properties["symbol"] =
|
||||
"assets:omdb/4601/${type}/1301_${referenceEntity.properties["currentDirect"]}.svg"
|
||||
Log.d("unpackingLaneInfo", referenceEntity.properties["symbol"].toString())
|
||||
Realm.getDefaultInstance().insert(referenceEntity)
|
||||
listResult.add(referenceEntity)
|
||||
}
|
||||
insertData(listResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -480,22 +502,22 @@ class ImportPreProcess {
|
||||
|
||||
var type = renderEntity.properties["sa"]
|
||||
|
||||
if(type!=null&&type=="1"){
|
||||
if (type != null && type == "1") {
|
||||
renderEntity.properties["name"] = "SA"
|
||||
renderEntity.properties["type"] = "1"
|
||||
}else{
|
||||
} else {
|
||||
type = renderEntity.properties["pa"]
|
||||
if(type!=null&&type=="1"){
|
||||
if (type != null && type == "1") {
|
||||
renderEntity.properties["type"] = "2"
|
||||
Log.e("qj","generateRoadText===2")
|
||||
} else{
|
||||
Log.e("qj", "generateRoadText===2")
|
||||
} else {
|
||||
type = renderEntity.properties["frontage"]
|
||||
if(type!=null&&type=="1"){
|
||||
if (type != null && type == "1") {
|
||||
renderEntity.properties["name"] = "FRONTAGE"
|
||||
renderEntity.properties["type"] = "3"
|
||||
}else{
|
||||
} else {
|
||||
type = renderEntity.properties["mainSideAccess"]
|
||||
if(type!=null&&type=="1"){
|
||||
if (type != null && type == "1") {
|
||||
renderEntity.properties["name"] = "MAIN"
|
||||
renderEntity.properties["type"] = "4"
|
||||
}
|
||||
@ -568,7 +590,9 @@ class ImportPreProcess {
|
||||
angleReference.zoomMax = renderEntity.zoomMax
|
||||
angleReference.taskId = renderEntity.taskId
|
||||
angleReference.enable = renderEntity.enable
|
||||
Realm.getDefaultInstance().insert(angleReference)
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
listResult.add(angleReference)
|
||||
insertData(listResult)
|
||||
}
|
||||
|
||||
|
||||
@ -579,6 +603,8 @@ class ImportPreProcess {
|
||||
// 路口数据的其他点位,是保存在nodeList对应的数组下
|
||||
if (renderEntity.properties.containsKey("nodeList")) {
|
||||
val nodeListJsonArray: JSONArray = JSONArray(renderEntity.properties["nodeList"])
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
for (i in 0 until nodeListJsonArray.length()) {
|
||||
val nodeJSONObject = nodeListJsonArray.getJSONObject(i)
|
||||
val intersectionReference = ReferenceEntity()
|
||||
@ -595,10 +621,12 @@ class ImportPreProcess {
|
||||
GeometryTools.createGeometry(nodeJSONObject["geometry"].toString()).toString()
|
||||
intersectionReference.properties["qi_table"] = renderEntity.table
|
||||
intersectionReference.properties["type"] = "node"
|
||||
Realm.getDefaultInstance().insert(intersectionReference)
|
||||
listResult.add(intersectionReference)
|
||||
}
|
||||
insertData(listResult)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成默认路口数据的参考数据
|
||||
* */
|
||||
@ -641,7 +669,12 @@ class ImportPreProcess {
|
||||
// renderEntity.geometry =
|
||||
// WKTWriter(3).write(GeometryTools.createLineString(geometry.coordinates))
|
||||
|
||||
renderEntity.geometry = GeometryTools.createGeometry(GeoPoint(geometry.coordinates[0].y, geometry.coordinates[0].x)).toString()
|
||||
renderEntity.geometry = GeometryTools.createGeometry(
|
||||
GeoPoint(
|
||||
geometry.coordinates[0].y,
|
||||
geometry.coordinates[0].x
|
||||
)
|
||||
).toString()
|
||||
}
|
||||
}
|
||||
|
||||
@ -680,7 +713,12 @@ class ImportPreProcess {
|
||||
* @param suffix 图片的后缀(根据codeName获取到的code后,匹配图片的后缀,还包含code码后的其他字符串内容)
|
||||
* @param codeName 数据对应的code字段的字段名
|
||||
* */
|
||||
fun obtainReferenceDynamicSrc(renderEntity: RenderEntity, prefix: String, suffix: String, codeName: String) {
|
||||
fun obtainReferenceDynamicSrc(
|
||||
renderEntity: RenderEntity,
|
||||
prefix: String,
|
||||
suffix: String,
|
||||
codeName: String
|
||||
) {
|
||||
if (codeName.isNullOrBlank()) {
|
||||
return
|
||||
}
|
||||
@ -731,6 +769,7 @@ class ImportPreProcess {
|
||||
defaultTranslateDistance,
|
||||
geometry?.coordinate?.y!!
|
||||
) * Math.sin(radian)
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
for (pointStart in pointStartArray) {
|
||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
||||
@ -750,14 +789,29 @@ class ImportPreProcess {
|
||||
dynamicSrcReference.properties["type"] = "dynamicSrc"
|
||||
val code = renderEntity.properties[codeName]
|
||||
dynamicSrcReference.properties["src"] = "${prefix}${code}${suffix}"
|
||||
Realm.getDefaultInstance().insert(dynamicSrcReference)
|
||||
listResult.add(dynamicSrcReference)
|
||||
}
|
||||
insertData(listResult)
|
||||
}
|
||||
|
||||
private fun insertData(list:List<ReferenceEntity>){
|
||||
Log.e("qj", "子表插入==")
|
||||
if(list!=null&& list.isNotEmpty()){
|
||||
Log.e("qj", "子表插入开始==")
|
||||
Realm.getInstance(Constant.currentInstallTaskConfig).insert(list)
|
||||
Log.e("qj", "子表插入结束==")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向当前renderEntity中添加动态属性
|
||||
* */
|
||||
fun obtainDynamicSrc(renderEntity: RenderEntity, prefix: String, suffix: String, codeName: String) {
|
||||
fun obtainDynamicSrc(
|
||||
renderEntity: RenderEntity,
|
||||
prefix: String,
|
||||
suffix: String,
|
||||
codeName: String
|
||||
) {
|
||||
val code = renderEntity.properties[codeName]
|
||||
renderEntity.properties["src"] = "${prefix}${code}${suffix}"
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import com.navinfo.collect.library.utils.MapParamUtils
|
||||
import com.navinfo.omqs.Constant
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmModel
|
||||
import io.realm.RealmQuery
|
||||
@ -61,9 +62,9 @@ class RealmOperateHelper() {
|
||||
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
||||
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||
// 查询realm中对应tile号的数据
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmList =
|
||||
getRealmTools(RenderEntity::class.java, false)
|
||||
getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||
.equalTo("table", "OMDB_RD_LINK")
|
||||
.greaterThanOrEqualTo("tileX", xStart)
|
||||
.lessThanOrEqualTo("tileX", xEnd)
|
||||
@ -72,6 +73,7 @@ class RealmOperateHelper() {
|
||||
.findAll()
|
||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||
val dataList = realm.copyFromRealm(realmList)
|
||||
realm.close()
|
||||
val queryResult = dataList?.stream()?.filter {
|
||||
polygon.intersects(it.wkt)
|
||||
}?.toList()
|
||||
@ -127,8 +129,8 @@ class RealmOperateHelper() {
|
||||
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
||||
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||
// 查询realm中对应tile号的数据
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realmList = getRealmTools(RenderEntity::class.java, true)
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmList = getSelectTaskRealmTools(RenderEntity::class.java, true)
|
||||
.equalTo("table", table)
|
||||
.greaterThanOrEqualTo("tileX", xStart)
|
||||
.lessThanOrEqualTo("tileX", xEnd)
|
||||
@ -169,34 +171,41 @@ class RealmOperateHelper() {
|
||||
buffer,
|
||||
bufferType
|
||||
)
|
||||
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realmList = getRealmTools(HadLinkDvoBean::class.java, false).findAll()
|
||||
var linkBean: HadLinkDvoBean? = null
|
||||
var nearLast: Double = 99999.99
|
||||
for (link in realmList) {
|
||||
if (polygon.intersects(GeometryTools.createGeometry(link.geometry))) {
|
||||
val near = point.distance(GeometryTools.createGeoPoint(link.geometry))
|
||||
if (near < nearLast) {
|
||||
nearLast = near
|
||||
linkBean = link
|
||||
try{
|
||||
val realmList = getRealmTools(HadLinkDvoBean::class.java).findAll()
|
||||
var linkBean: HadLinkDvoBean? = null
|
||||
var nearLast: Double = 99999.99
|
||||
for (link in realmList) {
|
||||
if (polygon.intersects(GeometryTools.createGeometry(link.geometry))) {
|
||||
val near = point.distance(GeometryTools.createGeoPoint(link.geometry))
|
||||
if (near < nearLast) {
|
||||
nearLast = near
|
||||
linkBean = link
|
||||
}
|
||||
}
|
||||
}
|
||||
if (linkBean != null)
|
||||
return realm.copyFromRealm(linkBean)
|
||||
}catch (e:Exception){
|
||||
|
||||
}finally {
|
||||
realm.close()
|
||||
}
|
||||
if (linkBean != null)
|
||||
return realm.copyFromRealm(linkBean)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
suspend fun queryLink(linkPid: String): RenderEntity? {
|
||||
var link: RenderEntity? = null
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmR =
|
||||
getRealmTools(RenderEntity::class.java, true).equalTo("table", "OMDB_RD_LINK")
|
||||
getSelectTaskRealmTools(RenderEntity::class.java, true).equalTo("table", "OMDB_RD_LINK")
|
||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findFirst()
|
||||
if (realmR != null) {
|
||||
link = realm.copyFromRealm(realmR)
|
||||
}
|
||||
realm.close()
|
||||
return link
|
||||
}
|
||||
|
||||
@ -207,20 +216,21 @@ class RealmOperateHelper() {
|
||||
suspend fun queryQcRecordBean(markId: String): QsRecordBean? {
|
||||
var qsRecordBean: QsRecordBean? = null
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realmR = getRealmTools(QsRecordBean::class.java, false)
|
||||
val realmR = getRealmTools(QsRecordBean::class.java)
|
||||
.equalTo("table", "QsRecordBean").equalTo("id", markId).findFirst()
|
||||
if (realmR != null) {
|
||||
qsRecordBean = realm.copyFromRealm(realmR)
|
||||
}
|
||||
realm.close()
|
||||
return qsRecordBean
|
||||
}
|
||||
|
||||
suspend fun queryLinkToMutableRenderEntityList(linkPid: String): MutableList<RenderEntity>? {
|
||||
val resultList = mutableListOf<RenderEntity>()
|
||||
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
|
||||
val realmR = getRealmTools(RenderEntity::class.java, true)
|
||||
val realmR = getSelectTaskRealmTools(RenderEntity::class.java, true)
|
||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findAll()
|
||||
|
||||
val dataList = realm.copyFromRealm(realmR)
|
||||
@ -229,6 +239,7 @@ class RealmOperateHelper() {
|
||||
resultList.add(it)
|
||||
}
|
||||
|
||||
realm.close()
|
||||
return resultList
|
||||
}
|
||||
|
||||
@ -261,11 +272,11 @@ class RealmOperateHelper() {
|
||||
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
||||
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
var realmList = mutableListOf<RenderEntity>()
|
||||
if(catchAll){
|
||||
// 查询realm中对应tile号的数据
|
||||
realmList = getRealmTools(RenderEntity::class.java, false)
|
||||
realmList = getSelectTaskRealmTools(RenderEntity::class.java,false)
|
||||
.greaterThanOrEqualTo("tileX", xStart)
|
||||
.lessThanOrEqualTo("tileX", xEnd)
|
||||
.greaterThanOrEqualTo("tileY", yStart)
|
||||
@ -273,7 +284,7 @@ class RealmOperateHelper() {
|
||||
.findAll()
|
||||
}else{
|
||||
// 查询realm中对应tile号的数据
|
||||
realmList = getRealmTools(RenderEntity::class.java, false)
|
||||
realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||
.lessThan("catchEnable", 1)
|
||||
.greaterThanOrEqualTo("tileX", xStart)
|
||||
.lessThanOrEqualTo("tileX", xEnd)
|
||||
@ -292,7 +303,7 @@ class RealmOperateHelper() {
|
||||
result.addAll(realm.copyFromRealm(it))
|
||||
}
|
||||
}
|
||||
|
||||
realm.close()
|
||||
return result
|
||||
}
|
||||
|
||||
@ -305,12 +316,13 @@ class RealmOperateHelper() {
|
||||
* */
|
||||
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
|
||||
val result = mutableListOf<RenderEntity>()
|
||||
val realm = getRealmDefaultInstance()
|
||||
val realmList = getRealmTools(RenderEntity::class.java, false)
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
|
||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
||||
.findAll()
|
||||
result.addAll(realm.copyFromRealm(realmList))
|
||||
realm.close()
|
||||
return result
|
||||
}
|
||||
|
||||
@ -381,34 +393,58 @@ class RealmOperateHelper() {
|
||||
return wkt
|
||||
}
|
||||
|
||||
|
||||
fun <E : RealmModel> getRealmTools(clazz: Class<E>, enableSql: Boolean): RealmQuery<E> {
|
||||
return if (MapParamUtils.getDataLayerEnum() != null) {
|
||||
|
||||
var sql = "taskId=${MapParamUtils.getTaskId()}"
|
||||
|
||||
if (enableSql) {
|
||||
sql =
|
||||
" enable${MapParamUtils.getDataLayerEnum().sql} and taskId=${MapParamUtils.getTaskId()}"
|
||||
}
|
||||
|
||||
getRealmDefaultInstance().where(clazz).rawPredicate(sql)
|
||||
|
||||
} else {
|
||||
getRealmDefaultInstance().where(clazz)
|
||||
.rawPredicate(" taskId=${MapParamUtils.getTaskId()}")
|
||||
}
|
||||
/**
|
||||
* 默认的数据库,用于存储任务、作业数据
|
||||
* @param clazz 查询表
|
||||
* @param enableSql
|
||||
* */
|
||||
fun <E : RealmModel> getRealmTools(clazz: Class<E>): RealmQuery<E> {
|
||||
return getRealmDefaultInstance().where(clazz)
|
||||
}
|
||||
|
||||
fun getRealmDefaultInstance(): Realm {
|
||||
if (isUpdate) {
|
||||
Log.e("jingo", "数据库更新")
|
||||
if(Realm.getDefaultInstance().isInTransaction){
|
||||
Realm.getDefaultInstance().cancelTransaction()
|
||||
Log.e("jingo", "数据库正在事物,需要退出当前事物")
|
||||
}
|
||||
Realm.getDefaultInstance().refresh()
|
||||
isUpdate = false;
|
||||
}
|
||||
return Realm.getDefaultInstance()
|
||||
}
|
||||
|
||||
|
||||
fun <E : RealmModel> getSelectTaskRealmTools(clazz: Class<E>, enableSql: Boolean): RealmQuery<E> {
|
||||
return if (MapParamUtils.getDataLayerEnum() != null) {
|
||||
|
||||
if (enableSql) {
|
||||
var sql =
|
||||
" enable${MapParamUtils.getDataLayerEnum().sql} }"
|
||||
getSelectTaskRealmInstance().where(clazz).rawPredicate(sql)
|
||||
}else{
|
||||
getSelectTaskRealmInstance().where(clazz)
|
||||
}
|
||||
|
||||
} else {
|
||||
getSelectTaskRealmInstance().where(clazz)
|
||||
}
|
||||
}
|
||||
|
||||
fun getSelectTaskRealmInstance(): Realm {
|
||||
if (isUpdate) {
|
||||
Log.e("jingo", "数据库更新")
|
||||
if(Realm.getInstance(Constant.currentSelectTaskConfig).isInTransaction){
|
||||
Realm.getInstance(Constant.currentSelectTaskConfig).cancelTransaction()
|
||||
Log.e("jingo", "数据库正在事物,需要退出当前事物")
|
||||
}
|
||||
Realm.getInstance(Constant.currentSelectTaskConfig).refresh()
|
||||
isUpdate = false;
|
||||
}
|
||||
return Realm.getInstance(Constant.currentSelectTaskConfig)
|
||||
}
|
||||
|
||||
fun updateRealmDefaultInstance() {
|
||||
isUpdate = true
|
||||
}
|
||||
|
@ -106,9 +106,10 @@ class TaskDownloadScope(
|
||||
downloadData.postValue(taskBean)
|
||||
if (status != FileDownloadStatus.LOADING && status != FileDownloadStatus.IMPORTING) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
realm.executeTransaction {
|
||||
it.insertOrUpdate(taskBean)
|
||||
}
|
||||
realm.beginTransaction()
|
||||
realm.insertOrUpdate(taskBean)
|
||||
realm.commitTransaction()
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,6 +143,7 @@ class TaskDownloadScope(
|
||||
Log.e("jingo", "数据安装 $it")
|
||||
if (it == "finish") {
|
||||
change(FileDownloadStatus.DONE)
|
||||
Log.e("jingo", "数据安装结束")
|
||||
withContext(Dispatchers.Main) {
|
||||
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ class TaskUploadScope(
|
||||
realm.executeTransaction {
|
||||
it.copyToRealmOrUpdate(taskBean)
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,7 +221,7 @@ class TaskUploadScope(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
realm.close()
|
||||
}
|
||||
|
||||
if (bodyList.size > 0) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.navinfo.omqs.ui.activity.login
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ActivityManager
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.DisplayMetrics
|
||||
@ -9,12 +11,15 @@ import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.ActivityLoginBinding
|
||||
import com.navinfo.omqs.ui.activity.CheckPermissionsActivity
|
||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* 登陆页面
|
||||
@ -72,36 +77,46 @@ class LoginActivity : CheckPermissionsActivity() {
|
||||
LoginStatus.LOGIN_STATUS_NET_LOADING -> {
|
||||
loginDialog("验证用户信息...")
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_FOLDER_INIT -> {
|
||||
loginDialog("检查本地数据...")
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_FOLDER_FAILURE -> {
|
||||
Toast.makeText(this, "文件夹初始化失败", Toast.LENGTH_SHORT).show()
|
||||
loginDialog?.dismiss()
|
||||
loginDialog = null
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_NET_FAILURE -> {
|
||||
Toast.makeText(this, "网络访问失败", Toast.LENGTH_SHORT).show()
|
||||
loginDialog?.dismiss()
|
||||
loginDialog = null
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_SUCCESS -> {
|
||||
loginDialog?.dismiss()
|
||||
loginDialog = null
|
||||
//Toast.makeText(this, "插入成功", Toast.LENGTH_SHORT).show()
|
||||
|
||||
val intent = Intent(this@LoginActivity, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_CANCEL -> {
|
||||
loginDialog?.dismiss()
|
||||
loginDialog = null
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP -> {
|
||||
loginDialog("检查离线地图...")
|
||||
}
|
||||
|
||||
LoginStatus.LOGIN_STATUS_NET_GET_TASK_LIST -> {
|
||||
loginDialog("获取任务列表...")
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@ -109,7 +124,6 @@ class LoginActivity : CheckPermissionsActivity() {
|
||||
private fun initView() {
|
||||
//登录校验,初始化成功
|
||||
viewModel.loginStatus.observe(this, loginObserve)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
@ -51,6 +51,7 @@ import com.navinfo.omqs.util.SoundMeter
|
||||
import com.navinfo.omqs.util.SpeakMode
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
import io.realm.RealmSet
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
@ -302,6 +303,9 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||
MapParamUtils.setTaskId(sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1))
|
||||
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH +"/${MapParamUtils.getTaskId()}")
|
||||
Constant.currentSelectTaskConfig = RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder).name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true).schemaVersion(2).build()
|
||||
MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig)
|
||||
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
||||
}
|
||||
|
||||
@ -316,6 +320,7 @@ class MainViewModel @Inject constructor(
|
||||
if (res != null) {
|
||||
currentTaskBean = realm.copyFromRealm(res)
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
|
||||
|
||||
@ -337,9 +342,10 @@ class MainViewModel @Inject constructor(
|
||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||
realm.executeTransaction {
|
||||
val objects =
|
||||
realmOperateHelper.getRealmTools(QsRecordBean::class.java, false).findAll()
|
||||
realmOperateHelper.getRealmTools(QsRecordBean::class.java).findAll()
|
||||
list = realm.copyFromRealm(objects)
|
||||
}
|
||||
realm.close()
|
||||
mapController.markerHandle.removeAllQsMarker()
|
||||
for (item in list) {
|
||||
mapController.markerHandle.addOrUpdateQsRecordMark(item)
|
||||
@ -354,11 +360,11 @@ class MainViewModel @Inject constructor(
|
||||
var list = mutableListOf<NoteBean>()
|
||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||
realm.executeTransaction {
|
||||
val objects = realmOperateHelper.getRealmTools(NoteBean::class.java, false).findAll()
|
||||
val objects = realmOperateHelper.getRealmTools(NoteBean::class.java).findAll()
|
||||
list = realm.copyFromRealm(objects)
|
||||
}
|
||||
|
||||
|
||||
realm.close()
|
||||
|
||||
for (item in list) {
|
||||
mapController.markerHandle.addOrUpdateNoteMark(item)
|
||||
@ -607,10 +613,10 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
}
|
||||
|
||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||
|
||||
val entity =
|
||||
realmOperateHelper.getRealmTools(RenderEntity::class.java, true)
|
||||
realmOperateHelper.getSelectTaskRealmTools(RenderEntity::class.java, true)
|
||||
.and()
|
||||
.equalTo("table", DataCodeEnum.OMDB_RESTRICTION.name)
|
||||
.and()
|
||||
@ -620,7 +626,7 @@ class MainViewModel @Inject constructor(
|
||||
if (entity != null) {
|
||||
val outLink = entity.properties["linkOut"]
|
||||
val linkOutEntity =
|
||||
realmOperateHelper.getRealmTools(RenderEntity::class.java, true)
|
||||
realmOperateHelper.getSelectTaskRealmTools(RenderEntity::class.java, true)
|
||||
.and()
|
||||
.equalTo("table", DataCodeEnum.OMDB_RD_LINK.name).and()
|
||||
.equalTo(
|
||||
@ -633,6 +639,7 @@ class MainViewModel @Inject constructor(
|
||||
)
|
||||
}
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||
|
@ -37,6 +37,7 @@ class ConsoleViewModel @Inject constructor() : ViewModel() {
|
||||
liveDataTaskCount.postValue(count.toInt())
|
||||
val count2 = realm.where(QsRecordBean::class.java).count()
|
||||
liveDataEvaluationResultCount.postValue(count2.toInt())
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
}
|
@ -162,7 +162,6 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
if (objects != null) {
|
||||
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
||||
}
|
||||
|
||||
//获取当前定位点
|
||||
val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint()
|
||||
//如果不是从面板进来的
|
||||
@ -204,6 +203,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
|
||||
getClassTypeList(bean)
|
||||
getProblemLinkList()
|
||||
realm.close()
|
||||
}
|
||||
addChatMsgEntity(filePath)
|
||||
}
|
||||
@ -412,6 +412,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
mapController.markerHandle.addOrUpdateQsRecordMark(liveDataQsRecordBean.value!!)
|
||||
liveDataFinish.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,6 +436,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
|
||||
mapController.mMapView.vtmMap.updateMap(true)
|
||||
liveDataFinish.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -495,6 +497,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
} else {
|
||||
liveDataToastMessage.postValue("数据读取失败")
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,6 +668,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
if (objects != null) {
|
||||
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
} else {
|
||||
liveDataFinish.postValue(true)
|
||||
|
@ -117,6 +117,7 @@ class NoteViewModel @Inject constructor(
|
||||
}
|
||||
mapController.markerHandle.addOrUpdateNoteMark(mNoteBean!!)
|
||||
liveDataFinish.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,6 +146,7 @@ class NoteViewModel @Inject constructor(
|
||||
}
|
||||
mapController.markerHandle.removeNoteMark(mNoteBean!!)
|
||||
liveDataFinish.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
mDialog.setNegativeButton("取消", null)
|
||||
@ -168,6 +170,7 @@ class NoteViewModel @Inject constructor(
|
||||
canvasView.setDrawPathList(list)
|
||||
}
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
}
|
@ -43,7 +43,6 @@ class PersonalCenterViewModel @Inject constructor(
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
suspend fun obtainOMDBZipData(importOMDBHelper: ImportOMDBHelper) {
|
||||
Log.d("OMQSApplication", "开始生成数据")
|
||||
// Realm.getDefaultInstance().beginTransaction()
|
||||
val gson = Gson()
|
||||
val hadLinkFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK.txt")
|
||||
val hadLinkKindFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_KIND.txt")
|
||||
@ -135,14 +134,7 @@ class PersonalCenterViewModel @Inject constructor(
|
||||
hadSpeedLimitVarFile, gson.toJson(hadSpeedlimitVar) + "\r", true
|
||||
)
|
||||
}
|
||||
// val properties = RealmDictionary<String?>()
|
||||
// for (entry in map.entries) {
|
||||
// properties.putIfAbsent(entry.key, entry.value.toString())
|
||||
// }
|
||||
|
||||
// // 将读取到的sqlite数据插入到Realm中
|
||||
// Realm.getDefaultInstance().insert(OMDBEntity(tableName, properties))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ZipUtils.zipFiles(
|
||||
|
@ -32,6 +32,7 @@ class QsRecordListViewModel @Inject constructor(
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val objects = realm.where(QsRecordBean::class.java).equalTo("taskId",taskId).findAll()
|
||||
liveDataQSList.postValue(realm.copyFromRealm(objects))
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,7 @@ class TaskLinkViewModel @Inject constructor(
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||
liveDataTaskBean.postValue(res?.let { realm.copyFromRealm(it) })
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,6 +235,7 @@ class TaskLinkViewModel @Inject constructor(
|
||||
.putString(Constant.SHARED_SYNC_TASK_LINK_ID, hadLinkDvoBean!!.linkPid)
|
||||
.apply()
|
||||
liveDataFinish.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,6 +304,7 @@ class TaskLinkViewModel @Inject constructor(
|
||||
mapController.measureLayerHandler.initPathLine(hadLinkDvoBean?.geometry!!)
|
||||
}
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,6 +357,7 @@ class TaskLinkViewModel @Inject constructor(
|
||||
mapController.lineHandler.removeTaskLink(hadLinkDvoBean!!.linkPid)
|
||||
mapController.mMapView.vtmMap.updateMap(true)
|
||||
liveDataFinish.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
mDialog.setNegativeButton("取消", null)
|
||||
|
@ -29,8 +29,10 @@ import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.util.DateTimeUtil
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
import kotlinx.coroutines.*
|
||||
import org.oscim.core.GeoPoint
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@ -143,6 +145,7 @@ class TaskViewModel @Inject constructor(
|
||||
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
|
||||
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||
mapController.mMapView.vtmMap.updateMap(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,6 +221,7 @@ class TaskViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
getLocalTaskList()
|
||||
}
|
||||
@ -262,6 +266,7 @@ class TaskViewModel @Inject constructor(
|
||||
FileManager.checkOMDBFileInfo(item)
|
||||
}
|
||||
liveDataTaskList.postValue(taskList)
|
||||
realm.close()
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
if (id > -1) {
|
||||
for (item in taskList) {
|
||||
@ -290,6 +295,9 @@ class TaskViewModel @Inject constructor(
|
||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||
showTaskLinks(taskBean)
|
||||
MapParamUtils.setTaskId(taskBean.id)
|
||||
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH +"/${MapParamUtils.getTaskId()}")
|
||||
Constant.currentSelectTaskConfig = RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder).name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true).schemaVersion(2).build()
|
||||
MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig)
|
||||
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||
mapController.mMapView.updateMap(true)
|
||||
|
||||
@ -383,6 +391,7 @@ class TaskViewModel @Inject constructor(
|
||||
realm.executeTransaction { r ->
|
||||
r.copyToRealmOrUpdate(it)
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
|
||||
}
|
||||
@ -399,6 +408,7 @@ class TaskViewModel @Inject constructor(
|
||||
val list = realm.where(TaskBean::class.java).contains("evaluationTaskName", key).or()
|
||||
.contains("dataVersion", key).or().contains("cityName", key).findAll()
|
||||
liveDataTaskList.postValue(realm.copyFromRealm(list))
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,6 +475,7 @@ class TaskViewModel @Inject constructor(
|
||||
}
|
||||
liveDataTaskList.postValue(taskList)
|
||||
liveDataCloseTask.postValue(true)
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
mDialog.setNegativeButton(
|
||||
@ -507,6 +518,7 @@ class TaskViewModel @Inject constructor(
|
||||
map[taskBean] = true
|
||||
liveDataTaskUpload.postValue(map)
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,6 +667,7 @@ class TaskViewModel @Inject constructor(
|
||||
mapController.lineHandler.removeTaskLink(hadLinkDvoBean.linkPid)
|
||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
mDialog.setNegativeButton(
|
||||
|
@ -39,12 +39,14 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||
int yStart = (int) tile.tileY << m;
|
||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||
|
||||
|
||||
if(isUpdate){
|
||||
Realm.getDefaultInstance().refresh();
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||
isUpdate = false;
|
||||
}
|
||||
|
||||
String sql = "taskId="+ MapParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
String sql = " tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
|
||||
if(MapParamUtils.getDataLayerEnum()!=null){
|
||||
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
||||
@ -52,7 +54,7 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
sql += " and 1=1";
|
||||
}
|
||||
|
||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
|
||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getInstance(MapParamUtils.getTaskConfig()).where(ReferenceEntity.class)
|
||||
.rawPredicate(sql);
|
||||
// 筛选不显示的数据
|
||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||
@ -67,7 +69,7 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
}
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
}
|
||||
|
@ -38,12 +38,13 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||
int yStart = (int) tile.tileY << m;
|
||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||
|
||||
if(isUpdate){
|
||||
Realm.getDefaultInstance().refresh();
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||
isUpdate = false;
|
||||
}
|
||||
|
||||
String sql = "taskId="+ MapParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
String sql =" tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
|
||||
if(MapParamUtils.getDataLayerEnum()!=null){
|
||||
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
||||
@ -51,7 +52,7 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
sql += " and 1=1";
|
||||
}
|
||||
|
||||
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate(sql);
|
||||
RealmQuery<RenderEntity> realmQuery = Realm.getInstance(MapParamUtils.getTaskConfig()).where(RenderEntity.class).rawPredicate(sql);
|
||||
// 筛选不显示的数据
|
||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||
realmQuery.beginGroup();
|
||||
@ -65,6 +66,7 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
}
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ public class RealmDBTileDataSource implements ITileDataSource {
|
||||
List<GeometryFeatureEntity> listResult = realmQuery.distinct("id").findAll();
|
||||
mThreadLocalDecoders.get().decode(tile, mapDataSink, listResult);
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
Realm.getDefaultInstance().close();
|
||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
|
@ -2,20 +2,33 @@ package com.navinfo.collect.library.utils;
|
||||
|
||||
import com.navinfo.collect.library.enums.DataLayerEnum;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.realm.RealmConfiguration;
|
||||
|
||||
public class MapParamUtils {
|
||||
|
||||
private static int mtaskId = -1;
|
||||
|
||||
private static RealmConfiguration mTaskConfig = null;
|
||||
|
||||
private static DataLayerEnum dataLayerEnum = DataLayerEnum.ONLY_ENABLE_LAYERS;
|
||||
|
||||
public static int getTaskId() {
|
||||
return mtaskId;
|
||||
}
|
||||
|
||||
public static void setTaskId(int taskId) {
|
||||
mtaskId = taskId;
|
||||
}
|
||||
|
||||
public static RealmConfiguration getTaskConfig() {
|
||||
return mTaskConfig;
|
||||
}
|
||||
|
||||
public static void setTaskConfig(RealmConfiguration taskConfig) {
|
||||
mTaskConfig = taskConfig;
|
||||
}
|
||||
|
||||
public static DataLayerEnum getDataLayerEnum() {
|
||||
return dataLayerEnum;
|
||||
}
|
||||
|
2
vtm
2
vtm
@ -1 +1 @@
|
||||
Subproject commit a087521b6e1b312d7ed2bdf20f83b0e674fad9b5
|
||||
Subproject commit 3031b70699d5d886834d75cc098466daa8cef118
|
Loading…
x
Reference in New Issue
Block a user