fix: 解决冲突
This commit is contained in:
commit
963c84a7d0
@ -77,7 +77,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':collect-library')
|
api project(':collect-library')
|
||||||
implementation project(path: ':vtm-android')
|
implementation project(path: ':vtm-android')
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"table": "OMDB_CHECKPOINT",
|
"table": "OMDB_CHECKPOINT",
|
||||||
"code": 1012,
|
"code": 1012,
|
||||||
"name": "检查点",
|
"name": "检查点",
|
||||||
|
"catch":true,
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20
|
"zoomMax": 20
|
||||||
},
|
},
|
||||||
@ -31,7 +32,7 @@
|
|||||||
"name": "道路线",
|
"name": "道路线",
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 17,
|
"zoomMax": 17,
|
||||||
"catch":false,
|
"catch":true,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
},
|
},
|
||||||
"2002": {
|
"2002": {
|
||||||
@ -80,6 +81,7 @@
|
|||||||
"name": "车道边界类型",
|
"name": "车道边界类型",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
|
"catch":true,
|
||||||
"checkLinkId": false,
|
"checkLinkId": false,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
@ -94,6 +96,7 @@
|
|||||||
"table": "OMDB_LINK_CONSTRUCTION",
|
"table": "OMDB_LINK_CONSTRUCTION",
|
||||||
"code": 2017,
|
"code": 2017,
|
||||||
"name": "道路施工",
|
"name": "道路施工",
|
||||||
|
"catch":true,
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 17
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
@ -129,12 +132,14 @@
|
|||||||
"name": "道路边界类型",
|
"name": "道路边界类型",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
|
"catch":true,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
},
|
},
|
||||||
"2090":{
|
"2090":{
|
||||||
"table": "OMDB_LANE_CONSTRUCTION",
|
"table": "OMDB_LANE_CONSTRUCTION",
|
||||||
"code": 2090,
|
"code": 2090,
|
||||||
"name": "车道施工",
|
"name": "车道施工",
|
||||||
|
"catch":true,
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
@ -175,6 +180,7 @@
|
|||||||
"name": "文字",
|
"name": "文字",
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
|
"catch":true,
|
||||||
"transformer": []
|
"transformer": []
|
||||||
},
|
},
|
||||||
"3003":{
|
"3003":{
|
||||||
@ -183,6 +189,7 @@
|
|||||||
"name": "符号",
|
"name": "符号",
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
|
"catch":true,
|
||||||
"transformer": []
|
"transformer": []
|
||||||
},
|
},
|
||||||
"3004":{
|
"3004":{
|
||||||
@ -224,6 +231,7 @@
|
|||||||
"code": 3006,
|
"code": 3006,
|
||||||
"name": "杆状物",
|
"name": "杆状物",
|
||||||
"is3D": true,
|
"is3D": true,
|
||||||
|
"catch":true,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -237,6 +245,7 @@
|
|||||||
"table": "OMDB_FILL_AREA",
|
"table": "OMDB_FILL_AREA",
|
||||||
"code": 3012,
|
"code": 3012,
|
||||||
"name": "导流区",
|
"name": "导流区",
|
||||||
|
"catch":true,
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20
|
"zoomMax": 20
|
||||||
},
|
},
|
||||||
@ -244,6 +253,7 @@
|
|||||||
"table": "OMDB_CROSS_WALK",
|
"table": "OMDB_CROSS_WALK",
|
||||||
"code": 3014,
|
"code": 3014,
|
||||||
"name": "人行横道",
|
"name": "人行横道",
|
||||||
|
"catch":true,
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20
|
"zoomMax": 20
|
||||||
},
|
},
|
||||||
@ -252,6 +262,7 @@
|
|||||||
"code": 3016,
|
"code": 3016,
|
||||||
"name": "停止位置",
|
"name": "停止位置",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
|
"catch":true,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
},
|
},
|
||||||
@ -261,6 +272,7 @@
|
|||||||
"name": "路口",
|
"name": "路口",
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 17,
|
"zoomMax": 17,
|
||||||
|
"catch":true,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -338,7 +350,8 @@
|
|||||||
"code": 4006,
|
"code": 4006,
|
||||||
"name": "普通交限",
|
"name": "普通交限",
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20,
|
"zoomMax": 17,
|
||||||
|
"catch":true,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -489,7 +502,7 @@
|
|||||||
"name": "车道中心线",
|
"name": "车道中心线",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"catch":false,
|
"checkLinkId": false,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -522,17 +535,23 @@
|
|||||||
"2022": {
|
"2022": {
|
||||||
"table": "OMDB_CON_ACCESS",
|
"table": "OMDB_CON_ACCESS",
|
||||||
"code": 2022,
|
"code": 2022,
|
||||||
"name": "全封闭"
|
"name": "全封闭",
|
||||||
|
"zoomMin": 15,
|
||||||
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2037": {
|
"2037": {
|
||||||
"table": "OMDB_RAMP",
|
"table": "OMDB_RAMP",
|
||||||
"code": 2037,
|
"code": 2037,
|
||||||
"name": "匝道"
|
"name": "匝道",
|
||||||
|
"zoomMin": 15,
|
||||||
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2040": {
|
"2040": {
|
||||||
"table": "OMDB_MULTI_DIGITIZED",
|
"table": "OMDB_MULTI_DIGITIZED",
|
||||||
"code": 2040,
|
"code": 2040,
|
||||||
"name": "上下线分离"
|
"name": "上下线分离",
|
||||||
|
"zoomMin": 15,
|
||||||
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2204":{
|
"2204":{
|
||||||
"table": "OMDB_ROUNDABOUT",
|
"table": "OMDB_ROUNDABOUT",
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.navinfo.omqs
|
package com.navinfo.omqs
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.utils.MapParamUtils
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
|
import io.realm.RealmConfiguration
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class Constant {
|
class Constant {
|
||||||
companion object {
|
companion object {
|
||||||
@ -37,6 +40,30 @@ class Constant {
|
|||||||
*/
|
*/
|
||||||
lateinit var USER_DATA_PATH: String
|
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 = ""
|
var INDOOR_IP: String = ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const val DEBUG = true
|
const val DEBUG = true
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,6 +103,11 @@ class Constant {
|
|||||||
*/
|
*/
|
||||||
var AUTO_LOCATION = false
|
var AUTO_LOCATION = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图视角是否锁定
|
||||||
|
*/
|
||||||
|
var MapRotateEnable = false
|
||||||
|
|
||||||
var IS_VIDEO_SPEED by kotlin.properties.Delegates.notNull<Boolean>()
|
var IS_VIDEO_SPEED by kotlin.properties.Delegates.notNull<Boolean>()
|
||||||
|
|
||||||
const val message_status_late = "预约,待发送"
|
const val message_status_late = "预约,待发送"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.omqs.bean
|
package com.navinfo.omqs.bean
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import com.google.gson.annotations.Expose
|
import com.google.gson.annotations.Expose
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.omqs.db.ImportPreProcess
|
import com.navinfo.omqs.db.ImportPreProcess
|
||||||
@ -20,8 +21,10 @@ class ImportConfig {
|
|||||||
fun transformProperties(renderEntity: RenderEntity): RenderEntity? {
|
fun transformProperties(renderEntity: RenderEntity): RenderEntity? {
|
||||||
val transformList = tableMap[renderEntity.code.toString()]?.transformer
|
val transformList = tableMap[renderEntity.code.toString()]?.transformer
|
||||||
if (transformList.isNullOrEmpty()) {
|
if (transformList.isNullOrEmpty()) {
|
||||||
|
Log.e("qj", "子表转换为空===${renderEntity.code}")
|
||||||
return renderEntity
|
return renderEntity
|
||||||
}
|
}
|
||||||
|
Log.e("qj", "子表转换不为空===${renderEntity.code}")
|
||||||
for (transform in transformList) {
|
for (transform in transformList) {
|
||||||
// 开始执行转换
|
// 开始执行转换
|
||||||
val key:String = transform.k
|
val key:String = transform.k
|
||||||
@ -122,7 +125,7 @@ class TableInfo {
|
|||||||
val zoomMin: Int = 16
|
val zoomMin: Int = 16
|
||||||
val zoomMax: Int = 21
|
val zoomMax: Int = 21
|
||||||
val checkLinkId: Boolean = true//是否需要校验linkid
|
val checkLinkId: Boolean = true//是否需要校验linkid
|
||||||
val catch: Boolean = true//是否需要捕捉
|
val catch: Boolean = false//是否需要捕捉 // 需要根据丹丹提供的捕捉原则进行设置,参考文档W行设置条件,https://navinfo.feishu.cn/sheets/shtcnfsxKZhekU26ezBcHgl7aWh?sheet=BZd6yM
|
||||||
val name: String = ""
|
val name: String = ""
|
||||||
var checked : Boolean = true
|
var checked : Boolean = true
|
||||||
var transformer: MutableList<Transform> = mutableListOf()
|
var transformer: MutableList<Transform> = mutableListOf()
|
||||||
|
24
app/src/main/java/com/navinfo/omqs/bean/Route.kt
Normal file
24
app/src/main/java/com/navinfo/omqs/bean/Route.kt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package com.navinfo.omqs.bean
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
|
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||||
|
import org.locationtech.jts.geom.Geometry
|
||||||
|
import org.oscim.core.GeoPoint
|
||||||
|
|
||||||
|
data class Route(
|
||||||
|
val linkId: String,
|
||||||
|
var sNode: String = "",
|
||||||
|
var eNode: String = "",
|
||||||
|
var direct: Int = 0,
|
||||||
|
var name: String = "",
|
||||||
|
var length: Double = 0.0,
|
||||||
|
) {
|
||||||
|
var pointList: MutableList<GeoPoint> = mutableListOf()
|
||||||
|
get() {
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
length = GeometryTools.getDistance(value)
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
}
|
@ -15,12 +15,16 @@ import com.navinfo.collect.library.data.entity.TaskBean
|
|||||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
import com.navinfo.omqs.Constant
|
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.bean.ImportConfig
|
||||||
import com.navinfo.omqs.db.deep.LinkList
|
import com.navinfo.omqs.db.deep.LinkList
|
||||||
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
|
import io.realm.RealmConfiguration
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
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> =
|
suspend fun importOmdbZipFile(omdbZipFile: File, task: TaskBean): Flow<String> =
|
||||||
withContext(Dispatchers.IO) {
|
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")
|
val unZipFolder = File(omdbZipFile.parentFile, "result")
|
||||||
|
|
||||||
flow {
|
flow {
|
||||||
if (unZipFolder.exists()) {
|
if (unZipFolder.exists()) {
|
||||||
unZipFolder.deleteRecursively()
|
unZipFolder.deleteRecursively()
|
||||||
@ -151,11 +166,13 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
// 先获取当前配置的所有图层的个数,方便后续计算数据解析进度
|
// 先获取当前配置的所有图层的个数,方便后续计算数据解析进度
|
||||||
var tableNum = 0
|
var tableNum = 0
|
||||||
var processIndex = 0
|
var processIndex = 0
|
||||||
|
var dataIndex = 0
|
||||||
|
|
||||||
|
Realm.getInstance(currentInstallTaskConfig).beginTransaction()
|
||||||
|
|
||||||
for (importConfig in importConfigList) {
|
for (importConfig in importConfigList) {
|
||||||
tableNum += importConfig.tableMap.size
|
tableNum += importConfig.tableMap.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//缓存任务link信息,便于下面与数据进行任务link匹配
|
//缓存任务link信息,便于下面与数据进行任务link匹配
|
||||||
val hashMap: HashMap<String, HadLinkDvoBean> =
|
val hashMap: HashMap<String, HadLinkDvoBean> =
|
||||||
HashMap<String, HadLinkDvoBean>() //define empty hashmap
|
HashMap<String, HadLinkDvoBean>() //define empty hashmap
|
||||||
@ -165,19 +182,17 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
|
|
||||||
val resHashMap: HashMap<String, RenderEntity> =
|
val resHashMap: HashMap<String, RenderEntity> =
|
||||||
HashMap<String, RenderEntity>() //define empty hashmap
|
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()) {
|
for ((index, currentEntry) in importConfig.tableMap.entries.withIndex()) {
|
||||||
realm.beginTransaction()
|
val listResult = mutableListOf<RenderEntity>()
|
||||||
val currentConfig = currentEntry.value
|
val currentConfig = currentEntry.value
|
||||||
val txtFile = unZipFiles.find {
|
val txtFile = unZipFiles.find {
|
||||||
it.name == currentConfig.table
|
it.name == currentConfig.table
|
||||||
}
|
}
|
||||||
// 将listResult数据插入到Realm数据库中
|
// 将listResult数据插入到Realm数据库中
|
||||||
// val listResult = mutableListOf<RenderEntity>()
|
|
||||||
currentConfig?.let {
|
currentConfig?.let {
|
||||||
val list = FileIOUtils.readFile2List(txtFile, "UTF-8")
|
val list = FileIOUtils.readFile2List(txtFile, "UTF-8")
|
||||||
Log.d("ImportOMDBHelper", "开始解析:${txtFile?.name}")
|
Log.d("ImportOMDBHelper", "开始解析:${txtFile?.name}")
|
||||||
@ -201,7 +216,6 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
map["qi_zoomMax"] = currentConfig.zoomMax
|
map["qi_zoomMax"] = currentConfig.zoomMax
|
||||||
|
|
||||||
// 先查询这个mesh下有没有数据,如果有则跳过即可
|
// 先查询这个mesh下有没有数据,如果有则跳过即可
|
||||||
// val meshEntity = Realm.getDefaultInstance().where(RenderEntity::class.java).equalTo("properties['mesh']", map["mesh"].toString()).findFirst()
|
|
||||||
val renderEntity = RenderEntity()
|
val renderEntity = RenderEntity()
|
||||||
renderEntity.code = map["qi_code"].toString()
|
renderEntity.code = map["qi_code"].toString()
|
||||||
renderEntity.name = map["qi_name"].toString()
|
renderEntity.name = map["qi_name"].toString()
|
||||||
@ -256,20 +270,6 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//测试代码
|
|
||||||
/* if(renderEntity.code == DataCodeEnum.OMDB_RD_LINK_KIND.code) {
|
|
||||||
|
|
||||||
var currentLinkPid = renderEntity.properties["linkPid"]
|
|
||||||
|
|
||||||
if(currentLinkPid!="84209046927907835"){
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}else if(renderEntity.code == DataCodeEnum.OMDB_RD_LINK.code){
|
|
||||||
continue
|
|
||||||
}else{
|
|
||||||
continue
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// 如果properties中不包含name,那么自动将要素名称添加进properties中
|
// 如果properties中不包含name,那么自动将要素名称添加进properties中
|
||||||
if (!renderEntity.properties.containsKey("name")) {
|
if (!renderEntity.properties.containsKey("name")) {
|
||||||
renderEntity.properties["name"] = renderEntity.name;
|
renderEntity.properties["name"] = renderEntity.name;
|
||||||
@ -332,28 +332,28 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //交限增加相同LinkIn与LinkOut过滤原则
|
//交限增加相同LinkIn与LinkOut过滤原则
|
||||||
// if (renderEntity.code == DataCodeEnum.OMDB_RESTRICTION.code) {
|
if (renderEntity.code == DataCodeEnum.OMDB_RESTRICTION.code) {
|
||||||
// if (renderEntity.properties.containsKey("linkIn") && renderEntity.properties.containsKey(
|
if (renderEntity.properties.containsKey("linkIn") && renderEntity.properties.containsKey(
|
||||||
// "linkOut"
|
"linkOut"
|
||||||
// )
|
)
|
||||||
// ) {
|
) {
|
||||||
// var linkIn = renderEntity.properties["linkIn"]
|
var linkIn = renderEntity.properties["linkIn"]
|
||||||
// var linkOut = renderEntity.properties["linkOut"]
|
var linkOut = renderEntity.properties["linkOut"]
|
||||||
// if (linkIn != null && linkOut != null) {
|
if (linkIn != null && linkOut != null) {
|
||||||
// var checkMsg = "$linkIn$linkOut"
|
var checkMsg = "$linkIn$linkOut"
|
||||||
// if (resHashMap.containsKey(checkMsg)) {
|
if (resHashMap.containsKey(checkMsg)) {
|
||||||
// Log.e(
|
Log.e(
|
||||||
// "qj",
|
"qj",
|
||||||
// "${renderEntity.name}==过滤交限linkin与linkout相同且存在多条数据"
|
"${renderEntity.name}==过滤交限linkin与linkout相同且存在多条数据"
|
||||||
// )
|
)
|
||||||
// continue
|
continue
|
||||||
// } else {
|
} else {
|
||||||
// resHashMap.put(checkMsg, renderEntity)
|
resHashMap.put(checkMsg, renderEntity)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
//遍历判断只显示与任务Link相关的任务数据
|
//遍历判断只显示与任务Link相关的任务数据
|
||||||
if (currentConfig.checkLinkId) {
|
if (currentConfig.checkLinkId) {
|
||||||
@ -381,73 +381,56 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (renderEntity.code == DataCodeEnum.OMDB_INTERSECTION.code && renderEntity.properties.containsKey(
|
}else if(renderEntity.code == DataCodeEnum.OMDB_INTERSECTION.code && renderEntity.properties.containsKey("linkList")){
|
||||||
"linkList"
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (renderEntity.properties["linkList"] != null) {
|
if (renderEntity.properties["linkList"] != null) {
|
||||||
|
|
||||||
Log.e(
|
Log.e("qj", "linkList==开始${renderEntity.name}==${renderEntity.properties["linkList"]}}")
|
||||||
"qj",
|
|
||||||
"linkList==开始${renderEntity.name}==${renderEntity.properties["linkList"]}}"
|
|
||||||
)
|
|
||||||
|
|
||||||
val linkList =
|
val linkList = renderEntity.properties["linkList"]
|
||||||
renderEntity.properties["linkList"]
|
|
||||||
|
|
||||||
if (!linkList.isNullOrEmpty()&&linkList!="null") {
|
if (!linkList.isNullOrEmpty()&&linkList!="null") {
|
||||||
|
|
||||||
Log.e(
|
Log.e("qj", "linkList==${renderEntity.name}==${renderEntity.properties["linkList"]}}")
|
||||||
"qj",
|
|
||||||
"linkList==${renderEntity.name}==${renderEntity.properties["linkList"]}}"
|
|
||||||
)
|
|
||||||
|
|
||||||
val list: List<LinkList> = gson.fromJson(
|
val list: List<LinkList> = gson.fromJson(linkList, object : TypeToken<List<LinkList>>() {}.type)
|
||||||
linkList,
|
|
||||||
object :
|
|
||||||
TypeToken<List<LinkList>>() {}.type
|
|
||||||
)
|
|
||||||
|
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
m@for (link in list){
|
m@for (link in list){
|
||||||
if (hashMap.containsKey(link.linkPid)) {
|
if (hashMap.containsKey(link.linkPid)) {
|
||||||
renderEntity.enable = 1
|
renderEntity.enable = 1
|
||||||
|
Log.e("qj", "${renderEntity.name}==包括任务link")
|
||||||
break@m
|
break@m
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//过滤掉非任务路线上的数据
|
||||||
|
if (renderEntity.enable != 1) {
|
||||||
Log.e(
|
Log.e(
|
||||||
"qj",
|
"qj",
|
||||||
"${renderEntity.name}==包括任务link"
|
"${renderEntity.name}==过滤不包括任务路线上的数据"
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
renderEntity.enable = 2
|
|
||||||
Log.e("qj", "简单路口")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
renderEntity.enable = 2
|
|
||||||
Log.e(
|
|
||||||
"qj",
|
|
||||||
"${renderEntity.name}==不包括任务linkPid"
|
|
||||||
)
|
)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
renderEntity.enable = 2
|
renderEntity.enable = 2
|
||||||
Log.e("qj", "${renderEntity.name}==不包括任务linkPid")
|
Log.e("qj", "${renderEntity.name}==不包括任务linkPid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 对renderEntity做预处理后再保存
|
// 对renderEntity做预处理后再保存
|
||||||
val resultEntity =
|
val resultEntity = importConfig.transformProperties(renderEntity)
|
||||||
importConfig.transformProperties(renderEntity)
|
|
||||||
|
|
||||||
if (resultEntity != null) {
|
if (resultEntity != null) {
|
||||||
|
|
||||||
if (currentConfig.catch) {
|
if (currentConfig.catch) {
|
||||||
renderEntity.catchEnable = 0
|
|
||||||
} else {
|
|
||||||
renderEntity.catchEnable = 1
|
renderEntity.catchEnable = 1
|
||||||
|
} else {
|
||||||
|
renderEntity.catchEnable = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
//对code编码需要特殊处理 存在多个属性值时,渲染优先级:SA>PA,存在多个属性值时,渲染优先级:FRONTAGE>MAIN_SIDE_A CCESS
|
//对code编码需要特殊处理 存在多个属性值时,渲染优先级:SA>PA,存在多个属性值时,渲染优先级:FRONTAGE>MAIN_SIDE_A CCESS
|
||||||
@ -472,6 +455,8 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
if (type != null && type == "1") {
|
if (type != null && type == "1") {
|
||||||
renderEntity.code =
|
renderEntity.code =
|
||||||
DataCodeEnum.OMDB_LINK_ATTRIBUTE_FORNTAGE.code
|
DataCodeEnum.OMDB_LINK_ATTRIBUTE_FORNTAGE.code
|
||||||
|
renderEntity.zoomMin = 15
|
||||||
|
renderEntity.zoomMax = 17
|
||||||
Log.e("qj", "道路属性===3")
|
Log.e("qj", "道路属性===3")
|
||||||
} else {
|
} else {
|
||||||
type =
|
type =
|
||||||
@ -479,9 +464,13 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
if (type != null && type == "1") {
|
if (type != null && type == "1") {
|
||||||
renderEntity.code =
|
renderEntity.code =
|
||||||
DataCodeEnum.OMDB_LINK_ATTRIBUTE_MAIN_SIDE_ACCESS.code
|
DataCodeEnum.OMDB_LINK_ATTRIBUTE_MAIN_SIDE_ACCESS.code
|
||||||
|
renderEntity.zoomMin = 15
|
||||||
|
renderEntity.zoomMax = 17
|
||||||
Log.e("qj", "道路属性===4")
|
Log.e("qj", "道路属性===4")
|
||||||
} else {
|
} else {
|
||||||
renderEntity.enable = 0
|
renderEntity.enable = 0
|
||||||
|
renderEntity.zoomMin = 15
|
||||||
|
renderEntity.zoomMax = 17
|
||||||
Log.e(
|
Log.e(
|
||||||
"qj",
|
"qj",
|
||||||
"过滤不显示数据${renderEntity.table}"
|
"过滤不显示数据${renderEntity.table}"
|
||||||
@ -619,25 +608,41 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
renderEntity.properties["startTime"] = "null"
|
renderEntity.properties["startTime"] = "null"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// listResult.add(renderEntity)
|
++dataIndex
|
||||||
realm.insert(renderEntity)
|
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"] }
|
||||||
}
|
}
|
||||||
// // 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
|
||||||
// if (currentConfig.table == "OMDB_RD_LINK") {
|
|
||||||
// importConfig.preProcess.cacheRdLink =
|
|
||||||
// listResult.associateBy { it.properties["linkPid"] }
|
|
||||||
// }
|
|
||||||
realm.commitTransaction()
|
|
||||||
// 1个文件发送一次flow流
|
// 1个文件发送一次flow流
|
||||||
emit("${++processIndex}/${tableNum}")
|
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")
|
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.ReferenceEntity
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
|
import com.navinfo.omqs.Constant
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
|
import io.realm.RealmConfiguration
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.locationtech.jts.algorithm.Angle
|
import org.locationtech.jts.algorithm.Angle
|
||||||
@ -20,23 +22,23 @@ class ImportPreProcess {
|
|||||||
val defaultTranslateDistance = 3.0
|
val defaultTranslateDistance = 3.0
|
||||||
val testFlag: Boolean = false
|
val testFlag: Boolean = false
|
||||||
fun checkCircleRoad(renderEntity: RenderEntity): Boolean {
|
fun checkCircleRoad(renderEntity: RenderEntity): Boolean {
|
||||||
// val linkInId = renderEntity.properties["linkIn"]
|
val linkInId = renderEntity.properties["linkIn"]
|
||||||
// val linkOutId = renderEntity.properties["linkOut"]
|
val linkOutId = renderEntity.properties["linkOut"]
|
||||||
// // 根据linkIn和linkOut获取对应的link数据
|
// 根据linkIn和linkOut获取对应的link数据
|
||||||
// val linkInEntity = cacheRdLink[linkInId]
|
val linkInEntity = cacheRdLink[linkInId]
|
||||||
// val linkOutEntity = cacheRdLink[linkOutId]
|
val linkOutEntity = cacheRdLink[linkOutId]
|
||||||
// Log.d(
|
Log.d(
|
||||||
// "checkCircleRoad",
|
"checkCircleRoad",
|
||||||
// "LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")},LinkOutEntity: ${linkOutId}- ${
|
"LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")},LinkOutEntity: ${linkOutId}- ${
|
||||||
// linkOutEntity?.properties?.get("enodePid")
|
linkOutEntity?.properties?.get("enodePid")
|
||||||
// }"
|
}"
|
||||||
// )
|
)
|
||||||
// // 查询linkIn的sNode和linkOut的eNode是否相同,如果相同,认为数据是环形路口,返回false
|
// 查询linkIn的sNode和linkOut的eNode是否相同,如果相同,认为数据是环形路口,返回false
|
||||||
// if (linkInEntity != null && linkOutEntity != null) {
|
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"]) {
|
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 false
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +57,8 @@ class ImportPreProcess {
|
|||||||
// 如果数据属性中存在angle,则使用该值,否则需要根据line中的数据进行计算
|
// 如果数据属性中存在angle,则使用该值,否则需要根据line中的数据进行计算
|
||||||
if (renderEntity?.properties?.get(
|
if (renderEntity?.properties?.get(
|
||||||
"angle"
|
"angle"
|
||||||
)!=null) {
|
) != null
|
||||||
|
) {
|
||||||
var angle = renderEntity?.properties?.get("angle")?.toDouble()!!
|
var angle = renderEntity?.properties?.get("angle")?.toDouble()!!
|
||||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||||
angle = ((450 - angle) % 360)
|
angle = ((450 - angle) % 360)
|
||||||
@ -207,7 +210,9 @@ class ImportPreProcess {
|
|||||||
GeometryTools.createLineString(arrayOf<Coordinate>(pointStart, pointEnd)).toString()
|
GeometryTools.createLineString(arrayOf<Coordinate>(pointStart, pointEnd)).toString()
|
||||||
startEndReference.properties["qi_table"] = renderEntity.table
|
startEndReference.properties["qi_table"] = renderEntity.table
|
||||||
startEndReference.properties["type"] = "s_2_e"
|
startEndReference.properties["type"] = "s_2_e"
|
||||||
Realm.getDefaultInstance().insert(startEndReference)
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
listResult.add(startEndReference)
|
||||||
|
insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generateS2EReferencePoint(
|
fun generateS2EReferencePoint(
|
||||||
@ -219,6 +224,7 @@ class ImportPreProcess {
|
|||||||
|
|
||||||
val pointEnd = geometry!!.coordinates[geometry.numPoints - 1] // 获取这个geometry对应的结束点坐标
|
val pointEnd = geometry!!.coordinates[geometry.numPoints - 1] // 获取这个geometry对应的结束点坐标
|
||||||
val pointStart = geometry!!.coordinates[0] // 获取这个geometry对应的起点
|
val pointStart = geometry!!.coordinates[0] // 获取这个geometry对应的起点
|
||||||
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
|
||||||
// 将这个起终点的线记录在数据中
|
// 将这个起终点的线记录在数据中
|
||||||
val startReference = ReferenceEntity()
|
val startReference = ReferenceEntity()
|
||||||
@ -232,7 +238,8 @@ class ImportPreProcess {
|
|||||||
startReference.enable = renderEntity.enable
|
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
|
startReference.properties["qi_table"] = renderEntity.table
|
||||||
Log.e("qj", "generateS2EReferencePoint===$table===$proKey")
|
Log.e("qj", "generateS2EReferencePoint===$table===$proKey")
|
||||||
if (renderEntity.table == table) {
|
if (renderEntity.table == table) {
|
||||||
@ -249,9 +256,13 @@ class ImportPreProcess {
|
|||||||
startReference.properties["type"] = "s_2_p"
|
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()
|
val endReference = ReferenceEntity()
|
||||||
endReference.renderEntityId = renderEntity.id
|
endReference.renderEntityId = renderEntity.id
|
||||||
@ -263,8 +274,12 @@ class ImportPreProcess {
|
|||||||
endReference.taskId = renderEntity.taskId
|
endReference.taskId = renderEntity.taskId
|
||||||
endReference.enable = renderEntity.enable
|
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
|
endReference.properties["qi_table"] = renderEntity.table
|
||||||
if (renderEntity.table == table) {
|
if (renderEntity.table == table) {
|
||||||
if (renderEntity.properties.containsKey(proKey)) {
|
if (renderEntity.properties.containsKey(proKey)) {
|
||||||
@ -279,7 +294,10 @@ class ImportPreProcess {
|
|||||||
Log.e("qj", "generateS2EReferencePoint===e_2_p${renderEntity.name}")
|
Log.e("qj", "generateS2EReferencePoint===e_2_p${renderEntity.name}")
|
||||||
}
|
}
|
||||||
endReference.properties["geometry"] = endReference.geometry
|
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!!
|
geometry?.coordinate?.y!!
|
||||||
) * Math.sin(radian)
|
) * Math.sin(radian)
|
||||||
}
|
}
|
||||||
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
|
||||||
for (pointStart in pointStartArray) {
|
for (pointStart in pointStartArray) {
|
||||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
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)))
|
WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
|
||||||
angleReference.properties["qi_table"] = renderEntity.table
|
angleReference.properties["qi_table"] = renderEntity.table
|
||||||
angleReference.properties["type"] = "angle"
|
angleReference.properties["type"] = "angle"
|
||||||
Realm.getDefaultInstance().insert(angleReference)
|
listResult.add(angleReference)
|
||||||
}
|
}
|
||||||
|
insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
|
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
|
||||||
@ -443,6 +462,7 @@ class ImportPreProcess {
|
|||||||
// 分别获取两个数组中的数据,取第一个作为主数据,另外两个作为辅助渲染数据
|
// 分别获取两个数组中的数据,取第一个作为主数据,另外两个作为辅助渲染数据
|
||||||
val laneInfoDirectArray = JSONArray(laneinfoGroup[0].toString())
|
val laneInfoDirectArray = JSONArray(laneinfoGroup[0].toString())
|
||||||
val laneInfoTypeArray = JSONArray(laneinfoGroup[1].toString())
|
val laneInfoTypeArray = JSONArray(laneinfoGroup[1].toString())
|
||||||
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
|
||||||
for (i in 0 until laneInfoDirectArray.length()) {
|
for (i in 0 until laneInfoDirectArray.length()) {
|
||||||
// 根据后续的数据生成辅助表数据
|
// 根据后续的数据生成辅助表数据
|
||||||
@ -461,12 +481,14 @@ class ImportPreProcess {
|
|||||||
laneInfoDirectArray[i].toString().split(",").distinct().joinToString("_")
|
laneInfoDirectArray[i].toString().split(",").distinct().joinToString("_")
|
||||||
referenceEntity.properties["currentType"] =
|
referenceEntity.properties["currentType"] =
|
||||||
laneInfoTypeArray[i].toString()
|
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"] =
|
referenceEntity.properties["symbol"] =
|
||||||
"assets:omdb/4601/${type}/1301_${referenceEntity.properties["currentDirect"]}.svg"
|
"assets:omdb/4601/${type}/1301_${referenceEntity.properties["currentDirect"]}.svg"
|
||||||
Log.d("unpackingLaneInfo", referenceEntity.properties["symbol"].toString())
|
Log.d("unpackingLaneInfo", referenceEntity.properties["symbol"].toString())
|
||||||
Realm.getDefaultInstance().insert(referenceEntity)
|
listResult.add(referenceEntity)
|
||||||
}
|
}
|
||||||
|
insertData(listResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,7 +590,9 @@ class ImportPreProcess {
|
|||||||
angleReference.zoomMax = renderEntity.zoomMax
|
angleReference.zoomMax = renderEntity.zoomMax
|
||||||
angleReference.taskId = renderEntity.taskId
|
angleReference.taskId = renderEntity.taskId
|
||||||
angleReference.enable = renderEntity.enable
|
angleReference.enable = renderEntity.enable
|
||||||
Realm.getDefaultInstance().insert(angleReference)
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
listResult.add(angleReference)
|
||||||
|
insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -579,6 +603,8 @@ class ImportPreProcess {
|
|||||||
// 路口数据的其他点位,是保存在nodeList对应的数组下
|
// 路口数据的其他点位,是保存在nodeList对应的数组下
|
||||||
if (renderEntity.properties.containsKey("nodeList")) {
|
if (renderEntity.properties.containsKey("nodeList")) {
|
||||||
val nodeListJsonArray: JSONArray = JSONArray(renderEntity.properties["nodeList"])
|
val nodeListJsonArray: JSONArray = JSONArray(renderEntity.properties["nodeList"])
|
||||||
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
|
||||||
for (i in 0 until nodeListJsonArray.length()) {
|
for (i in 0 until nodeListJsonArray.length()) {
|
||||||
val nodeJSONObject = nodeListJsonArray.getJSONObject(i)
|
val nodeJSONObject = nodeListJsonArray.getJSONObject(i)
|
||||||
val intersectionReference = ReferenceEntity()
|
val intersectionReference = ReferenceEntity()
|
||||||
@ -595,10 +621,12 @@ class ImportPreProcess {
|
|||||||
GeometryTools.createGeometry(nodeJSONObject["geometry"].toString()).toString()
|
GeometryTools.createGeometry(nodeJSONObject["geometry"].toString()).toString()
|
||||||
intersectionReference.properties["qi_table"] = renderEntity.table
|
intersectionReference.properties["qi_table"] = renderEntity.table
|
||||||
intersectionReference.properties["type"] = "node"
|
intersectionReference.properties["type"] = "node"
|
||||||
Realm.getDefaultInstance().insert(intersectionReference)
|
listResult.add(intersectionReference)
|
||||||
}
|
}
|
||||||
|
insertData(listResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成默认路口数据的参考数据
|
* 生成默认路口数据的参考数据
|
||||||
* */
|
* */
|
||||||
@ -641,7 +669,12 @@ class ImportPreProcess {
|
|||||||
// renderEntity.geometry =
|
// renderEntity.geometry =
|
||||||
// WKTWriter(3).write(GeometryTools.createLineString(geometry.coordinates))
|
// 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 suffix 图片的后缀(根据codeName获取到的code后,匹配图片的后缀,还包含code码后的其他字符串内容)
|
||||||
* @param codeName 数据对应的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()) {
|
if (codeName.isNullOrBlank()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -731,6 +769,7 @@ class ImportPreProcess {
|
|||||||
defaultTranslateDistance,
|
defaultTranslateDistance,
|
||||||
geometry?.coordinate?.y!!
|
geometry?.coordinate?.y!!
|
||||||
) * Math.sin(radian)
|
) * Math.sin(radian)
|
||||||
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
|
|
||||||
for (pointStart in pointStartArray) {
|
for (pointStart in pointStartArray) {
|
||||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
||||||
@ -750,14 +789,29 @@ class ImportPreProcess {
|
|||||||
dynamicSrcReference.properties["type"] = "dynamicSrc"
|
dynamicSrcReference.properties["type"] = "dynamicSrc"
|
||||||
val code = renderEntity.properties[codeName]
|
val code = renderEntity.properties[codeName]
|
||||||
dynamicSrcReference.properties["src"] = "${prefix}${code}${suffix}"
|
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中添加动态属性
|
* 向当前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]
|
val code = renderEntity.properties[codeName]
|
||||||
renderEntity.properties["src"] = "${prefix}${code}${suffix}"
|
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.GeometryTools
|
||||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||||
import com.navinfo.collect.library.utils.MapParamUtils
|
import com.navinfo.collect.library.utils.MapParamUtils
|
||||||
|
import com.navinfo.omqs.Constant
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import io.realm.RealmModel
|
import io.realm.RealmModel
|
||||||
import io.realm.RealmQuery
|
import io.realm.RealmQuery
|
||||||
@ -61,9 +62,9 @@ class RealmOperateHelper() {
|
|||||||
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
||||||
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||||
// 查询realm中对应tile号的数据
|
// 查询realm中对应tile号的数据
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getSelectTaskRealmInstance()
|
||||||
val realmList =
|
val realmList =
|
||||||
getRealmTools(RenderEntity::class.java, false)
|
getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||||
.equalTo("table", "OMDB_RD_LINK")
|
.equalTo("table", "OMDB_RD_LINK")
|
||||||
.greaterThanOrEqualTo("tileX", xStart)
|
.greaterThanOrEqualTo("tileX", xStart)
|
||||||
.lessThanOrEqualTo("tileX", xEnd)
|
.lessThanOrEqualTo("tileX", xEnd)
|
||||||
@ -72,6 +73,7 @@ class RealmOperateHelper() {
|
|||||||
.findAll()
|
.findAll()
|
||||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||||
val dataList = realm.copyFromRealm(realmList)
|
val dataList = realm.copyFromRealm(realmList)
|
||||||
|
realm.close()
|
||||||
val queryResult = dataList?.stream()?.filter {
|
val queryResult = dataList?.stream()?.filter {
|
||||||
polygon.intersects(it.wkt)
|
polygon.intersects(it.wkt)
|
||||||
}?.toList()
|
}?.toList()
|
||||||
@ -127,8 +129,8 @@ class RealmOperateHelper() {
|
|||||||
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
||||||
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||||
// 查询realm中对应tile号的数据
|
// 查询realm中对应tile号的数据
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getSelectTaskRealmInstance()
|
||||||
val realmList = getRealmTools(RenderEntity::class.java, true)
|
val realmList = getSelectTaskRealmTools(RenderEntity::class.java, true)
|
||||||
.equalTo("table", table)
|
.equalTo("table", table)
|
||||||
.greaterThanOrEqualTo("tileX", xStart)
|
.greaterThanOrEqualTo("tileX", xStart)
|
||||||
.lessThanOrEqualTo("tileX", xEnd)
|
.lessThanOrEqualTo("tileX", xEnd)
|
||||||
@ -169,9 +171,9 @@ class RealmOperateHelper() {
|
|||||||
buffer,
|
buffer,
|
||||||
bufferType
|
bufferType
|
||||||
)
|
)
|
||||||
|
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getRealmDefaultInstance()
|
||||||
val realmList = getRealmTools(HadLinkDvoBean::class.java, false).findAll()
|
try {
|
||||||
|
val realmList = getRealmTools(HadLinkDvoBean::class.java).findAll()
|
||||||
var linkBean: HadLinkDvoBean? = null
|
var linkBean: HadLinkDvoBean? = null
|
||||||
var nearLast: Double = 99999.99
|
var nearLast: Double = 99999.99
|
||||||
for (link in realmList) {
|
for (link in realmList) {
|
||||||
@ -185,18 +187,25 @@ class RealmOperateHelper() {
|
|||||||
}
|
}
|
||||||
if (linkBean != null)
|
if (linkBean != null)
|
||||||
return realm.copyFromRealm(linkBean)
|
return realm.copyFromRealm(linkBean)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
realm.close()
|
||||||
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun queryLink(linkPid: String): RenderEntity? {
|
suspend fun queryLink(linkPid: String): RenderEntity? {
|
||||||
var link: RenderEntity? = null
|
var link: RenderEntity? = null
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getSelectTaskRealmInstance()
|
||||||
val realmR =
|
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()
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findFirst()
|
||||||
if (realmR != null) {
|
if (realmR != null) {
|
||||||
link = realm.copyFromRealm(realmR)
|
link = realm.copyFromRealm(realmR)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
return link
|
return link
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,20 +216,21 @@ class RealmOperateHelper() {
|
|||||||
suspend fun queryQcRecordBean(markId: String): QsRecordBean? {
|
suspend fun queryQcRecordBean(markId: String): QsRecordBean? {
|
||||||
var qsRecordBean: QsRecordBean? = null
|
var qsRecordBean: QsRecordBean? = null
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getRealmDefaultInstance()
|
||||||
val realmR = getRealmTools(QsRecordBean::class.java, false)
|
val realmR = getRealmTools(QsRecordBean::class.java)
|
||||||
.equalTo("table", "QsRecordBean").equalTo("id", markId).findFirst()
|
.equalTo("table", "QsRecordBean").equalTo("id", markId).findFirst()
|
||||||
if (realmR != null) {
|
if (realmR != null) {
|
||||||
qsRecordBean = realm.copyFromRealm(realmR)
|
qsRecordBean = realm.copyFromRealm(realmR)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
return qsRecordBean
|
return qsRecordBean
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun queryLinkToMutableRenderEntityList(linkPid: String): MutableList<RenderEntity>? {
|
suspend fun queryLinkToMutableRenderEntityList(linkPid: String): MutableList<RenderEntity>? {
|
||||||
val resultList = mutableListOf<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()
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findAll()
|
||||||
|
|
||||||
val dataList = realm.copyFromRealm(realmR)
|
val dataList = realm.copyFromRealm(realmR)
|
||||||
@ -229,6 +239,7 @@ class RealmOperateHelper() {
|
|||||||
resultList.add(it)
|
resultList.add(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
realm.close()
|
||||||
return resultList
|
return resultList
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,6 +260,9 @@ class RealmOperateHelper() {
|
|||||||
): MutableList<RenderEntity> {
|
): MutableList<RenderEntity> {
|
||||||
val result = mutableListOf<RenderEntity>()
|
val result = mutableListOf<RenderEntity>()
|
||||||
val polygon = getPolygonFromPoint(point, buffer, bufferType)
|
val polygon = getPolygonFromPoint(point, buffer, bufferType)
|
||||||
|
|
||||||
|
niMapController.lineHandler.showLine(polygon.toText())
|
||||||
|
|
||||||
// 根据polygon查询相交的tile号
|
// 根据polygon查询相交的tile号
|
||||||
val tileXSet = mutableSetOf<Int>()
|
val tileXSet = mutableSetOf<Int>()
|
||||||
tileXSet.toString()
|
tileXSet.toString()
|
||||||
@ -261,11 +275,11 @@ class RealmOperateHelper() {
|
|||||||
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||||
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
|
||||||
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getSelectTaskRealmInstance()
|
||||||
var realmList = mutableListOf<RenderEntity>()
|
var realmList = mutableListOf<RenderEntity>()
|
||||||
if (catchAll) {
|
if (catchAll) {
|
||||||
// 查询realm中对应tile号的数据
|
// 查询realm中对应tile号的数据
|
||||||
realmList = getRealmTools(RenderEntity::class.java, false)
|
realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||||
.greaterThanOrEqualTo("tileX", xStart)
|
.greaterThanOrEqualTo("tileX", xStart)
|
||||||
.lessThanOrEqualTo("tileX", xEnd)
|
.lessThanOrEqualTo("tileX", xEnd)
|
||||||
.greaterThanOrEqualTo("tileY", yStart)
|
.greaterThanOrEqualTo("tileY", yStart)
|
||||||
@ -273,12 +287,12 @@ class RealmOperateHelper() {
|
|||||||
.findAll()
|
.findAll()
|
||||||
} else {
|
} else {
|
||||||
// 查询realm中对应tile号的数据
|
// 查询realm中对应tile号的数据
|
||||||
realmList = getRealmTools(RenderEntity::class.java, false)
|
realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||||
.lessThan("catchEnable", 1)
|
|
||||||
.greaterThanOrEqualTo("tileX", xStart)
|
.greaterThanOrEqualTo("tileX", xStart)
|
||||||
.lessThanOrEqualTo("tileX", xEnd)
|
.lessThanOrEqualTo("tileX", xEnd)
|
||||||
.greaterThanOrEqualTo("tileY", yStart)
|
.greaterThanOrEqualTo("tileY", yStart)
|
||||||
.lessThanOrEqualTo("tileY", yEnd)
|
.lessThanOrEqualTo("tileY", yEnd)
|
||||||
|
.greaterThan("catchEnable", 0)
|
||||||
.findAll()
|
.findAll()
|
||||||
}
|
}
|
||||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||||
@ -292,7 +306,7 @@ class RealmOperateHelper() {
|
|||||||
result.addAll(realm.copyFromRealm(it))
|
result.addAll(realm.copyFromRealm(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,12 +319,13 @@ class RealmOperateHelper() {
|
|||||||
* */
|
* */
|
||||||
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
|
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
|
||||||
val result = mutableListOf<RenderEntity>()
|
val result = mutableListOf<RenderEntity>()
|
||||||
val realm = getRealmDefaultInstance()
|
val realm = getSelectTaskRealmInstance()
|
||||||
val realmList = getRealmTools(RenderEntity::class.java, false)
|
val realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||||
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
|
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
|
||||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
||||||
.findAll()
|
.findAll()
|
||||||
result.addAll(realm.copyFromRealm(realmList))
|
result.addAll(realm.copyFromRealm(realmList))
|
||||||
|
realm.close()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,34 +396,61 @@ class RealmOperateHelper() {
|
|||||||
return wkt
|
return wkt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
fun <E : RealmModel> getRealmTools(clazz: Class<E>, enableSql: Boolean): RealmQuery<E> {
|
* 默认的数据库,用于存储任务、作业数据
|
||||||
return if (MapParamUtils.getDataLayerEnum() != null) {
|
* @param clazz 查询表
|
||||||
|
* @param enableSql
|
||||||
var sql = "taskId=${MapParamUtils.getTaskId()}"
|
* */
|
||||||
|
fun <E : RealmModel> getRealmTools(clazz: Class<E>): RealmQuery<E> {
|
||||||
if (enableSql) {
|
return getRealmDefaultInstance().where(clazz)
|
||||||
sql =
|
|
||||||
" enable${MapParamUtils.getDataLayerEnum().sql} and taskId=${MapParamUtils.getTaskId()}"
|
|
||||||
}
|
|
||||||
|
|
||||||
getRealmDefaultInstance().where(clazz).rawPredicate(sql)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
getRealmDefaultInstance().where(clazz)
|
|
||||||
.rawPredicate(" taskId=${MapParamUtils.getTaskId()}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRealmDefaultInstance(): Realm {
|
fun getRealmDefaultInstance(): Realm {
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
Log.e("jingo", "数据库更新")
|
Log.e("jingo", "数据库更新")
|
||||||
|
if (Realm.getDefaultInstance().isInTransaction) {
|
||||||
|
Realm.getDefaultInstance().cancelTransaction()
|
||||||
|
Log.e("jingo", "数据库正在事物,需要退出当前事物")
|
||||||
|
}
|
||||||
Realm.getDefaultInstance().refresh()
|
Realm.getDefaultInstance().refresh()
|
||||||
isUpdate = false;
|
isUpdate = false;
|
||||||
}
|
}
|
||||||
return Realm.getDefaultInstance()
|
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() {
|
fun updateRealmDefaultInstance() {
|
||||||
isUpdate = true
|
isUpdate = true
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,9 @@ import android.util.Log
|
|||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
import com.blankj.utilcode.util.MapUtils
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
|
import com.navinfo.collect.library.utils.MapParamUtils
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.db.ImportOMDBHelper
|
import com.navinfo.omqs.db.ImportOMDBHelper
|
||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
@ -106,9 +108,10 @@ class TaskDownloadScope(
|
|||||||
downloadData.postValue(taskBean)
|
downloadData.postValue(taskBean)
|
||||||
if (status != FileDownloadStatus.LOADING && status != FileDownloadStatus.IMPORTING) {
|
if (status != FileDownloadStatus.LOADING && status != FileDownloadStatus.IMPORTING) {
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
realm.executeTransaction {
|
realm.beginTransaction()
|
||||||
it.insertOrUpdate(taskBean)
|
realm.insertOrUpdate(taskBean)
|
||||||
}
|
realm.commitTransaction()
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,9 +145,13 @@ class TaskDownloadScope(
|
|||||||
Log.e("jingo", "数据安装 $it")
|
Log.e("jingo", "数据安装 $it")
|
||||||
if (it == "finish") {
|
if (it == "finish") {
|
||||||
change(FileDownloadStatus.DONE)
|
change(FileDownloadStatus.DONE)
|
||||||
|
Log.e("jingo", "数据安装结束")
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
//任务与当前一致,需要更新渲染图层
|
||||||
|
if(MapParamUtils.getTaskId()==taskBean.id){
|
||||||
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
change(FileDownloadStatus.IMPORTING, it)
|
change(FileDownloadStatus.IMPORTING, it)
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ class TaskUploadScope(
|
|||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
it.copyToRealmOrUpdate(taskBean)
|
it.copyToRealmOrUpdate(taskBean)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +221,7 @@ class TaskUploadScope(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bodyList.size > 0) {
|
if (bodyList.size > 0) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.navinfo.omqs.ui.activity.login
|
package com.navinfo.omqs.ui.activity.login
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.app.ActivityManager
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
@ -9,12 +11,15 @@ import androidx.activity.viewModels
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.databinding.ActivityLoginBinding
|
import com.navinfo.omqs.databinding.ActivityLoginBinding
|
||||||
import com.navinfo.omqs.ui.activity.CheckPermissionsActivity
|
import com.navinfo.omqs.ui.activity.CheckPermissionsActivity
|
||||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
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 -> {
|
LoginStatus.LOGIN_STATUS_NET_LOADING -> {
|
||||||
loginDialog("验证用户信息...")
|
loginDialog("验证用户信息...")
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_FOLDER_INIT -> {
|
LoginStatus.LOGIN_STATUS_FOLDER_INIT -> {
|
||||||
loginDialog("检查本地数据...")
|
loginDialog("检查本地数据...")
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_FOLDER_FAILURE -> {
|
LoginStatus.LOGIN_STATUS_FOLDER_FAILURE -> {
|
||||||
Toast.makeText(this, "文件夹初始化失败", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "文件夹初始化失败", Toast.LENGTH_SHORT).show()
|
||||||
loginDialog?.dismiss()
|
loginDialog?.dismiss()
|
||||||
loginDialog = null
|
loginDialog = null
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_NET_FAILURE -> {
|
LoginStatus.LOGIN_STATUS_NET_FAILURE -> {
|
||||||
Toast.makeText(this, "网络访问失败", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "网络访问失败", Toast.LENGTH_SHORT).show()
|
||||||
loginDialog?.dismiss()
|
loginDialog?.dismiss()
|
||||||
loginDialog = null
|
loginDialog = null
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_SUCCESS -> {
|
LoginStatus.LOGIN_STATUS_SUCCESS -> {
|
||||||
loginDialog?.dismiss()
|
loginDialog?.dismiss()
|
||||||
loginDialog = null
|
loginDialog = null
|
||||||
|
//Toast.makeText(this, "插入成功", Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
val intent = Intent(this@LoginActivity, MainActivity::class.java)
|
val intent = Intent(this@LoginActivity, MainActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_CANCEL -> {
|
LoginStatus.LOGIN_STATUS_CANCEL -> {
|
||||||
loginDialog?.dismiss()
|
loginDialog?.dismiss()
|
||||||
loginDialog = null
|
loginDialog = null
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP -> {
|
LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP -> {
|
||||||
loginDialog("检查离线地图...")
|
loginDialog("检查离线地图...")
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginStatus.LOGIN_STATUS_NET_GET_TASK_LIST -> {
|
LoginStatus.LOGIN_STATUS_NET_GET_TASK_LIST -> {
|
||||||
loginDialog("获取任务列表...")
|
loginDialog("获取任务列表...")
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +124,6 @@ class LoginActivity : CheckPermissionsActivity() {
|
|||||||
private fun initView() {
|
private fun initView() {
|
||||||
//登录校验,初始化成功
|
//登录校验,初始化成功
|
||||||
viewModel.loginStatus.observe(this, loginObserve)
|
viewModel.loginStatus.observe(this, loginObserve)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because one or more lines are too long
@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import com.blankj.utilcode.util.ClipboardUtils
|
import com.blankj.utilcode.util.ClipboardUtils
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
@ -46,6 +47,7 @@ import com.navinfo.omqs.ui.fragment.tasklist.TaskManagerFragment
|
|||||||
import com.navinfo.omqs.ui.other.BaseToast
|
import com.navinfo.omqs.ui.other.BaseToast
|
||||||
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
||||||
import com.navinfo.omqs.util.FlowEventBus
|
import com.navinfo.omqs.util.FlowEventBus
|
||||||
|
import com.navinfo.omqs.util.SignUtil
|
||||||
import com.navinfo.omqs.util.SpeakMode
|
import com.navinfo.omqs.util.SpeakMode
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -279,11 +281,8 @@ class MainActivity : BaseActivity() {
|
|||||||
viewModel.liveDataRoadName.observe(this) {
|
viewModel.liveDataRoadName.observe(this) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
binding.mainActivityRoadName.text = it.properties["name"]
|
binding.mainActivityRoadName.text = it.properties["name"]
|
||||||
if (binding.mainActivityRoadName.visibility != View.VISIBLE) binding.mainActivityRoadName.visibility =
|
|
||||||
View.VISIBLE
|
|
||||||
} else {
|
} else {
|
||||||
if (binding.mainActivityRoadName.visibility != View.GONE) binding.mainActivityRoadName.visibility =
|
binding.mainActivityRoadName.text = " "
|
||||||
View.GONE
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,12 +325,18 @@ class MainActivity : BaseActivity() {
|
|||||||
7, RoundingMode.HALF_UP
|
7, RoundingMode.HALF_UP
|
||||||
)
|
)
|
||||||
},${BigDecimal(it.latitude).setScale(7, RoundingMode.HALF_UP)}"
|
},${BigDecimal(it.latitude).setScale(7, RoundingMode.HALF_UP)}"
|
||||||
|
viewModel.startAutoLocationTimer()
|
||||||
|
binding.mainActivityLocation.setImageResource(R.drawable.icon_location)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("qj", "异常 $e")
|
Log.e("qj", "异常 $e")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewModel.liveDataAutoLocation.observe(this){
|
||||||
|
if(it==true){
|
||||||
|
onClickLocation()
|
||||||
|
}
|
||||||
|
}
|
||||||
viewModel.liveDataSignMoreInfo.observe(this) {
|
viewModel.liveDataSignMoreInfo.observe(this) {
|
||||||
val fragment =
|
val fragment =
|
||||||
supportFragmentManager.findFragmentById(R.id.main_activity_sign_more_info_fragment)
|
supportFragmentManager.findFragmentById(R.id.main_activity_sign_more_info_fragment)
|
||||||
@ -340,6 +345,22 @@ class MainActivity : BaseActivity() {
|
|||||||
.replace(R.id.main_activity_sign_more_info_fragment, SignMoreInfoFragment())
|
.replace(R.id.main_activity_sign_more_info_fragment, SignMoreInfoFragment())
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
|
//启动问题记录
|
||||||
|
val signBean = SignBean(
|
||||||
|
iconId = SignUtil.getSignIcon(it),
|
||||||
|
iconText = SignUtil.getSignIconText(it),
|
||||||
|
linkId = it.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||||
|
?: "",
|
||||||
|
name = SignUtil.getSignNameText(it),
|
||||||
|
bottomRightText = SignUtil.getSignBottomRightText(it),
|
||||||
|
renderEntity = it,
|
||||||
|
isMoreInfo = SignUtil.isMoreInfo(it),
|
||||||
|
index = SignUtil.getRoadInfoIndex(it)
|
||||||
|
)
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putParcelable("SignBean", signBean)
|
||||||
|
bundle.putBoolean("AutoSave", false)
|
||||||
|
rightController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.liveIndoorToolsResp.observe(this) {
|
viewModel.liveIndoorToolsResp.observe(this) {
|
||||||
@ -1114,6 +1135,14 @@ class MainActivity : BaseActivity() {
|
|||||||
rightController.navigate(R.id.NoteFragment)
|
rightController.navigate(R.id.NoteFragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击定位按钮
|
||||||
|
*/
|
||||||
|
fun onClickLocation() {
|
||||||
|
binding.mainActivityLocation.setImageResource(R.drawable.icon_location_north)
|
||||||
|
viewModel.onClickLocationButton()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增评测link
|
* 新增评测link
|
||||||
*/
|
*/
|
||||||
|
@ -4,6 +4,7 @@ import android.app.Activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.AnimationDrawable
|
import android.graphics.drawable.AnimationDrawable
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -34,27 +35,26 @@ import com.navinfo.collect.library.utils.GeometryToolsKt
|
|||||||
import com.navinfo.collect.library.utils.MapParamUtils
|
import com.navinfo.collect.library.utils.MapParamUtils
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.*
|
||||||
import com.navinfo.omqs.bean.QRCodeBean
|
|
||||||
import com.navinfo.omqs.bean.SignBean
|
|
||||||
import com.navinfo.omqs.bean.TraceVideoBean
|
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.http.NetResult
|
import com.navinfo.omqs.http.NetResult
|
||||||
import com.navinfo.omqs.http.NetworkService
|
import com.navinfo.omqs.http.NetworkService
|
||||||
|
import com.navinfo.omqs.tools.FileManager
|
||||||
import com.navinfo.omqs.ui.dialog.CommonDialog
|
import com.navinfo.omqs.ui.dialog.CommonDialog
|
||||||
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
||||||
import com.navinfo.omqs.ui.other.BaseToast
|
import com.navinfo.omqs.ui.other.BaseToast
|
||||||
import com.navinfo.omqs.util.SignUtil
|
import com.navinfo.omqs.util.*
|
||||||
import com.navinfo.omqs.util.DateTimeUtil
|
|
||||||
import com.navinfo.omqs.util.ShareUtil
|
|
||||||
import com.navinfo.omqs.util.SoundMeter
|
|
||||||
import com.navinfo.omqs.util.SpeakMode
|
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
|
import io.realm.RealmConfiguration
|
||||||
import io.realm.RealmSet
|
import io.realm.RealmSet
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.locationtech.jts.geom.Geometry
|
import org.locationtech.jts.geom.Geometry
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
@ -85,6 +85,9 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
private var mCameraDialog: CommonDialog? = null
|
private var mCameraDialog: CommonDialog? = null
|
||||||
|
|
||||||
|
//路径计算
|
||||||
|
val liveDataPlanningPathStatus = MutableLiveData<Int>()
|
||||||
|
|
||||||
//地图点击捕捉到的质检数据ID列表
|
//地图点击捕捉到的质检数据ID列表
|
||||||
val liveDataQsRecordIdList = MutableLiveData<List<String>>()
|
val liveDataQsRecordIdList = MutableLiveData<List<String>>()
|
||||||
|
|
||||||
@ -128,6 +131,11 @@ class MainViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
val liveDataCenterPoint = MutableLiveData<MapPosition>()
|
val liveDataCenterPoint = MutableLiveData<MapPosition>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自动定位
|
||||||
|
*/
|
||||||
|
val liveDataAutoLocation = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
// var testPoint = GeoPoint(0, 0)
|
// var testPoint = GeoPoint(0, 0)
|
||||||
|
|
||||||
//uuid标识,用于记录轨迹组
|
//uuid标识,用于记录轨迹组
|
||||||
@ -205,20 +213,32 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
private var timer: Timer? = null
|
private var timer: Timer? = null
|
||||||
|
|
||||||
|
//自动定位
|
||||||
|
private var autoLocationTimer: Timer? = null
|
||||||
|
|
||||||
|
private var disAutoLocationTime: Long = 10000
|
||||||
|
|
||||||
private var disTime: Long = 1000
|
private var disTime: Long = 1000
|
||||||
|
|
||||||
private var currentMapZoomLevel: Int = 0
|
private var currentMapZoomLevel: Int = 0
|
||||||
|
|
||||||
|
//导航信息
|
||||||
|
private var naviEngine: NaviEngine = NaviEngine()
|
||||||
|
|
||||||
|
// 定义一个互斥锁
|
||||||
|
private val naviMutex = Mutex()
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
||||||
|
|
||||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||||
when (e) {
|
when (e) {
|
||||||
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT -> liveDataCenterPoint.value =
|
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT -> liveDataCenterPoint.value =
|
||||||
mapPosition
|
mapPosition
|
||||||
|
//Map.CLEAR_EVENT->startAutoLocationTimer()
|
||||||
}
|
}
|
||||||
if (mapController.mMapView.vtmMap.mapPosition.zoomLevel >= 16) {
|
|
||||||
|
|
||||||
}
|
|
||||||
currentMapZoomLevel = mapController.mMapView.vtmMap.mapPosition.zoomLevel
|
currentMapZoomLevel = mapController.mMapView.vtmMap.mapPosition.zoomLevel
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -226,6 +246,9 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
realmOperateHelper.niMapController = mapController
|
||||||
|
|
||||||
initLocation()
|
initLocation()
|
||||||
/**
|
/**
|
||||||
* 处理点击道路捕捉回调功能
|
* 处理点击道路捕捉回调功能
|
||||||
@ -302,10 +325,54 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
MapParamUtils.setTaskId(sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1))
|
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)
|
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
||||||
|
|
||||||
|
// viewModelScope.launch(Dispatchers.Default) {
|
||||||
|
// naviTestFlow().collect {
|
||||||
|
// naviMutex.lock()
|
||||||
|
// if (naviEngine.geometry != null) {
|
||||||
|
// //定义垂线
|
||||||
|
// val pointPairDistance = PointPairDistance()
|
||||||
|
// val coordinate = Coordinate(it.longitude, it.latitude)
|
||||||
|
// DistanceToPoint.computeDistance(
|
||||||
|
// naviEngine.geometry,
|
||||||
|
// coordinate,
|
||||||
|
// pointPairDistance
|
||||||
|
// )
|
||||||
|
// if (pointPairDistance.getCoordinate(0) !== null) {
|
||||||
|
// val line = GeometryTools.createLineString(
|
||||||
|
// mutableListOf(
|
||||||
|
// it,
|
||||||
|
// GeoPoint(
|
||||||
|
// pointPairDistance.getCoordinate(0).y,
|
||||||
|
// pointPairDistance.getCoordinate(0).x
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// mapController.lineHandler.showLine(line.toText())
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// naviMutex.unlock()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun naviTestFlow(): Flow<GeoPoint> = flow {
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
emit(mapController.mMapView.vtmMap.mapPosition.geoPoint)
|
||||||
|
delay(1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前任务
|
* 获取当前任务
|
||||||
*/
|
*/
|
||||||
@ -315,6 +382,147 @@ class MainViewModel @Inject constructor(
|
|||||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
currentTaskBean = realm.copyFromRealm(res)
|
currentTaskBean = realm.copyFromRealm(res)
|
||||||
|
planningPath(currentTaskBean!!)
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun planningPath(taskBean: TaskBean) {
|
||||||
|
if (taskBean.status == FileManager.Companion.FileDownloadStatus.DONE) {
|
||||||
|
// Toast.makeText(context, "正在计算导航路径", Toast.LENGTH_SHORT).show()
|
||||||
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
|
naviMutex.lock()
|
||||||
|
naviEngine = NaviEngine()
|
||||||
|
val pathList = mutableListOf<Route>()
|
||||||
|
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
|
for (link in taskBean.hadLinkDvoList) {
|
||||||
|
//测线不参与导航
|
||||||
|
if (link.linkStatus == 3) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
val route = Route(
|
||||||
|
linkId = link.linkPid,
|
||||||
|
)
|
||||||
|
route.pointList = GeometryTools.getGeoPoints(link.geometry)
|
||||||
|
//查询每条link的snode,enode
|
||||||
|
val res1 = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("table", DataCodeEnum.OMDB_RD_LINK.name).and()
|
||||||
|
.equalTo("properties['linkPid']", link.linkPid).findFirst()
|
||||||
|
res1?.let {
|
||||||
|
|
||||||
|
val snodePid = it.properties["snodePid"]
|
||||||
|
if (snodePid != null) {
|
||||||
|
route.sNode = snodePid
|
||||||
|
}
|
||||||
|
val enodePid = it.properties["enodePid"]
|
||||||
|
if (enodePid != null) {
|
||||||
|
route.eNode = enodePid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//查询每条link的方向
|
||||||
|
val res2 = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("table", DataCodeEnum.OMDB_LINK_DIRECT.name).and()
|
||||||
|
.equalTo("properties['linkPid']", link.linkPid).findFirst()
|
||||||
|
res2?.let {
|
||||||
|
val direct = it.properties["direct"]
|
||||||
|
if (direct != null) {
|
||||||
|
route.direct = direct.toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//查询每条link的名称
|
||||||
|
val res3 = realm.where(RenderEntity::class.java)
|
||||||
|
.equalTo("table", DataCodeEnum.OMDB_LINK_NAME.name).and()
|
||||||
|
.equalTo("properties['linkPid']", link.linkPid).findFirst()
|
||||||
|
res3?.let {
|
||||||
|
route.name = "${it.properties["name"]}"
|
||||||
|
}
|
||||||
|
pathList.add(route)
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
//用来存储最终的导航路径
|
||||||
|
val newRouteList = mutableListOf<Route>()
|
||||||
|
//比对路径排序用的
|
||||||
|
val tempRouteList = pathList.toMutableList()
|
||||||
|
//先找到一根有方向的link,确定起终点
|
||||||
|
var routeStart: Route? = null
|
||||||
|
for (i in tempRouteList.indices) {
|
||||||
|
val route = pathList[i]
|
||||||
|
//只要时单方向的就行
|
||||||
|
if (route.direct == 2 || route.direct == 3) {
|
||||||
|
routeStart = route
|
||||||
|
tempRouteList.removeAt(i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (routeStart != null) {
|
||||||
|
var sNode = ""
|
||||||
|
var eNode = ""
|
||||||
|
//如果snode,enode是顺方向,geometry 不动,否则反转
|
||||||
|
if (routeStart.direct == 3) {
|
||||||
|
routeStart.pointList.reverse()
|
||||||
|
sNode = routeStart.eNode
|
||||||
|
eNode = routeStart.sNode
|
||||||
|
} else {
|
||||||
|
sNode = routeStart.sNode
|
||||||
|
eNode = routeStart.eNode
|
||||||
|
}
|
||||||
|
newRouteList.add(routeStart)
|
||||||
|
var bBreak = true
|
||||||
|
while (bBreak) {
|
||||||
|
//先找其实link的后续link
|
||||||
|
var bHasNext = false
|
||||||
|
for (route in tempRouteList) {
|
||||||
|
//如果是link 的e 对下个link的s,方向不用动,否则下个link的geometry反转
|
||||||
|
if (route.sNode != "" && eNode == route.sNode) {
|
||||||
|
newRouteList.add(route)
|
||||||
|
tempRouteList.remove(route)
|
||||||
|
eNode = route.eNode
|
||||||
|
bHasNext = true
|
||||||
|
break
|
||||||
|
} else if (route.eNode != "" && eNode == route.eNode) {
|
||||||
|
route.pointList.reverse()
|
||||||
|
newRouteList.add(route)
|
||||||
|
tempRouteList.remove(route)
|
||||||
|
eNode = route.sNode
|
||||||
|
bHasNext = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//先找其实link的起始link
|
||||||
|
var bHasLast = false
|
||||||
|
for (route in tempRouteList) {
|
||||||
|
//如果是link 的s 对上个link的e,方向不用动,否则下个link的geometry反转
|
||||||
|
if (route.eNode != "" && sNode == route.eNode) {
|
||||||
|
newRouteList.add(0, route)
|
||||||
|
tempRouteList.remove(route)
|
||||||
|
sNode = route.sNode
|
||||||
|
bHasLast = true
|
||||||
|
break
|
||||||
|
} else if (route.sNode != "" && sNode == route.sNode) {
|
||||||
|
route.pointList.reverse()
|
||||||
|
newRouteList.add(0, route)
|
||||||
|
tempRouteList.remove(route)
|
||||||
|
sNode = route.eNode
|
||||||
|
bHasLast = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tempRouteList.size == 0) {
|
||||||
|
bBreak = false
|
||||||
|
} else {
|
||||||
|
if (!bHasLast && !bHasNext) {
|
||||||
|
bBreak = false
|
||||||
|
//TODO 处理错误,路径不完整
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
naviEngine.routeList = newRouteList
|
||||||
|
naviMutex.unlock()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Toast.makeText(context, "数据未安装,无法计算导航路径", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,9 +545,10 @@ class MainViewModel @Inject constructor(
|
|||||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
val objects =
|
val objects =
|
||||||
realmOperateHelper.getRealmTools(QsRecordBean::class.java, false).findAll()
|
realmOperateHelper.getRealmTools(QsRecordBean::class.java).findAll()
|
||||||
list = realm.copyFromRealm(objects)
|
list = realm.copyFromRealm(objects)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
mapController.markerHandle.removeAllQsMarker()
|
mapController.markerHandle.removeAllQsMarker()
|
||||||
for (item in list) {
|
for (item in list) {
|
||||||
mapController.markerHandle.addOrUpdateQsRecordMark(item)
|
mapController.markerHandle.addOrUpdateQsRecordMark(item)
|
||||||
@ -354,11 +563,11 @@ class MainViewModel @Inject constructor(
|
|||||||
var list = mutableListOf<NoteBean>()
|
var list = mutableListOf<NoteBean>()
|
||||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
val objects = realmOperateHelper.getRealmTools(NoteBean::class.java, false).findAll()
|
val objects = realmOperateHelper.getRealmTools(NoteBean::class.java).findAll()
|
||||||
list = realm.copyFromRealm(objects)
|
list = realm.copyFromRealm(objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
realm.close()
|
||||||
|
|
||||||
for (item in list) {
|
for (item in list) {
|
||||||
mapController.markerHandle.addOrUpdateNoteMark(item)
|
mapController.markerHandle.addOrUpdateNoteMark(item)
|
||||||
@ -453,12 +662,6 @@ class MainViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
|
||||||
if (Constant.AUTO_LOCATION) {
|
|
||||||
mapController.mMapView.vtmMap.animator()
|
|
||||||
.animateTo(GeoPoint(location.latitude, location.longitude))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//显示轨迹图层
|
//显示轨迹图层
|
||||||
@ -475,13 +678,21 @@ class MainViewModel @Inject constructor(
|
|||||||
point.longitude,
|
point.longitude,
|
||||||
point.latitude
|
point.latitude
|
||||||
),
|
),
|
||||||
buffer = 2.5, catchAll = false
|
buffer = 2.4, catchAll = false,
|
||||||
)
|
)
|
||||||
|
//增加道路线过滤原则
|
||||||
if (itemList.size == 1) {
|
val filterResult = itemList.filter {
|
||||||
liveDataSignMoreInfo.postValue(itemList[0])
|
if(isHighRoad()){
|
||||||
|
mapController.mMapView.mapLevel>=it.zoomMin&&mapController.mMapView.mapLevel<=it.zoomMax
|
||||||
}else{
|
}else{
|
||||||
liveDataItemList.postValue(itemList)
|
//关闭时过滤道路线捕捉s
|
||||||
|
mapController.mMapView.mapLevel>=it.zoomMin&&mapController.mMapView.mapLevel<=it.zoomMax&&it.code!=DataCodeEnum.OMDB_RD_LINK.code
|
||||||
|
}
|
||||||
|
}.toList()
|
||||||
|
if (filterResult.size == 1) {
|
||||||
|
liveDataSignMoreInfo.postValue(filterResult[0])
|
||||||
|
} else {
|
||||||
|
liveDataItemList.postValue(filterResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -558,6 +769,7 @@ class MainViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataCodeEnum.OMDB_LANE_NUM.code, //车道数
|
DataCodeEnum.OMDB_LANE_NUM.code, //车道数
|
||||||
DataCodeEnum.OMDB_RD_LINK_KIND.code,//种别,
|
DataCodeEnum.OMDB_RD_LINK_KIND.code,//种别,
|
||||||
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code, // 功能等级,
|
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code, // 功能等级,
|
||||||
@ -607,21 +819,28 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
|
|
||||||
val entity =
|
val entityList =
|
||||||
realmOperateHelper.getRealmTools(RenderEntity::class.java, true)
|
realmOperateHelper.getSelectTaskRealmTools(
|
||||||
|
RenderEntity::class.java,
|
||||||
|
true
|
||||||
|
)
|
||||||
.and()
|
.and()
|
||||||
.equalTo("table", DataCodeEnum.OMDB_RESTRICTION.name)
|
.equalTo("table", DataCodeEnum.OMDB_RESTRICTION.name)
|
||||||
.and()
|
.and()
|
||||||
.equalTo(
|
.equalTo(
|
||||||
"properties['linkIn']", it
|
"properties['linkIn']", it
|
||||||
).findFirst()
|
).findAll()
|
||||||
if (entity != null) {
|
if (entityList.isNotEmpty()) {
|
||||||
val outLink = entity.properties["linkOut"]
|
val outList = entityList.distinct()
|
||||||
|
for (i in outList.indices) {
|
||||||
|
val outLink = outList[i].properties["linkOut"]
|
||||||
val linkOutEntity =
|
val linkOutEntity =
|
||||||
realmOperateHelper.getRealmTools(RenderEntity::class.java, true)
|
realmOperateHelper.getSelectTaskRealmTools(
|
||||||
.and()
|
RenderEntity::class.java,
|
||||||
|
true
|
||||||
|
)
|
||||||
.equalTo("table", DataCodeEnum.OMDB_RD_LINK.name).and()
|
.equalTo("table", DataCodeEnum.OMDB_RD_LINK.name).and()
|
||||||
.equalTo(
|
.equalTo(
|
||||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||||
@ -633,6 +852,12 @@ class MainViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mapController.lineHandler.linksLayer.addLine(
|
||||||
|
link.geometry,
|
||||||
|
Color.BLUE
|
||||||
|
)
|
||||||
|
realm.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||||
@ -666,6 +891,9 @@ class MainViewModel @Inject constructor(
|
|||||||
* 点击我的位置,回到我的位置
|
* 点击我的位置,回到我的位置
|
||||||
*/
|
*/
|
||||||
fun onClickLocationButton() {
|
fun onClickLocationButton() {
|
||||||
|
val mapPosition: MapPosition = mapController.mMapView.vtmMap.getMapPosition()
|
||||||
|
mapPosition.setBearing(0f) // 锁定角度,自动将地图旋转到正北方向
|
||||||
|
mapController.mMapView.vtmMap.setMapPosition(mapPosition)
|
||||||
mapController.locationLayerHandler.animateToCurrentPosition()
|
mapController.locationLayerHandler.animateToCurrentPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,6 +1143,7 @@ class MainViewModel @Inject constructor(
|
|||||||
val geoPoint = GeometryTools.createGeoPoint(data.wkt!!.toText())
|
val geoPoint = GeometryTools.createGeoPoint(data.wkt!!.toText())
|
||||||
mapController.markerHandle.addMarker(geoPoint, "moreInfo")
|
mapController.markerHandle.addMarker(geoPoint, "moreInfo")
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry.TYPENAME_LINESTRING -> {
|
Geometry.TYPENAME_LINESTRING -> {
|
||||||
mapController.lineHandler.showLine(data.wkt!!.toText())
|
mapController.lineHandler.showLine(data.wkt!!.toText())
|
||||||
}
|
}
|
||||||
@ -1168,6 +1397,27 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启自动定位
|
||||||
|
*/
|
||||||
|
fun startAutoLocationTimer(){
|
||||||
|
if (autoLocationTimer != null) {
|
||||||
|
cancelAutoLocation()
|
||||||
|
}
|
||||||
|
autoLocationTimer = fixedRateTimer("", false, disAutoLocationTime, disAutoLocationTime) {
|
||||||
|
liveDataAutoLocation.postValue(true)
|
||||||
|
Log.e("qj","自动定位开始执行")
|
||||||
|
startAutoLocationTimer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束自动定位
|
||||||
|
*/
|
||||||
|
fun cancelAutoLocation() {
|
||||||
|
autoLocationTimer?.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启测量工具
|
* 开启测量工具
|
||||||
*/
|
*/
|
||||||
|
@ -37,6 +37,7 @@ class ConsoleViewModel @Inject constructor() : ViewModel() {
|
|||||||
liveDataTaskCount.postValue(count.toInt())
|
liveDataTaskCount.postValue(count.toInt())
|
||||||
val count2 = realm.where(QsRecordBean::class.java).count()
|
val count2 = realm.where(QsRecordBean::class.java).count()
|
||||||
liveDataEvaluationResultCount.postValue(count2.toInt())
|
liveDataEvaluationResultCount.postValue(count2.toInt())
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -162,7 +162,6 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取当前定位点
|
//获取当前定位点
|
||||||
val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint()
|
val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint()
|
||||||
//如果不是从面板进来的
|
//如果不是从面板进来的
|
||||||
@ -204,6 +203,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
|
|
||||||
getClassTypeList(bean)
|
getClassTypeList(bean)
|
||||||
getProblemLinkList()
|
getProblemLinkList()
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
addChatMsgEntity(filePath)
|
addChatMsgEntity(filePath)
|
||||||
}
|
}
|
||||||
@ -412,6 +412,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
mapController.markerHandle.addOrUpdateQsRecordMark(liveDataQsRecordBean.value!!)
|
mapController.markerHandle.addOrUpdateQsRecordMark(liveDataQsRecordBean.value!!)
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,6 +436,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
|
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -495,6 +497,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
} else {
|
} else {
|
||||||
liveDataToastMessage.postValue("数据读取失败")
|
liveDataToastMessage.postValue("数据读取失败")
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,6 +668,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
@ -117,6 +117,7 @@ class NoteViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
mapController.markerHandle.addOrUpdateNoteMark(mNoteBean!!)
|
mapController.markerHandle.addOrUpdateNoteMark(mNoteBean!!)
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,6 +146,7 @@ class NoteViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
mapController.markerHandle.removeNoteMark(mNoteBean!!)
|
mapController.markerHandle.removeNoteMark(mNoteBean!!)
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDialog.setNegativeButton("取消", null)
|
mDialog.setNegativeButton("取消", null)
|
||||||
@ -168,6 +170,7 @@ class NoteViewModel @Inject constructor(
|
|||||||
canvasView.setDrawPathList(list)
|
canvasView.setDrawPathList(list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,8 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.core.view.forEach
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
@ -26,24 +28,28 @@ import com.navinfo.omqs.databinding.FragmentPersonalCenterBinding
|
|||||||
import com.navinfo.omqs.db.ImportOMDBHelper
|
import com.navinfo.omqs.db.ImportOMDBHelper
|
||||||
import com.navinfo.omqs.hilt.ImportOMDBHiltFactory
|
import com.navinfo.omqs.hilt.ImportOMDBHiltFactory
|
||||||
import com.navinfo.omqs.tools.CoroutineUtils
|
import com.navinfo.omqs.tools.CoroutineUtils
|
||||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
import com.navinfo.omqs.ui.activity.map.MainViewModel
|
||||||
import com.navinfo.omqs.ui.activity.scan.QrCodeActivity
|
import com.navinfo.omqs.ui.activity.scan.QrCodeActivity
|
||||||
|
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||||
import com.permissionx.guolindev.PermissionX
|
import com.permissionx.guolindev.PermissionX
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
|
import org.oscim.core.MapPosition
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人中心
|
* 个人中心
|
||||||
*/
|
*/
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?)? = null) : BaseFragment(),
|
class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?)? = null) :
|
||||||
|
BaseFragment(),
|
||||||
FSAFActivityCallbacks {
|
FSAFActivityCallbacks {
|
||||||
|
|
||||||
private var _binding: FragmentPersonalCenterBinding? = null
|
private var _binding: FragmentPersonalCenterBinding? = null
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
private val fileChooser by lazy { FileChooser(requireContext()) }
|
private val fileChooser by lazy { FileChooser(requireContext()) }
|
||||||
private val viewModel by lazy { viewModels<PersonalCenterViewModel>().value }
|
private val viewModel by lazy { viewModels<PersonalCenterViewModel>().value }
|
||||||
|
private val viewMainModel by activityViewModels<MainViewModel>()
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var importOMDBHiltFactory: ImportOMDBHiltFactory
|
lateinit var importOMDBHiltFactory: ImportOMDBHiltFactory
|
||||||
@ -66,6 +72,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
|||||||
when (it.itemId) {
|
when (it.itemId) {
|
||||||
R.id.personal_center_menu_offline_map ->
|
R.id.personal_center_menu_offline_map ->
|
||||||
findNavController().navigate(R.id.OfflineMapFragment)
|
findNavController().navigate(R.id.OfflineMapFragment)
|
||||||
|
|
||||||
R.id.personal_center_menu_obtain_data -> { // 生成数据,根据sqlite文件生成对应的zip文件
|
R.id.personal_center_menu_obtain_data -> { // 生成数据,根据sqlite文件生成对应的zip文件
|
||||||
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
|
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
|
||||||
override fun onCancel(reason: String) {
|
override fun onCancel(reason: String) {
|
||||||
@ -90,6 +97,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_import_data -> { // 导入zip数据
|
R.id.personal_center_menu_import_data -> { // 导入zip数据
|
||||||
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
|
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
|
||||||
override fun onCancel(reason: String) {
|
override fun onCancel(reason: String) {
|
||||||
@ -106,6 +114,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_import_yuan_data -> {
|
R.id.personal_center_menu_import_yuan_data -> {
|
||||||
// 用户选中导入数据,打开文件选择器,用户选择导入的数据文件目录
|
// 用户选中导入数据,打开文件选择器,用户选择导入的数据文件目录
|
||||||
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
|
fileChooser.openChooseFileDialog(object : FileChooserCallback() {
|
||||||
@ -117,49 +126,59 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_open_auto_location -> {
|
R.id.personal_center_menu_open_auto_location -> {
|
||||||
Constant.AUTO_LOCATION = true
|
Constant.AUTO_LOCATION = !Constant.AUTO_LOCATION
|
||||||
|
if (Constant.AUTO_LOCATION) {
|
||||||
|
it.title = "关闭自动定位"
|
||||||
|
viewMainModel.startAutoLocationTimer()
|
||||||
|
} else {
|
||||||
|
it.title = "开启10S自动定位"
|
||||||
|
viewMainModel.cancelAutoLocation()
|
||||||
}
|
}
|
||||||
R.id.personal_center_menu_close_auto_location -> {
|
|
||||||
Constant.AUTO_LOCATION = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R.id.personal_center_menu_rotate_over_look -> {
|
||||||
|
niMapController.mMapView.vtmMap.eventLayer.enableTilt(Constant.MapRotateEnable)
|
||||||
|
niMapController.mMapView.vtmMap.eventLayer.enableRotation(Constant.MapRotateEnable)
|
||||||
|
Constant.MapRotateEnable = !Constant.MapRotateEnable
|
||||||
|
if (Constant.MapRotateEnable) {
|
||||||
|
val mapPosition: MapPosition =
|
||||||
|
niMapController.mMapView.vtmMap.getMapPosition()
|
||||||
|
mapPosition.setBearing(0f) // 锁定角度,自动将地图旋转到正北方向
|
||||||
|
niMapController.mMapView.vtmMap.setMapPosition(mapPosition)
|
||||||
|
it.title = "开启地图旋转及视角"
|
||||||
|
} else {
|
||||||
|
it.title = "锁定地图旋转及视角"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_test -> {
|
R.id.personal_center_menu_test -> {
|
||||||
viewModel.readRealmData()
|
viewModel.readRealmData()
|
||||||
//116.25017070328308 40.061730653134696
|
//116.25017070328308 40.061730653134696
|
||||||
// 定位到指定位置
|
// 定位到指定位置
|
||||||
niMapController.mMapView.vtmMap.animator()
|
niMapController.mMapView.vtmMap.animator()
|
||||||
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
|
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
|
||||||
.animateTo(GeoPoint(40.08785792571823, 116.27562659540283))
|
.animateTo(GeoPoint(40.51850916836801, 115.78801387178642))
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_open_all_layer -> {
|
R.id.personal_center_menu_open_all_layer -> {
|
||||||
MapParamUtils.setDataLayerEnum(DataLayerEnum.SHOW_ALL_LAYERS)
|
MapParamUtils.setDataLayerEnum(DataLayerEnum.SHOW_ALL_LAYERS)
|
||||||
niMapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
niMapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
viewModel.realmOperateHelper.updateRealmDefaultInstance()
|
viewModel.realmOperateHelper.updateRealmDefaultInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_close_hide_layer -> {
|
R.id.personal_center_menu_close_hide_layer -> {
|
||||||
MapParamUtils.setDataLayerEnum(DataLayerEnum.ONLY_ENABLE_LAYERS)
|
MapParamUtils.setDataLayerEnum(DataLayerEnum.ONLY_ENABLE_LAYERS)
|
||||||
niMapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
niMapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
viewModel.realmOperateHelper.updateRealmDefaultInstance()
|
viewModel.realmOperateHelper.updateRealmDefaultInstance()
|
||||||
}
|
}
|
||||||
// R.id.personal_center_menu_task_list -> {
|
|
||||||
// findNavController().navigate(R.id.TaskManagerFragment)
|
|
||||||
// }
|
|
||||||
// R.id.personal_center_menu_qs_record_list -> {
|
|
||||||
// findNavController().navigate(R.id.QsRecordListFragment)
|
|
||||||
// }
|
|
||||||
// R.id.personal_center_menu_layer_manager -> { // 图层管理
|
|
||||||
// findNavController().navigate(R.id.QsLayerManagerFragment)
|
|
||||||
// }
|
|
||||||
/* R.id.personal_center_menu_qs_record_list -> {
|
|
||||||
findNavController().navigate(R.id.QsRecordListFragment)
|
|
||||||
}
|
|
||||||
R.id.personal_center_menu_layer_manager -> { // 图层管理
|
|
||||||
findNavController().navigate(R.id.QsLayerManagerFragment)
|
|
||||||
}*/
|
|
||||||
R.id.personal_center_menu_scan_qr_code -> {
|
R.id.personal_center_menu_scan_qr_code -> {
|
||||||
//跳转二维码扫描界面
|
//跳转二维码扫描界面
|
||||||
checkPermission()
|
checkPermission()
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.personal_center_menu_scan_indoor_data -> {
|
R.id.personal_center_menu_scan_indoor_data -> {
|
||||||
indoorDataListener?.invoke(true)
|
indoorDataListener?.invoke(true)
|
||||||
}
|
}
|
||||||
@ -171,6 +190,24 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
|||||||
ToastUtils.showShort(it)
|
ToastUtils.showShort(it)
|
||||||
}
|
}
|
||||||
fileChooser.setCallbacks(this@PersonalCenterFragment)
|
fileChooser.setCallbacks(this@PersonalCenterFragment)
|
||||||
|
binding.root.menu.forEach {
|
||||||
|
when (it.itemId) {
|
||||||
|
R.id.personal_center_menu_open_auto_location -> {
|
||||||
|
if (Constant.AUTO_LOCATION) {
|
||||||
|
it.title = "关闭自动定位"
|
||||||
|
} else {
|
||||||
|
it.title = "开启10S自动定位"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
R.id.personal_center_menu_rotate_over_look -> {
|
||||||
|
if (Constant.MapRotateEnable) {
|
||||||
|
it.title = "开启地图旋转及视角"
|
||||||
|
} else {
|
||||||
|
it.title = "锁定地图旋转及视角"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun intentTOQRCode() {
|
private fun intentTOQRCode() {
|
||||||
|
@ -43,7 +43,6 @@ class PersonalCenterViewModel @Inject constructor(
|
|||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
suspend fun obtainOMDBZipData(importOMDBHelper: ImportOMDBHelper) {
|
suspend fun obtainOMDBZipData(importOMDBHelper: ImportOMDBHelper) {
|
||||||
Log.d("OMQSApplication", "开始生成数据")
|
Log.d("OMQSApplication", "开始生成数据")
|
||||||
// Realm.getDefaultInstance().beginTransaction()
|
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
val hadLinkFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK.txt")
|
val hadLinkFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK.txt")
|
||||||
val hadLinkKindFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_KIND.txt")
|
val hadLinkKindFile = File(importOMDBHelper.omdbFile.parentFile, "HAD_LINK_KIND.txt")
|
||||||
@ -135,13 +134,6 @@ class PersonalCenterViewModel @Inject constructor(
|
|||||||
hadSpeedLimitVarFile, gson.toJson(hadSpeedlimitVar) + "\r", true
|
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))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ class QsRecordListViewModel @Inject constructor(
|
|||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
val objects = realm.where(QsRecordBean::class.java).equalTo("taskId",taskId).findAll()
|
val objects = realm.where(QsRecordBean::class.java).equalTo("taskId",taskId).findAll()
|
||||||
liveDataQSList.postValue(realm.copyFromRealm(objects))
|
liveDataQSList.postValue(realm.copyFromRealm(objects))
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ class LaneBoundaryAdapter : RecyclerView.Adapter<ViewHolder>() {
|
|||||||
fun bind(pos: Int, laneBoundaryItem: LaneBoundaryItem) {
|
fun bind(pos: Int, laneBoundaryItem: LaneBoundaryItem) {
|
||||||
viewBinding.contactName.text = laneBoundaryItem.title
|
viewBinding.contactName.text = laneBoundaryItem.title
|
||||||
if (laneBoundaryItem.itemList != null) {
|
if (laneBoundaryItem.itemList != null) {
|
||||||
|
viewBinding.infos.removeAllViews()
|
||||||
for (item in laneBoundaryItem.itemList) {
|
for (item in laneBoundaryItem.itemList) {
|
||||||
var view = LayoutInflater.from(viewBinding.root.context)
|
var view = LayoutInflater.from(viewBinding.root.context)
|
||||||
.inflate(R.layout.adapter_two_item, null, false)
|
.inflate(R.layout.adapter_two_item, null, false)
|
||||||
|
@ -123,6 +123,7 @@ class TaskLinkViewModel @Inject constructor(
|
|||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||||
liveDataTaskBean.postValue(res?.let { realm.copyFromRealm(it) })
|
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)
|
.putString(Constant.SHARED_SYNC_TASK_LINK_ID, hadLinkDvoBean!!.linkPid)
|
||||||
.apply()
|
.apply()
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,6 +304,7 @@ class TaskLinkViewModel @Inject constructor(
|
|||||||
mapController.measureLayerHandler.initPathLine(hadLinkDvoBean?.geometry!!)
|
mapController.measureLayerHandler.initPathLine(hadLinkDvoBean?.geometry!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +357,7 @@ class TaskLinkViewModel @Inject constructor(
|
|||||||
mapController.lineHandler.removeTaskLink(hadLinkDvoBean!!.linkPid)
|
mapController.lineHandler.removeTaskLink(hadLinkDvoBean!!.linkPid)
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDialog.setNegativeButton("取消", null)
|
mDialog.setNegativeButton("取消", null)
|
||||||
|
@ -11,15 +11,14 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
import com.navinfo.collect.library.data.entity.*
|
||||||
import com.navinfo.collect.library.data.entity.NiLocation
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
import com.navinfo.collect.library.utils.MapParamUtils
|
import com.navinfo.collect.library.utils.MapParamUtils
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
|
import com.navinfo.omqs.bean.Route
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.http.NetResult
|
import com.navinfo.omqs.http.NetResult
|
||||||
import com.navinfo.omqs.http.NetworkService
|
import com.navinfo.omqs.http.NetworkService
|
||||||
@ -29,8 +28,10 @@ import com.navinfo.omqs.ui.dialog.FirstDialog
|
|||||||
import com.navinfo.omqs.util.DateTimeUtil
|
import com.navinfo.omqs.util.DateTimeUtil
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
|
import io.realm.RealmConfiguration
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
@ -143,6 +144,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
|
mapController.lineHandler.addTaskLink(hadLinkDvoBean)
|
||||||
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,6 +220,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
getLocalTaskList()
|
getLocalTaskList()
|
||||||
}
|
}
|
||||||
@ -239,12 +242,12 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is NetResult.Loading -> {}
|
is NetResult.Loading -> {}
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取任务列表
|
* 获取任务列表
|
||||||
*/
|
*/
|
||||||
@ -262,6 +265,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
FileManager.checkOMDBFileInfo(item)
|
FileManager.checkOMDBFileInfo(item)
|
||||||
}
|
}
|
||||||
liveDataTaskList.postValue(taskList)
|
liveDataTaskList.postValue(taskList)
|
||||||
|
realm.close()
|
||||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||||
if (id > -1) {
|
if (id > -1) {
|
||||||
for (item in taskList) {
|
for (item in taskList) {
|
||||||
@ -290,11 +294,15 @@ class TaskViewModel @Inject constructor(
|
|||||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||||
showTaskLinks(taskBean)
|
showTaskLinks(taskBean)
|
||||||
MapParamUtils.setTaskId(taskBean.id)
|
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.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
mapController.mMapView.updateMap(true)
|
mapController.mMapView.updateMap(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun showTaskLinks(taskBean: TaskBean) {
|
private fun showTaskLinks(taskBean: TaskBean) {
|
||||||
|
|
||||||
mapController.lineHandler.removeAllTaskLine()
|
mapController.lineHandler.removeAllTaskLine()
|
||||||
@ -383,6 +391,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
realm.executeTransaction { r ->
|
realm.executeTransaction { r ->
|
||||||
r.copyToRealmOrUpdate(it)
|
r.copyToRealmOrUpdate(it)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -399,6 +408,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
val list = realm.where(TaskBean::class.java).contains("evaluationTaskName", key).or()
|
val list = realm.where(TaskBean::class.java).contains("evaluationTaskName", key).or()
|
||||||
.contains("dataVersion", key).or().contains("cityName", key).findAll()
|
.contains("dataVersion", key).or().contains("cityName", key).findAll()
|
||||||
liveDataTaskList.postValue(realm.copyFromRealm(list))
|
liveDataTaskList.postValue(realm.copyFromRealm(list))
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,6 +475,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
liveDataTaskList.postValue(taskList)
|
liveDataTaskList.postValue(taskList)
|
||||||
liveDataCloseTask.postValue(true)
|
liveDataCloseTask.postValue(true)
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDialog.setNegativeButton(
|
mDialog.setNegativeButton(
|
||||||
@ -507,6 +518,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
map[taskBean] = true
|
map[taskBean] = true
|
||||||
liveDataTaskUpload.postValue(map)
|
liveDataTaskUpload.postValue(map)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,6 +667,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
mapController.lineHandler.removeTaskLink(hadLinkDvoBean.linkPid)
|
mapController.lineHandler.removeTaskLink(hadLinkDvoBean.linkPid)
|
||||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
||||||
}
|
}
|
||||||
|
realm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDialog.setNegativeButton(
|
mDialog.setNegativeButton(
|
||||||
|
25
app/src/main/java/com/navinfo/omqs/util/NaviEngine.kt
Normal file
25
app/src/main/java/com/navinfo/omqs/util/NaviEngine.kt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.navinfo.omqs.util
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
|
import com.navinfo.omqs.bean.Route
|
||||||
|
import org.locationtech.jts.geom.LineString
|
||||||
|
import org.oscim.core.GeoPoint
|
||||||
|
|
||||||
|
class NaviEngine {
|
||||||
|
var geometry: LineString? = null
|
||||||
|
var routeList = mutableListOf<Route>()
|
||||||
|
get() {
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
val list = mutableListOf<GeoPoint>()
|
||||||
|
list.addAll(value[0].pointList)
|
||||||
|
for (i in 1 until value.size) {
|
||||||
|
val list2 = value[i].pointList
|
||||||
|
list2.removeAt(0)
|
||||||
|
list.addAll(list2)
|
||||||
|
}
|
||||||
|
geometry = GeometryTools.createLineString(list)
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
}
|
@ -563,15 +563,57 @@ class SignUtil {
|
|||||||
try {
|
try {
|
||||||
val linkList = renderEntity.properties["tollinfoList"]
|
val linkList = renderEntity.properties["tollinfoList"]
|
||||||
if (linkList != null && linkList != "" && linkList != "null") {
|
if (linkList != null && linkList != "" && linkList != "null") {
|
||||||
val itemList = mutableListOf<TwoItemAdapterItem>()
|
|
||||||
val jsonArray = JSONArray(linkList)
|
val jsonArray = JSONArray(linkList)
|
||||||
for (i in 0 until jsonArray.length()) {
|
for (i in 0 until jsonArray.length()) {
|
||||||
val arrayObject: JSONObject = jsonArray[i] as JSONObject
|
val arrayObject: JSONObject = jsonArray[i] as JSONObject
|
||||||
|
val itemList = mutableListOf<TwoItemAdapterItem>()
|
||||||
// itemList.add(TwoItemAdapterItem("方向", direct))
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
itemList.add(
|
||||||
|
TwoItemAdapterItem("通道号码", "${arrayObject.optString("pid")}")
|
||||||
|
)
|
||||||
val stringBuffer = StringBuffer()
|
val stringBuffer = StringBuffer()
|
||||||
|
|
||||||
|
stringBuffer.setLength(0)
|
||||||
|
val passageType = arrayObject.getInt("passageType")
|
||||||
|
for (i in 1 downTo 0) {
|
||||||
|
val bit = (passageType shr i) and 1
|
||||||
|
if (bit == 1) {
|
||||||
|
when (i) {
|
||||||
|
0 -> stringBuffer.append("称重车道 ")
|
||||||
|
1 -> stringBuffer.append("绿色通道 ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemList.add(
|
||||||
|
TwoItemAdapterItem("通道类型", stringBuffer.toString())
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
stringBuffer.setLength(0)
|
||||||
|
val payMethod = arrayObject.getInt("payMethod")
|
||||||
|
for (i in 8 downTo 0) {
|
||||||
|
val bit = (payMethod shr i) and 1
|
||||||
|
if (bit == 1) {
|
||||||
|
when (i) {
|
||||||
|
0 -> stringBuffer.append("ETC ")
|
||||||
|
1 -> stringBuffer.append("现金 ")
|
||||||
|
2 -> stringBuffer.append("银行卡(借记卡) ")
|
||||||
|
3 -> stringBuffer.append("信用卡 ")
|
||||||
|
4 -> stringBuffer.append("IC卡 ")
|
||||||
|
5 -> stringBuffer.append("预付卡 ")
|
||||||
|
6 -> stringBuffer.append("微信 ")
|
||||||
|
7 -> stringBuffer.append("支付宝 ")
|
||||||
|
8 -> stringBuffer.append("其他APP ")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemList.add(
|
||||||
|
TwoItemAdapterItem("收费方式", stringBuffer.toString())
|
||||||
|
)
|
||||||
|
|
||||||
|
stringBuffer.setLength(0)
|
||||||
val cardType = arrayObject.getInt("cardType")
|
val cardType = arrayObject.getInt("cardType")
|
||||||
for (i in 2 downTo 0) {
|
for (i in 2 downTo 0) {
|
||||||
val bit = (cardType shr i) and 1
|
val bit = (cardType shr i) and 1
|
||||||
@ -586,34 +628,18 @@ class SignUtil {
|
|||||||
itemList.add(
|
itemList.add(
|
||||||
TwoItemAdapterItem("领卡方式", stringBuffer.toString())
|
TwoItemAdapterItem("领卡方式", stringBuffer.toString())
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("jingo", "领卡方式 报错 ${e.message}")
|
val seqNum = arrayObject.getInt("seqNum")
|
||||||
}
|
|
||||||
try {
|
|
||||||
val stringBuffer = StringBuffer()
|
|
||||||
val passageType = arrayObject.getInt("passageType")
|
|
||||||
for (i in 2 downTo 0) {
|
|
||||||
val bit = (passageType shr i) and 1
|
|
||||||
if (bit == 1) {
|
|
||||||
when (i) {
|
|
||||||
0 -> stringBuffer.append("ETC ")
|
|
||||||
1 -> stringBuffer.append("人工 ")
|
|
||||||
2 -> stringBuffer.append("自助 ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itemList.add(
|
|
||||||
TwoItemAdapterItem("领卡方式", stringBuffer.toString())
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("jingo", "领卡方式 报错 ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.add(
|
list.add(
|
||||||
LaneBoundaryItem(
|
LaneBoundaryItem(
|
||||||
"车道信息", null, itemList
|
"车道$seqNum", null, itemList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("jingo", "领卡方式 报错 ${e.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@ -642,9 +668,9 @@ class SignUtil {
|
|||||||
try {
|
try {
|
||||||
val linkList = renderEntity.properties["linkList"]
|
val linkList = renderEntity.properties["linkList"]
|
||||||
if (linkList != null && linkList != "" && linkList != "null") {
|
if (linkList != null && linkList != "" && linkList != "null") {
|
||||||
val itemList = mutableListOf<TwoItemAdapterItem>()
|
|
||||||
val jsonArray = JSONArray(linkList)
|
val jsonArray = JSONArray(linkList)
|
||||||
for (i in 0 until jsonArray.length()) {
|
for (i in 0 until jsonArray.length()) {
|
||||||
|
val itemList = mutableListOf<TwoItemAdapterItem>()
|
||||||
val arrayObject: JSONObject = jsonArray[i] as JSONObject
|
val arrayObject: JSONObject = jsonArray[i] as JSONObject
|
||||||
val direct = when (arrayObject.getInt("direct")) {
|
val direct = when (arrayObject.getInt("direct")) {
|
||||||
2 -> "顺方向"
|
2 -> "顺方向"
|
||||||
@ -652,6 +678,7 @@ class SignUtil {
|
|||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
itemList.add(TwoItemAdapterItem("方向", direct))
|
itemList.add(TwoItemAdapterItem("方向", direct))
|
||||||
|
|
||||||
val featureType = when (arrayObject.getInt("featureType")) {
|
val featureType = when (arrayObject.getInt("featureType")) {
|
||||||
1 -> "LINK"
|
1 -> "LINK"
|
||||||
2 -> "LINK PA"
|
2 -> "LINK PA"
|
||||||
|
BIN
app/src/main/res/drawable-xxhdpi/icon_location_north.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_location_north.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_location_reset.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_location_reset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
@ -102,7 +102,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="@dimen/top_right_drawer_btns_mr"
|
android:layout_marginRight="@dimen/top_right_drawer_btns_mr"
|
||||||
app:constraint_referenced_ids="main_activity_note,main_activity_task_line,main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_calc_distance,main_activity_menu"
|
app:constraint_referenced_ids="main_activity_add_new,main_activity_task_line,main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_calc_distance,main_activity_menu"
|
||||||
app:flow_horizontalGap="6dp"
|
app:flow_horizontalGap="6dp"
|
||||||
app:flow_wrapMode="aligned"
|
app:flow_wrapMode="aligned"
|
||||||
app:layout_constraintRight_toLeftOf="@id/main_activity_right_fragment"
|
app:layout_constraintRight_toLeftOf="@id/main_activity_right_fragment"
|
||||||
@ -113,7 +113,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_note,main_activity_task_line,main_activity_calc_distance" />
|
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_add_new,main_activity_task_line,main_activity_calc_distance" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_serach"
|
android:id="@+id/main_activity_serach"
|
||||||
@ -146,10 +146,10 @@
|
|||||||
android:src="@drawable/icon_calc_disance" />
|
android:src="@drawable/icon_calc_disance" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_note"
|
android:id="@+id/main_activity_add_new"
|
||||||
style="@style/top_right_drawer_btns_style"
|
style="@style/top_right_drawer_btns_style"
|
||||||
android:onClick="@{()->mainActivity.onClickNewNote()}"
|
android:onClick="@{()->mainActivity.voiceOnclick()}"
|
||||||
android:src="@drawable/icon_menu_note" />
|
android:src="@drawable/icon_add_data" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_task_line"
|
android:id="@+id/main_activity_task_line"
|
||||||
@ -243,7 +243,6 @@
|
|||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/main_activity_bottom_sheet"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_bottom_sheet"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/main_activity_top_sign_recyclerview" />
|
app:layout_constraintLeft_toLeftOf="@id/main_activity_top_sign_recyclerview" />
|
||||||
|
|
||||||
@ -285,17 +284,17 @@
|
|||||||
android:id="@+id/main_activity_location"
|
android:id="@+id/main_activity_location"
|
||||||
style="@style/zoom_btns_style"
|
style="@style/zoom_btns_style"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:onClick="@{()->viewModel.onClickLocationButton()}"
|
android:onClick="@{()->mainActivity.onClickLocation()}"
|
||||||
android:src="@drawable/icon_location"
|
android:src="@drawable/icon_location_north"
|
||||||
app:layout_constraintBottom_toTopOf="@id/main_activity_map_update"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_map_update"
|
||||||
app:layout_constraintRight_toRightOf="@id/main_activity_map_update" />
|
app:layout_constraintRight_toRightOf="@id/main_activity_map_update" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_add_new"
|
android:id="@+id/main_activity_note"
|
||||||
style="@style/zoom_btns_style"
|
style="@style/zoom_btns_style"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:onClick="@{()->mainActivity.voiceOnclick()}"
|
android:onClick="@{()->mainActivity.onClickNewNote()}"
|
||||||
android:src="@drawable/icon_add_data"
|
android:src="@drawable/icon_menu_note"
|
||||||
app:layout_constraintBottom_toTopOf="@id/main_activity_location"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_location"
|
||||||
app:layout_constraintRight_toRightOf="@id/main_activity_location" />
|
app:layout_constraintRight_toRightOf="@id/main_activity_location" />
|
||||||
|
|
||||||
@ -305,8 +304,8 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:onClick="@{()->mainActivity.voiceOnclick()}"
|
android:onClick="@{()->mainActivity.voiceOnclick()}"
|
||||||
android:src="@drawable/icon_add_voice"
|
android:src="@drawable/icon_add_voice"
|
||||||
app:layout_constraintBottom_toTopOf="@id/main_activity_add_new"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_note"
|
||||||
app:layout_constraintRight_toRightOf="@id/main_activity_add_new" />
|
app:layout_constraintRight_toRightOf="@id/main_activity_note" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_select_line"
|
android:id="@+id/main_activity_select_line"
|
||||||
@ -332,13 +331,13 @@
|
|||||||
android:id="@+id/main_activity_right_visibility_buttons_group"
|
android:id="@+id/main_activity_right_visibility_buttons_group"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:constraint_referenced_ids="main_activity_close_line,main_activity_select_line,main_activity_voice,main_activity_add_new" />
|
app:constraint_referenced_ids="main_activity_close_line,main_activity_select_line,main_activity_voice,main_activity_note" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Group
|
<androidx.constraintlayout.widget.Group
|
||||||
android:id="@+id/main_activity_right_visibility_buttons_group2"
|
android:id="@+id/main_activity_right_visibility_buttons_group2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:constraint_referenced_ids="main_activity_close_line,main_activity_select_line,main_activity_voice,main_activity_add_new,main_activity_map_update,main_activity_zoom_in,main_activity_zoom_out,main_activity_geometry,main_activity_location" />
|
app:constraint_referenced_ids="main_activity_close_line,main_activity_select_line,main_activity_voice,main_activity_note,main_activity_map_update,main_activity_zoom_in,main_activity_zoom_out,main_activity_geometry,main_activity_location" />
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/main_activity_middle_fragment"
|
android:id="@+id/main_activity_middle_fragment"
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:background="@color/transparent"
|
android:background="@color/transparent"
|
||||||
android:src="@drawable/icon_delete"
|
android:src="@drawable/icon_delete"
|
||||||
app:layout_constraintRight_toLeftOf="@id/note_bar_cancel"
|
app:layout_constraintRight_toLeftOf="@id/note_bar_save"
|
||||||
app:layout_constraintTop_toTopOf="@id/note_bar_save" />
|
app:layout_constraintTop_toTopOf="@id/note_bar_save" />
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
|
@ -36,26 +36,24 @@
|
|||||||
android:visible="false"
|
android:visible="false"
|
||||||
android:icon="@drawable/ic_baseline_sim_card_download_24"
|
android:icon="@drawable/ic_baseline_sim_card_download_24"
|
||||||
android:title="备份数据" />
|
android:title="备份数据" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/personal_center_menu_open_auto_location"
|
||||||
|
android:icon="@drawable/baseline_person_24"
|
||||||
|
android:visible="true"
|
||||||
|
android:title="开启10S自动定位" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/personal_center_menu_rotate_over_look"
|
||||||
|
android:icon="@drawable/baseline_person_24"
|
||||||
|
android:visible="true"
|
||||||
|
android:title="锁定地图旋转及视角" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/personal_center_menu_version"
|
android:id="@+id/personal_center_menu_version"
|
||||||
android:icon="@drawable/ic_baseline_layers_24"
|
android:icon="@drawable/ic_baseline_layers_24"
|
||||||
android:title="版本:ONE_23QE4_V1.5.0_20230904_A" />
|
android:title="版本:23QE4_V1.5.0_20230904_A" />
|
||||||
</group>
|
</group>
|
||||||
<group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
<item android:title="小标题">
|
<item android:title="小标题">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
|
||||||
android:id="@+id/personal_center_menu_open_auto_location"
|
|
||||||
android:icon="@drawable/baseline_person_24"
|
|
||||||
android:visible="true"
|
|
||||||
android:title="开启自动定位" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/personal_center_menu_close_auto_location"
|
|
||||||
android:icon="@drawable/baseline_person_24"
|
|
||||||
android:visible="true"
|
|
||||||
android:title="关闭自动定位" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/personal_center_menu_open_all_layer"
|
android:id="@+id/personal_center_menu_open_all_layer"
|
||||||
android:icon="@drawable/baseline_person_24"
|
android:icon="@drawable/baseline_person_24"
|
||||||
|
@ -185,7 +185,7 @@
|
|||||||
width="0.1" />
|
width="0.1" />
|
||||||
|
|
||||||
<!--道路形态-->
|
<!--道路形态-->
|
||||||
<style-line dasharray="8,2,2,2,2,2" id="road_morphology" repeat-gap="3" repeat-start="0" stroke="#1afa29" width="0.3" />
|
<style-line dasharray="8,2,2,2,2,2" id="road_morphology" repeat-gap="3" repeat-start="0" stroke="#1afa29" width="0.4" />
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
@ -1491,41 +1491,48 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<m k="qi_table">
|
<m k="qi_table">
|
||||||
|
|
||||||
<!-- 道路线 -->
|
<!-- 道路线 -->
|
||||||
<m v="OMDB_RD_LINK">
|
<m v="OMDB_RD_LINK">
|
||||||
<line stroke="#9c9c9c" width="1" />
|
<line stroke="#9c9c9c" width="0.5" />
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--道路种别-->
|
<!--道路种别-->
|
||||||
<m v="OMDB_RD_LINK_KIND">
|
<m v="OMDB_RD_LINK_KIND">
|
||||||
<outline-layer id="kind0" stroke="#44000000" width="0.1" />
|
<outline-layer id="kind0" stroke="#44000000" width="0.8" fix="true"/>
|
||||||
<outline-layer id="kind1" stroke="#aa807040" width="0.1" />
|
<outline-layer id="kind1" stroke="#aa807040" width="0.8" fix="true"/>
|
||||||
|
|
||||||
<m k="kind" v="1">
|
<m k="kind" v="1">
|
||||||
<line blur="0.3" outline="kind0" use="highway:z11" />
|
<line blur="0.3" outline="kind0" use="highway:z11" width="3.5" fix="true"/>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<m k="kind" v="2|3">
|
<m k="kind" v="2|3">
|
||||||
<line outline="kind0" use="trunk" />
|
<line outline="kind0" use="trunk" fix="true" width="2.6"/>
|
||||||
</m>
|
</m>
|
||||||
<m k="kind" v="4">
|
|
||||||
<line outline="kind0" use="primary:z11" />
|
<m k="kind" v="4">width="0.4"
|
||||||
|
<line outline="kind0" use="primary:z11" fix="true" width="2.2"/>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<m k="kind" v="5|6">
|
<m k="kind" v="5|6">
|
||||||
<line outline="kind0" use="secondary:z11" />
|
<line outline="kind0" use="secondary:z11" fix="true" width="1.5"/>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<m k="kind" v="7">
|
<m k="kind" v="7">
|
||||||
<line outline="kind0" use="tertiary" />
|
<line outline="kind0" use="tertiary" fix="true" width="2.2"/>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<m k="kind" v="8">
|
<m k="kind" v="8">
|
||||||
<line outline="kind0" use="residential" />
|
<line outline="kind0" use="residential" fix="true" width="0.5"/>
|
||||||
</m>
|
</m>
|
||||||
<m k="kind" v="9|10">
|
<m k="kind" v="9|10">
|
||||||
<line outline="kind0" use="footway:z17" />
|
<line outline="kind0" use="footway:z17" fix="true" width="0.7"/>
|
||||||
</m>
|
</m>
|
||||||
<m k="kind" v="11|13">
|
<m k="kind" v="11|13">
|
||||||
<line outline="kind0" use="ferry" />
|
<line outline="kind0" use="ferry" fix="true" width="5"/>
|
||||||
</m>
|
</m>
|
||||||
<m k="kind" v="15">
|
<m k="kind" v="15">
|
||||||
<line outline="kind0" use="highway:cycleway" />
|
<line outline="kind0" use="highway:cycleway" width="1"/>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
|||||||
var zoomMin: Int = 18 //显示最小级别
|
var zoomMin: Int = 18 //显示最小级别
|
||||||
var zoomMax: Int = 23 //显示最大级别
|
var zoomMax: Int = 23 //显示最大级别
|
||||||
var enable:Int = 0 // 默认0不是显示 1为渲染显示 2为常显
|
var enable:Int = 0 // 默认0不是显示 1为渲染显示 2为常显
|
||||||
var catchEnable:Int = 0 // 0捕捉 1不捕捉
|
var catchEnable:Int = 0 // 0不捕捉 1捕捉
|
||||||
|
|
||||||
constructor(name: String) : this() {
|
constructor(name: String) : this() {
|
||||||
this.name = name
|
this.name = name
|
||||||
|
@ -735,7 +735,7 @@ public final class NIMapView extends RelativeLayout {
|
|||||||
if (mapView != null && mapView.map() != null)
|
if (mapView != null && mapView.map() != null)
|
||||||
return mapView.map().getMapPosition().getZoomLevel();
|
return mapView.map().getMapPosition().getZoomLevel();
|
||||||
|
|
||||||
return 0;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,6 +146,7 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
|||||||
// 添加显示grid的tile号的图层
|
// 添加显示grid的tile号的图层
|
||||||
tileGridLayer = TileGridLayer(mMapView.vtmMap)
|
tileGridLayer = TileGridLayer(mMapView.vtmMap)
|
||||||
addLayer(tileGridLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
addLayer(tileGridLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||||
|
tileGridLayer.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resetOMDBVectorTileLayer() {
|
private fun resetOMDBVectorTileLayer() {
|
||||||
|
@ -28,7 +28,7 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
|||||||
//高亮线绘制线 样式
|
//高亮线绘制线 样式
|
||||||
val defaultLineStyle = Style.builder()
|
val defaultLineStyle = Style.builder()
|
||||||
.stippleColor(context.resources.getColor(R.color.draw_line_blue2_color))
|
.stippleColor(context.resources.getColor(R.color.draw_line_blue2_color))
|
||||||
.strokeWidth(10f)
|
.strokeWidth(5f)
|
||||||
.fillColor(context.resources.getColor(R.color.teal_200))
|
.fillColor(context.resources.getColor(R.color.teal_200))
|
||||||
.fillAlpha(0.5f)
|
.fillAlpha(0.5f)
|
||||||
.strokeColor(context.resources.getColor(R.color.teal_200))
|
.strokeColor(context.resources.getColor(R.color.teal_200))
|
||||||
|
@ -67,7 +67,10 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
val errorCode = it.locType
|
val errorCode = it.locType
|
||||||
mCurrentLocation = it
|
mCurrentLocation = it
|
||||||
mLocationLayer.setPosition(it.latitude, it.longitude, it.radius)
|
mLocationLayer.setPosition(it.latitude, it.longitude, it.radius)
|
||||||
Log.e("qj", "location==${it.longitude}==errorCode===$errorCode===${it.locTypeDescription}")
|
Log.e(
|
||||||
|
"qj",
|
||||||
|
"location==${it.longitude}==errorCode===$errorCode===${it.locTypeDescription}"
|
||||||
|
)
|
||||||
|
|
||||||
getCurrentNiLocation()?.let { it1 ->
|
getCurrentNiLocation()?.let { it1 ->
|
||||||
mContext.lifecycleScope.launch {
|
mContext.lifecycleScope.launch {
|
||||||
@ -212,6 +215,7 @@ private class MyLocationListener(callback: (BDLocation) -> Unit) : BDAbstractLoc
|
|||||||
val call = callback;
|
val call = callback;
|
||||||
override fun onReceiveLocation(location: BDLocation) {
|
override fun onReceiveLocation(location: BDLocation) {
|
||||||
call(location)
|
call(location)
|
||||||
|
Log.e("jingo", "定位结果:速度=" + location.speed +" 方向=" + location.direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +42,14 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
|||||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||||
int yStart = (int) tile.tileY << m;
|
int yStart = (int) tile.tileY << m;
|
||||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||||
|
|
||||||
|
|
||||||
if(isUpdate){
|
if(isUpdate){
|
||||||
Realm.getDefaultInstance().refresh();
|
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||||
isUpdate = false;
|
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){
|
if(MapParamUtils.getDataLayerEnum()!=null){
|
||||||
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
||||||
@ -55,7 +57,7 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
|||||||
sql += " and 1=1";
|
sql += " and 1=1";
|
||||||
}
|
}
|
||||||
|
|
||||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
|
RealmQuery<ReferenceEntity> realmQuery = Realm.getInstance(MapParamUtils.getTaskConfig()).where(ReferenceEntity.class)
|
||||||
.rawPredicate(sql);
|
.rawPredicate(sql);
|
||||||
// 筛选不显示的数据
|
// 筛选不显示的数据
|
||||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||||
@ -74,7 +76,7 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
|||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,13 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||||
int yStart = (int) tile.tileY << m;
|
int yStart = (int) tile.tileY << m;
|
||||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||||
|
|
||||||
if(isUpdate){
|
if(isUpdate){
|
||||||
Realm.getDefaultInstance().refresh();
|
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||||
isUpdate = false;
|
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){
|
if(MapParamUtils.getDataLayerEnum()!=null){
|
||||||
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
||||||
@ -54,7 +55,7 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
sql += " and 1=1";
|
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) {
|
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||||
realmQuery.beginGroup();
|
realmQuery.beginGroup();
|
||||||
@ -73,6 +74,7 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ public class RealmDBTileDataSource implements ITileDataSource {
|
|||||||
List<GeometryFeatureEntity> listResult = realmQuery.distinct("id").findAll();
|
List<GeometryFeatureEntity> listResult = realmQuery.distinct("id").findAll();
|
||||||
mThreadLocalDecoders.get().decode(tile, mapDataSink, listResult);
|
mThreadLocalDecoders.get().decode(tile, mapDataSink, listResult);
|
||||||
mapDataSink.completed(QueryResult.SUCCESS);
|
mapDataSink.completed(QueryResult.SUCCESS);
|
||||||
|
Realm.getDefaultInstance().close();
|
||||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.SUCCESS);
|
mapDataSink.completed(QueryResult.SUCCESS);
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.navinfo.collect.library.utils;
|
package com.navinfo.collect.library.utils;
|
||||||
|
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.locationtech.jts.algorithm.distance.DistanceToPoint;
|
||||||
|
import org.locationtech.jts.algorithm.distance.PointPairDistance;
|
||||||
import org.locationtech.jts.geom.Coordinate;
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import org.locationtech.jts.geom.GeometryFactory;
|
import org.locationtech.jts.geom.GeometryFactory;
|
||||||
@ -609,6 +613,21 @@ public class GeometryTools {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<GeoPoint> getGeoPoints(Geometry geometry) {
|
||||||
|
List<GeoPoint> list = null;
|
||||||
|
if (geometry != null) {
|
||||||
|
Coordinate[] coordinates = geometry.getCoordinates();
|
||||||
|
if (coordinates != null && coordinates.length > 0) {
|
||||||
|
list = new ArrayList<GeoPoint>();
|
||||||
|
for (Coordinate coor : coordinates) {
|
||||||
|
list.add(new GeoPoint(coor.y, coor.x));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Coordinate[] getCoordinates(String str) {
|
public static Coordinate[] getCoordinates(String str) {
|
||||||
Coordinate[] coordinates = null;
|
Coordinate[] coordinates = null;
|
||||||
if (Check.isEmpty(str))
|
if (Check.isEmpty(str))
|
||||||
@ -1314,6 +1333,8 @@ public class GeometryTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public enum SNAP_TYPE {
|
public enum SNAP_TYPE {
|
||||||
/**
|
/**
|
||||||
* 像素
|
* 像素
|
||||||
@ -1397,9 +1418,11 @@ public class GeometryTools {
|
|||||||
|
|
||||||
static class Check {
|
static class Check {
|
||||||
public static boolean isEmpty(String str) {
|
public static boolean isEmpty(String str) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||||
if (str == null || str.isEmpty()) {
|
if (str == null || str.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1541,6 +1564,7 @@ public class GeometryTools {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算距离
|
* 计算距离
|
||||||
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -1593,13 +1617,18 @@ public class GeometryTools {
|
|||||||
* @return 对应的地理坐标系中的距离(单位:度)
|
* @return 对应的地理坐标系中的距离(单位:度)
|
||||||
*/
|
*/
|
||||||
private static final double EARTH_RADIUS = 6371000.0;
|
private static final double EARTH_RADIUS = 6371000.0;
|
||||||
|
|
||||||
public static double convertDistanceToDegree(double distance, double latitude) {
|
public static double convertDistanceToDegree(double distance, double latitude) {
|
||||||
double radianDistance = distance / EARTH_RADIUS;
|
double radianDistance = distance / EARTH_RADIUS;
|
||||||
double radianLatitude = Math.toRadians(latitude);
|
double radianLatitude = Math.toRadians(latitude);
|
||||||
|
|
||||||
double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude));
|
double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude));
|
||||||
return Math.toDegrees(radianDegree);
|
return Math.toDegrees(radianDegree);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取指定tile对应的polygon面
|
||||||
|
* @param tile vtm中的瓦片
|
||||||
|
* */
|
||||||
public static Polygon getTilePolygon(Tile tile) {
|
public static Polygon getTilePolygon(Tile tile) {
|
||||||
// 获取当前tile的起点坐标
|
// 获取当前tile的起点坐标
|
||||||
double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel);
|
double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel);
|
||||||
@ -1609,4 +1638,59 @@ public class GeometryTools {
|
|||||||
return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLongitude), new Coordinate(endLongitude, startLatitude),
|
return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLongitude), new Coordinate(endLongitude, startLatitude),
|
||||||
new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLongitude)});
|
new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLongitude)});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 经纬度转墨卡托
|
||||||
|
*/
|
||||||
|
public static Coordinate geoPointToMercator(GeoPoint point) {
|
||||||
|
Coordinate coordinate = new Coordinate();
|
||||||
|
|
||||||
|
double x = point.getLongitude() * 20037508.34 / 180;
|
||||||
|
double y = Math.log(Math.tan((90 + point.getLatitude()) * Math.PI / 360)) / (Math.PI / 180);
|
||||||
|
|
||||||
|
y = y * 20037508.34 / 180;
|
||||||
|
|
||||||
|
coordinate.x = x;
|
||||||
|
coordinate.y = y;
|
||||||
|
|
||||||
|
return coordinate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 墨卡托转经纬度
|
||||||
|
*/
|
||||||
|
public static GeoPoint mercatorToGeoPoint(Coordinate coordinate) {
|
||||||
|
GeoPoint point = null;
|
||||||
|
double x = coordinate.x / 20037508.34 * 180;
|
||||||
|
double y = coordinate.y / 20037508.34 * 180;
|
||||||
|
|
||||||
|
y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
|
||||||
|
|
||||||
|
point = new GeoPoint(y, x);
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<GeoPoint> pointToLineDistance(GeoPoint point, List<GeoPoint> pointList) {
|
||||||
|
|
||||||
|
Coordinate coordinate = geoPointToMercator(point);
|
||||||
|
Coordinate[] cs = new Coordinate[pointList.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < pointList.size(); i++) {
|
||||||
|
Coordinate c = geoPointToMercator(pointList.get(i));
|
||||||
|
cs[i] = c;
|
||||||
|
}
|
||||||
|
GeometryFactory factory = new GeometryFactory();
|
||||||
|
LineString lineString = factory.createLineString(cs);
|
||||||
|
PointPairDistance pointPairDistance = new PointPairDistance();
|
||||||
|
DistanceToPoint.computeDistance(
|
||||||
|
lineString,
|
||||||
|
coordinate,
|
||||||
|
pointPairDistance
|
||||||
|
);
|
||||||
|
|
||||||
|
List newPoints = new ArrayList<GeoPoint>();
|
||||||
|
for (int i = 0; i < pointPairDistance.getCoordinates().length; i++) {
|
||||||
|
newPoints.add(mercatorToGeoPoint(pointPairDistance.getCoordinate(i)));
|
||||||
|
}
|
||||||
|
return newPoints;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,33 @@ package com.navinfo.collect.library.utils;
|
|||||||
|
|
||||||
import com.navinfo.collect.library.enums.DataLayerEnum;
|
import com.navinfo.collect.library.enums.DataLayerEnum;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import io.realm.RealmConfiguration;
|
||||||
|
|
||||||
public class MapParamUtils {
|
public class MapParamUtils {
|
||||||
|
|
||||||
private static int mtaskId = -1;
|
private static int mtaskId = -1;
|
||||||
|
|
||||||
|
private static RealmConfiguration mTaskConfig = null;
|
||||||
|
|
||||||
private static DataLayerEnum dataLayerEnum = DataLayerEnum.ONLY_ENABLE_LAYERS;
|
private static DataLayerEnum dataLayerEnum = DataLayerEnum.ONLY_ENABLE_LAYERS;
|
||||||
|
|
||||||
public static int getTaskId() {
|
public static int getTaskId() {
|
||||||
return mtaskId;
|
return mtaskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTaskId(int taskId) {
|
public static void setTaskId(int taskId) {
|
||||||
mtaskId = taskId;
|
mtaskId = taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RealmConfiguration getTaskConfig() {
|
||||||
|
return mTaskConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTaskConfig(RealmConfiguration taskConfig) {
|
||||||
|
mTaskConfig = taskConfig;
|
||||||
|
}
|
||||||
|
|
||||||
public static DataLayerEnum getDataLayerEnum() {
|
public static DataLayerEnum getDataLayerEnum() {
|
||||||
return dataLayerEnum;
|
return dataLayerEnum;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user