Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS

This commit is contained in:
xiaoyan 2023-06-02 10:06:30 +08:00
commit c237ccb928
20 changed files with 590 additions and 286 deletions

View File

@ -37,52 +37,49 @@ class RealmOperateHelper() {
sort: Boolean = true sort: Boolean = true
): MutableList<RenderEntity> { ): MutableList<RenderEntity> {
val result = mutableListOf<RenderEntity>() val result = mutableListOf<RenderEntity>()
withContext(Dispatchers.IO) { val polygon = getPolygonFromPoint(
val polygon = getPolygonFromPoint( GeometryTools.createPoint(point.longitude, point.latitude),
GeometryTools.createPoint(point.longitude, point.latitude), buffer,
buffer, bufferType
bufferType )
) // 根据polygon查询相交的tile号
// 根据polygon查询相交的tile号 val tileXSet = mutableSetOf<Int>()
val tileXSet = mutableSetOf<Int>() tileXSet.toString()
tileXSet.toString() GeometryToolsKt.getTileXByGeometry(polygon.toString(), tileXSet)
GeometryToolsKt.getTileXByGeometry(polygon.toString(), tileXSet) val tileYSet = mutableSetOf<Int>()
val tileYSet = mutableSetOf<Int>() GeometryToolsKt.getTileYByGeometry(polygon.toString(), tileYSet)
GeometryToolsKt.getTileYByGeometry(polygon.toString(), tileYSet)
// 对tileXSet和tileYSet查询最大最小值 // 对tileXSet和tileYSet查询最大最小值
val xStart = tileXSet.stream().min(Comparator.naturalOrder()).orElse(null) val xStart = tileXSet.stream().min(Comparator.naturalOrder()).orElse(null)
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)
// 查询realm中对应tile号的数据 // 查询realm中对应tile号的数据
val realm = Realm.getDefaultInstance() val realm = Realm.getDefaultInstance()
val realmList = realm.where(RenderEntity::class.java) val realmList = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK") .equalTo("table", "OMDB_RD_LINK")
.and() .and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd") .rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.findAll() .findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据 // 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList) val dataList = realm.copyFromRealm(realmList)
val queryResult = dataList?.stream()?.filter { val queryResult = dataList?.stream()?.filter {
polygon.intersects(it.wkt) polygon.intersects(it.wkt)
}?.toList() }?.toList()
queryResult?.let { queryResult?.let {
if (sort) { if (sort) {
result.addAll( result.addAll(
sortRenderEntity( sortRenderEntity(
GeometryTools.createPoint( GeometryTools.createPoint(
point.longitude, point.longitude,
point.latitude point.latitude
) , it ), it
)
) )
} else { )
result.addAll(it) } else {
} result.addAll(it)
} }
} }
return result return result
} }
@ -163,15 +160,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>()
withContext(Dispatchers.IO) { val realm = Realm.getDefaultInstance()
val realm = Realm.getDefaultInstance() val realmList = realm.where(RenderEntity::class.java)
val realmList = realm.where(RenderEntity::class.java) .notEqualTo("table", "OMDB_RD_LINK")
.notEqualTo("table", "OMDB_RD_LINK") .and()
.and() .equalTo("properties['${LinkTable.linkPid}']", linkPid)
.equalTo("properties['${LinkTable.linkPid}']", linkPid) .findAll()
.findAll() result.addAll(realm.copyFromRealm(realmList))
result.addAll(realm.copyFromRealm(realmList))
}
return result return result
} }

View File

