fix: 合并代码

This commit is contained in:
2023-11-03 15:31:34 +08:00
49 changed files with 3588 additions and 1981 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,20 @@ class Constant {
*/
lateinit var USER_DATA_PATH: String
/**
* 用户数据安装标识
*/
var INSTALL_DATA: Boolean = false
/**
* 轨迹渲染个数统计
*/
var TRACE_COUNT : Int = 0
var TRACE_COUNT_TIME : Int = 9
var TRACE_COUNT_MORE_TIME : Int = 24
/**
* 当前安装任务
*/
@@ -79,6 +93,11 @@ class Constant {
*/
lateinit var DOWNLOAD_PATH: String
/**
* 日志目录
*/
lateinit var USER_DATA_LOG_PATH: String
/**
* 图层管理对应的配置
* */
@@ -107,6 +126,11 @@ class Constant {
*/
var MapMarkerCloseEnable = false
/**
* 轨迹显隐
*/
var MapTraceCloseEnable = false
/**
* 是否开启线捕捉
*/

View File

@@ -8,6 +8,7 @@ import android.view.Surface
import android.view.WindowManager
import com.navinfo.omqs.tools.FileManager
import com.navinfo.omqs.ui.manager.TakePhotoManager
import com.navinfo.omqs.util.CMLog
import com.navinfo.omqs.util.NetUtils
import com.umeng.commonsdk.UMConfigure
import dagger.hilt.android.HiltAndroidApp
@@ -20,6 +21,7 @@ class OMQSApplication : Application() {
super.onCreate()
FileManager.initRootDir(this)
Util.getInstance().init(applicationContext)
CMLog.getInstance().init(applicationContext)
NetUtils.getInstance().init(this)
TakePhotoManager.getInstance().init(this, 1)
// 初始化友盟统计

View File

@@ -4,6 +4,7 @@ import android.util.Log
import com.google.gson.annotations.Expose
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.omqs.db.ImportPreProcess
import io.realm.Realm
import kotlin.reflect.KFunction
import kotlin.reflect.KParameter
import kotlin.reflect.full.declaredMemberFunctions
@@ -12,22 +13,22 @@ import kotlin.reflect.full.declaredMemberFunctions
class ImportConfig {
@Expose
var tableMap: MutableMap<String, TableInfo> = mutableMapOf()
@Expose
val tableGroupName: String = "OMDB数据"
@Expose
var checked : Boolean = true
val preProcess: ImportPreProcess = ImportPreProcess()
fun transformProperties(renderEntity: RenderEntity): RenderEntity? {
@Expose
var checked: Boolean = true
val preProcess: ImportPreProcess = ImportPreProcess()
fun transformProperties(renderEntity: RenderEntity, realm: Realm?): RenderEntity? {
preProcess.realm = realm
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
val key: String = transform.k
val value = transform.v
val keylib = transform.klib
val valuelib = transform.vlib
@@ -36,7 +37,10 @@ class ImportConfig {
continue
}
// 如果key和value都为空说明当前数据需要增加一个新字段
if (key.isNullOrEmpty()&&value.isNullOrEmpty()&&!renderEntity.properties.containsKey(keylib)) {
if (key.isNullOrEmpty() && value.isNullOrEmpty() && !renderEntity.properties.containsKey(
keylib
)
) {
renderEntity.properties[keylib] = valuelib
continue
}
@@ -44,26 +48,32 @@ class ImportConfig {
m@ for (k in processKeyOrValue(key)) {
if (renderEntity.properties.containsKey(k)) { // json配置的key可以匹配到数据
for (v in processKeyOrValue(value)) {
if ("~" == v ) { // ~符可以匹配任意元素
if ("~" == v) { // ~符可以匹配任意元素
if (valuelib.endsWith(")")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
// 获取方法名
val methodName = valuelib.substringBefore("(")
// 获取参数
val params: List<String> = valuelib.substringAfter("(").substringBefore(")").split(",").filter{ it.isNotEmpty() }.map { it.trim() }
val method = preProcess::class.members.filter { it.name == methodName }.first() as KFunction<*>
val params: List<String> =
valuelib.substringAfter("(").substringBefore(")").split(",")
.filter { it.isNotEmpty() }.map { it.trim() }
val method =
preProcess::class.members.filter { it.name == methodName }
.first() as KFunction<*>
val methodParams = method.parameters
val callByParams = mutableMapOf<KParameter, Any>(
methodParams[0] to preProcess,
methodParams[1] to renderEntity
methodParams[1] to renderEntity,
)
for ((index, value) in params.withIndex()) {
// 前2个参数确定为对象本身和RenderEntity因此自定义参数从index+2开始设置
if (methodParams.size>index+2) {
callByParams[methodParams[index+2]] = value.replace("'", "")
if (methodParams.size > index + 2) {
callByParams[methodParams[index + 2]] =
value.replace("'", "")
}
}
when(val result = method.callBy(callByParams)) { // 如果方法返回的数据类型是boolean且返回为false则该数据不处理
when (val result =
method.callBy(callByParams)) { // 如果方法返回的数据类型是boolean且返回为false则该数据不处理
is Boolean ->
if (!result) {
return null
@@ -78,8 +88,12 @@ class ImportConfig {
// 获取方法名
val methodName = valuelib.substringBefore("(")
// 获取参数
val params: List<String> = valuelib.substringAfter("(").substringBefore(")").split(",").filter{ it.isNotEmpty() }.map { it.trim() }
val method = preProcess::class.members.filter { it.name == methodName }.first() as KFunction<*>
val params: List<String> =
valuelib.substringAfter("(").substringBefore(")").split(",")
.filter { it.isNotEmpty() }.map { it.trim() }
val method =
preProcess::class.members.filter { it.name == methodName }
.first() as KFunction<*>
val methodParams = method.parameters
val callByParams = mutableMapOf<KParameter, Any>(
@@ -88,11 +102,11 @@ class ImportConfig {
)
for ((index, value) in params.withIndex()) {
// 前2个参数确定为对象本身和RenderEntity因此自定义参数从index+2开始设置
if (methodParams.size>index+2) {
callByParams[methodParams[index+2]] = value
if (methodParams.size > index + 2) {
callByParams[methodParams[index + 2]] = value
}
}
when(val result = method.callBy(callByParams)) {
when (val result = method.callBy(callByParams)) {
is Boolean ->
if (!result) {
return null
@@ -107,6 +121,7 @@ class ImportConfig {
}
}
}
preProcess.realm = null
return renderEntity
}
@@ -125,14 +140,15 @@ class TableInfo {
val zoomMin: Int = 16
val zoomMax: Int = 21
val checkLinkId: Boolean = true//是否需要校验linkid
val filterData : Boolean = false//是否需要过滤数据
val existSubCode : Boolean = false//是否存在子编码
val catch: Boolean = false//是否需要捕捉 // 需要根据丹丹提供的捕捉原则进行设置参考文档W行设置条件https://navinfo.feishu.cn/sheets/shtcnfsxKZhekU26ezBcHgl7aWh?sheet=BZd6yM
val filterData: Boolean = false//是否需要过滤数据
val existSubCode: Boolean = false//是否存在子编码
val isDependOnOtherTable = false//是否依赖其他表
val catch: Boolean =
false//是否需要捕捉 // 需要根据丹丹提供的捕捉原则进行设置参考文档W行设置条件https://navinfo.feishu.cn/sheets/shtcnfsxKZhekU26ezBcHgl7aWh?sheet=BZd6yM
val name: String = ""
var checked : Boolean = true
var checked: Boolean = true
var transformer: MutableList<Transform> = mutableListOf()
var is3D : Boolean = false // 是否支持3D默认情况下都不支持3D在数据导入阶段会自动抹去Z轴高程信息
var is3D: Boolean = false // 是否支持3D默认情况下都不支持3D在数据导入阶段会自动抹去Z轴高程信息
}
class Transform {

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,15 @@
package com.navinfo.omqs.db
import android.util.Log
import com.alibaba.fastjson.JSON
import com.google.gson.Gson
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.DeflaterUtil
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.StrZipUtil
import com.navinfo.omqs.Constant
import io.realm.Realm
import io.realm.RealmModel
@@ -15,30 +20,44 @@ 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
var realm:Realm? = null
var realm: Realm? = null
val gson = Gson()
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
// // 根据linkIn和linkOut获取对应的link数据
// val linkInEntity = cacheRdLink[linkInId]
// val linkOutEntity = cacheRdLink[linkOutId]
realm?.let {
val linkInEntity = it.where(RenderEntity::class.java)
.equalTo("code", DataCodeEnum.OMDB_RD_LINK.code)
.and().equalTo("linkPid", linkInId)
.findFirst()
val linkOutEntity = it.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}- ${
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
@@ -200,16 +219,16 @@ class ImportPreProcess {
startGeometry!!.coordinates[startGeometry.numPoints - 1] // 获取这个geometry对应的结束点坐标
if (translateGeometry.geometryType == Geometry.TYPENAME_LINESTRING) { // 如果是线数据,则取倒数第二个点作为偏移的起止点
pointEnd =
translateGeometry!!.coordinates[translateGeometry.numPoints - 2] // 获取这个geometry对应的结束点坐标
translateGeometry.coordinates[translateGeometry.numPoints - 2] // 获取这个geometry对应的结束点坐标
}
if (startGeometry.geometryType == Geometry.TYPENAME_LINESTRING) { // 如果是线数据,则取倒数第二个点作为偏移的起止点
pointStart =
startGeometry!!.coordinates[startGeometry.numPoints - 2] // 获取这个geometry对应的结束点坐标
startGeometry.coordinates[startGeometry.numPoints - 2] // 获取这个geometry对应的结束点坐标
}
// 将这个起终点的线记录在数据中
val startEndReference = ReferenceEntity()
startEndReference.renderEntityId = renderEntity.id
// startEndReference.renderEntityId = renderEntity.id
startEndReference.name = "${renderEntity.name}参考线"
startEndReference.table = renderEntity.table
startEndReference.zoomMin = renderEntity.zoomMin
@@ -222,6 +241,7 @@ class ImportPreProcess {
startEndReference.properties["qi_table"] = renderEntity.table
startEndReference.properties["type"] = "s_2_e"
val listResult = mutableListOf<ReferenceEntity>()
startEndReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(startEndReference.properties))
listResult.add(startEndReference)
insertData(listResult)
}
@@ -254,7 +274,7 @@ class ImportPreProcess {
// 将这个起终点的线记录在数据中
val startReference = ReferenceEntity()
startReference.renderEntityId = renderEntity.id
// startReference.renderEntityId = renderEntity.id
startReference.name = "${renderEntity.name}参考点"
startReference.code = renderEntity.code
startReference.table = renderEntity.table
@@ -262,7 +282,6 @@ class ImportPreProcess {
startReference.zoomMax = renderEntity.zoomMax
startReference.taskId = renderEntity.taskId
startReference.enable = renderEntity.enable
// 起点坐标
startReference.geometry =
GeometryTools.createGeometry(GeoPoint(pointStart.y, pointStart.x)).toString()
@@ -272,7 +291,7 @@ class ImportPreProcess {
listResult.add(startReference)
val endReference = ReferenceEntity()
endReference.renderEntityId = renderEntity.id
// endReference.renderEntityId = renderEntity.id
endReference.name = "${renderEntity.name}参考点"
endReference.code = renderEntity.code
endReference.table = renderEntity.table
@@ -306,7 +325,7 @@ class ImportPreProcess {
// 将这个起终点的线记录在数据中
val startReference = ReferenceEntity()
startReference.renderEntityId = renderEntity.id
// startReference.renderEntityId = renderEntity.id
startReference.name = "${renderEntity.name}参考点"
startReference.code = renderEntity.code
startReference.table = renderEntity.table
@@ -338,12 +357,13 @@ class ImportPreProcess {
Log.e("qj", "generateS2EReferencePoint===${startReference.geometry}")
startReference.properties["geometry"] = startReference.geometry
startReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(startReference.properties))
listResult.add(startReference)
Log.e("qj", "generateS2EReferencePoint===1")
val endReference = ReferenceEntity()
endReference.renderEntityId = renderEntity.id
// endReference.renderEntityId = renderEntity.id
endReference.name = "${renderEntity.name}参考点"
endReference.code = renderEntity.code
endReference.table = renderEntity.table
@@ -372,7 +392,7 @@ class ImportPreProcess {
Log.e("qj", "generateS2EReferencePoint===e_2_p${renderEntity.name}")
}
endReference.properties["geometry"] = endReference.geometry
endReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(endReference.properties))
listResult.add(endReference)
Log.e("qj", "generateS2EReferencePoint===4")
insertData(listResult)
@@ -458,7 +478,7 @@ class ImportPreProcess {
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
val angleReference = ReferenceEntity()
angleReference.renderEntityId = renderEntity.id
// angleReference.renderEntityId = renderEntity.id
angleReference.name = "${renderEntity.name}参考方向"
angleReference.table = renderEntity.table
angleReference.zoomMin = renderEntity.zoomMin
@@ -470,6 +490,7 @@ class ImportPreProcess {
WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
angleReference.properties["qi_table"] = renderEntity.table
angleReference.properties["type"] = "angle"
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
listResult.add(angleReference)
}
insertData(listResult)
@@ -553,10 +574,12 @@ class ImportPreProcess {
renderEntityTemp.catchEnable = renderEntity.catchEnable
var dis = -lateralOffset.toDouble() / 100000000
//最小值取10厘米否正渲染太近无法显示
if (dis > 0 && dis < 0.0000028) {
dis = 0.0000028
} else if (dis > -0.0000028 && dis < 0) {
dis = -0.0000028
if (dis > 0 && dis < 0.000005) {
dis = 0.000005
Log.d("lateralOffset", "$dis")
} else if (dis > -0.000005 && dis < 0) {
dis = -0.000005
Log.d("lateralOffset", "$dis")
}
renderEntityTemp.geometry = GeometryTools.computeLine(
dis,
@@ -605,7 +628,7 @@ class ImportPreProcess {
for (i in 0 until laneInfoDirectArray.length()) {
// 根据后续的数据生成辅助表数据
val referenceEntity = ReferenceEntity()
referenceEntity.renderEntityId = renderEntity.id
// referenceEntity.renderEntityId = renderEntity.id
referenceEntity.name = "${renderEntity.name}参考方向"
referenceEntity.table = renderEntity.table
referenceEntity.enable = renderEntity.enable
@@ -613,7 +636,7 @@ class ImportPreProcess {
referenceEntity.zoomMin = renderEntity.zoomMin
referenceEntity.zoomMax = renderEntity.zoomMax
// 与原数据使用相同的geometry
referenceEntity.geometry = renderEntity.geometry.toString()
referenceEntity.geometry = renderEntity.geometry
referenceEntity.properties["qi_table"] = renderEntity.table
referenceEntity.properties["currentDirect"] =
laneInfoDirectArray[i].toString().split(",").distinct().joinToString("_")
@@ -624,6 +647,7 @@ class ImportPreProcess {
referenceEntity.properties["symbol"] =
"assets:omdb/4601/${type}/1301_${referenceEntity.properties["currentDirect"]}.svg"
Log.d("unpackingLaneInfo", referenceEntity.properties["symbol"].toString())
referenceEntity.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(referenceEntity.properties))
listResult.add(referenceEntity)
}
insertData(listResult)
@@ -716,14 +740,16 @@ class ImportPreProcess {
* 生成车道中心线面宽度
* */
fun generateAddWidthLine(renderEntity: RenderEntity) {
var newTime = 0L
// 添加车道中心面渲染原则,根据车道宽度进行渲染
val angleReference = ReferenceEntity()
angleReference.renderEntityId = renderEntity.id
// angleReference.renderEntityId = renderEntity.id
angleReference.name = "${renderEntity.name}车道中线面"
angleReference.table = renderEntity.table
angleReference.geometry =
GeometryTools.createGeometry(renderEntity.geometry).buffer(0.000035)
.toString()//GeometryTools.computeLine(0.000035,0.000035,renderEntity.geometry)
Log.e("jingo", "几何转换开始")
angleReference.geometry = renderEntity.geometry
//GeometryTools.createGeometry(renderEntity.geometry).buffer(0.000035).toString()//GeometryTools.computeLine(0.000035,0.000035,renderEntity.geometry)
Log.e("jingo", "几何转换结束")
angleReference.properties["qi_table"] = renderEntity.table
angleReference.properties["widthProperties"] = "3"
angleReference.zoomMin = renderEntity.zoomMin
@@ -731,6 +757,7 @@ class ImportPreProcess {
angleReference.taskId = renderEntity.taskId
angleReference.enable = renderEntity.enable
val listResult = mutableListOf<ReferenceEntity>()
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
listResult.add(angleReference)
insertData(listResult)
}
@@ -748,7 +775,7 @@ class ImportPreProcess {
for (i in 0 until nodeListJsonArray.length()) {
val nodeJSONObject = nodeListJsonArray.getJSONObject(i)
val intersectionReference = ReferenceEntity()
intersectionReference.renderEntityId = renderEntity.id
// intersectionReference.renderEntityId = renderEntity.id
intersectionReference.name = "${renderEntity.name}参考点"
intersectionReference.code = renderEntity.code
intersectionReference.table = renderEntity.table
@@ -761,6 +788,7 @@ class ImportPreProcess {
GeometryTools.createGeometry(nodeJSONObject["geometry"].toString()).toString()
intersectionReference.properties["qi_table"] = renderEntity.table
intersectionReference.properties["type"] = "node"
intersectionReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(intersectionReference.properties))
listResult.add(intersectionReference)
}
insertData(listResult)
@@ -915,7 +943,7 @@ class ImportPreProcess {
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
val dynamicSrcReference = ReferenceEntity()
dynamicSrcReference.renderEntityId = renderEntity.id
// dynamicSrcReference.renderEntityId = renderEntity.id
dynamicSrcReference.name = "${renderEntity.name}动态icon"
dynamicSrcReference.table = renderEntity.table
dynamicSrcReference.zoomMin = renderEntity.zoomMin
@@ -929,17 +957,17 @@ class ImportPreProcess {
dynamicSrcReference.properties["type"] = "dynamicSrc"
val code = renderEntity.properties[codeName]
dynamicSrcReference.properties["src"] = "${prefix}${code}${suffix}"
dynamicSrcReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(dynamicSrcReference.properties))
listResult.add(dynamicSrcReference)
}
insertData(listResult)
}
private fun insertData(list: List<RealmModel>) {
Log.e("qj", "子表插入==")
if (list != null && list.isNotEmpty()) {
Log.e("qj", "子表插入开始==")
Realm.getInstance(Constant.currentInstallTaskConfig).insert(list)
Log.e("qj", "子表插入结束==")
realm?.let {
if (list != null && list.isNotEmpty()) {
it.copyToRealm(list)
}
}
}

View File

@@ -6,7 +6,6 @@ import androidx.annotation.RequiresApi
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
import com.navinfo.collect.library.data.entity.QsRecordBean
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.collect.library.data.entity.RenderEntity.Companion.LinkTable
import com.navinfo.collect.library.enums.DataCodeEnum
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.collect.library.utils.GeometryTools
@@ -65,13 +64,12 @@ class RealmOperateHelper() {
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
// 查询realm中对应tile号的数据
// val realm = getSelectTaskRealmInstance()
val sql =
" ((tileXMin <= $xStart and tileXMax >= $xStart) or (tileXMin <=$xEnd and tileXMax >=$xStart)) and ((tileYMin <= $yStart and tileYMax >= $yStart) or (tileYMin <=$yEnd and tileYMin >=$yStart))"
val realmList =
getSelectTaskRealmTools(realm, RenderEntity::class.java, false)
.equalTo("table", DataCodeEnum.OMDB_LINK_DIRECT.name)
.greaterThanOrEqualTo("tileX", xStart)
.lessThanOrEqualTo("tileX", xEnd)
.greaterThanOrEqualTo("tileY", yStart)
.lessThanOrEqualTo("tileY", yEnd)
.rawPredicate(sql)
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList)
@@ -133,12 +131,11 @@ class RealmOperateHelper() {
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
// 查询realm中对应tile号的数据
val realm = getSelectTaskRealmInstance()
val sql =
" ((tileXMin <= $xStart and tileXMax >= $xStart) or (tileXMin <=$xEnd and tileXMax >=$xStart)) and ((tileYMin <= $yStart and tileYMax >= $yStart) or (tileYMin <=$yEnd and tileYMin >=$yStart))"
val realmList = getSelectTaskRealmTools(realm, RenderEntity::class.java, true)
.equalTo("table", table)
.greaterThanOrEqualTo("tileX", xStart)
.lessThanOrEqualTo("tileX", xEnd)
.greaterThanOrEqualTo("tileY", yStart)
.lessThanOrEqualTo("tileY", yEnd)
.rawPredicate(sql)
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList)
@@ -178,7 +175,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) {
@@ -206,7 +204,7 @@ class RealmOperateHelper() {
val realm = getSelectTaskRealmInstance()
val realmR =
realm.where(RenderEntity::class.java).equalTo("table", "OMDB_RD_LINK_KIND")
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findFirst()
.equalTo("linkPid", linkPid).findFirst()
if (realmR != null) {
link = realm.copyFromRealm(realmR)
}
@@ -238,7 +236,7 @@ class RealmOperateHelper() {
// val realm = getSelectTaskRealmInstance()
val realmR = getSelectTaskRealmTools(realm, RenderEntity::class.java, true)
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findAll()
.equalTo("linkPid", linkPid).findAll()
val dataList = realm.copyFromRealm(realmR)
@@ -284,11 +282,11 @@ class RealmOperateHelper() {
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
val realm = getSelectTaskRealmInstance()
var realmList = mutableListOf<RenderEntity>()
val sql =
" ((tileXMin <= $xStart and tileXMax >= $xStart) or (tileXMin <=$xEnd and tileXMax >=$xStart)) and ((tileYMin <= $yStart and tileYMax >= $yStart) or (tileYMin <=$yEnd and tileYMin >=$yStart))"
val realmQuery = getSelectTaskRealmTools(realm, RenderEntity::class.java, false)
.greaterThanOrEqualTo("tileX", xStart)
.lessThanOrEqualTo("tileX", xEnd)
.greaterThanOrEqualTo("tileY", yStart)
.lessThanOrEqualTo("tileY", yEnd)
.rawPredicate(sql)
// 筛选不显示的数据
if (catchAll) {
// 查询realm中对应tile号的数据
@@ -333,7 +331,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

View File

@@ -154,20 +154,6 @@ class GlobalModule {
)
}
// /**
// * realm 注册
// */
// @Provides
// @Singleton
// fun provideRealmService(context: Application): RealmCoroutineScope {
// return RealmCoroutineScope(context)
// }
// @Singleton
// @Provides
// fun provideRealmDefaultInstance(): Realm {
// return Realm.getDefaultInstance()
// }
@Singleton
@Provides

View File

@@ -155,21 +155,20 @@ class TaskDownloadScope(
fileNew
)
if (task != null) {
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task).collect {
Log.e("jingo", "数据安装 $it")
if (it == "finish") {
change(FileDownloadStatus.DONE)
Log.e("jingo", "数据安装结束")
withContext(Dispatchers.Main) {
//任务与当前一致,需要更新渲染图层
if (MapParamUtils.getTaskId() == taskBean.id) {
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
}
if (importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task, this)) {
// if (it == "finish") {
change(FileDownloadStatus.DONE)
Log.e("jingo", "数据安装结束")
withContext(Dispatchers.Main) {
//任务与当前一致,需要更新渲染图层
if (MapParamUtils.getTaskId() == taskBean.id) {
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
}
} else {
change(FileDownloadStatus.IMPORTING, it)
}
} else {
change(FileDownloadStatus.IMPORTING, "anzhuang")
}
// }
}
} catch (e: Exception) {
Log.e("jingo", "数据安装失败 ${e.toString()}")

View File

@@ -1,7 +1,5 @@
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
@@ -11,7 +9,6 @@ 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
@@ -19,8 +16,6 @@ import com.navinfo.omqs.ui.activity.CheckPermissionsActivity
import com.navinfo.omqs.ui.activity.map.MainActivity
import com.umeng.commonsdk.UMConfigure
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
/**
* 登陆页面

View File

@@ -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
@@ -282,6 +287,12 @@ class LoginViewModel @Inject constructor(
task.fileSize = item.fileSize
task.status = item.status
task.currentSize = item.currentSize
//增加mesh==null兼容性处理
for (hadLink in item.hadLinkDvoList) {
if(hadLink.mesh==null){
hadLink.mesh = ""
}
}
task.hadLinkDvoList = item.hadLinkDvoList
task.syncStatus = item.syncStatus
//已上传后不在更新操作时间
@@ -293,8 +304,10 @@ class LoginViewModel @Inject constructor(
}
} else {
for (hadLink in task.hadLinkDvoList) {
if(hadLink.geometry==null||hadLink.mesh==null){
if(hadLink.geometry==null){
inSertData = false
}else if(hadLink.mesh==null){
hadLink.mesh = ""
}else{
hadLink.taskId = task.id
}
@@ -418,12 +431,15 @@ class LoginViewModel @Inject constructor(
Constant.VERSION_ID = userId
Constant.USER_DATA_PATH = Constant.DATA_PATH + Constant.USER_ID + "/" + Constant.VERSION_ID
Constant.USER_DATA_ATTACHEMNT_PATH = Constant.USER_DATA_PATH + "/attachment/"
Constant.USER_DATA_LOG_PATH = Constant.USER_DATA_PATH + "/log/"
// 在SD卡创建用户目录解压资源等
val userFolder = File(Constant.USER_DATA_PATH)
if (!userFolder.exists()) userFolder.mkdirs()
//创建附件目录
val userAttachmentFolder = File(Constant.USER_DATA_ATTACHEMNT_PATH)
if (!userAttachmentFolder.exists()) userAttachmentFolder.mkdirs()
val userLogFolder = File(Constant.USER_DATA_LOG_PATH)
if (!userLogFolder.exists()) userLogFolder.mkdirs()
// 初始化Realm
Realm.init(context.applicationContext)
// 656e6372797000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@@ -431,8 +447,9 @@ class LoginViewModel @Inject constructor(
.directory(userFolder)
.name("OMQS.realm")
.encryptionKey(Constant.PASSWORD)
.allowQueriesOnUiThread(true)
.schemaVersion(2)
// .allowQueriesOnUiThread(true)
.schemaVersion(3)
// .migration(migration)
.build()
Realm.setDefaultConfiguration(config)
// 拷贝配置文件到用户目录下
@@ -458,4 +475,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)
}
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -23,6 +23,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.navigation.findNavController
import com.blankj.utilcode.util.ToastUtils
import com.google.gson.Gson
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
import com.navinfo.collect.library.data.entity.*
import com.navinfo.collect.library.enums.DataCodeEnum
@@ -50,7 +51,9 @@ import io.realm.Realm
import io.realm.RealmConfiguration
import io.realm.RealmSet
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.sync.Mutex
import org.locationtech.jts.geom.Geometry
import org.oscim.core.GeoPoint
@@ -67,6 +70,18 @@ import kotlin.concurrent.fixedRateTimer
* 创建Activity全局viewmode
*/
enum class LoadDataStatus {
/**
* 加载开始
*/
LOAD_DATA_STATUS_BEGIN,
/**
* 加载结束
*/
LOAD_DATA_STATUS_FISISH,
}
@HiltViewModel
class MainViewModel @Inject constructor(
private val mapController: NIMapController,
@@ -94,6 +109,9 @@ class MainViewModel @Inject constructor(
//地图点击捕捉到的轨迹列表
val liveDataNILocationList = MutableLiveData<NiLocation>()
//加载数据
val liveDataLoadData = MutableLiveData<LoadDataStatus>()
//左侧看板数据
val liveDataSignList = MutableLiveData<List<SignBean>>()
@@ -239,11 +257,14 @@ class MainViewModel @Inject constructor(
//导航信息
private var naviEngine: NaviEngine? = null
private var naviEngineNew: NaviEngineNew = NaviEngineNew(realmOperateHelper)
// 0:不导航 1导航 2暂停
private var naviEngineStatus = 0
// 定义一个互斥锁
private val naviMutex = Mutex()
private var testRealm: Realm? = null;
init {
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
@@ -271,6 +292,10 @@ class MainViewModel @Inject constructor(
object : OnGeoPointClickListener {
override fun onMapClick(tag: String, point: GeoPoint) {
if (tag == TAG) {
//数据安装时不允许操作数据
if(Constant.INSTALL_DATA){
return
}
if (bMeasuringTool) {
mapController.measureLayerHandler.addPoint(measuringType, point)
} else {
@@ -321,6 +346,7 @@ class MainViewModel @Inject constructor(
})
viewModelScope.launch(Dispatchers.IO) {
liveDataLoadData.postValue(LoadDataStatus.LOAD_DATA_STATUS_BEGIN)
getTaskBean()
//初始化选中的任务高亮高亮
if (currentTaskBean != null) {
@@ -329,6 +355,7 @@ class MainViewModel @Inject constructor(
initQsRecordData()
initNoteData()
initNILocationData()
liveDataLoadData.postValue(LoadDataStatus.LOAD_DATA_STATUS_FISISH)
}
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
MapParamUtils.setTaskId(sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1))
@@ -336,32 +363,45 @@ class MainViewModel @Inject constructor(
File(Constant.USER_DATA_PATH + "/${MapParamUtils.getTaskId()}")
Constant.currentSelectTaskConfig =
RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder)
.name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true)
.name("OMQS.realm").encryptionKey(Constant.PASSWORD)
// .assetFile("${Constant.currentSelectTaskFolder}/OMQS.realm")
// .readOnly()
// .allowQueriesOnUiThread(true)
.schemaVersion(2).build()
MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig)
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
// viewModelScope.launch(Dispatchers.Default) {
// naviTestFlow().collect { point ->
// if (naviEngineStatus == 1) {
// naviEngine?.let {
viewModelScope.launch(Dispatchers.IO) {
naviTestFlow().collect { point ->
if (naviEngineStatus == 1) {
naviEngineNew.let {
// naviMutex.lock()
if (testRealm == null)
testRealm = realmOperateHelper.getSelectTaskRealmInstance()
if (currentTaskBean != null) {
naviEngineNew.bindingRoute(
taskBean = currentTaskBean!!,
geoPoint = point,
realm = testRealm!!
)
}
// it.bindingRoute(null, point)
// naviMutex.unlock()
// }
// }
// }
// }
}
}
}
}
}
// fun naviTestFlow(): Flow<GeoPoint> = flow {
//
// while (true) {
// emit(mapController.mMapView.vtmMap.mapPosition.geoPoint)
// delay(1000)
// }
// }
fun naviTestFlow(): Flow<GeoPoint> = flow {
while (true) {
emit(mapController.mMapView.vtmMap.mapPosition.geoPoint)
delay(5000)
}
}
/**
* 获取当前任务
@@ -403,7 +443,10 @@ class MainViewModel @Inject constructor(
naviOption = naviOption,
callback = object : OnNaviEngineCallbackListener {
override fun planningPathStatus(status: NaviStatus) {
override fun planningPathStatus(
status: NaviStatus, linkdId: String?,
geometry: String?
) {
when (status) {
NaviStatus.NAVI_STATUS_PATH_PLANNING -> naviEngineStatus = 0
NaviStatus.NAVI_STATUS_PATH_ERROR_NODE -> naviEngineStatus = 0
@@ -415,8 +458,24 @@ class MainViewModel @Inject constructor(
NaviStatus.NAVI_STATUS_DIRECTION_OFF -> {}
}
liveDataNaviStatus.postValue(status)
if (geometry != null) {
viewModelScope.launch(Dispatchers.Main) {
val lineString = GeometryTools.createGeometry(geometry)
val envelope = lineString.envelopeInternal
mapController.animationHandler.animateToBox(
envelope.maxX,
envelope.maxY,
envelope.minX,
envelope.minY
)
mapController.lineHandler.showLine(geometry)
}
}
}
override suspend fun bindingResults(
route: NaviRoute?,
list: List<NaviRouteItem>
@@ -526,7 +585,20 @@ class MainViewModel @Inject constructor(
).niLocationDao.findToTaskIdAll(id.toString())
if (list != null) {
for (location in list) {
Constant.TRACE_COUNT++
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_MORE_TIME==0){
mapController.markerHandle.addNiLocationMarkerItemRough(location)
Log.e("qj","${Constant.TRACE_COUNT}===轨迹")
}
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_TIME==0){
mapController.markerHandle.addNiLocationMarkerItemSimple(location)
Log.e("qj","${Constant.TRACE_COUNT}===轨迹")
}
mapController.markerHandle.addNiLocationMarkerItem(location)
}
}
}
@@ -535,6 +607,7 @@ class MainViewModel @Inject constructor(
* 初始化定位信息
*/
private fun initLocation() {
var gson = Gson();
//用于定位点存储到数据库
viewModelScope.launch(Dispatchers.Default) {
@@ -588,12 +661,23 @@ class MainViewModel @Inject constructor(
lastNiLocaion!!.longitude
)
}
//室内整理工具时不能进行轨迹存储,判断轨迹间隔要超过2.5并小于60米
if (Constant.INDOOR_IP.isEmpty() && (disance == 0.0 || (disance > 2.5 && disance < 60))) {
//室内整理工具时不能进行轨迹存储,判断轨迹间隔要超过6并小于60米
if (Constant.INDOOR_IP.isEmpty() && (disance == 0.0 || (disance > 6.0 && disance < 60))) {
Log.e("jingo", "轨迹插入开始")
CMLog.writeLogtoFile(MainViewModel::class.java.name,"insertTrace","开始")
traceDataBase.niLocationDao.insert(location)
mapController.markerHandle.addNiLocationMarkerItem(location)
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_TIME==0){
mapController.markerHandle.addNiLocationMarkerItemSimple(location)
}
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_MORE_TIME==0){
mapController.markerHandle.addNiLocationMarkerItemRough(location)
}
mapController.mMapView.vtmMap.updateMap(true)
lastNiLocaion = location
CMLog.writeLogtoFile(MainViewModel::class.java.name,"insertTrace",gson.toJson(location))
Log.e("jingo", "轨迹插入结束")
}
}
}
@@ -786,7 +870,7 @@ class MainViewModel @Inject constructor(
if (linkList.isNotEmpty()) {
val link = linkList[0]
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
val linkId = link.linkPid
//看板数据
val signList = mutableListOf<SignBean>()
val topSignList = mutableListOf<SignBean>()
@@ -816,8 +900,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
@@ -930,7 +1018,7 @@ class MainViewModel @Inject constructor(
.equalTo("table", DataCodeEnum.OMDB_RD_LINK_KIND.name)
.and()
.equalTo(
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
"linkPid",
outLink
).findFirst()
if (linkOutEntity != null) {
@@ -964,6 +1052,7 @@ class MainViewModel @Inject constructor(
if (!hisRoadName) {
liveDataRoadName.postValue(null)
}
Log.e("jingo", "另一个地方查询数据库")
realm.close()
}
} catch (e: Exception) {
@@ -980,8 +1069,9 @@ class MainViewModel @Inject constructor(
fun onClickLocationButton() {
val mapPosition: MapPosition = mapController.mMapView.vtmMap.getMapPosition()
mapPosition.setBearing(0f) // 锁定角度,自动将地图旋转到正北方向
mapController.mMapView.vtmMap.setMapPosition(mapPosition)
mapController.mMapView.vtmMap.mapPosition = mapPosition
mapController.locationLayerHandler.animateToCurrentPosition()
naviEngineStatus = 1
}
/**
@@ -1658,7 +1748,7 @@ class MainViewModel @Inject constructor(
val tempTime = nowTime - lastTime
if (tempTime > 10000) {
liveDataMessage.postValue("下个定位点与当前定位点时间间隔超过10秒(${tempTime}),将直接跳转到下个点")
delay(5000)
delay(2000)
} else {
delay(tempTime)
}

View File

@@ -37,6 +37,8 @@ class SignAdapter(private var listener: OnSignAdapterClickListener?) :
override fun getItemViewType(position: Int): Int {
if (data.isNotEmpty() && data[position].renderEntity.code == DataCodeEnum.OMDB_LANEINFO.code) {
return 4601
}else if (data.isNotEmpty() && data[position].renderEntity.code == DataCodeEnum.OMDB_CLM_LANEINFO.code) {
return 4602
} else if (data.isNotEmpty() && data[position].renderEntity.code == DataCodeEnum.OMDB_TOLLGATE.code) {
return 4023
}

View File

@@ -23,7 +23,6 @@ import com.blankj.utilcode.util.ToastUtils
import com.navinfo.collect.library.data.entity.AttachmentBean
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
import com.navinfo.collect.library.data.entity.QsRecordBean
import com.navinfo.collect.library.data.entity.RenderEntity.Companion.LinkTable
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.collect.library.map.OnGeoPointClickListener
@@ -236,7 +235,7 @@ class EvaluationResultViewModel @Inject constructor(
} else {
val linkList = realmOperateHelper.queryLink(realm, point = point)
if (linkList.isNotEmpty()) {
it.linkId = linkList[0].properties[LinkTable.linkPid] ?: ""
it.linkId = linkList[0].linkPid
mapController.lineHandler.showLine(linkList[0].geometry)
Log.e("jingo", "捕捉道路EEE 2")
return

View File

@@ -7,6 +7,7 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.TimePicker
@@ -21,6 +22,7 @@ import com.blankj.utilcode.util.UriUtils
import com.github.k1rakishou.fsaf.FileChooser
import com.github.k1rakishou.fsaf.callback.FSAFActivityCallbacks
import com.github.k1rakishou.fsaf.callback.FileChooserCallback
import com.google.android.material.internal.NavigationMenuItemView
import com.google.android.material.timepicker.MaterialTimePicker
import com.navinfo.collect.library.enums.DataLayerEnum
import com.navinfo.collect.library.map.NIMapController
@@ -40,6 +42,7 @@ import com.permissionx.guolindev.PermissionX
import dagger.hilt.android.AndroidEntryPoint
import org.oscim.core.GeoPoint
import org.oscim.core.MapPosition
import org.oscim.utils.MinHeap.Item
import javax.inject.Inject
/**
@@ -73,35 +76,35 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.root.setNavigationItemSelectedListener {
binding.root.setNavigationItemSelectedListener { it ->
when (it.itemId) {
R.id.personal_center_menu_offline_map ->
findNavController().navigate(R.id.OfflineMapFragment)
R.id.personal_center_menu_obtain_data -> { // 生成数据根据sqlite文件生成对应的zip文件
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
override fun onCancel(reason: String) {
}
@RequiresApi(Build.VERSION_CODES.N)
override fun onResult(uri: Uri) {
val file = UriUtils.uri2File(uri)
// 开始导入数据
// 656e6372797000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
CoroutineUtils.launchWithLoading(
requireContext(),
loadingMessage = "生成数据..."
) {
val importOMDBHelper: ImportOMDBHelper =
importOMDBHiltFactory.obtainImportOMDBHelper(
requireContext(),
file
)
viewModel.obtainOMDBZipData(importOMDBHelper)
}
}
})
}
// R.id.personal_center_menu_obtain_data -> { // 生成数据根据sqlite文件生成对应的zip文件
// fileChooser.openChooseFileDialog(object : FileChooserCallback() {
// override fun onCancel(reason: String) {
// }
//
// @RequiresApi(Build.VERSION_CODES.N)
// override fun onResult(uri: Uri) {
// val file = UriUtils.uri2File(uri)
// // 开始导入数据
// // 656e6372797000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
// CoroutineUtils.launchWithLoading(
// requireContext(),
// loadingMessage = "生成数据..."
// ) {
// val importOMDBHelper: ImportOMDBHelper =
// importOMDBHiltFactory.obtainImportOMDBHelper(
// requireContext(),
// file
// )
// viewModel.obtainOMDBZipData(importOMDBHelper)
// }
// }
// })
// }
R.id.personal_center_menu_import_data -> { // 导入zip数据
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
@@ -151,7 +154,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
val mapPosition: MapPosition =
niMapController.mMapView.vtmMap.getMapPosition()
mapPosition.setBearing(0f) // 锁定角度,自动将地图旋转到正北方向
niMapController.mMapView.vtmMap.setMapPosition(mapPosition)
niMapController.mMapView.vtmMap.mapPosition = mapPosition
it.title = "开启地图旋转及视角"
} else {
it.title = "锁定地图旋转及视角"
@@ -168,6 +171,17 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
it.title = "隐藏Marker"
}
}
R.id.personal_center_menu_trace -> {
Constant.MapTraceCloseEnable = !Constant.MapTraceCloseEnable
//增加开关控制
niMapController.markerHandle.setTraceMarkEnable(!Constant.MapTraceCloseEnable)
//增加开关控制
if (Constant.MapTraceCloseEnable) {
it.title = "显示轨迹"
} else {
it.title = "隐藏轨迹"
}
}
R.id.personal_center_menu_catch_all -> {
Constant.CATCH_ALL = !Constant.CATCH_ALL
if (Constant.CATCH_ALL) {
@@ -258,6 +272,13 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
it.title = "隐藏Marker"
}
}
R.id.personal_center_menu_trace -> {
if (Constant.MapTraceCloseEnable) {
it.title = "显示轨迹"
} else {
it.title = "隐藏轨迹"
}
}
}
}
}

View File

@@ -1,17 +1,12 @@
package com.navinfo.omqs.ui.fragment.personalcenter
import android.net.Uri
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.blankj.utilcode.util.FileIOUtils
import com.blankj.utilcode.util.UriUtils
import com.blankj.utilcode.util.ZipUtils
import com.google.gson.Gson
import com.navinfo.collect.library.data.entity.*
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.omqs.bean.ScProblemTypeBean
import com.navinfo.omqs.bean.ScRootCauseAnalysisBean
import com.navinfo.omqs.bean.ScWarningCodeBean
@@ -24,7 +19,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.apache.commons.io.input.BOMInputStream
import java.io.*
import java.util.*
import javax.inject.Inject
@@ -37,119 +31,119 @@ class PersonalCenterViewModel @Inject constructor(
val liveDataMessage = MutableLiveData<String>()
/**
* 导入OMDB数据
* */
@RequiresApi(Build.VERSION_CODES.N)
suspend fun obtainOMDBZipData(importOMDBHelper: ImportOMDBHelper) {
Log.d("OMQSApplication", "开始生成数据")
val gson = Gson()
val hadLinkFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK.txt")
val hadLinkKindFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_KIND.txt")
val hadLinkDirectFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_DIRECT.txt")
val hadSpeedLimitFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_SPEEDLIMIT.txt")
val hadSpeedLimitCondFile =
File(importOMDBHelper.omdbFile.parentFile, "HAD_SPEEDLIMIT_COND.txt")
val hadSpeedLimitVarFile =
File(importOMDBHelper.omdbFile.parentFile, "HAD_SPEEDLIMIT_VAR.txt")
for (tableName in listOf<String>(
"HAD_LINK", "HAD_SPEEDLIMIT", "HAD_SPEEDLIMIT_COND", "HAD_SPEEDLIMIT_VAR"
)/*listOf<String>("HAD_LINK")*/) {
importOMDBHelper.getOMDBTableData(tableName).collect {
for (map in it) {
if ("HAD_LINK" == tableName) {
// 根据HAD_Link生成json文件
val hadLink = HAD_LINK()
hadLink.LINK_PID = map["LINK_PID"].toString()
hadLink.MESH = map["MESH"].toString()
hadLink.S_NODE_PID = map["S_NODE_PID"].toString()
hadLink.E_NODE_PID = map["E_NODE_PID"].toString()
hadLink.GEOMETRY = map["GEOMETRY"].toString()
// 将该数据写入到对应的txt文件
FileIOUtils.writeFileFromString(
hadLinkFile, gson.toJson(hadLink) + "\r", true
)
val hadLinkDirect = HAD_LINK_DIRECT()
hadLinkDirect.LINK_PID = map["LINK_PID"].toString()
hadLinkDirect.MESH = map["MESH"].toString()
hadLinkDirect.DIRECT = map["DIRECT"].toString().toInt()
hadLinkDirect.GEOMETRY = map["GEOMETRY"].toString()
// 将该数据写入到对应的txt文件
FileIOUtils.writeFileFromString(
hadLinkDirectFile, gson.toJson(hadLinkDirect) + "\r", true
)
val hadLinkKind = HAD_LINK_KIND()
hadLinkKind.LINK_PID = map["LINK_PID"].toString()
hadLinkKind.MESH = map["MESH"].toString()
hadLinkKind.KIND = map["KIND"].toString().toInt()
hadLinkKind.GEOMETRY = map["GEOMETRY"].toString()
// 将该数据写入到对应的txt文件
FileIOUtils.writeFileFromString(
hadLinkKindFile, gson.toJson(hadLinkKind) + "\r", true
)
} else if ("HAD_SPEEDLIMIT" == tableName) {
val hadSpeedlimit = HAD_SPEEDLIMIT()
hadSpeedlimit.SPEED_ID = map["SPEED_ID"].toString()
hadSpeedlimit.MESH = map["MESH"].toString()
hadSpeedlimit.LINK_PID = map["LINK_PID"].toString()
hadSpeedlimit.GEOMETRY = map["GEOMETRY"].toString()
hadSpeedlimit.DIRECT = map["DIRECT"].toString().toInt()
hadSpeedlimit.SPEED_FLAG = map["SPEED_FLAG"].toString().toInt()
hadSpeedlimit.MAX_SPEED = map["MAX_SPEED"].toString().toInt()
hadSpeedlimit.MIN_SPEED = map["MIN_SPEED"].toString().toInt()
// 将该数据写入到对应的txt文件
FileIOUtils.writeFileFromString(
hadSpeedLimitFile, gson.toJson(hadSpeedlimit) + "\r", true
)
} else if ("HAD_SPEEDLIMIT_COND" == tableName) {
val hadSpeedlimitCond = HAD_SPEEDLIMIT_COND()
hadSpeedlimitCond.SPEED_COND_ID = map["SPEED_COND_ID"].toString()
hadSpeedlimitCond.MESH = map["MESH"].toString()
hadSpeedlimitCond.LINK_PID = map["LINK_PID"].toString()
hadSpeedlimitCond.GEOMETRY = map["GEOMETRY"].toString()
hadSpeedlimitCond.DIRECT = map["DIRECT"].toString().toInt()
hadSpeedlimitCond.SPEED_FLAG = map["SPEED_FLAG"].toString().toInt()
hadSpeedlimitCond.MAX_SPEED = map["MAX_SPEED"].toString().toInt()
hadSpeedlimitCond.SPEED_DEPENDENT =
map["SPEED_DEPENDENT"].toString().toInt()
hadSpeedlimitCond.VEHICLE_TYPE = map["VEHICLE_TYPE"].toString().toInt()
hadSpeedlimitCond.VALID_PERIOD = map["VALID_PERIOD"].toString()
// 将该数据写入到对应的txt文件
FileIOUtils.writeFileFromString(
hadSpeedLimitCondFile, gson.toJson(hadSpeedlimitCond) + "\r", true
)
} else if ("HAD_SPEEDLIMIT_VAR" == tableName) {
val hadSpeedlimitVar = HAD_SPEEDLIMIT_VAR()
hadSpeedlimitVar.SPEED_VAR_ID = map["SPEED_ID"].toString()
hadSpeedlimitVar.MESH = map["MESH"].toString()
hadSpeedlimitVar.LINK_PID = map["LINK_PID"].toString()
hadSpeedlimitVar.GEOMETRY = map["GEOMETRY"].toString()
hadSpeedlimitVar.DIRECT = map["DIRECT"].toString().toInt()
hadSpeedlimitVar.LOCATION = map["LOCATION"].toString()
// 将该数据写入到对应的txt文件
FileIOUtils.writeFileFromString(
hadSpeedLimitVarFile, gson.toJson(hadSpeedlimitVar) + "\r", true
)
}
}
}
}
ZipUtils.zipFiles(
mutableListOf(
hadLinkFile,
hadLinkKindFile,
hadLinkDirectFile,
hadSpeedLimitFile,
hadSpeedLimitCondFile,
hadSpeedLimitVarFile
), File(importOMDBHelper.omdbFile.parentFile, "output.zip")
)
Log.d("OMQSApplication", "生成数据完成")
}
// /**
// * 导入OMDB数据
// * */
// @RequiresApi(Build.VERSION_CODES.N)
// suspend fun obtainOMDBZipData(importOMDBHelper: ImportOMDBHelper) {
// Log.d("OMQSApplication", "开始生成数据")
// val gson = Gson()
// val hadLinkFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK.txt")
// val hadLinkKindFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_KIND.txt")
// val hadLinkDirectFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_DIRECT.txt")
// val hadSpeedLimitFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_SPEEDLIMIT.txt")
// val hadSpeedLimitCondFile =
// File(importOMDBHelper.omdbFile.parentFile, "HAD_SPEEDLIMIT_COND.txt")
// val hadSpeedLimitVarFile =
// File(importOMDBHelper.omdbFile.parentFile, "HAD_SPEEDLIMIT_VAR.txt")
//
// for (tableName in listOf<String>(
// "HAD_LINK", "HAD_SPEEDLIMIT", "HAD_SPEEDLIMIT_COND", "HAD_SPEEDLIMIT_VAR"
// )/*listOf<String>("HAD_LINK")*/) {
// importOMDBHelper.getOMDBTableData(tableName).collect {
// for (map in it) {
// if ("HAD_LINK" == tableName) {
// // 根据HAD_Link生成json文件
// val hadLink = HAD_LINK()
// hadLink.LINK_PID = map["LINK_PID"].toString()
// hadLink.MESH = map["MESH"].toString()
// hadLink.S_NODE_PID = map["S_NODE_PID"].toString()
// hadLink.E_NODE_PID = map["E_NODE_PID"].toString()
// hadLink.GEOMETRY = map["GEOMETRY"].toString()
// // 将该数据写入到对应的txt文件
// FileIOUtils.writeFileFromString(
// hadLinkFile, gson.toJson(hadLink) + "\r", true
// )
//
// val hadLinkDirect = HAD_LINK_DIRECT()
// hadLinkDirect.LINK_PID = map["LINK_PID"].toString()
// hadLinkDirect.MESH = map["MESH"].toString()
// hadLinkDirect.DIRECT = map["DIRECT"].toString().toInt()
// hadLinkDirect.GEOMETRY = map["GEOMETRY"].toString()
// // 将该数据写入到对应的txt文件
// FileIOUtils.writeFileFromString(
// hadLinkDirectFile, gson.toJson(hadLinkDirect) + "\r", true
// )
//
// val hadLinkKind = HAD_LINK_KIND()
// hadLinkKind.LINK_PID = map["LINK_PID"].toString()
// hadLinkKind.MESH = map["MESH"].toString()
// hadLinkKind.KIND = map["KIND"].toString().toInt()
// hadLinkKind.GEOMETRY = map["GEOMETRY"].toString()
// // 将该数据写入到对应的txt文件
// FileIOUtils.writeFileFromString(
// hadLinkKindFile, gson.toJson(hadLinkKind) + "\r", true
// )
// } else if ("HAD_SPEEDLIMIT" == tableName) {
// val hadSpeedlimit = HAD_SPEEDLIMIT()
// hadSpeedlimit.SPEED_ID = map["SPEED_ID"].toString()
// hadSpeedlimit.MESH = map["MESH"].toString()
// hadSpeedlimit.LINK_PID = map["LINK_PID"].toString()
// hadSpeedlimit.GEOMETRY = map["GEOMETRY"].toString()
// hadSpeedlimit.DIRECT = map["DIRECT"].toString().toInt()
// hadSpeedlimit.SPEED_FLAG = map["SPEED_FLAG"].toString().toInt()
// hadSpeedlimit.MAX_SPEED = map["MAX_SPEED"].toString().toInt()
// hadSpeedlimit.MIN_SPEED = map["MIN_SPEED"].toString().toInt()
// // 将该数据写入到对应的txt文件
// FileIOUtils.writeFileFromString(
// hadSpeedLimitFile, gson.toJson(hadSpeedlimit) + "\r", true
// )
// } else if ("HAD_SPEEDLIMIT_COND" == tableName) {
// val hadSpeedlimitCond = HAD_SPEEDLIMIT_COND()
// hadSpeedlimitCond.SPEED_COND_ID = map["SPEED_COND_ID"].toString()
// hadSpeedlimitCond.MESH = map["MESH"].toString()
// hadSpeedlimitCond.LINK_PID = map["LINK_PID"].toString()
// hadSpeedlimitCond.GEOMETRY = map["GEOMETRY"].toString()
// hadSpeedlimitCond.DIRECT = map["DIRECT"].toString().toInt()
// hadSpeedlimitCond.SPEED_FLAG = map["SPEED_FLAG"].toString().toInt()
// hadSpeedlimitCond.MAX_SPEED = map["MAX_SPEED"].toString().toInt()
// hadSpeedlimitCond.SPEED_DEPENDENT =
// map["SPEED_DEPENDENT"].toString().toInt()
// hadSpeedlimitCond.VEHICLE_TYPE = map["VEHICLE_TYPE"].toString().toInt()
// hadSpeedlimitCond.VALID_PERIOD = map["VALID_PERIOD"].toString()
// // 将该数据写入到对应的txt文件
// FileIOUtils.writeFileFromString(
// hadSpeedLimitCondFile, gson.toJson(hadSpeedlimitCond) + "\r", true
// )
// } else if ("HAD_SPEEDLIMIT_VAR" == tableName) {
// val hadSpeedlimitVar = HAD_SPEEDLIMIT_VAR()
// hadSpeedlimitVar.SPEED_VAR_ID = map["SPEED_ID"].toString()
// hadSpeedlimitVar.MESH = map["MESH"].toString()
// hadSpeedlimitVar.LINK_PID = map["LINK_PID"].toString()
// hadSpeedlimitVar.GEOMETRY = map["GEOMETRY"].toString()
// hadSpeedlimitVar.DIRECT = map["DIRECT"].toString().toInt()
// hadSpeedlimitVar.LOCATION = map["LOCATION"].toString()
// // 将该数据写入到对应的txt文件
// FileIOUtils.writeFileFromString(
// hadSpeedLimitVarFile, gson.toJson(hadSpeedlimitVar) + "\r", true
// )
// }
// }
// }
// }
// ZipUtils.zipFiles(
// mutableListOf(
// hadLinkFile,
// hadLinkKindFile,
// hadLinkDirectFile,
// hadSpeedLimitFile,
// hadSpeedLimitCondFile,
// hadSpeedLimitVarFile
// ), File(importOMDBHelper.omdbFile.parentFile, "output.zip")
// )
//
// Log.d("OMQSApplication", "生成数据完成")
// }
/**
* 导入OMDB数据
@@ -158,15 +152,12 @@ class PersonalCenterViewModel @Inject constructor(
viewModelScope.launch(Dispatchers.IO) {
Log.d("OMQSApplication", "开始导入数据")
if (task != null) {
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task).collect {
Log.d("importOMDBData", it)
}
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task, this)
} else {
val newTask = TaskBean()
newTask.id = -1
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, newTask).collect {
Log.d("importOMDBData", it)
}
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, newTask, this)
}
Log.d("OMQSApplication", "导入数据完成")
}

View File

@@ -79,7 +79,9 @@ class TaskFragment : BaseFragment() {
viewModel.liveDataAddLinkDialog.observe(viewLifecycleOwner){
viewModel.addTaskLink(requireContext(),it)
}
viewModel.liveDataUpdateTask.observe(viewLifecycleOwner) {
}
//注意:使用滑动菜单不能开启滑动删除,否则只有滑动删除没有滑动菜单
val mSwipeMenuCreator = SwipeMenuCreator { _, rightMenu, _ ->

View File

@@ -89,8 +89,15 @@ class TaskListFragment : BaseFragment() {
deleteItem.background = requireContext().getDrawable(R.color.red)
deleteItem.setTextColor(requireContext().resources.getColor(R.color.white))
rightMenu.addMenuItem(deleteItem)
}
val resetDownLoad = SwipeMenuItem(context)
resetDownLoad.height = Util.convertDpToPx(requireContext(), 60)
resetDownLoad.width = Util.convertDpToPx(requireContext(), 80)
resetDownLoad.text = "重新下载"
resetDownLoad.background = requireContext().getDrawable(R.color.btn_bg_blue)
resetDownLoad.setTextColor(requireContext().resources.getColor(R.color.white))
rightMenu.addMenuItem(resetDownLoad)
}
val layoutManager = LinearLayoutManager(context)
//// 设置 RecyclerView 的固定大小,避免在滚动时重新计算视图大小和布局,提高性能
@@ -104,11 +111,15 @@ class TaskListFragment : BaseFragment() {
binding.taskListRecyclerview.setOnItemMenuClickListener { menuBridge, position ->
menuBridge.closeMenu()
val taskBean = adapter.data[position]
if (taskBean.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
Toast.makeText(context, "数据未上传,不允许关闭!", Toast.LENGTH_SHORT)
.show()
} else {
viewModel.removeTask(requireContext(), taskBean)
if(menuBridge.position==0){
if (taskBean.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
Toast.makeText(context, "数据未上传,不允许关闭!", Toast.LENGTH_SHORT)
.show()
} else {
viewModel.removeTask(requireContext(), taskBean)
}
}else{
viewModel.resetDownload(requireContext(), taskBean)
}
}
@@ -134,6 +145,39 @@ class TaskListFragment : BaseFragment() {
binding.taskListRecyclerview.smoothScrollToPosition(position)
}
viewModel.liveDataLoadTask.observe(viewLifecycleOwner){
when(it){
TaskLoadStatus.TASK_LOAD_STATUS_BEGIN->{
showLoadingDialog("正在切换任务")
}
TaskLoadStatus.TASK_LOAD_STATUS_FISISH->{
hideLoadingDialog()
}
}
}
viewModel.liveDataCloseTask.observe(viewLifecycleOwner){
when(it){
TaskDelStatus.TASK_DEL_STATUS_BEGIN->{
showLoadingDialog("正在重置...")
}
TaskDelStatus.TASK_DEL_STATUS_LOADING->{
showLoadingDialog("正在重置...")
}
TaskDelStatus.TASK_DEL_STATUS_SUCCESS->{
hideLoadingDialog()
Toast.makeText(context,"成功重置",Toast.LENGTH_LONG).show()
}
TaskDelStatus.TASK_DEL_STATUS_FAILED->{
hideLoadingDialog()
}
TaskDelStatus.TASK_DEL_STATUS_CANCEL->{
}
}
}
//监听并调用上传
viewModel.liveDataTaskUpload.observe(viewLifecycleOwner) {
for ((key, value) in it) {

View File

@@ -4,6 +4,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.os.Build
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.annotation.RequiresApi
@@ -31,6 +32,44 @@ import org.oscim.core.GeoPoint
import java.io.File
import javax.inject.Inject
enum class TaskDelStatus {
/**
* 删除开始
*/
TASK_DEL_STATUS_BEGIN,
/**
* 删除中
*/
TASK_DEL_STATUS_LOADING,
/**
* 删除成功
*/
TASK_DEL_STATUS_SUCCESS,
/**
* 删除失败
*/
TASK_DEL_STATUS_FAILED,
/**
* 取消删除
*/
TASK_DEL_STATUS_CANCEL,
}
enum class TaskLoadStatus {
/**
* 加载开始
*/
TASK_LOAD_STATUS_BEGIN,
/**
* 加载结束
*/
TASK_LOAD_STATUS_FISISH,
}
@HiltViewModel
class TaskViewModel @Inject constructor(
@@ -61,7 +100,17 @@ class TaskViewModel @Inject constructor(
/**
* 用来确定是否关闭
*/
val liveDataCloseTask = MutableLiveData<Boolean>()
val liveDataCloseTask = MutableLiveData<TaskDelStatus>()
/**
* 用来确定是否加载
*/
val liveDataLoadTask = MutableLiveData<TaskLoadStatus>()
/**
* 用来更新任务
*/
val liveDataUpdateTask = MutableLiveData<TaskBean>()
/**
* 提示信息
@@ -107,13 +156,14 @@ class TaskViewModel @Inject constructor(
if (currentSelectTaskBean == null) {
liveDataToastMessage.postValue("还没有开启任何任务")
} else {
val links = realmOperateHelper.queryLink(realm,
val links = realmOperateHelper.queryLink(
realm,
point = point,
)
if (links.isNotEmpty()) {
val l = links[0]
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
if (link.linkPid == l.properties["linkPid"]) {
if (link.linkPid == l.linkPid) {
return@launch
}
}
@@ -125,13 +175,14 @@ class TaskViewModel @Inject constructor(
} else {
viewModelScope.launch(Dispatchers.IO) {
val realm = realmOperateHelper.getSelectTaskRealmInstance()
val links = realmOperateHelper.queryLink(realm,
val links = realmOperateHelper.queryLink(
realm,
point = point,
)
if (links.isNotEmpty()) {
val l = links[0]
for (link in currentSelectTaskBean!!.hadLinkDvoList) {
if (link.linkPid == l.properties["linkPid"]) {
if (link.linkPid == l.linkPid) {
liveDataSelectLink.postValue(link.linkPid)
mapController.lineHandler.showLine(link.geometry)
break
@@ -178,22 +229,34 @@ class TaskViewModel @Inject constructor(
task.fileSize = item.fileSize
task.status = item.status
task.currentSize = item.currentSize
//增加mesh==null兼容性处理
for (hadLink in item.hadLinkDvoList) {
if (hadLink.mesh == null) {
hadLink.mesh = ""
Log.e("qj", "${task.id}==null")
}
}
task.hadLinkDvoList = item.hadLinkDvoList
task.syncStatus = item.syncStatus
//已上传后不在更新操作时间
if (task.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
//赋值时间,用于查询过滤
task.operationTime = DateTimeUtil.getNowDate().time
}else{//已上传数据不做更新
} else {//已上传数据不做更新
continue
}
} else {
for (hadLink in task.hadLinkDvoList) {
hadLink.taskId = task.id
if (hadLink.mesh == null) {
hadLink.mesh = ""
Log.e("qj", "${task.id}==新增==null")
}
}
//赋值时间,用于查询过滤
task.operationTime = DateTimeUtil.getNowDate().time
}
Log.e("qj", "${task.id}")
realm.copyToRealmOrUpdate(task)
}
}
@@ -271,16 +334,45 @@ class TaskViewModel @Inject constructor(
currentSelectTaskBean = taskBean
liveDataTaskLinks.value = taskBean.hadLinkDvoList
liveDataLoadTask.postValue(TaskLoadStatus.TASK_LOAD_STATUS_BEGIN)
showTaskLinks(taskBean)
MapParamUtils.setTaskId(taskBean.id)
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH + "/${taskBean.id}")
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)
//重新加载轨迹
viewModelScope.launch(Dispatchers.IO) {
Constant.TRACE_COUNT = 0
val list: List<NiLocation>? = TraceDataBase.getDatabase(
mapController.mMapView.context, Constant.USER_DATA_PATH
).niLocationDao.findToTaskIdAll(taskBean.id.toString())
list!!.forEach {
Constant.TRACE_COUNT ++
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_MORE_TIME==0){
mapController.markerHandle.addNiLocationMarkerItemRough(it)
}
if(Constant.TRACE_COUNT%Constant.TRACE_COUNT_TIME==0){
mapController.markerHandle.addNiLocationMarkerItemSimple(it)
}
mapController.markerHandle.addNiLocationMarkerItem(it)
}
liveDataLoadTask.postValue(TaskLoadStatus.TASK_LOAD_STATUS_FISISH)
withContext(Dispatchers.Main){
MapParamUtils.setTaskId(taskBean.id)
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH + "/${taskBean.id}")
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)
}
}
}
@@ -410,6 +502,71 @@ class TaskViewModel @Inject constructor(
}
}
/**
* 重新下载数据任务
*/
fun resetDownload(context: Context, taskBean: TaskBean) {
val mDialog = FirstDialog(context)
mDialog.setTitle("提示?")
mDialog.setMessage("是否重置下载状态,请确认!")
mDialog.setPositiveButton(
"确定"
) { dialog, _ ->
dialog.dismiss()
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_BEGIN)
viewModelScope.launch(Dispatchers.IO) {
//删除已下载的数据
val fileTemp =
File("${Constant.DOWNLOAD_PATH}${taskBean.evaluationTaskName}_${taskBean.dataVersion}.zip")
if (fileTemp.exists()) {
fileTemp.delete()
}
val taskFileTemp = File(Constant.USER_DATA_PATH + "/${taskBean.id}")
//重命名
if (taskFileTemp.exists()) {
/* var currentSelectTaskFolder = File(Constant.USER_DATA_PATH + "/${taskBean.id}")
var currentSelectTaskConfig =
RealmConfiguration.Builder().directory(currentSelectTaskFolder)
.name("OMQS.realm").encryptionKey(Constant.PASSWORD)
.allowQueriesOnUiThread(true)
.schemaVersion(2).build()
Realm.getInstance(currentSelectTaskConfig).executeTransaction { r ->
//删除已有所有数据
r.delete(RenderEntity::class.java)
r.delete(ReferenceEntity::class.java)
}
Realm.getInstance(currentSelectTaskConfig).close()*/
}
//将下载状态修改已下载
val realm = realmOperateHelper.getRealmDefaultInstance()
taskBean.syncStatus = FileManager.Companion.FileUploadStatus.NONE
taskBean.status = FileManager.Companion.FileDownloadStatus.NONE
realm.beginTransaction()
realm.copyToRealmOrUpdate(taskBean)
realm.commitTransaction()
realm.close()
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_SUCCESS)
withContext(Dispatchers.Main) {
if (taskBean.id == currentSelectTaskBean?.id ?: 0) {
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
} else {
setSelectTaskBean(taskBean)
}
realmOperateHelper.getRealmDefaultInstance().refresh()
//重新加载数据
getLocalTaskList()
}
}
}
mDialog.setNegativeButton(
"取消"
) { _, _ ->
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_CANCEL)
mDialog.dismiss()
}
mDialog.show()
}
/**
* 关闭任务
*/
@@ -421,7 +578,9 @@ class TaskViewModel @Inject constructor(
"确定"
) { dialog, _ ->
dialog.dismiss()
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_BEGIN)
viewModelScope.launch(Dispatchers.IO) {
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_LOADING)
val realm = realmOperateHelper.getRealmDefaultInstance()
realm.executeTransaction {
val objects =
@@ -455,14 +614,14 @@ class TaskViewModel @Inject constructor(
FileManager.checkOMDBFileInfo(item)
}
liveDataTaskList.postValue(taskList)
liveDataCloseTask.postValue(true)
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_SUCCESS)
realm.close()
}
}
mDialog.setNegativeButton(
"取消"
) { _, _ ->
liveDataCloseTask.postValue(false)
liveDataCloseTask.postValue(TaskDelStatus.TASK_DEL_STATUS_CANCEL)
mDialog.dismiss()
}
mDialog.show()
@@ -559,7 +718,7 @@ class TaskViewModel @Inject constructor(
viewModelScope.launch(Dispatchers.IO) {
val hadLinkDvoBean = HadLinkDvoBean(
taskId = currentSelectTaskBean!!.id,
linkPid = data.properties["linkPid"]!!,
linkPid = data.linkPid,
geometry = data.geometry,
linkStatus = 2
)
@@ -572,8 +731,8 @@ class TaskViewModel @Inject constructor(
r.copyToRealmOrUpdate(currentSelectTaskBean!!)
}
//根据Link数据查询对应数据上要素对要素进行显示重置
data.properties["linkPid"]?.let {
realmOperateHelper.queryLinkToMutableRenderEntityList(realm,it)
data.linkPid.let {
realmOperateHelper.queryLinkToMutableRenderEntityList(realm, it)
?.forEach { renderEntity ->
if (renderEntity.enable != 1) {
renderEntity.enable = 1
@@ -628,7 +787,10 @@ class TaskViewModel @Inject constructor(
//重置数据为隐藏
if (hadLinkDvoBean.linkStatus == 2) {
realmOperateHelper.queryLinkToMutableRenderEntityList(realm,hadLinkDvoBean.linkPid)
realmOperateHelper.queryLinkToMutableRenderEntityList(
realm,
hadLinkDvoBean.linkPid
)
?.forEach { renderEntity ->
if (renderEntity.enable == 1) {
renderEntity.enable = 0

View File

@@ -0,0 +1,349 @@
package com.navinfo.omqs.util;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.content.Context;
import android.util.Log;
import com.navinfo.omqs.Constant;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 带日志文件输入的,又可控开关的日志调试
*
* @author qj
* @version 1.0
* @data 2016-8-23
*/
public class CMLog {
//CrashHandler实例
/**
*
*/
private static CMLog instance;
/**
*
*/
private static Boolean MYLOG_SWITCH = true; //日志文件总开关
/**
*
*/
private static Boolean MYLOG_WRITE_TO_FILE = true;//日志写入文件开关
/**
*
*/
private static char MYLOG_TYPE = 'v';//输入日志类型w代表只输出告警信息等v代表输出所有信息
// private static String MYLOG_PATH_SDCARD_DIR = FMConstant.USER_DATA_LOG_PATH;// 日志文件在sdcard中的路径
/**
*
*/
private static int SDCARD_LOG_FILE_SAVE_DAYS = 0;// sd卡中日志文件的最多保存天数
/**
*
*/
private static String MYLOGFILEName = "Log.txt";// 本类输出的日志文件名称
/**
*
*/
private static String STACKLOGFILEName = "StackLog.txt";// 本类输出的日志文件名称
/**
*
*/
private static SimpleDateFormat myLogSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//日志的输出格式
/**
*
*/
private static SimpleDateFormat logfile = new SimpleDateFormat("yyyy-MM-dd-HH");//日志文件格式
/**
*
*/
private static Context mContext;
/**
*
*/
private static boolean flag;
/**
*
*/
private static int count = 0;
/**
*
*/
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
/**
* 获取CrashHandler实例 ,单例模式
* @return
*/
public static CMLog getInstance() {
if (instance == null)
instance = new CMLog();
return instance;
}
/**
* 初始化
* @param context
*/
public void init(Context context) {
mContext = context;
}
/**
* @param tag
* @param msg
*/
public static void w(String tag, Object msg) {//警告信息
log(tag, msg.toString(), 'w');
}
/**
* @param tag
* @param msg
*/
public static void e(String tag, Object msg) {//错误信息
log(tag, msg.toString(), 'e');
}
/**
* @param tag
* @param msg
*/
public static void d(String tag, Object msg) {//调试信息
log(tag, msg.toString(), 'd');
}
/**
* @param tag
* @param msg
*/
public static void i(String tag, Object msg) {//
log(tag, msg.toString(), 'i');
}
/**
* @param tag
* @param msg
*/
public static void v(String tag, Object msg) {
log(tag, msg.toString(), 'v');
}
/**
* @param tag
* @param text
*/
public static void w(String tag, String text) {
log(tag, text, 'w');
}
/**
* @param tag
* @param text
*/
public static void e(String tag, String text) {
log(tag, text, 'e');
}
/**
* @param tag
* @param text
*/
public static void d(String tag, String text) {
log(tag, text, 'd');
}
/**
* @param tag
* @param text
*/
public static void i(String tag, String text) {
log(tag, text, 'i');
}
/**
* @param tag
* @param text
*/
public static void v(String tag, String text) {
log(tag, text, 'v');
}
/**
* 根据tag, msg和等级输出日志
*
* @param tag
* @param msg
* @param level
* @return void
* @since v 1.0
*/
private static void log(String tag, String msg, char level) {
if (MYLOG_SWITCH) {
if ('e' == level && ('e' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) { // 输出错误信息
Log.e(tag, msg);
} else if ('w' == level && ('w' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) {
Log.w(tag, msg);
} else if ('d' == level && ('d' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) {
Log.d(tag, msg);
} else if ('i' == level && ('d' == MYLOG_TYPE || 'v' == MYLOG_TYPE)) {
Log.i(tag, msg);
} else {
Log.v(tag, msg);
}
if (MYLOG_WRITE_TO_FILE)
writeLogtoFile(String.valueOf(level), tag, msg);
}
}
/**
* 打开日志文件并写入日志
*
* @param mylogtype
* @param tag
* @param text
**/
public static void writeLogtoFile(String mylogtype, String tag, String text) {
if (!flag&&MYLOG_WRITE_TO_FILE) {
flag = true;
try {
Log.e("qj", "日志写入0");
// 新建或打开日志文件
Date nowtime = new Date();
String needWriteFiel = logfile.format(nowtime);
// String needWriteMessage = myLogSdf.format(nowtime) + " " + mylogtype
String needWriteMessage = simpleDateFormat.format(nowtime) + " " + mylogtype
+ " " + count + " " + tag + " " + text + "\r\n";
//输出内存使用情况
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
MemoryInfo memoryInfo = new MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
/* needWriteMessage += " 系统剩余内存: " + (memoryInfo.availMem / 1024) + "(KB)\n";
needWriteMessage += " 系统是否处于低内存运行: " + memoryInfo.lowMemory + "\n";
needWriteMessage += " 当系统剩余内存低于: " + (memoryInfo.threshold / 1024) + "(KB)\n";*/
if (new File(Constant.USER_DATA_LOG_PATH).exists() == false) {
new File(Constant.USER_DATA_LOG_PATH).mkdirs();
}
File file = new File(Constant.USER_DATA_LOG_PATH, needWriteFiel + MYLOGFILEName);
Log.e("qj", "日志写入1");
if (!file.exists())
file.createNewFile();
Log.e("qj", "日志写入2");
FileWriter filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据,不进行覆盖
BufferedWriter bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(needWriteMessage);
bufWriter.newLine();
bufWriter.close();
filerWriter.close();
Log.e("qj", "日志写入结束");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
flag = false;
}
}
count ++;
if(count>10000){
count = 0;
}
}
/**
* 写入调用栈的信息,包括文件名,行号,接口名称
*
* @param extMsg 扩展信息如果不为NULL则输出到栈信息之前
*/
public static void writeStackLogtoFile(String extMsg) {// 新建或打开日志文件
StackTraceElement[] eles = Thread.currentThread().getStackTrace();
Date nowtime = new Date();
String needWriteFiel = logfile.format(nowtime);
String needWriteMessage = "[Java Stack]:" + myLogSdf.format(nowtime) + "\n";
if(eles!=null&&eles.length>3){
needWriteMessage += "\t file name :" + eles[3].getFileName() + "\n";
needWriteMessage += "\t line num :" + eles[3].getLineNumber() + "\n";
needWriteMessage += "\t class name:" + eles[3].getClassName() + "\n";
needWriteMessage += "\t method :" + eles[3].getMethodName() + "\n";
}
if (extMsg != null && extMsg.length() > 0) {
needWriteMessage += "\t extMsg :" + extMsg + "\n";
}
if (new File(Constant.USER_DATA_LOG_PATH).exists() == false) {
new File(Constant.USER_DATA_LOG_PATH).mkdirs();
}
File file = new File(Constant.USER_DATA_LOG_PATH, needWriteFiel
+ STACKLOGFILEName);
try {
FileWriter filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据,不进行覆盖
BufferedWriter bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(needWriteMessage);
bufWriter.newLine();
bufWriter.close();
filerWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 删除制定的日志文件
*/
public static void delFile() {// 删除日志文件
String needDelFiel = logfile.format(getDateBefore());
File file = new File(Constant.USER_DATA_LOG_PATH, needDelFiel + MYLOGFILEName);
if (file.exists()) {
file.delete();
}
}
/**
* 得到现在时间前的几天日期,用来得到需要删除的日志文件名
* @return
*/
private static Date getDateBefore() {
Date nowtime = new Date();
Calendar now = Calendar.getInstance();
now.setTime(nowtime);
now.set(Calendar.DATE, now.get(Calendar.DATE)
- SDCARD_LOG_FILE_SAVE_DAYS);
return now.getTime();
}
//输出错误日志
/**
* 得到现在时间前的几天日期,用来得到需要删除的日志文件名
* @param e
* @param TAG
*/
public static void writeStackLogtoFile(Exception e, String TAG) {
String errorInfo = "";
for (int i = 0; i < e.getStackTrace().length; i++) {
errorInfo += e.getStackTrace()[i];
}
writeLogtoFile("异常崩溃", "异常", "异常信息:" + errorInfo);
}
/**
* @param mylogWriteToFile
*/
public static void setMylogWriteToFile(Boolean mylogWriteToFile) {
MYLOG_WRITE_TO_FILE = mylogWriteToFile;
}
}

View File

@@ -11,15 +11,17 @@ import com.navinfo.omqs.bean.NaviRoute
import com.navinfo.omqs.bean.NaviRouteItem
import com.navinfo.omqs.db.RealmOperateHelper
import io.realm.Realm
import org.locationtech.jts.geom.Geometry
import org.locationtech.jts.geom.LineString
import org.locationtech.jts.geom.Point
import org.oscim.core.GeoPoint
interface OnNaviEngineCallbackListener {
fun planningPathStatus(code: NaviStatus)
fun planningPathStatus(code: NaviStatus, linkdId: String? = null, geometry: String? = null)
// fun planningPathError(errorCode: NaviStatus, errorMessage: String)
suspend fun bindingResults(route: NaviRoute?, list: List<NaviRouteItem>)
}
enum class NaviStatus {
@@ -73,6 +75,7 @@ class NaviEngine(
DataCodeEnum.OMDB_TRAFFICLIGHT.name,
// DataCodeEnum.OMDB_RESTRICTION.name,
DataCodeEnum.OMDB_LANEINFO.name,
DataCodeEnum.OMDB_CLM_LANEINFO.name,
DataCodeEnum.OMDB_TRAFFIC_SIGN.name,
DataCodeEnum.OMDB_WARNINGSIGN.name,
DataCodeEnum.OMDB_TOLLGATE.name
@@ -205,9 +208,12 @@ class NaviEngine(
callback.planningPathStatus(NaviStatus.NAVI_STATUS_PATH_PLANNING)
val pathList = mutableListOf<NaviRoute>()
val realm = realmOperateHelper.getSelectTaskRealmInstance()
for (link in taskBean.hadLinkDvoList) {
Log.e("jingo", "路径计算 条数 ${taskBean.hadLinkDvoList.size}")
for (i in 0 until taskBean.hadLinkDvoList.size) {
val link = taskBean.hadLinkDvoList[i]
Log.e("jingo","获取 S E $i 总共 ${taskBean.hadLinkDvoList.size}")
//测线不参与导航
if (link.linkStatus == 3) {
if (link!!.linkStatus == 3) {
continue
}
val route = NaviRoute(
@@ -217,7 +223,7 @@ class NaviEngine(
route.pointList = GeometryTools.getGeoPoints(link.geometry)
val res = realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST)
.equalTo("properties['linkPid']", link.linkPid).findAll()
.equalTo("linkPid", link.linkPid).findAll()
var bHasNode = false
var bHasDir = false
var bHasName = false
@@ -255,13 +261,17 @@ class NaviEngine(
}
if (!bHasNode) {
callback.planningPathStatus(
NaviStatus.NAVI_STATUS_PATH_ERROR_NODE
NaviStatus.NAVI_STATUS_PATH_ERROR_NODE,
link.linkPid,
link.geometry
)
return
}
if (!bHasDir) {
callback.planningPathStatus(
NaviStatus.NAVI_STATUS_PATH_ERROR_DIRECTION
NaviStatus.NAVI_STATUS_PATH_ERROR_DIRECTION,
link!!.linkPid,
link.geometry
)
return
}
@@ -346,7 +356,9 @@ class NaviEngine(
if (!bHasLast && !bHasNext) {
bBreak = false
callback.planningPathStatus(
NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED
NaviStatus.NAVI_STATUS_PATH_ERROR_BLOCKED,
tempRouteList[0].linkId,
GeometryTools.getLineString(tempRouteList[0].pointList)
)
realm.close()
return
@@ -356,11 +368,13 @@ class NaviEngine(
val itemMap: MutableMap<GeoPoint, MutableList<RenderEntity>> = mutableMapOf()
//查询每根link上的关联要素
for (route in newRouteList) {
for (i in newRouteList.indices) {
val route = newRouteList[i]
Log.e("jingo","获取 插入要素 $i 总共 ${newRouteList.size}")
itemMap.clear()
//常规点限速
val res = realm.where(RenderEntity::class.java)
.equalTo("properties['linkPid']", route.linkId).and().`in`(
.equalTo("linkPid", route.linkId).and().`in`(
"table",
QUERY_KEY_ITEM_LIST
).findAll()

View File

@@ -0,0 +1,84 @@
package com.navinfo.omqs.util
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
import com.navinfo.collect.library.data.entity.NiLocation
import com.navinfo.collect.library.data.entity.RenderEntity
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.db.RealmOperateHelper
import io.realm.Realm
import org.oscim.core.GeoPoint
class NaviEngineNew(
private val realmOperateHelper: RealmOperateHelper,
) {
/**
* 要查询的link基本信息列表
*/
private val QUERY_KEY_LINK_INFO_LIST = arrayOf(
DataCodeEnum.OMDB_RD_LINK.name,
DataCodeEnum.OMDB_LINK_DIRECT.name,
DataCodeEnum.OMDB_LINK_NAME.name,
)
private val locationList = mutableListOf<NiLocation>()
suspend fun bindingRoute(
niLocation: NiLocation? = null,
taskBean: TaskBean,
geoPoint: GeoPoint,
realm:Realm
) {
var latestRoute: HadLinkDvoBean? = null
var lastDis = -1.0
for (link in taskBean.hadLinkDvoList) {
val linkGeometry = GeometryTools.createGeometry(link.geometry)
val footAndDistance = GeometryTools.pointToLineDistance(geoPoint, linkGeometry)
val meterD = footAndDistance.getMeterDistance()
if (meterD < 15 && (lastDis < 0 || lastDis > meterD)) {
latestRoute = link
lastDis = meterD
}
}
latestRoute?.let {
val res2 =
realm.where(RenderEntity::class.java).`in`("table", QUERY_KEY_LINK_INFO_LIST)
.equalTo("linkPid", it.linkPid).findAll()
if (res2 != null) {
for (entity in res2) {
when (entity.code) {
DataCodeEnum.OMDB_RD_LINK.code -> {
val snodePid = entity.properties["snodePid"]
if (snodePid != null) {
} else {
}
val enodePid = entity.properties["enodePid"]
if (enodePid != null) {
} else {
}
}
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
val direct = entity.properties["direct"]
if (direct != null) {
}
}
DataCodeEnum.OMDB_LINK_NAME.code -> {
// var name = realm.copyFromRealm(res4)
}
}
}
}
}
}
}

View File

@@ -35,7 +35,7 @@ class SignUtil {
return SignBean(
iconId = getSignIcon(element),
iconText = getSignIconText(element),
linkId = element.properties[RenderEntity.Companion.LinkTable.linkPid]
linkId = element.linkPid
?: "",
name = getSignNameText(element),
bottomRightText = getSignBottomRightText(
@@ -107,7 +107,7 @@ class SignUtil {
//物理车道数OMDB_PHY_LANENUM
DataCodeEnum.OMDB_LANE_NUM.code,
DataCodeEnum.OMDB_PHY_LANENUM.code -> {
"${data.properties["laneNum"]}|${data.properties["laneS2e"]}|${data.properties["laneE2s"]}"
"${data.properties["laneS2e"]}|${data.properties["laneE2s"]}"
}
//常规点限速,条件点限速
@@ -208,7 +208,7 @@ class SignUtil {
DataCodeEnum.OMDB_RD_LINK.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
title = "linkPid", text = "${data.linkPid}"
)
)
list.add(
@@ -226,7 +226,7 @@ class SignUtil {
DataCodeEnum.OMDB_RD_LINK_KIND.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
title = "linkPid", text = "${data.linkPid}"
)
)
try {
@@ -244,7 +244,7 @@ class SignUtil {
DataCodeEnum.OMDB_LINK_DIRECT.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
title = "linkPid", text = "${data.linkPid}"
)
)
try {
@@ -286,11 +286,11 @@ class SignUtil {
//车道数//增加物理车道数DataCodeEnum.OMDB_PHY_LANENUM.code
DataCodeEnum.OMDB_PHY_LANENUM.code,
DataCodeEnum.OMDB_LANE_NUM.code -> {
list.add(
/* list.add(
TwoItemAdapterItem(
title = "车道总数", text = "${data.properties["laneNum"]}"
)
)
)*/
list.add(
TwoItemAdapterItem(
title = "顺方向车道数", text = "${data.properties["laneS2e"]}"
@@ -333,7 +333,7 @@ class SignUtil {
DataCodeEnum.OMDB_LINK_CONSTRUCTION.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
title = "linkPid", text = "${data.linkPid}"
)
)
@@ -386,7 +386,7 @@ class SignUtil {
DataCodeEnum.OMDB_WARNINGSIGN.code -> {
list.add(
TwoItemAdapterItem(
title = "linkPid", text = "${data.properties["linkPid"]}"
title = "linkPid", text = "${data.linkPid}"
)
)
list.add(
@@ -751,7 +751,7 @@ class SignUtil {
fun getTollgateInfo(renderEntity: RenderEntity): List<LaneBoundaryItem> {
val list = mutableListOf<LaneBoundaryItem>()
list.add(
LaneBoundaryItem("linkPid", "${renderEntity.properties["linkPid"]}", null)
LaneBoundaryItem("linkPid", "${renderEntity.linkPid}", null)
)
list.add(
LaneBoundaryItem("收费站号码", "${renderEntity.properties["tollgatePid"]}", null)
@@ -1426,14 +1426,14 @@ class SignUtil {
)
DataCodeEnum.OMDB_RD_LINK_KIND.code -> stringBuffer.append("种别${item.iconText},")
DataCodeEnum.OMDB_LINK_DIRECT.code -> stringBuffer.append("${item.iconText},")
DataCodeEnum.OMDB_PHY_LANENUM.code,//物理车道数
/* DataCodeEnum.OMDB_PHY_LANENUM.code,//物理车道数
DataCodeEnum.OMDB_LANE_NUM.code -> stringBuffer.append(
"${
item.iconText.substringBefore(
"|"
)
}车道"
)
)*/
}
}
return stringBuffer.toString()

View File

@@ -48,12 +48,17 @@
android:title="锁定地图旋转及视角" />
<item
android:id="@+id/personal_center_menu_marker"
android:icon="@drawable/baseline_person_24"
android:icon="@drawable/baseline_map_24"
android:visible="true"
android:title="隐藏Marker" />
<item
android:id="@+id/personal_center_menu_trace"
android:icon="@drawable/baseline_map_24"
android:visible="true"
android:title="隐藏轨迹" />
<item
android:id="@+id/personal_center_menu_catch_all"
android:icon="@drawable/baseline_person_24"
android:icon="@drawable/baseline_map_24"
android:visible="true"
android:title="全要素捕捉" />
<item