Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
This commit is contained in:
commit
5ad883d543
@ -150,7 +150,7 @@
|
|||||||
"code": 2092,
|
"code": 2092,
|
||||||
"name": "车道类型",
|
"name": "车道类型",
|
||||||
"catch": true,
|
"catch": true,
|
||||||
"isDependOnOtherTable": true,
|
"isDependOnOtherTable": false,
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
@ -179,7 +179,7 @@
|
|||||||
"name": "桥",
|
"name": "桥",
|
||||||
"catch": true,
|
"catch": true,
|
||||||
"existSubCode": true,
|
"existSubCode": true,
|
||||||
"isDependOnOtherTable": true,
|
"isDependOnOtherTable": false,
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
@ -356,7 +356,7 @@
|
|||||||
"code": 4001,
|
"code": 4001,
|
||||||
"name": "路口",
|
"name": "路口",
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"isDependOnOtherTable": true,
|
"isDependOnOtherTable": false,
|
||||||
"zoomMax": 17,
|
"zoomMax": 17,
|
||||||
"catch": true,
|
"catch": true,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
@ -498,7 +498,7 @@
|
|||||||
"code": 4009,
|
"code": 4009,
|
||||||
"name": "警示信息",
|
"name": "警示信息",
|
||||||
"catch": true,
|
"catch": true,
|
||||||
"isDependOnOtherTable": true,
|
"isDependOnOtherTable": false,
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
@ -587,7 +587,7 @@
|
|||||||
"code": 4601,
|
"code": 4601,
|
||||||
"name": "车信",
|
"name": "车信",
|
||||||
"catch": true,
|
"catch": true,
|
||||||
"isDependOnOtherTable": true,
|
"isDependOnOtherTable": false,
|
||||||
"zoomMin": 15,
|
"zoomMin": 15,
|
||||||
"zoomMax": 17,
|
"zoomMax": 17,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
@ -615,8 +615,8 @@
|
|||||||
"table": "OMDB_LANE_LINK_LG",
|
"table": "OMDB_LANE_LINK_LG",
|
||||||
"code": 5001,
|
"code": 5001,
|
||||||
"name": "车道中心线",
|
"name": "车道中心线",
|
||||||
"catch": false,
|
"catch": true,
|
||||||
"isDependOnOtherTable": true,
|
"isDependOnOtherTable": false,
|
||||||
"checkLinkId": false,
|
"checkLinkId": false,
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 20,
|
"zoomMax": 20,
|
||||||
|
@ -10,7 +10,6 @@ import com.google.gson.reflect.TypeToken
|
|||||||
import com.navinfo.collect.library.data.entity.*
|
import com.navinfo.collect.library.data.entity.*
|
||||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.utils.DeflaterUtil
|
import com.navinfo.collect.library.utils.DeflaterUtil
|
||||||
import com.navinfo.collect.library.utils.StrZipUtil
|
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.Constant.Companion.currentInstallTaskConfig
|
import com.navinfo.omqs.Constant.Companion.currentInstallTaskConfig
|
||||||
import com.navinfo.omqs.Constant.Companion.currentInstallTaskFolder
|
import com.navinfo.omqs.Constant.Companion.currentInstallTaskFolder
|
||||||
@ -26,19 +25,34 @@ import io.realm.Realm
|
|||||||
import io.realm.RealmConfiguration
|
import io.realm.RealmConfiguration
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.channels.awaitClose
|
||||||
import kotlinx.coroutines.flow.FlowCollector
|
import kotlinx.coroutines.channels.trySendBlocking
|
||||||
import kotlinx.coroutines.flow.channelFlow
|
import kotlinx.coroutines.flow.callbackFlow
|
||||||
import kotlinx.coroutines.flow.flow
|
import kotlinx.coroutines.flow.conflate
|
||||||
import kotlinx.coroutines.sync.Mutex
|
|
||||||
import org.spatialite.database.SQLiteDatabase
|
|
||||||
import sun.misc.BASE64Encoder
|
|
||||||
import java.io.BufferedReader
|
import java.io.BufferedReader
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileReader
|
import java.io.FileReader
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
|
//定义一个接口
|
||||||
|
sealed interface Event
|
||||||
|
class OnProgress(val value:Int):Event
|
||||||
|
class OnError(val t:Throwable):Event
|
||||||
|
class OnResult<T>(val value:T):Event
|
||||||
|
object OnComplete:Event
|
||||||
|
|
||||||
|
interface MultiPathsCallback<T>{
|
||||||
|
fun onProgress(value: Int)
|
||||||
|
|
||||||
|
fun onResult(value: T)
|
||||||
|
|
||||||
|
fun onError(t:Throwable)
|
||||||
|
|
||||||
|
fun onComplete()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入omdb数据的帮助类
|
* 导入omdb数据的帮助类
|
||||||
* */
|
* */
|
||||||
@ -150,8 +164,9 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
* @param configFile 对应的配置文件
|
* @param configFile 对应的配置文件
|
||||||
* */
|
* */
|
||||||
suspend fun importOmdbZipFile(
|
suspend fun importOmdbZipFile(
|
||||||
omdbZipFile: File, task: TaskBean, scope: CoroutineScope
|
omdbZipFile: File, task: TaskBean, scope: CoroutineScope,callback: MultiPathsCallback<String>
|
||||||
): Boolean {
|
) {
|
||||||
|
|
||||||
val channel = Channel<List<RenderEntity>>(Channel.RENDEZVOUS)
|
val channel = Channel<List<RenderEntity>>(Channel.RENDEZVOUS)
|
||||||
|
|
||||||
installTaskid = task.id.toString()
|
installTaskid = task.id.toString()
|
||||||
@ -193,9 +208,11 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
mutableMapOf<MutableMap.MutableEntry<String, TableInfo>, ImportConfig>()
|
mutableMapOf<MutableMap.MutableEntry<String, TableInfo>, ImportConfig>()
|
||||||
//协程池
|
//协程池
|
||||||
val listJob = mutableListOf<Job>()
|
val listJob = mutableListOf<Job>()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "数据安装", "开始安装数据")
|
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "数据安装", "开始安装数据")
|
||||||
Constant.INSTALL_DATA = true
|
Constant.INSTALL_DATA = true
|
||||||
|
|
||||||
for (importConfig in importConfigList) {
|
for (importConfig in importConfigList) {
|
||||||
for ((index, currentEntry) in importConfig.tableMap.entries.withIndex()) {
|
for ((index, currentEntry) in importConfig.tableMap.entries.withIndex()) {
|
||||||
if (currentEntry.value.isDependOnOtherTable) {
|
if (currentEntry.value.isDependOnOtherTable) {
|
||||||
@ -203,14 +220,64 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
val job = scope.launch(Dispatchers.IO) {
|
val job = scope.launch(Dispatchers.IO) {
|
||||||
importData(
|
startTaskAsFlow(
|
||||||
channel,
|
channel,
|
||||||
unZipFiles,
|
unZipFiles,
|
||||||
currentEntry,
|
currentEntry,
|
||||||
task,
|
task,
|
||||||
importConfig,
|
importConfig,
|
||||||
hashMap
|
hashMap,
|
||||||
)
|
true).collect{
|
||||||
|
when(it){
|
||||||
|
OnComplete->{
|
||||||
|
processIndex ++
|
||||||
|
callback.onResult("$processIndex|$tableNum")
|
||||||
|
Log.e("jingo", "安装==$processIndex===$tableNum")
|
||||||
|
if(tableNum-processIndex==listDependOnEntry.size){
|
||||||
|
for ((currentEntry, importConfig) in listDependOnEntry) {
|
||||||
|
processIndex++
|
||||||
|
if(processIndex==tableNum){
|
||||||
|
importData(
|
||||||
|
channel,
|
||||||
|
unZipFiles,
|
||||||
|
currentEntry,
|
||||||
|
task,
|
||||||
|
importConfig,
|
||||||
|
hashMap,
|
||||||
|
false, callback
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
callback.onResult("$processIndex|$tableNum")
|
||||||
|
importData(
|
||||||
|
channel,
|
||||||
|
unZipFiles,
|
||||||
|
currentEntry,
|
||||||
|
task,
|
||||||
|
importConfig,
|
||||||
|
hashMap,
|
||||||
|
false, null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.e("jingo", "安装结束")
|
||||||
|
|
||||||
|
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "数据安装", "安装结束")
|
||||||
|
|
||||||
|
Constant.INSTALL_DATA = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is OnProgress->{
|
||||||
|
callback.onProgress(it.value)
|
||||||
|
Log.e("qj","progress==${it.value}")
|
||||||
|
}
|
||||||
|
is OnResult<*>->{
|
||||||
|
callback.onResult(it.value.toString())
|
||||||
|
}
|
||||||
|
is OnError->{
|
||||||
|
callback.onError(it.t)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
listJob.add(job)
|
listJob.add(job)
|
||||||
}
|
}
|
||||||
@ -225,36 +292,49 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
realm.close()
|
realm.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listJob.joinAll()
|
listJob.joinAll()
|
||||||
channel.close()
|
channel.close()
|
||||||
channelJob.join()
|
channelJob.join()
|
||||||
Log.e("jingo", "channel close 等待结束")
|
|
||||||
for ((currentEntry, importConfig) in listDependOnEntry) {
|
|
||||||
importData(
|
|
||||||
channel,
|
|
||||||
unZipFiles,
|
|
||||||
currentEntry,
|
|
||||||
task,
|
|
||||||
importConfig,
|
|
||||||
hashMap,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Log.e("jingo", "安装结束")
|
|
||||||
|
|
||||||
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "数据安装", "安装结束")
|
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("jingo", "安装报错1 ${e.message}")
|
Log.e("jingo", "安装报错1 ${e.message}")
|
||||||
return false
|
|
||||||
}finally {
|
callback.onError(e)
|
||||||
|
|
||||||
Constant.INSTALL_DATA = false
|
Constant.INSTALL_DATA = false
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
private fun startTaskAsFlow(
|
||||||
|
f: Channel<List<RenderEntity>>,
|
||||||
|
unZipFiles: List<File>,
|
||||||
|
currentEntry: MutableMap.MutableEntry<String, TableInfo>,
|
||||||
|
task: TaskBean,
|
||||||
|
importConfig: ImportConfig,
|
||||||
|
hashMap: HashMap<Long, HadLinkDvoBean>,
|
||||||
|
isEmit: Boolean = true) = callbackFlow <Event>{
|
||||||
|
val cancellable= importData(f,unZipFiles,currentEntry,task,importConfig,hashMap,isEmit,object :MultiPathsCallback<String>{
|
||||||
|
override fun onProgress(value: Int) {
|
||||||
|
trySendBlocking(OnProgress(value))
|
||||||
|
Log.e("jingo","=====$value")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
trySendBlocking(OnError(t))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
trySendBlocking(OnComplete)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResult(value: String) {
|
||||||
|
trySendBlocking(OnResult(value))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
awaitClose {
|
||||||
|
|
||||||
|
}
|
||||||
|
}.conflate()
|
||||||
|
|
||||||
private suspend fun importData(
|
private suspend fun importData(
|
||||||
f: Channel<List<RenderEntity>>,
|
f: Channel<List<RenderEntity>>,
|
||||||
@ -263,15 +343,19 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
task: TaskBean,
|
task: TaskBean,
|
||||||
importConfig: ImportConfig,
|
importConfig: ImportConfig,
|
||||||
hashMap: HashMap<Long, HadLinkDvoBean>,
|
hashMap: HashMap<Long, HadLinkDvoBean>,
|
||||||
isEmit: Boolean = true
|
isEmit: Boolean = true, callback: MultiPathsCallback<String>?
|
||||||
) {
|
):NonCancellable {
|
||||||
val resHashMap: HashMap<String, RenderEntity> = HashMap() //define empty hashmap
|
val resHashMap: HashMap<String, RenderEntity> = HashMap() //define empty hashmap
|
||||||
var listRenderEntity = mutableListOf<RenderEntity>()
|
var listRenderEntity = mutableListOf<RenderEntity>()
|
||||||
//单个表要素统计
|
//单个表要素统计
|
||||||
var elementIndex = 0
|
var elementIndex = 0
|
||||||
val currentConfig = currentEntry.value
|
val currentConfig = currentEntry.value
|
||||||
|
|
||||||
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "importOmdbZipFile", "${currentConfig.table}开始")
|
CMLog.writeLogtoFile(
|
||||||
|
ImportOMDBHelper::class.java.name,
|
||||||
|
"importOmdbZipFile",
|
||||||
|
"${currentConfig.table}开始"
|
||||||
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var realm: Realm? = null
|
var realm: Realm? = null
|
||||||
@ -294,12 +378,18 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
newTime = System.currentTimeMillis()
|
newTime = System.currentTimeMillis()
|
||||||
Log.e(
|
|
||||||
"jingo",
|
if (elementIndex % 50 == 0) {
|
||||||
"安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size} ${newTime - time}"
|
Log.e(
|
||||||
)
|
"jingo",
|
||||||
|
"安装数据 ${currentConfig.table} $elementIndex ${listRenderEntity.size} ${newTime - time}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
time = newTime
|
time = newTime
|
||||||
|
|
||||||
elementIndex += 1
|
elementIndex += 1
|
||||||
|
|
||||||
val map = gson.fromJson<Map<String, Any>>(
|
val map = gson.fromJson<Map<String, Any>>(
|
||||||
line, object : TypeToken<Map<String, Any>>() {}.type
|
line, object : TypeToken<Map<String, Any>>() {}.type
|
||||||
).toMutableMap()
|
).toMutableMap()
|
||||||
@ -488,6 +578,8 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
|
|
||||||
// 对renderEntity做预处理后再保存
|
// 对renderEntity做预处理后再保存
|
||||||
val resultEntity = importConfig.transformProperties(renderEntity, realm)
|
val resultEntity = importConfig.transformProperties(renderEntity, realm)
|
||||||
|
|
||||||
|
//车道中心线不在主表写入
|
||||||
if (resultEntity != null) {
|
if (resultEntity != null) {
|
||||||
|
|
||||||
//对code编码需要特殊处理 存在多个属性值时,渲染优先级:SA>PA,存在多个属性值时,渲染优先级:FRONTAGE>MAIN_SIDE_A CCESS
|
//对code编码需要特殊处理 存在多个属性值时,渲染优先级:SA>PA,存在多个属性值时,渲染优先级:FRONTAGE>MAIN_SIDE_A CCESS
|
||||||
@ -534,6 +626,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
when (renderEntity.properties["bridgeType"]) {
|
when (renderEntity.properties["bridgeType"]) {
|
||||||
"1" -> renderEntity.code =
|
"1" -> renderEntity.code =
|
||||||
DataCodeEnum.OMDB_BRIDGE_1.code
|
DataCodeEnum.OMDB_BRIDGE_1.code
|
||||||
|
|
||||||
"2" -> renderEntity.code =
|
"2" -> renderEntity.code =
|
||||||
DataCodeEnum.OMDB_BRIDGE_2.code
|
DataCodeEnum.OMDB_BRIDGE_2.code
|
||||||
// "3" -> renderEntity.code = DataCodeEnum.OMDB_BRIDGE_3.code
|
// "3" -> renderEntity.code = DataCodeEnum.OMDB_BRIDGE_3.code
|
||||||
@ -677,6 +770,21 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
renderEntity.properties.remove("linkPid")
|
renderEntity.properties.remove("linkPid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//去掉暂用控件较大的字段多余属性字段
|
||||||
|
if (renderEntity.properties.containsKey("shapeList")) {
|
||||||
|
renderEntity.properties.remove("shapeList")
|
||||||
|
}
|
||||||
|
|
||||||
|
//只保留link表相关的pid
|
||||||
|
if (currentConfig.code != DataCodeEnum.OMDB_RD_LINK.code.toInt() && currentConfig.code != DataCodeEnum.OMDB_RD_LINK_KIND.code.toInt() && renderEntity.properties.containsKey(
|
||||||
|
"linkPid"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (renderEntity.properties.containsKey("mesh")) {
|
||||||
|
renderEntity.properties.remove("mesh")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
// 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用
|
||||||
if (currentConfig.code == DataCodeEnum.OMDB_RD_LINK.code.toInt()) {
|
if (currentConfig.code == DataCodeEnum.OMDB_RD_LINK.code.toInt()) {
|
||||||
if (renderEntity.linkRelation == null) {
|
if (renderEntity.linkRelation == null) {
|
||||||
@ -689,14 +797,11 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
renderEntity.properties["enodePid"]
|
renderEntity.properties["enodePid"]
|
||||||
}
|
}
|
||||||
|
|
||||||
//去掉暂用控件较大的字段多余属性字段
|
renderEntity.propertiesDb =
|
||||||
if (renderEntity.properties.containsKey("shapeList")) {
|
DeflaterUtil.zipString(JSON.toJSONString(renderEntity.properties))
|
||||||
renderEntity.properties.remove("shapeList")
|
|
||||||
}
|
|
||||||
|
|
||||||
renderEntity.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(renderEntity.properties))
|
|
||||||
|
|
||||||
listRenderEntity.add(renderEntity)
|
listRenderEntity.add(renderEntity)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listRenderEntity.size > 20000) {
|
if (listRenderEntity.size > 20000) {
|
||||||
@ -707,12 +812,14 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
if (isEmit) {
|
if (isEmit) {
|
||||||
f.send(listRenderEntity)
|
f.send(listRenderEntity)
|
||||||
delay(20)
|
delay(20)
|
||||||
|
callback?.onProgress(elementIndex)
|
||||||
} else {
|
} else {
|
||||||
realm!!.copyToRealm(listRenderEntity)
|
realm!!.copyToRealm(listRenderEntity)
|
||||||
realm!!.commitTransaction()
|
realm!!.commitTransaction()
|
||||||
realm!!.close()
|
realm!!.close()
|
||||||
realm = Realm.getInstance(currentInstallTaskConfig)
|
realm = Realm.getInstance(currentInstallTaskConfig)
|
||||||
realm.beginTransaction()
|
realm.beginTransaction()
|
||||||
|
callback?.onProgress(elementIndex)
|
||||||
}
|
}
|
||||||
listRenderEntity = mutableListOf()
|
listRenderEntity = mutableListOf()
|
||||||
//
|
//
|
||||||
@ -720,16 +827,21 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
line = bufferedReader.readLine()
|
line = bufferedReader.readLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
CMLog.writeLogtoFile(ImportOMDBHelper::class.java.name, "importOmdbZipFile", "${currentConfig.table}结束===总量$elementIndex")
|
CMLog.writeLogtoFile(
|
||||||
|
ImportOMDBHelper::class.java.name,
|
||||||
|
"importOmdbZipFile",
|
||||||
|
"${currentConfig.table}结束===总量$elementIndex"
|
||||||
|
)
|
||||||
|
|
||||||
if (isEmit) {
|
if (isEmit) {
|
||||||
f.send(listRenderEntity)
|
f.send(listRenderEntity)
|
||||||
delay(20)
|
delay(20)
|
||||||
|
callback?.onProgress(elementIndex)
|
||||||
} else {
|
} else {
|
||||||
bufferedReader.close()
|
bufferedReader.close()
|
||||||
realm!!.copyToRealm(listRenderEntity)
|
realm!!.copyToRealm(listRenderEntity)
|
||||||
realm!!.commitTransaction()
|
realm!!.commitTransaction()
|
||||||
|
callback?.onProgress(elementIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isEmit) {
|
if (!isEmit) {
|
||||||
@ -739,7 +851,12 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
Log.e("jingo", "安装报错 ${currentConfig.table} ${elementIndex} ${e.message}")
|
Log.e("jingo", "安装报错 ${currentConfig.table} ${elementIndex} ${e.message}")
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.e("jingo", "完成 ${currentConfig.table}")
|
Log.e("jingo", "完成 ${currentConfig.table}")
|
||||||
|
|
||||||
|
callback?.onComplete()
|
||||||
|
|
||||||
|
return NonCancellable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ class ImportPreProcess {
|
|||||||
// startEndReference.renderEntityId = renderEntity.id
|
// startEndReference.renderEntityId = renderEntity.id
|
||||||
startEndReference.name = "${renderEntity.name}参考线"
|
startEndReference.name = "${renderEntity.name}参考线"
|
||||||
startEndReference.table = renderEntity.table
|
startEndReference.table = renderEntity.table
|
||||||
|
startEndReference.code = renderEntity.code
|
||||||
startEndReference.zoomMin = renderEntity.zoomMin
|
startEndReference.zoomMin = renderEntity.zoomMin
|
||||||
startEndReference.zoomMax = renderEntity.zoomMax
|
startEndReference.zoomMax = renderEntity.zoomMax
|
||||||
startEndReference.taskId = renderEntity.taskId
|
startEndReference.taskId = renderEntity.taskId
|
||||||
@ -242,8 +243,9 @@ class ImportPreProcess {
|
|||||||
startEndReference.properties["type"] = "s_2_e"
|
startEndReference.properties["type"] = "s_2_e"
|
||||||
val listResult = mutableListOf<ReferenceEntity>()
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
startEndReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(startEndReference.properties))
|
startEndReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(startEndReference.properties))
|
||||||
listResult.add(startEndReference)
|
renderEntity.referenceEntitys?.add(startEndReference)
|
||||||
insertData(listResult)
|
//listResult.add(startEndReference)
|
||||||
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,9 +308,9 @@ class ImportPreProcess {
|
|||||||
endReference.properties["qi_table"] = renderEntity.table
|
endReference.properties["qi_table"] = renderEntity.table
|
||||||
endReference.properties["type"] = "e${if (renderEntity.properties["laneType"]!!.toInt() and (0b1000)>0) "_dec" else "_acc"}"
|
endReference.properties["type"] = "e${if (renderEntity.properties["laneType"]!!.toInt() and (0b1000)>0) "_dec" else "_acc"}"
|
||||||
endReference.properties["geometry"] = endReference.geometry
|
endReference.properties["geometry"] = endReference.geometry
|
||||||
|
renderEntity.referenceEntitys?.add(endReference)
|
||||||
listResult.add(endReference)
|
//listResult.add(endReference)
|
||||||
insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,9 +395,10 @@ class ImportPreProcess {
|
|||||||
}
|
}
|
||||||
endReference.properties["geometry"] = endReference.geometry
|
endReference.properties["geometry"] = endReference.geometry
|
||||||
endReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(endReference.properties))
|
endReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(endReference.properties))
|
||||||
listResult.add(endReference)
|
renderEntity.referenceEntitys?.add(endReference)
|
||||||
|
//listResult.add(endReference)
|
||||||
Log.e("qj", "generateS2EReferencePoint===4")
|
Log.e("qj", "generateS2EReferencePoint===4")
|
||||||
insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -481,6 +484,7 @@ class ImportPreProcess {
|
|||||||
// angleReference.renderEntityId = renderEntity.id
|
// angleReference.renderEntityId = renderEntity.id
|
||||||
angleReference.name = "${renderEntity.name}参考方向"
|
angleReference.name = "${renderEntity.name}参考方向"
|
||||||
angleReference.table = renderEntity.table
|
angleReference.table = renderEntity.table
|
||||||
|
angleReference.code = renderEntity.code
|
||||||
angleReference.zoomMin = renderEntity.zoomMin
|
angleReference.zoomMin = renderEntity.zoomMin
|
||||||
angleReference.zoomMax = renderEntity.zoomMax
|
angleReference.zoomMax = renderEntity.zoomMax
|
||||||
angleReference.taskId = renderEntity.taskId
|
angleReference.taskId = renderEntity.taskId
|
||||||
@ -491,9 +495,10 @@ class ImportPreProcess {
|
|||||||
angleReference.properties["qi_table"] = renderEntity.table
|
angleReference.properties["qi_table"] = renderEntity.table
|
||||||
angleReference.properties["type"] = "angle"
|
angleReference.properties["type"] = "angle"
|
||||||
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
|
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
|
||||||
listResult.add(angleReference)
|
renderEntity.referenceEntitys?.add(angleReference)
|
||||||
|
//listResult.add(angleReference)
|
||||||
}
|
}
|
||||||
insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
|
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
|
||||||
@ -648,9 +653,10 @@ class ImportPreProcess {
|
|||||||
"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())
|
||||||
referenceEntity.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(referenceEntity.properties))
|
referenceEntity.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(referenceEntity.properties))
|
||||||
listResult.add(referenceEntity)
|
renderEntity.referenceEntitys?.add(referenceEntity)
|
||||||
|
//listResult.add(referenceEntity)
|
||||||
}
|
}
|
||||||
insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -746,9 +752,10 @@ class ImportPreProcess {
|
|||||||
// angleReference.renderEntityId = renderEntity.id
|
// angleReference.renderEntityId = renderEntity.id
|
||||||
angleReference.name = "${renderEntity.name}车道中线面"
|
angleReference.name = "${renderEntity.name}车道中线面"
|
||||||
angleReference.table = renderEntity.table
|
angleReference.table = renderEntity.table
|
||||||
|
angleReference.code = renderEntity.code
|
||||||
Log.e("jingo", "几何转换开始")
|
Log.e("jingo", "几何转换开始")
|
||||||
angleReference.geometry = renderEntity.geometry
|
//angleReference.geometry = renderEntity.geometry
|
||||||
//GeometryTools.createGeometry(renderEntity.geometry).buffer(0.000035).toString()//GeometryTools.computeLine(0.000035,0.000035,renderEntity.geometry)
|
angleReference.geometry = GeometryTools.computeLine(0.000035,0.000035,renderEntity.geometry)
|
||||||
Log.e("jingo", "几何转换结束")
|
Log.e("jingo", "几何转换结束")
|
||||||
angleReference.properties["qi_table"] = renderEntity.table
|
angleReference.properties["qi_table"] = renderEntity.table
|
||||||
angleReference.properties["widthProperties"] = "3"
|
angleReference.properties["widthProperties"] = "3"
|
||||||
@ -758,8 +765,9 @@ class ImportPreProcess {
|
|||||||
angleReference.enable = renderEntity.enable
|
angleReference.enable = renderEntity.enable
|
||||||
val listResult = mutableListOf<ReferenceEntity>()
|
val listResult = mutableListOf<ReferenceEntity>()
|
||||||
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
|
angleReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(angleReference.properties))
|
||||||
listResult.add(angleReference)
|
renderEntity.referenceEntitys?.add(angleReference)
|
||||||
insertData(listResult)
|
//listResult.add(angleReference)
|
||||||
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -789,9 +797,10 @@ class ImportPreProcess {
|
|||||||
intersectionReference.properties["qi_table"] = renderEntity.table
|
intersectionReference.properties["qi_table"] = renderEntity.table
|
||||||
intersectionReference.properties["type"] = "node"
|
intersectionReference.properties["type"] = "node"
|
||||||
intersectionReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(intersectionReference.properties))
|
intersectionReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(intersectionReference.properties))
|
||||||
listResult.add(intersectionReference)
|
renderEntity.referenceEntitys?.add(intersectionReference)
|
||||||
|
//listResult.add(intersectionReference)
|
||||||
}
|
}
|
||||||
insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -946,6 +955,7 @@ class ImportPreProcess {
|
|||||||
// dynamicSrcReference.renderEntityId = renderEntity.id
|
// dynamicSrcReference.renderEntityId = renderEntity.id
|
||||||
dynamicSrcReference.name = "${renderEntity.name}动态icon"
|
dynamicSrcReference.name = "${renderEntity.name}动态icon"
|
||||||
dynamicSrcReference.table = renderEntity.table
|
dynamicSrcReference.table = renderEntity.table
|
||||||
|
dynamicSrcReference.code = renderEntity.code
|
||||||
dynamicSrcReference.zoomMin = renderEntity.zoomMin
|
dynamicSrcReference.zoomMin = renderEntity.zoomMin
|
||||||
dynamicSrcReference.zoomMax = renderEntity.zoomMax
|
dynamicSrcReference.zoomMax = renderEntity.zoomMax
|
||||||
dynamicSrcReference.taskId = renderEntity.taskId
|
dynamicSrcReference.taskId = renderEntity.taskId
|
||||||
@ -958,9 +968,10 @@ class ImportPreProcess {
|
|||||||
val code = renderEntity.properties[codeName]
|
val code = renderEntity.properties[codeName]
|
||||||
dynamicSrcReference.properties["src"] = "${prefix}${code}${suffix}"
|
dynamicSrcReference.properties["src"] = "${prefix}${code}${suffix}"
|
||||||
dynamicSrcReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(dynamicSrcReference.properties))
|
dynamicSrcReference.propertiesDb = DeflaterUtil.zipString(JSON.toJSONString(dynamicSrcReference.properties))
|
||||||
listResult.add(dynamicSrcReference)
|
renderEntity.referenceEntitys?.add(dynamicSrcReference)
|
||||||
|
//listResult.add(dynamicSrcReference)
|
||||||
}
|
}
|
||||||
insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun insertData(list: List<RealmModel>) {
|
private fun insertData(list: List<RealmModel>) {
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package com.navinfo.omqs.http.taskdownload
|
package com.navinfo.omqs.http.taskdownload
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Message
|
||||||
import android.util.Log
|
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 androidx.lifecycle.viewmodel.viewModelFactory
|
||||||
import com.blankj.utilcode.util.MapUtils
|
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.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.db.MultiPathsCallback
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
||||||
@ -155,20 +159,50 @@ class TaskDownloadScope(
|
|||||||
fileNew
|
fileNew
|
||||||
)
|
)
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
if (importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task, this)) {
|
importOMDBHelper.importOmdbZipFile(
|
||||||
// if (it == "finish") {
|
importOMDBHelper.omdbFile,
|
||||||
change(FileDownloadStatus.DONE)
|
task,
|
||||||
Log.e("jingo", "数据安装结束")
|
this,
|
||||||
withContext(Dispatchers.Main) {
|
object : MultiPathsCallback<String> {
|
||||||
//任务与当前一致,需要更新渲染图层
|
override fun onProgress(value: Int) {
|
||||||
if (MapParamUtils.getTaskId() == taskBean.id) {
|
Log.e("jingo", "安装====$value")
|
||||||
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
override fun onError(t: Throwable) {
|
||||||
change(FileDownloadStatus.IMPORTING, "anzhuang")
|
}
|
||||||
}
|
|
||||||
// }
|
override fun onComplete() {
|
||||||
|
taskBean.status = FileDownloadStatus.DONE
|
||||||
|
downloadData.postValue(taskBean)
|
||||||
|
//任务与当前一致,需要更新渲染图层
|
||||||
|
if (MapParamUtils.getTaskId() == taskBean.id) {
|
||||||
|
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
|
}
|
||||||
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
|
realm.executeTransaction { r ->
|
||||||
|
val newTask =
|
||||||
|
realm.where(TaskBean::class.java).equalTo("id", taskBean.id)
|
||||||
|
.findFirst()
|
||||||
|
newTask?.let {
|
||||||
|
it.syncStatus = taskBean.syncStatus
|
||||||
|
it.status = taskBean.status
|
||||||
|
it.errMsg = taskBean.errMsg
|
||||||
|
//赋值时间,用于查询过滤
|
||||||
|
it.operationTime = taskBean.operationTime
|
||||||
|
r.copyToRealmOrUpdate(it)
|
||||||
|
taskBean = realm.copyFromRealm(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
realm.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResult(value: String) {
|
||||||
|
taskBean.status = FileDownloadStatus.IMPORTING
|
||||||
|
taskBean.message = value
|
||||||
|
downloadData.postValue(taskBean)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("jingo", "数据安装失败 ${e.toString()}")
|
Log.e("jingo", "数据安装失败 ${e.toString()}")
|
||||||
|
@ -854,7 +854,7 @@ class MainViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
private suspend fun captureLink(point: GeoPoint) {
|
private suspend fun captureLink(point: GeoPoint) {
|
||||||
|
|
||||||
if (captureLinkState) {
|
if (captureLinkState||Constant.INSTALL_DATA) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import com.navinfo.omqs.bean.ScProblemTypeBean
|
|||||||
import com.navinfo.omqs.bean.ScRootCauseAnalysisBean
|
import com.navinfo.omqs.bean.ScRootCauseAnalysisBean
|
||||||
import com.navinfo.omqs.bean.ScWarningCodeBean
|
import com.navinfo.omqs.bean.ScWarningCodeBean
|
||||||
import com.navinfo.omqs.db.ImportOMDBHelper
|
import com.navinfo.omqs.db.ImportOMDBHelper
|
||||||
|
import com.navinfo.omqs.db.MultiPathsCallback
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.db.RoomAppDatabase
|
import com.navinfo.omqs.db.RoomAppDatabase
|
||||||
import com.navinfo.omqs.tools.MetadataUtils
|
import com.navinfo.omqs.tools.MetadataUtils
|
||||||
@ -152,11 +153,36 @@ class PersonalCenterViewModel @Inject constructor(
|
|||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
Log.d("OMQSApplication", "开始导入数据")
|
Log.d("OMQSApplication", "开始导入数据")
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task, this)
|
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task, this,object :MultiPathsCallback<String>{
|
||||||
|
override fun onProgress(value: Int) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResult(value: String) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
val newTask = TaskBean()
|
val newTask = TaskBean()
|
||||||
newTask.id = -1
|
newTask.id = -1
|
||||||
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, newTask, this)
|
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, newTask, this,object :MultiPathsCallback<String>{
|
||||||
|
override fun onProgress(value: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResult(value: String) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
Log.d("OMQSApplication", "导入数据完成")
|
Log.d("OMQSApplication", "导入数据完成")
|
||||||
|
@ -325,18 +325,19 @@ class TaskListAdapter(
|
|||||||
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.setText("安装中")
|
binding.taskDownloadBtn.setText("安装中")
|
||||||
|
Log.e("jingo", "更新进度条 ${taskBean.message}")
|
||||||
val split = taskBean.message.split("/")
|
val split = taskBean.message.split("/")
|
||||||
if (split.size == 2) {
|
if (split.size == 2) {
|
||||||
try {
|
try {
|
||||||
val index = split[0].toInt()
|
val index = split[0].toInt()
|
||||||
val count = split[1].toInt()
|
val count = split[1].toInt()
|
||||||
binding.taskProgressText.text =
|
Log.e("jingo", "更新进度条 $index====$count")
|
||||||
"${index * 100 / count}%"
|
binding.taskProgressText.text = "${index * 100 / count}%"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("jingo", "更新进度条 $e")
|
Log.e("jingo", "更新进度条 $e")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.taskProgressText.text = "0%"
|
binding.taskProgressText.text = taskBean.message
|
||||||
}
|
}
|
||||||
val errMsg = taskBean.errMsg
|
val errMsg = taskBean.errMsg
|
||||||
if (errMsg != null && errMsg.isNotEmpty()) {
|
if (errMsg != null && errMsg.isNotEmpty()) {
|
||||||
|
@ -108,6 +108,7 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
|||||||
@Index
|
@Index
|
||||||
var linkPid: String = "" // RenderEntity关联的linkPid集合(可能会关联多个)
|
var linkPid: String = "" // RenderEntity关联的linkPid集合(可能会关联多个)
|
||||||
var linkRelation: LinkRelation? = null
|
var linkRelation: LinkRelation? = null
|
||||||
|
var referenceEntitys: RealmSet<ReferenceEntity>? = RealmSet()//
|
||||||
|
|
||||||
constructor(name: String) : this() {
|
constructor(name: String) : this() {
|
||||||
this.name = name
|
this.name = name
|
||||||
|
@ -4,10 +4,13 @@ import static org.oscim.core.MercatorProjection.latitudeToY;
|
|||||||
import static org.oscim.core.MercatorProjection.longitudeToX;
|
import static org.oscim.core.MercatorProjection.longitudeToX;
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||||
|
import com.navinfo.collect.library.enums.DataCodeEnum;
|
||||||
|
import com.navinfo.collect.library.utils.GeometryTools;
|
||||||
|
|
||||||
import org.locationtech.jts.geom.Coordinate;
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
@ -103,7 +106,14 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
||||||
}
|
}
|
||||||
} else if (geometry instanceof LineString) {
|
} else if (geometry instanceof LineString) {
|
||||||
processLineString((LineString) geometry);
|
//将车道中心进行转化面渲染
|
||||||
|
if(layerName!=null&&layerName.equals(DataCodeEnum.OMDB_LANE_LINK_LG.name())){
|
||||||
|
Log.e("qj","车道中心线转化开始");
|
||||||
|
processPolygon((Polygon) GeometryTools.createGeometry(GeometryTools.computeLine(0.000035,0.000035,geometry.toString())));
|
||||||
|
Log.e("qj","车道中心线转化结束");
|
||||||
|
}else{
|
||||||
|
processLineString((LineString) geometry);
|
||||||
|
}
|
||||||
} else if (geometry instanceof MultiLineString) {
|
} else if (geometry instanceof MultiLineString) {
|
||||||
MultiLineString multiLineString = (MultiLineString) geometry;
|
MultiLineString multiLineString = (MultiLineString) geometry;
|
||||||
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
||||||
|
@ -71,25 +71,35 @@ public class DeflaterUtil{
|
|||||||
|
|
||||||
deflater.finish();
|
deflater.finish();
|
||||||
|
|
||||||
final byte[] bytes = new byte[256];
|
final byte[] bytes = new byte[512];
|
||||||
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
|
||||||
|
|
||||||
while (!deflater.finished()) {
|
try {
|
||||||
|
|
||||||
//压缩输入数据并用压缩数据填充指定的缓冲区。
|
while (!deflater.finished()) {
|
||||||
|
|
||||||
int length = deflater.deflate(bytes);
|
//压缩输入数据并用压缩数据填充指定的缓冲区。
|
||||||
|
|
||||||
outputStream.write(bytes, 0, length);
|
int length = deflater.deflate(bytes);
|
||||||
|
|
||||||
|
outputStream.write(bytes, 0, length);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
deflater.end();
|
||||||
|
|
||||||
|
return Base64.encodeBase64String(outputStream.toByteArray());
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
return null;
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deflater.end();
|
|
||||||
|
|
||||||
return Base64.encodeBase64String(outputStream.toByteArray());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,9 +118,9 @@ public class DeflaterUtil{
|
|||||||
|
|
||||||
inflater.setInput(decode);
|
inflater.setInput(decode);
|
||||||
|
|
||||||
final byte[] bytes = new byte[256];
|
final byte[] bytes = new byte[512];
|
||||||
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -150,6 +160,12 @@ public class DeflaterUtil{
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user