@ -44,7 +44,7 @@ class TaskDownloadScope(
//改进的代码 //改进的代码
fun start() { fun start() {
launch{ launch {
change(FileDownloadStatus.WAITING) change(FileDownloadStatus.WAITING)
} }
downloadManager.launchScope(this@TaskDownloadScope) downloadManager.launchScope(this@TaskDownloadScope)
@ -56,7 +56,7 @@ class TaskDownloadScope(
*/ */
fun pause() { fun pause() {
downloadJob?.cancel("pause") downloadJob?.cancel("pause")
launch{ launch {
change(FileDownloadStatus.PAUSE) change(FileDownloadStatus.PAUSE)
} }
@ -141,7 +141,7 @@ class TaskDownloadScope(
} catch (e: Exception) { } catch (e: Exception) {
Log.e("jingo", "数据安装失败 ${e.toString()}") Log.e("jingo", "数据安装失败 ${e.toString()}")
change(FileDownloadStatus.ERROR) change(FileDownloadStatus.ERROR)
}finally { } finally {
} }
@ -167,8 +167,12 @@ class TaskDownloadScope(
val fileTemp = val fileTemp =
File("${Constant.DOWNLOAD_PATH}${taskBean.evaluationTaskName}_${taskBean.dataVersion}.zip") File("${Constant.DOWNLOAD_PATH}${taskBean.evaluationTaskName}_${taskBean.dataVersion}.zip")
val startPosition = taskBean.currentSize var startPosition = taskBean.currentSize
if (fileTemp.length() > taskBean.fileSize && taskBean.fileSize > 0) {
fileTemp.delete()
fileTemp.createNewFile()
startPosition = 0
}
if (fileTemp.length() > 0 && taskBean.fileSize > 0 && fileTemp.length() == taskBean.fileSize) { if (fileTemp.length() > 0 && taskBean.fileSize > 0 && fileTemp.length() == taskBean.fileSize) {
importData(fileTemp) importData(fileTemp)
return return

View File

@ -1,9 +1,7 @@
package com.navinfo.omqs.ui.activity package com.navinfo.omqs.ui.activity
import android.app.Dialog
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.os.Bundle import android.os.Bundle
import android.os.PersistableBundle
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.R import com.google.android.material.R

View File

@ -23,6 +23,7 @@ import androidx.navigation.findNavController
import com.blankj.utilcode.util.ToastUtils import com.blankj.utilcode.util.ToastUtils
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.RenderEntity import com.navinfo.collect.library.data.entity.RenderEntity
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.handler.OnQsRecordItemClickListener import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
import com.navinfo.collect.library.utils.GeometryTools import com.navinfo.collect.library.utils.GeometryTools
@ -31,7 +32,6 @@ 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.ImportConfig
import com.navinfo.omqs.bean.SignBean import com.navinfo.omqs.bean.SignBean
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.omqs.db.RealmOperateHelper import com.navinfo.omqs.db.RealmOperateHelper
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
@ -115,7 +115,7 @@ class MainViewModel @Inject constructor(
}) })
initLocation() initLocation()
//处理地图点击操作 //处理地图点击操作
viewModelScope.launch { viewModelScope.launch(Dispatchers.Default) {
mapController.onMapClickFlow.collectLatest { mapController.onMapClickFlow.collectLatest {
// testPoint = it // testPoint = it
//线选择状态 //线选择状态
@ -146,9 +146,9 @@ class MainViewModel @Inject constructor(
} }
mapController.lineHandler.omdbTaskLinkLayer.removeAll() mapController.lineHandler.omdbTaskLinkLayer.removeAll()
for (item in list) { for (item in list) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color)) // mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
} // }
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList) mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
} }
} }
@ -213,10 +213,11 @@ class MainViewModel @Inject constructor(
//看板数据 //看板数据
val signList = mutableListOf<SignBean>() val signList = mutableListOf<SignBean>()
val topSignList = mutableListOf<SignBean>() val topSignList = mutableListOf<SignBean>()
mapController.lineHandler.linksLayer.clear()
if (linkList.isNotEmpty()) { if (linkList.isNotEmpty()) {
val link = linkList[0] val link = linkList[0]
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid] val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
mapController.lineHandler.showLine(link.geometry) mapController.lineHandler.showLine(link.geometry)
linkId?.let { linkId?.let {
var elementList = realmOperateHelper.queryLinkByLinkPid(it) var elementList = realmOperateHelper.queryLinkByLinkPid(it)
@ -244,19 +245,37 @@ class MainViewModel @Inject constructor(
4002, 4003, 4004, 4022 -> signList.add( 4002, 4003, 4004, 4022 -> signList.add(
signBean signBean
) )
4006 -> {
mapController.lineHandler.linksLayer.clear()
val inLink = element.properties["linkIn"]
val outLink = element.properties["linkOut"]
if (inLink != null){
}
}
} }
} }
val realm = Realm.getDefaultInstance()
val entity = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RESTRICTION")
.and()
.equalTo(
"properties['linkIn']",
it
).findFirst()
if (entity != null) {
val outLink = entity.properties["linkOut"]
val linkOutEntity = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK")
.and()
.equalTo(
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
outLink
).findFirst()
if (linkOutEntity != null) {
mapController.lineHandler.linksLayer.addLine(
linkOutEntity.geometry,
0x7DFF0000
)
Log.e("jingo", "捕捉到的linkid $outLink ${linkOutEntity.geometry}")
}
}
} }
} }
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode }) liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
liveDataSignList.postValue(signList.distinctBy { it.elementCode }) liveDataSignList.postValue(signList.distinctBy { it.elementCode })

View File

@ -75,22 +75,6 @@ class ProblemLinkFragment : BaseFragment() {
} }
}) })
// //中间菜单
// binding.linkMiddleRecyclerview.setHasFixedSize(true)
// binding.linkMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
// binding.linkMiddleRecyclerview.adapter = middleAdapter
//中间侧菜单查询结果监听
// viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
// middleAdapter.refreshData(it)
// }
binding.linkDrawer.setOnClickListener {
when (binding.group.visibility) {
View.INVISIBLE, View.GONE ->
binding.group.visibility = View.VISIBLE
else ->
binding.group.visibility = View.GONE
}
}
viewModel.getProblemLinkList() viewModel.getProblemLinkList()
} }

