1.增加要素聚合显示数字业务2.调整部分渲染样式

This commit is contained in:
qiji4215
2023-11-15 16:37:44 +08:00
parent b123fa543f
commit 2c571bf9ce
42 changed files with 1055 additions and 381 deletions

View File

@@ -813,6 +813,21 @@ class ImportPreProcess {
}
}
/**
* 几何方向排序
* */
fun sortGeometry(renderEntity: RenderEntity) {
// 路口数据的其他点位是保存在nodeList对应的数组下
/* if (renderEntity.properties.containsKey("linkPid")) {
val linkList = renderEntity.properties["linkPid"]?.split(",")
//几何较少时需要判断是否要计算判断长短边
if(linkList!=null&&linkList.size<3){
}
}*/
}
/**
* 生成默认路口数据的参考数据
* */

View File

@@ -8,16 +8,8 @@ import android.widget.Toast
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.blankj.utilcode.util.FileIOUtils
import com.blankj.utilcode.util.ResourceUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.navinfo.collect.library.data.entity.LinkRelation
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.omqs.Constant
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.bean.SysUserBean
@@ -94,10 +86,8 @@ class LoginViewModel @Inject constructor(
var sharedPreferences: SharedPreferences? = null
var dataIndex = 0
init {
loginUser.value = LoginUserBean(userCode = "haofuyue00213", passWord = "123456")
loginUser.value = LoginUserBean(userCode = "lixiaoming00427", passWord = "123456")
}
@@ -270,130 +260,97 @@ class LoginViewModel @Inject constructor(
* 获取任务列表
*/
private suspend fun getTaskList(context: Context) {
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_GET_TASK_LIST)
when (val result = networkService.getTaskList(Constant.USER_ID)) {
is NetResult.Success -> {
if (result.data != null) {
val realm = Realm.getDefaultInstance()
realm.executeTransaction {
result.data.obj?.let { list ->
for (index in list.indices) {
var inSertData = true
val task = list[index]
val item = realm.where(TaskBean::class.java).equalTo(
"id", task.id
).findFirst()
if (item != null) {
task.fileSize = item.fileSize
task.status = item.status
task.currentSize = item.currentSize
//增加mesh==null兼容性处理
for (hadLink in item.hadLinkDvoList) {
if(hadLink.mesh==null){
hadLink.mesh = ""
//每天主动请求一次,其他情况列表内自己手动请求
val questToday = sharedPreferences?.getBoolean(DateTimeUtil.getYYYYMMDDDate()+"getTaskList",false)
if(!questToday!!){
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_GET_TASK_LIST)
Log.e("qj","获取任务请求开始==")
when (val result = networkService.getTaskList(Constant.USER_ID)) {
is NetResult.Success -> {
if (result.data != null) {
Log.e("qj","获取任务返回成功==")
val realm = Realm.getDefaultInstance()
realm.executeTransaction {
result.data.obj?.let { list ->
for (index in list.indices) {
var inSertData = true
val task = list[index]
val item = realm.where(TaskBean::class.java).equalTo(
"id", task.id
).findFirst()
if (item != null) {
task.fileSize = item.fileSize
task.status = item.status
task.currentSize = item.currentSize
//增加mesh==null兼容性处理
for (hadLink in item.hadLinkDvoList) {
if(hadLink.mesh==null){
hadLink.mesh = ""
}
}
task.hadLinkDvoList = item.hadLinkDvoList
task.syncStatus = item.syncStatus
//已上传后不在更新操作时间
if (task.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
//赋值时间,用于查询过滤
task.operationTime = DateTimeUtil.getNowDate().time
}else{
continue
}
} else {
for (hadLink in task.hadLinkDvoList) {
if(hadLink.geometry==null){
inSertData = false
}else if(hadLink.mesh==null){
hadLink.mesh = ""
}else{
hadLink.taskId = task.id
}
Log.e("qj","mesh==${hadLink.mesh}")
}
}
task.hadLinkDvoList = item.hadLinkDvoList
task.syncStatus = item.syncStatus
//已上传后不在更新操作时间
if (task.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
//赋值时间,用于查询过滤
task.operationTime = DateTimeUtil.getNowDate().time
}else{
continue
}
} else {
for (hadLink in task.hadLinkDvoList) {
if(hadLink.geometry==null){
inSertData = false
}else if(hadLink.mesh==null){
hadLink.mesh = ""
}else{
hadLink.taskId = task.id
}
Log.e("qj","mesh==${hadLink.mesh}")
Log.e("qj","task==${task.id}")
if(inSertData){
realm.copyToRealmOrUpdate(task)
}
//赋值时间,用于查询过滤
task.operationTime = DateTimeUtil.getNowDate().time
}
Log.e("qj","task==${task.id}")
if(inSertData){
realm.copyToRealmOrUpdate(task)
}
}
}
}
realm.close()
}
//测试代码
/* viewModelScope.launch(Dispatchers.IO) {
val userTaskFolder = File(Constant.USER_DATA_PATH + "/4")
if (!userTaskFolder.exists()) userTaskFolder.mkdirs()
val password = "encryp".encodeToByteArray().copyInto(ByteArray(64))
val config = RealmConfiguration.Builder()
.directory(userTaskFolder)
.name("OMQS.realm")
.encryptionKey(password)
.allowQueriesOnUiThread(true)
.schemaVersion(2)
.build()
var realm = Realm.getInstance(config)
var time = System.currentTimeMillis()
Log.e("qj", "test===开始安装")
Realm.compactRealm(config)
realm.beginTransaction()
val txtFile = File(Constant.USER_DATA_PATH + "/OMDB_LANE_MARK_BOUNDARYTYPE")
// 将list数据转换为map
var gson = Gson();
val type = object : TypeToken<RenderEntity>() {}.type
val list = FileIOUtils.readFile2List(txtFile, "UTF-8")
val count = 12
if (list != null) {
for (i in 0 until count) {
for ((index, line) in list.withIndex()) {
if (line == null || line.trim() == "") {
continue
}
val renderEntity = gson.fromJson<RenderEntity>(line, type)
realm.insert(renderEntity)
}
}
Log.e("qj", "test===总数===${list.size*count}")
realm.close()
//增加当天请求过标识
sharedPreferences?.edit()
?.putBoolean(DateTimeUtil.getYYYYMMDDDate()+"getTaskList",true)
Log.e("qj","获取任务结束==")
}
Log.e("qj", "test===提交===${System.currentTimeMillis() - time}")
realm.commitTransaction()
Log.e("qj", "test===提交===${System.currentTimeMillis() - time}")
realm.close()
Log.e("qj", "test===结束===${System.currentTimeMillis() - time}")
}*/
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
is NetResult.Error<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
.show()
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
is NetResult.Failure<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
.show()
is NetResult.Error<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
.show()
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
is NetResult.Loading -> {}
is NetResult.Failure<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
.show()
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
is NetResult.Loading -> {}
}
}else{
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
}
}

View File

@@ -819,12 +819,22 @@ class MainActivity : BaseActivity() {
* zoomOut
*/
fun zoomOutOnclick(view: View) {
val result = mutableListOf<RenderEntity>()
/* val result = mutableListOf<RenderEntity>()
for (i in 0 until 10) {
var renderEntity: RenderEntity = RenderEntity()
renderEntity.code = "3005"
renderEntity.geometry = "POINT(116.2694${i}13016946 40.0844${i}5791644373 0)"
result.add(renderEntity)
}
var renderEntity: RenderEntity = RenderEntity()
renderEntity.code = "3006"
renderEntity.geometry = "POINT(116.269413016946 40.08445791644373 0)"
result.add(renderEntity)
var renderEntity1: RenderEntity = RenderEntity()
renderEntity1.code = "3007"
renderEntity1.geometry = "POINT(116.269413016946 40.08445791644373 0)"
result.add(renderEntity1)
//计算后
var index = 0
Log.e("qj","====计算开始")
@@ -836,7 +846,7 @@ class MainActivity : BaseActivity() {
}
}
lastRender = it
}
}*/
Log.e("qj","====计算结束")
mapController.animationHandler.zoomOut()
}

View File

@@ -719,9 +719,9 @@ class MainViewModel @Inject constructor(
*/
private suspend fun captureItem(point: GeoPoint) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
var buffer = 8.0
var buffer = 10.0
if (mapController.mMapView.mapLevel >= 18) {
buffer = 2.0
buffer = 2.2
}
val itemList = realmOperateHelper.queryElement(
GeometryTools.createPoint(

View File

@@ -64,7 +64,7 @@
<item
android:id="@+id/personal_center_menu_version"
android:icon="@drawable/ic_baseline_layers_24"
android:title="版本23QE4_V1.5.8_20231103_A" />
android:title="版本24QE1_V1.1.1_20231115_A" />
</group>
<group android:checkableBehavior="single">
<item android:title="小标题">