View File

@ -3,6 +3,8 @@ package com.navinfo.omqs.ui.fragment.tasklist
import android.app.AlertDialog import android.app.AlertDialog
import android.content.DialogInterface import android.content.DialogInterface
import android.os.Bundle import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -64,12 +66,26 @@ class TaskFragment : BaseFragment() {
binding.taskRecyclerview.setHasFixedSize(true) binding.taskRecyclerview.setHasFixedSize(true)
binding.taskRecyclerview.layoutManager = layoutManager binding.taskRecyclerview.layoutManager = layoutManager
binding.taskRecyclerview.adapter = adapter binding.taskRecyclerview.adapter = adapter
binding.taskSearchClear.setOnClickListener {
binding.taskSearch.setText("")
}
viewModel.liveDataTaskLinks.observe(viewLifecycleOwner) { viewModel.liveDataTaskLinks.observe(viewLifecycleOwner) {
adapter.resetSelect() adapter.resetSelect()
adapter.refreshData(it) adapter.refreshData(it)
} }
viewModel.getTaskList(requireContext()) viewModel.getTaskList(requireContext())
binding.taskSearch.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
viewModel.filterTask(s.toString())
}
})
} }
override fun onDestroyView() { override fun onDestroyView() {

View File

@ -1,5 +1,6 @@
package com.navinfo.omqs.ui.fragment.tasklist package com.navinfo.omqs.ui.fragment.tasklist
import android.graphics.Color
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -85,6 +86,27 @@ class TaskListAdapter(
downloadManager.observer(taskBean.id, holder, DownloadObserver(taskBean.id, holder)) downloadManager.observer(taskBean.id, holder, DownloadObserver(taskBean.id, holder))
uploadManager.addTask(taskBean) uploadManager.addTask(taskBean)
uploadManager.observer(taskBean.id, holder, UploadObserver(taskBean.id, binding)) uploadManager.observer(taskBean.id, holder, UploadObserver(taskBean.id, binding))
if (taskBean.status == FileDownloadStatus.NONE) {
binding.taskDownloadBtn.setBackgroundColor(Color.WHITE)
binding.taskDownloadBtn.setTextColor(Color.parseColor("#888FB3"))
} else {
binding.taskDownloadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
binding.taskDownloadBtn.setTextColor(Color.WHITE)
}
if (taskBean.status == FileDownloadStatus.DONE) {
binding.taskDownloadBtn.visibility = View.INVISIBLE
binding.taskUploadBtn.visibility = View.VISIBLE
} else {
binding.taskDownloadBtn.visibility = View.VISIBLE
binding.taskUploadBtn.visibility = View.INVISIBLE
}
if (taskBean.syncStatus == FileUploadStatus.DONE) {
binding.taskUploadBtn.setProgress(0)
binding.taskUploadBtn.setBackgroundColor(binding.root.resources.getColor(R.color.ripple_end_color))
} else {
binding.taskUploadBtn.setProgress(100)
binding.taskUploadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
}
binding.taskDownloadBtn.tag = position binding.taskDownloadBtn.tag = position
binding.taskDownloadBtn.setOnClickListener(downloadBtnClick) binding.taskDownloadBtn.setOnClickListener(downloadBtnClick)
binding.taskUploadBtn.tag = position binding.taskUploadBtn.tag = position
@ -92,7 +114,6 @@ class TaskListAdapter(
binding.taskName.text = taskBean.evaluationTaskName binding.taskName.text = taskBean.evaluationTaskName
binding.taskCityName.text = taskBean.cityName binding.taskCityName.text = taskBean.cityName
binding.taskDataVersion.text = "版本号:${taskBean.dataVersion}" binding.taskDataVersion.text = "版本号:${taskBean.dataVersion}"
binding.taskColor.setTextColor(taskBean.color)
binding.root.isSelected = selectPosition == position binding.root.isSelected = selectPosition == position
binding.root.setOnClickListener { binding.root.setOnClickListener {
val pos = holder.adapterPosition val pos = holder.adapterPosition
@ -133,87 +154,108 @@ class TaskListAdapter(
private fun changeUploadTxtViews(binding: AdapterTaskListBinding, taskBean: TaskBean) { private fun changeUploadTxtViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
when (taskBean.syncStatus) { when (taskBean.syncStatus) {
FileUploadStatus.DONE -> { FileUploadStatus.DONE -> {
binding.taskUploadBtn.text = "已上传" binding.taskUploadBtn.stopAnimator()
binding.taskUploadBtn.setText("已上传")
binding.taskUploadBtn.setProgress(0)
binding.taskUploadBtn.setBackgroundColor(binding.root.resources.getColor(R.color.ripple_end_color))
} }
FileUploadStatus.ERROR -> { FileUploadStatus.ERROR -> {
binding.taskUploadBtn.text = "重新同步" binding.taskUploadBtn.stopAnimator()
binding.taskUploadBtn.setText("重新同步")
binding.taskUploadBtn.setProgress(100)
} }
FileUploadStatus.NONE -> { FileUploadStatus.NONE -> {
binding.taskUploadBtn.text = "同步" binding.taskUploadBtn.setText("未上传")
binding.taskUploadBtn.setProgress(0)
} }
FileUploadStatus.WAITING -> { FileUploadStatus.WAITING -> {
binding.taskUploadBtn.text = "等待同步" binding.taskUploadBtn.setText("等待同步")
binding.taskUploadBtn.setProgress(100)
} }
FileUploadStatus.UPLOADING -> { FileUploadStatus.UPLOADING -> {
binding.taskUploadBtn.text = "同步中" binding.taskUploadBtn.setText("上传中")
binding.taskUploadBtn.setProgress(100)
binding.taskUploadBtn.startAnimator()
} }
} }
} }
private fun changeViews(binding: AdapterTaskListBinding, taskBean: TaskBean) { private fun changeViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
if (taskBean.status == FileDownloadStatus.NONE) {
binding.taskDownloadBtn.setBackgroundColor(Color.WHITE)
binding.taskDownloadBtn.setTextColor(Color.parseColor("#888FB3"))
} else {
binding.taskDownloadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
binding.taskDownloadBtn.setTextColor(Color.WHITE)
}
if (taskBean.fileSize > 0L) { if (taskBean.fileSize > 0L) {
binding.taskProgress.progress = val progress = (taskBean.currentSize * 100 / taskBean.fileSize).toInt()
(taskBean.currentSize * 100 / taskBean.fileSize).toInt() binding.taskProgressText.text =
"$progress%"
binding.taskDownloadBtn.setProgress(progress)
} }
when (taskBean.status) { when (taskBean.status) {
FileDownloadStatus.NONE -> { FileDownloadStatus.NONE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE View.INVISIBLE
binding.taskDownloadBtn.text = "下载" binding.taskDownloadBtn.setText("下载")
} }
FileDownloadStatus.WAITING -> { FileDownloadStatus.WAITING -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE View.VISIBLE
binding.taskDownloadBtn.text = "等待中" binding.taskDownloadBtn.setText("等待中")
} }
FileDownloadStatus.LOADING -> { FileDownloadStatus.LOADING -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE View.VISIBLE
binding.taskDownloadBtn.text = "暂停" binding.taskDownloadBtn.setText("暂停")
} }
FileDownloadStatus.PAUSE -> { FileDownloadStatus.PAUSE -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE View.VISIBLE
binding.taskDownloadBtn.text = "继续" binding.taskDownloadBtn.setText("继续")
} }
FileDownloadStatus.ERROR -> { FileDownloadStatus.ERROR -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE View.VISIBLE
binding.taskDownloadBtn.text = "重试" binding.taskDownloadBtn.setText("重试")
} }
FileDownloadStatus.DONE -> { FileDownloadStatus.DONE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE View.INVISIBLE
binding.taskDownloadBtn.text = "已完成" binding.taskDownloadBtn.setText("已完成")
binding.taskDownloadBtn.visibility = View.INVISIBLE
binding.taskUploadBtn.visibility = View.VISIBLE
} }
FileDownloadStatus.UPDATE -> { FileDownloadStatus.UPDATE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE View.INVISIBLE
binding.taskDownloadBtn.text = "更新" binding.taskDownloadBtn.setText("更新")
} }
FileDownloadStatus.IMPORTING -> { FileDownloadStatus.IMPORTING -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE View.VISIBLE
binding.taskDownloadBtn.text = "安装中" binding.taskDownloadBtn.setText("安装中")
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.taskProgress.progress = binding.taskProgressText.text =
index * 100 / count "${index * 100 / count}%"
} catch (e: Exception) { } catch (e: Exception) {
Log.e("jingo", "更新进度条 $e") Log.e("jingo", "更新进度条 $e")
} }
} else { } else {
binding.taskProgress.progress = 0 binding.taskProgressText.text = "0%"
} }
} }
FileDownloadStatus.IMPORT -> { FileDownloadStatus.IMPORT -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE View.INVISIBLE
binding.taskDownloadBtn.text = "安装" binding.taskDownloadBtn.setText("安装")
} }
} }
} }

View File

@ -1,6 +1,8 @@
package com.navinfo.omqs.ui.fragment.tasklist package com.navinfo.omqs.ui.fragment.tasklist
import android.os.Bundle import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -60,6 +62,17 @@ class TaskListFragment : BaseFragment() {
adapter.refreshData(it) adapter.refreshData(it)
} }
binding.taskListSearch.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
viewModel.filterTaskList(s.toString())
}
})
} }
override fun onDestroyView() { override fun onDestroyView() {

View File

@ -17,17 +17,13 @@ import com.navinfo.omqs.http.NetworkService
import com.navinfo.omqs.tools.FileManager import com.navinfo.omqs.tools.FileManager
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm import io.realm.Realm
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.*
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
class TaskViewModel @Inject constructor( class TaskViewModel @Inject constructor(
private val networkService: NetworkService, private val networkService: NetworkService, private val mapController: NIMapController
private val mapController: NIMapController
) : ViewModel() { ) : ViewModel() {
/** /**
@ -47,6 +43,12 @@ class TaskViewModel @Inject constructor(
*/ */
private var currentSelectTaskBean: TaskBean? = null private var currentSelectTaskBean: TaskBean? = null
/**
* 任务列表查询协程
*/
private var filterTaskListJob: Job? = null
private var filterTaskJob: Job? = null
/** /**
* 下载任务列表 * 下载任务列表
@ -70,20 +72,21 @@ class TaskViewModel @Inject constructor(
task.fileSize = item.fileSize task.fileSize = item.fileSize
task.status = item.status task.status = item.status
task.currentSize = item.currentSize task.currentSize = item.currentSize
task.color = item.color // task.color = item.color
} else {
if (index < 6)
task.color = colors[index]
else {
val random = Random()
task.color = Color.argb(
255,
random.nextInt(256),
random.nextInt(256),
random.nextInt(256)
)
}
} }
// else {
// if (index < 6)
// task.color = colors[index]
// else {
// val random = Random()
// task.color = Color.argb(
// 255,
// random.nextInt(256),
// random.nextInt(256),
// random.nextInt(256)
// )
// }
// }
realm.copyToRealmOrUpdate(task) realm.copyToRealmOrUpdate(task)
} }
} }
@ -162,10 +165,7 @@ class TaskViewModel @Inject constructor(
} }
} }
mapController.animationHandler.animateToBox( mapController.animationHandler.animateToBox(
maxX = maxX, maxX = maxX, maxY = maxY, minX = minX, minY = minY
maxY = maxY,
minX = minX,
minY = minY
) )
} }
} }
@ -210,4 +210,41 @@ class TaskViewModel @Inject constructor(
} }
} }
} }
/**
* 筛选任务列表
*/
fun filterTaskList(key: String) {
if (filterTaskListJob != null)
filterTaskListJob!!.cancel()
filterTaskListJob = viewModelScope.launch(Dispatchers.IO) {
delay(500)
val realm = Realm.getDefaultInstance()
val list = realm.where(TaskBean::class.java)
.contains("evaluationTaskName", key)
.or()
.contains("dataVersion", key)
.or()
.contains("cityName", key)
.findAll()
liveDataTaskList.postValue(realm.copyFromRealm(list))
}
}
fun filterTask(pidKey: String) {
if (currentSelectTaskBean == null)
return
if (filterTaskJob != null)
filterTaskJob!!.cancel()
filterTaskJob = viewModelScope.launch(Dispatchers.Default) {
delay(500)
val list = mutableListOf<HadLinkDvoBean>()
for (item in currentSelectTaskBean!!.hadLinkDvoList) {
if (item.linkPid.contains(pidKey))
list.add(item)
}
liveDataTaskLinks.postValue(list)
}
}
} }

View File

@ -0,0 +1,270 @@
package com.navinfo.omqs.ui.widget
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.*
import android.os.Build
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import com.navinfo.omqs.R
class TextProgressButtonBar : View {
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
init(context!!, attrs!!)
}
constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs) {
init(context!!, attrs!!)
}
private lateinit var fm: Paint.FontMetrics
private var progress = 0
private var textColor: Int = Color.WHITE
private var paint: Paint? = null
private var textSize: Float = 10f
private var foreground = 0
private var backgroundcolor = 0
private var text: String? = null
private var max = 100
private val corner = 30 // 圆角的弧度
private val mStartColor = resources.getColor(R.color.default_button_blue_color)
private val mEndColor = resources.getColor(R.color.ripple_end_color)
private val mValueAnimator = ValueAnimator.ofInt(
mEndColor,
mStartColor
)
private var mCurrentColor = mEndColor
// private var buttonClickListener: OnProgressButtonClickListener? = null
fun init(
context: Context, attrs: AttributeSet
) {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ProgressButton)
backgroundcolor = typedArray.getInteger(
R.styleable.ProgressButton_backgroundcolor, Color.parseColor("#C6C6C6")
)
foreground = typedArray.getInteger(
R.styleable.ProgressButton_foreground, Color.rgb(20, 131, 214)
)
textColor = typedArray.getInteger(
R.styleable.ProgressButton_textcolor, Color.WHITE
)
max = typedArray.getInteger(R.styleable.ProgressButton_max, 100)
progress = typedArray.getInteger(R.styleable.ProgressButton_progress, 0)
text = typedArray.getString(R.styleable.ProgressButton_text)
textSize = typedArray.getDimension(R.styleable.ProgressButton_textSize, 20f)
typedArray.recycle()
mValueAnimator.duration = 1000
mValueAnimator.repeatCount = ValueAnimator.INFINITE
mValueAnimator.repeatMode = ValueAnimator.REVERSE
// 为 ValueAnimator 对象添加 ArgbEvaluator
mValueAnimator.setEvaluator(ArgbEvaluator());
// 添加动画监听器,在动画值改变时更新当前颜色值并重绘 View
mValueAnimator.addUpdateListener { animation ->
mCurrentColor = animation.animatedValue as Int
invalidate();
};
}
fun startAnimator() {
if (!mValueAnimator.isStarted) {
progress = max
mValueAnimator.start()
}
}
fun stopAnimator() {
if (mValueAnimator.isRunning || mValueAnimator.isStarted) {
mValueAnimator.cancel()
mCurrentColor = mEndColor
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 在 View 从窗口中移除时停止动画
mValueAnimator.cancel()
}
@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
paint = Paint()
paint?.let {
it.isAntiAlias = true
it.strokeWidth = 5f
it.style = Paint.Style.STROKE
it.color = textColor
/**
* 绘制背景
*/
var oval = RectF(0F, 0F, width.toFloat(), height.toFloat())
canvas.drawRoundRect(oval, corner.toFloat(), corner.toFloat(), it)
it.style = Paint.Style.FILL
it.color = this.backgroundcolor
canvas.drawRoundRect(oval, corner.toFloat(), corner.toFloat(), it)
if (progress <= corner) {
oval = RectF(
0F,
(corner - progress).toFloat(),
(width * progress / max).toFloat(),
(height - corner + progress).toFloat()
)
/***
* 绘制进度值
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val shader = LinearGradient(
oval.left,
oval.top,
oval.right,
oval.bottom,
mStartColor,
mCurrentColor,
Shader.TileMode.MIRROR
)
it.shader = shader
}
canvas.drawRoundRect(oval, progress.toFloat(), progress.toFloat(), it)
} else {
oval = RectF(
0F, 0F, (width * progress / max).toFloat(), height.toFloat()
)
/***
* 绘制进度值
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val shader = LinearGradient(
oval.left,
oval.top,
oval.right,
oval.bottom,
mStartColor,
mCurrentColor,
Shader.TileMode.CLAMP
)
it.shader = shader
}
canvas.drawRoundRect(oval, corner.toFloat(), corner.toFloat(), it)
}
/***
* 绘制文本
*/
it.shader = null
if ("" == text || text == null) {
return
}
it.textSize = textSize
fm = it.fontMetrics
it.color = textColor
val textCenterVerticalBaselineY = height / 2 - fm.descent + (fm.descent - fm.ascent) / 2
canvas.drawText(
text!!, (measuredWidth - it.measureText(text)) / 2, textCenterVerticalBaselineY, it
)
}
}
/**
* 设置最大值
*
* @param max
*/
fun setMax(max: Int) {
this.max = max
}
/**
* 设置文本提示信息
*
* @param text
*/
fun setText(text: String?) {
this.text = text
postInvalidate()
}
/**
* 设置进度条的颜色值
*
* @param color
*/
fun setForeground(color: Int) {
foreground = color
}
/**
* 设置进度条的背景色
*/
override fun setBackgroundColor(color: Int) {
this.backgroundcolor = color
}
/***
* 设置文本的大小
*/
fun setTextSize(size: Int) {
textSize = size.toFloat()
}
/**
* 设置文本的颜色值
*
* @param color
*/
fun setTextColor(color: Int) {
textColor = color
}
/**
* 设置进度值
*
* @param progress
*/
fun setProgress(progress: Int) {
if (progress > max) {
return
}
this.progress = progress
//设置进度之后要求UI强制进行重绘
postInvalidate()
}
fun getMax(): Int {
return max
}
fun getProgress(): Int {
return progress
}
// @SuppressLint("ClickableViewAccessibility")
// override fun onTouchEvent(event: MotionEvent): Boolean {
// when (event.action) {
// MotionEvent.ACTION_UP -> buttonClickListener?.onClickListener(this)
// else -> {
// }
// }
// return true
// }
//
// fun setOnProgressButtonClickListener(clickListener: OnProgressButtonClickListener) {
// buttonClickListener = clickListener
// }
//
//
// interface OnProgressButtonClickListener {
// fun onClickListener(view: View)
// }
}

View File

@ -8,7 +8,7 @@
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingTop="6dp" android:paddingTop="6dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingBottom="4dp" android:paddingBottom="8dp"
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter"> tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter">
<ImageView <ImageView
@ -30,66 +30,57 @@
android:textColor="#15141F" android:textColor="#15141F"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView
android:id="@+id/task_city_name"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_name"
android:layout_alignLeft="@id/task_name"
android:layout_marginTop="5dp"
android:text="省市名称"
android:textColor="@color/gray_121"
android:textSize="13sp" />
<TextView <TextView
android:id="@+id/task_data_version" android:id="@+id/task_data_version"
style="@style/map_size_font_style" style="@style/map_size_font_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/task_city_name" android:layout_below="@id/task_name"
android:layout_alignLeft="@id/task_name" android:layout_alignLeft="@id/task_name"
android:layout_toLeftOf="@id/task_upload_btn" android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:text="版本号" android:text="版本号"
android:textColor="@color/gray_121" android:textColor="@color/gray_121"
android:textSize="13sp" /> android:textSize="13sp" />
<TextView <TextView
android:id="@+id/task_color" android:id="@+id/task_city_name"
style="@style/map_size_font_style" style="@style/map_size_font_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/task_data_version" android:layout_below="@id/task_data_version"
android:layout_alignLeft="@id/task_name" android:layout_alignLeft="@id/task_name"
android:layout_marginTop="5dp" android:text="省市名称"
android:drawableLeft="@drawable/point_blue" android:textColor="@color/gray_121"
android:text="路线颜色" android:textSize="13sp" />
android:textSize="@dimen/card_title_font_3size" />
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
<TextView
android:id="@+id/task_download_btn" android:id="@+id/task_download_btn"
style="@style/btn_default_stroke_horizontal_round" android:layout_width="75dp"
android:layout_width="72dp" android:layout_height="22dp"
android:layout_alignBottom="@id/task_city_name"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/task_data_version" android:layout_gravity="center"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:gravity="center" app:backgroundcolor="#888FB3"
android:text="下载" app:text="下载"
android:textSize="@dimen/card_title_font_2size" /> app:textSize="@dimen/card_title_font_2size"
app:textcolor="@color/white" />
<TextView <com.navinfo.omqs.ui.widget.TextProgressButtonBar
android:id="@+id/task_upload_btn" android:id="@+id/task_upload_btn"
style="@style/btn_default_stroke_horizontal_round" android:layout_width="75dp"
android:layout_width="wrap_content" android:layout_height="22dp"
android:layout_centerVertical="true" android:layout_alignBottom="@id/task_city_name"
android:layout_marginRight="5dp" android:layout_alignParentRight="true"
android:layout_toLeftOf="@id/task_download_btn" android:layout_gravity="center"
android:gravity="center" android:layout_marginTop="5dp"
android:minWidth="60dp" android:visibility="gone"
android:shadowColor="@android:color/transparent" app:backgroundcolor="#888FB3"
android:text="同步" app:text="未上传"
android:textSize="@dimen/card_title_font_2size" /> app:textSize="@dimen/card_title_font_2size"
app:textcolor="@color/white" />
<TextView <TextView
android:id="@+id/task_status" android:id="@+id/task_status"
@ -104,13 +95,14 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/card_title_font_2size" /> android:textSize="@dimen/card_title_font_2size" />
<com.navinfo.omqs.ui.widget.MyProgressBar <TextView
android:id="@+id/task_progress" android:id="@+id/task_progress_text"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="16dp" android:layout_height="wrap_content"
android:layout_below="@id/task_download_btn" android:layout_alignTop="@id/task_download_btn"
android:paddingTop="10dp" android:layout_alignBottom="@id/task_download_btn"
android:progressDrawable="@drawable/progress_bg" android:layout_toLeftOf="@id/task_download_btn"
android:gravity="center"
android:visibility="invisible" /> android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>

View File

@ -7,25 +7,6 @@
android:background="@drawable/shape_middle_fragment_bg" android:background="@drawable/shape_middle_fragment_bg"
tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.PhenomenonFragment"> tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.PhenomenonFragment">
<!-- <ImageView-->
<!-- android:id="@+id/phenomenon_drawer"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@drawable/progress_bg"-->
<!-- android:paddingLeft="10dp"-->
<!-- android:paddingTop="30dp"-->
<!-- android:paddingRight="10dp"-->
<!-- android:paddingBottom="30dp"-->
<!-- android:src="@drawable/btn_back_xml" />-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/phenomenon_middle_recyclerview"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="35dp"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toLeftOf="@id/phenomenon_right_recyclerview"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/phenomenon_left_recyclerview" android:id="@+id/phenomenon_left_recyclerview"
android:layout_width="148dp" android:layout_width="148dp"
@ -42,29 +23,4 @@
app:layout_constraintLeft_toRightOf="@id/phenomenon_left_recyclerview" app:layout_constraintLeft_toRightOf="@id/phenomenon_left_recyclerview"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<!-- <LinearLayout-->
<!-- android:id="@+id/group"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="vertical">-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="2">-->
<!-- -->
<!-- </RelativeLayout>-->
<!-- -->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,51 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="@dimen/fragment_problem_link_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="right|center_vertical" android:background="@drawable/shape_middle_fragment_bg"
android:orientation="horizontal"
android:paddingTop="@dimen/fragment_margin_top"
android:paddingLeft="@dimen/fragment_margin_left"
tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.ProblemLinkFragment"> tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.ProblemLinkFragment">
<ImageView <androidx.recyclerview.widget.RecyclerView
android:visibility="gone" android:id="@+id/link_right_recyclerview"
android:id="@+id/link_drawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/progress_bg"
android:paddingLeft="10dp"
android:paddingTop="30dp"
android:paddingRight="10dp"
android:paddingBottom="30dp"
android:src="@drawable/selector_btn_back_xml" />
<LinearLayout
android:id="@+id/group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:orientation="vertical"> </androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/link_middle_recyclerview"
android:layout_width="0dp"
android:visibility="invisible"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@color/white" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/link_right_recyclerview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="@color/white" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -9,4 +9,5 @@
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen> <dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen> <dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
<dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">360dp</dimen> <dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">360dp</dimen>
<dimen name="fragment_problem_link_width" comment="问题原因面板宽度">213dp</dimen>
</resources> </resources>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ProgressButton">
<attr name="backgroundcolor" format="color" />
<attr name="foreground" format="reference|color|integer"/>
<attr name="textcolor" format="color" />
<attr name="max" format="integer"/>
<attr name="progress" format="integer"/>
<attr name="textSize" format="dimension" />
<attr name="text" format="string" />
</declare-styleable>
</resources>

View File

@ -39,6 +39,6 @@
<dimen name="right_fragment_w" comment="右侧fragment宽度">213dp</dimen> <dimen name="right_fragment_w" comment="右侧fragment宽度">213dp</dimen>
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen> <dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen> <dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
<dimen name="fragment_problem_link_width" comment="问题原因面板宽度">213dp</dimen>
</resources> </resources>

View File

@ -393,5 +393,6 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
editIndex = -1 editIndex = -1
bDrawLine = false bDrawLine = false
omdbTaskLinkLayer.removeAll() omdbTaskLinkLayer.removeAll()
linksLayer.clear()
} }
} }

View File

@ -28,6 +28,7 @@ class MultiLinesLayer(map: Map) : VectorLayer(map) {
LineDrawable(GeometryTools.createGeometry(geometry), style) LineDrawable(GeometryTools.createGeometry(geometry), style)
super.add(lineDrawable) super.add(lineDrawable)
linkList.add(lineDrawable) linkList.add(lineDrawable)
update()
} catch (e: Exception) { } catch (e: Exception) {
} }
@ -39,5 +40,6 @@ class MultiLinesLayer(map: Map) : VectorLayer(map) {
super.remove(item) super.remove(item)
} }
linkList.clear() linkList.clear()
update()
} }
} }

View File

@ -32,19 +32,18 @@ public class OMDBTileDataSource implements ITileDataSource {
@Override @Override
public void query(MapTile tile, ITileDataSink mapDataSink) { public void query(MapTile tile, ITileDataSink mapDataSink) {
// 获取tile对应的坐标范围 // 获取tile对应的坐标范围
if (tile.zoomLevel>=Constant.OMDB_MIN_ZOOM&&tile.zoomLevel<=Constant.OVER_ZOOM) { if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.OVER_ZOOM) {
int m = Constant.OVER_ZOOM-tile.zoomLevel; int m = Constant.OVER_ZOOM - tile.zoomLevel;
int xStart = (int)tile.tileX<<m; int xStart = (int) tile.tileX << m;
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);
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class) RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd);
.rawPredicate("tileX>="+xStart+" and tileX<="+xEnd+" and tileY>="+yStart+" and tileY<="+yEnd);
// 筛选不显示的数据 // 筛选不显示的数据
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();
for (String type: Constant.HAD_LAYER_INVISIABLE_ARRAY) { for (String type : Constant.HAD_LAYER_INVISIABLE_ARRAY) {
realmQuery.notEqualTo("table", type); realmQuery.notEqualTo("table", type);
} }
realmQuery.endGroup(); realmQuery.endGroup();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="transp">#00000000</color> <color name="transp">#00000000</color>
<color name="teal_200">#FF03DAC5</color> <color name="teal_200">#7F03DAC5</color>
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="transparent">#00FFFFFF</color> <color name="transparent">#00FFFFFF</color>