修改任务线刷新,数据安装刷新
This commit is contained in:
parent
752550f376
commit
d86ec46943
@ -129,7 +129,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
// 开始解压zip文件
|
// 开始解压zip文件
|
||||||
val unZipFiles = ZipUtils.unzipFile(omdbZipFile, unZipFolder)
|
val unZipFiles = ZipUtils.unzipFile(omdbZipFile, unZipFolder)
|
||||||
// 将listResult数据插入到Realm数据库中
|
// 将listResult数据插入到Realm数据库中
|
||||||
Realm.getDefaultInstance().beginTransaction()
|
val realm = Realm.getDefaultInstance()
|
||||||
// 遍历解压后的文件,读取该数据返回
|
// 遍历解压后的文件,读取该数据返回
|
||||||
for ((index, currentConfig) in importConfig.tables.withIndex()) {
|
for ((index, currentConfig) in importConfig.tables.withIndex()) {
|
||||||
val txtFile = unZipFiles.find {
|
val txtFile = unZipFiles.find {
|
||||||
|
@ -13,8 +13,6 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.locationtech.jts.geom.*
|
import org.locationtech.jts.geom.*
|
||||||
import org.locationtech.jts.operation.buffer.BufferOp
|
import org.locationtech.jts.operation.buffer.BufferOp
|
||||||
import org.locationtech.spatial4j.context.SpatialContext
|
|
||||||
import org.locationtech.spatial4j.distance.DistanceUtils
|
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
import org.oscim.core.MercatorProjection
|
import org.oscim.core.MercatorProjection
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -33,14 +31,18 @@ class RealmOperateHelper() {
|
|||||||
* */
|
* */
|
||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
suspend fun queryLink(
|
suspend fun queryLink(
|
||||||
point: Point,
|
point: GeoPoint,
|
||||||
buffer: Double = DEFAULT_BUFFER,
|
buffer: Double = DEFAULT_BUFFER,
|
||||||
bufferType: BUFFER_TYPE = DEFAULT_BUFFER_TYPE,
|
bufferType: BUFFER_TYPE = DEFAULT_BUFFER_TYPE,
|
||||||
sort: Boolean = true
|
sort: Boolean = true
|
||||||
): MutableList<RenderEntity> {
|
): MutableList<RenderEntity> {
|
||||||
val result = mutableListOf<RenderEntity>()
|
val result = mutableListOf<RenderEntity>()
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val polygon = getPolygonFromPoint(point, buffer, bufferType)
|
val polygon = getPolygonFromPoint(
|
||||||
|
GeometryTools.createPoint(point.longitude, point.latitude),
|
||||||
|
buffer,
|
||||||
|
bufferType
|
||||||
|
)
|
||||||
// 根据polygon查询相交的tile号
|
// 根据polygon查询相交的tile号
|
||||||
val tileXSet = mutableSetOf<Int>()
|
val tileXSet = mutableSetOf<Int>()
|
||||||
tileXSet.toString()
|
tileXSet.toString()
|
||||||
@ -68,7 +70,14 @@ class RealmOperateHelper() {
|
|||||||
|
|
||||||
queryResult?.let {
|
queryResult?.let {
|
||||||
if (sort) {
|
if (sort) {
|
||||||
result.addAll(sortRenderEntity(point, it))
|
result.addAll(
|
||||||
|
sortRenderEntity(
|
||||||
|
GeometryTools.createPoint(
|
||||||
|
point.longitude,
|
||||||
|
point.latitude
|
||||||
|
), it
|
||||||
|
)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
result.addAll(it)
|
result.addAll(it)
|
||||||
}
|
}
|
||||||
@ -172,6 +181,7 @@ class RealmOperateHelper() {
|
|||||||
* @param unSortList 未排序的数据
|
* @param unSortList 未排序的数据
|
||||||
* @return 排序后的数据
|
* @return 排序后的数据
|
||||||
* */
|
* */
|
||||||
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
fun sortRenderEntity(point: Point, unSortList: List<RenderEntity>): List<RenderEntity> {
|
fun sortRenderEntity(point: Point, unSortList: List<RenderEntity>): List<RenderEntity> {
|
||||||
val sortList = unSortList.stream().sorted { renderEntity, renderEntity2 ->
|
val sortList = unSortList.stream().sorted { renderEntity, renderEntity2 ->
|
||||||
val near = point.distance(renderEntity.wkt) - point.distance(renderEntity2.wkt)
|
val near = point.distance(renderEntity.wkt) - point.distance(renderEntity2.wkt)
|
||||||
|
@ -46,8 +46,9 @@ class ActivityModule {
|
|||||||
fun providesTaskListDownloadManager(
|
fun providesTaskListDownloadManager(
|
||||||
networkServiceAPI: RetrofitNetworkServiceAPI,
|
networkServiceAPI: RetrofitNetworkServiceAPI,
|
||||||
importFactory: ImportOMDBHiltFactory,
|
importFactory: ImportOMDBHiltFactory,
|
||||||
|
mapController: NIMapController
|
||||||
): TaskDownloadManager =
|
): TaskDownloadManager =
|
||||||
TaskDownloadManager(importFactory, networkServiceAPI)
|
TaskDownloadManager(importFactory, networkServiceAPI, mapController)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注入任务下载
|
* 注入任务下载
|
||||||
|
@ -67,7 +67,7 @@ class GlobalModule {
|
|||||||
}.apply {
|
}.apply {
|
||||||
level = if (Constant.DEBUG) {
|
level = if (Constant.DEBUG) {
|
||||||
//坑 !!!! 下载文件时打印log 内存不足
|
//坑 !!!! 下载文件时打印log 内存不足
|
||||||
HttpLoggingInterceptor.Level.BODY
|
HttpLoggingInterceptor.Level.BASIC
|
||||||
} else {
|
} else {
|
||||||
HttpLoggingInterceptor.Level.NONE
|
HttpLoggingInterceptor.Level.NONE
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.navinfo.omqs.http.taskdownload
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.omqs.bean.TaskBean
|
import com.navinfo.omqs.bean.TaskBean
|
||||||
import com.navinfo.omqs.hilt.ImportOMDBHiltFactory
|
import com.navinfo.omqs.hilt.ImportOMDBHiltFactory
|
||||||
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
||||||
@ -19,6 +20,7 @@ import javax.inject.Inject
|
|||||||
class TaskDownloadManager constructor(
|
class TaskDownloadManager constructor(
|
||||||
val importFactory: ImportOMDBHiltFactory,
|
val importFactory: ImportOMDBHiltFactory,
|
||||||
val netApi: RetrofitNetworkServiceAPI,
|
val netApi: RetrofitNetworkServiceAPI,
|
||||||
|
val mapController:NIMapController
|
||||||
) {
|
) {
|
||||||
|
|
||||||
lateinit var context: Context
|
lateinit var context: Context
|
||||||
|
@ -131,6 +131,9 @@ class TaskDownloadScope(
|
|||||||
Log.e("jingo", "数据安装 $it")
|
Log.e("jingo", "数据安装 $it")
|
||||||
if (it == "finish") {
|
if (it == "finish") {
|
||||||
change(FileDownloadStatus.DONE)
|
change(FileDownloadStatus.DONE)
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
downloadManager.mapController.mMapView.updateMap(true)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
change(FileDownloadStatus.IMPORTING, it)
|
change(FileDownloadStatus.IMPORTING, it)
|
||||||
}
|
}
|
||||||
@ -138,6 +141,8 @@ 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 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.e("jingo", "importData EEE")
|
Log.e("jingo", "importData EEE")
|
||||||
|
@ -116,7 +116,8 @@ class TaskUploadScope(
|
|||||||
val objects = realm.where(QsRecordBean::class.java)
|
val objects = realm.where(QsRecordBean::class.java)
|
||||||
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
||||||
if (objects.size == 0) {
|
if (objects.size == 0) {
|
||||||
// change(FileUploadStatus.NONE)
|
if (taskBean.syncStatus == FileUploadStatus.WAITING)
|
||||||
|
change(FileUploadStatus.NONE)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +227,15 @@ class MainActivity : BaseActivity() {
|
|||||||
* 点击录音按钮
|
* 点击录音按钮
|
||||||
*/
|
*/
|
||||||
fun voiceOnclick() {
|
fun voiceOnclick() {
|
||||||
/* val naviController = findNavController(R.id.main_activity_right_fragment)
|
val naviController = findNavController(R.id.main_activity_right_fragment)
|
||||||
naviController.navigate(R.id.EvaluationResultFragment)*/
|
naviController.navigate(R.id.EvaluationResultFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击线选择
|
||||||
|
*/
|
||||||
|
fun selectLineOnclick(){
|
||||||
|
viewModel.setSelectRoad(!viewModel.isSelectRoad())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun voiceOnTouchStart() {
|
fun voiceOnTouchStart() {
|
||||||
|
@ -37,14 +37,12 @@ import com.navinfo.omqs.ui.dialog.CommonDialog
|
|||||||
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
||||||
import com.navinfo.omqs.ui.widget.SignUtil
|
import com.navinfo.omqs.ui.widget.SignUtil
|
||||||
import com.navinfo.omqs.util.DateTimeUtil
|
import com.navinfo.omqs.util.DateTimeUtil
|
||||||
import com.navinfo.omqs.util.FlowEventBus
|
|
||||||
import com.navinfo.omqs.util.SoundMeter
|
import com.navinfo.omqs.util.SoundMeter
|
||||||
import com.navinfo.omqs.util.SpeakMode
|
import com.navinfo.omqs.util.SpeakMode
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import io.realm.RealmSet
|
import io.realm.RealmSet
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
@ -72,7 +70,7 @@ class MainViewModel @Inject constructor(
|
|||||||
//看板数据
|
//看板数据
|
||||||
val liveDataSignList = MutableLiveData<List<SignBean>>()
|
val liveDataSignList = MutableLiveData<List<SignBean>>()
|
||||||
|
|
||||||
var testPoint = GeoPoint(0, 0)
|
// var testPoint = GeoPoint(0, 0)
|
||||||
|
|
||||||
//语音窗体
|
//语音窗体
|
||||||
private var pop: PopupWindow? = null
|
private var pop: PopupWindow? = null
|
||||||
@ -87,6 +85,11 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
val liveDataMenuState = MutableLiveData<Boolean>()
|
val liveDataMenuState = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是不是线选择模式
|
||||||
|
*/
|
||||||
|
private var bSelectRoad = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
mapController.markerHandle.setOnQsRecordItemClickListener(object :
|
mapController.markerHandle.setOnQsRecordItemClickListener(object :
|
||||||
OnQsRecordItemClickListener {
|
OnQsRecordItemClickListener {
|
||||||
@ -97,7 +100,10 @@ class MainViewModel @Inject constructor(
|
|||||||
initLocation()
|
initLocation()
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
mapController.onMapClickFlow.collectLatest {
|
mapController.onMapClickFlow.collectLatest {
|
||||||
testPoint = it
|
// testPoint = it
|
||||||
|
if (bSelectRoad) {
|
||||||
|
captureLink(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,8 +146,8 @@ class MainViewModel @Inject constructor(
|
|||||||
//用于定位点存储到数据库
|
//用于定位点存储到数据库
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
mapController.locationLayerHandler.niLocationFlow.collect { location ->
|
mapController.locationLayerHandler.niLocationFlow.collect { location ->
|
||||||
location.longitude = testPoint.longitude
|
// location.longitude = testPoint.longitude
|
||||||
location.latitude = testPoint.latitude
|
// location.latitude = testPoint.latitude
|
||||||
val geometry = GeometryTools.createGeometry(
|
val geometry = GeometryTools.createGeometry(
|
||||||
GeoPoint(
|
GeoPoint(
|
||||||
location.latitude,
|
location.latitude,
|
||||||
@ -168,15 +174,25 @@ class MainViewModel @Inject constructor(
|
|||||||
//用于定位点捕捉道路
|
//用于定位点捕捉道路
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
|
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
|
||||||
Log.e("jingo", "定位点绑定道路 ${Thread.currentThread().name}")
|
// location.longitude = testPoint.longitude
|
||||||
location.longitude = testPoint.longitude
|
// location.latitude = testPoint.latitude
|
||||||
location.latitude = testPoint.latitude
|
if (!isSelectRoad())
|
||||||
|
captureLink(GeoPoint(location.latitude, location.longitude))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示轨迹图层
|
||||||
|
mapController.layerManagerHandler.showNiLocationLayer()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 捕获道路和面板
|
||||||
|
*/
|
||||||
|
private suspend fun captureLink(point: GeoPoint) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
val linkList = realmOperateHelper.queryLink(
|
val linkList = realmOperateHelper.queryLink(
|
||||||
point = GeometryTools.createPoint(
|
point = point,
|
||||||
location.longitude,
|
|
||||||
location.latitude
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
//看板数据
|
//看板数据
|
||||||
val signList = mutableListOf<SignBean>()
|
val signList = mutableListOf<SignBean>()
|
||||||
@ -188,9 +204,7 @@ class MainViewModel @Inject constructor(
|
|||||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||||
for (element in elementList) {
|
for (element in elementList) {
|
||||||
val distance = GeometryTools.distanceToDouble(
|
val distance = GeometryTools.distanceToDouble(
|
||||||
GeoPoint(
|
point,
|
||||||
location.latitude, location.longitude,
|
|
||||||
),
|
|
||||||
GeometryTools.createGeoPoint(element.geometry)
|
GeometryTools.createGeoPoint(element.geometry)
|
||||||
)
|
)
|
||||||
signList.add(
|
signList.add(
|
||||||
@ -205,18 +219,13 @@ class MainViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
liveDataSignList.postValue(signList)
|
liveDataSignList.postValue(signList)
|
||||||
Log.e("jingo", "自动捕捉数据 共${elementList.size}条")
|
Log.e("jingo", "自动捕捉数据 共${signList.size}条")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//显示轨迹图层
|
|
||||||
mapController.layerManagerHandler.showNiLocationLayer()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击我的位置,回到我的位置
|
* 点击我的位置,回到我的位置
|
||||||
@ -365,10 +374,11 @@ class MainViewModel @Inject constructor(
|
|||||||
importConfig.tableGroupName == "OMDB数据"
|
importConfig.tableGroupName == "OMDB数据"
|
||||||
}.first().tables.filter { tableInfo ->
|
}.first().tables.filter { tableInfo ->
|
||||||
!tableInfo.checked
|
!tableInfo.checked
|
||||||
}.map {
|
}.map { tableInfo ->
|
||||||
tableInfo -> tableInfo.table
|
tableInfo.table
|
||||||
}.toList()
|
}.toList()
|
||||||
com.navinfo.collect.library.system.Constant.HAD_LAYER_INVISIABLE_ARRAY = omdbVisibleList.toTypedArray()
|
com.navinfo.collect.library.system.Constant.HAD_LAYER_INVISIABLE_ARRAY =
|
||||||
|
omdbVisibleList.toTypedArray()
|
||||||
// 刷新地图
|
// 刷新地图
|
||||||
mapController.mMapView.vtmMap.clearMap()
|
mapController.mMapView.vtmMap.clearMap()
|
||||||
}
|
}
|
||||||
@ -409,4 +419,16 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启线选择
|
||||||
|
*/
|
||||||
|
fun setSelectRoad(select: Boolean) {
|
||||||
|
bSelectRoad = select
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isSelectRoad(): Boolean {
|
||||||
|
return bSelectRoad
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -25,6 +25,7 @@ class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null)
|
|||||||
val item = data[position]
|
val item = data[position]
|
||||||
bd.signMainIcon.background = holder.viewBinding.root.context.getDrawable(item.iconId)
|
bd.signMainIcon.background = holder.viewBinding.root.context.getDrawable(item.iconId)
|
||||||
bd.signMainIcon.text = item.iconText
|
bd.signMainIcon.text = item.iconText
|
||||||
|
bd.signBottomText.text = item.bottomText
|
||||||
bd.root.setOnClickListener {
|
bd.root.setOnClickListener {
|
||||||
itemListener?.invoke(position, item)
|
itemListener?.invoke(position, item)
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,7 @@ import android.app.Activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.AnimationDrawable
|
import android.graphics.drawable.AnimationDrawable
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
@ -15,11 +13,9 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.PopupWindow
|
import android.widget.PopupWindow
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.util.rangeTo
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import androidx.navigation.findNavController
|
|
||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
import com.navinfo.collect.library.data.entity.AttachmentBean
|
import com.navinfo.collect.library.data.entity.AttachmentBean
|
||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
@ -130,7 +126,9 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
geoPoint?.let {
|
geoPoint?.let {
|
||||||
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
||||||
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
||||||
mapController.animationHandler.animationByLonLat(geoPoint.latitude,geoPoint.longitude)
|
mapController.animationHandler.animationByLonLat(
|
||||||
|
geoPoint.latitude, geoPoint.longitude
|
||||||
|
)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
captureLink(geoPoint.longitude, geoPoint.latitude)
|
captureLink(geoPoint.longitude, geoPoint.latitude)
|
||||||
}
|
}
|
||||||
@ -165,16 +163,12 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
private suspend fun captureLink(longitude: Double, latitude: Double) {
|
private suspend fun captureLink(longitude: Double, latitude: Double) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
val linkList = realmOperateHelper.queryLink(
|
val linkList = realmOperateHelper.queryLink(
|
||||||
point = GeometryTools.createPoint(
|
point = GeoPoint(latitude, longitude),
|
||||||
longitude,
|
|
||||||
latitude
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
liveDataQsRecordBean.value?.let {
|
liveDataQsRecordBean.value?.let {
|
||||||
if (linkList.isNotEmpty()) {
|
if (linkList.isNotEmpty()) {
|
||||||
it.linkId =
|
it.linkId = linkList[0].properties[LinkTable.linkPid] ?: ""
|
||||||
linkList[0].properties[LinkTable.linkPid] ?: ""
|
|
||||||
mapController.lineHandler.showLine(linkList[0].geometry)
|
mapController.lineHandler.showLine(linkList[0].geometry)
|
||||||
Log.e("jingo", "捕捉到的linkId = ${it.linkId}")
|
Log.e("jingo", "捕捉到的linkId = ${it.linkId}")
|
||||||
} else {
|
} else {
|
||||||
@ -328,8 +322,9 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
|
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
val objects = it.where(QsRecordBean::class.java)
|
val objects =
|
||||||
.equalTo("id", liveDataQsRecordBean.value?.id).findFirst()
|
it.where(QsRecordBean::class.java).equalTo("id", liveDataQsRecordBean.value?.id)
|
||||||
|
.findFirst()
|
||||||
objects?.deleteFromRealm()
|
objects?.deleteFromRealm()
|
||||||
}
|
}
|
||||||
// realm.close()
|
// realm.close()
|
||||||
@ -354,8 +349,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
liveDataQsRecordBean.postValue(it.copy())
|
liveDataQsRecordBean.postValue(it.copy())
|
||||||
val p = GeometryTools.createGeoPoint(it.geometry)
|
val p = GeometryTools.createGeoPoint(it.geometry)
|
||||||
mapController.markerHandle.addMarker(
|
mapController.markerHandle.addMarker(
|
||||||
GeoPoint(p.latitude, p.longitude),
|
GeoPoint(p.latitude, p.longitude), markerTitle
|
||||||
markerTitle
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (it.linkId.isNotEmpty()) {
|
if (it.linkId.isNotEmpty()) {
|
||||||
|
@ -2,6 +2,7 @@ package com.navinfo.omqs.ui.fragment.tasklist
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.os.Build
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
@ -23,7 +24,7 @@ import javax.inject.Inject
|
|||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class TaskListViewModel @Inject constructor(
|
class TaskListViewModel @Inject constructor(
|
||||||
private val networkService: NetworkService,
|
private val networkService: NetworkService,
|
||||||
private val niMapController: NIMapController
|
private val mapController: NIMapController
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
val liveDataTaskList = MutableLiveData<List<TaskBean>>()
|
val liveDataTaskList = MutableLiveData<List<TaskBean>>()
|
||||||
@ -66,6 +67,7 @@ class TaskListViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
val objects = realm.where(TaskBean::class.java).findAll()
|
val objects = realm.where(TaskBean::class.java).findAll()
|
||||||
taskList = realm.copyFromRealm(objects)
|
taskList = realm.copyFromRealm(objects)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,6 +97,14 @@ class TaskListViewModel @Inject constructor(
|
|||||||
// }
|
// }
|
||||||
// niMapController.lineHandler.omdbTaskLinkLayer.update()
|
// niMapController.lineHandler.omdbTaskLinkLayer.update()
|
||||||
liveDataTaskList.postValue(taskList)
|
liveDataTaskList.postValue(taskList)
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||||
|
for (item in taskList) {
|
||||||
|
mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
|
||||||
|
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
5
app/src/main/res/drawable/baseline_timeline_24.xml
Normal file
5
app/src/main/res/drawable/baseline_timeline_24.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#3756DF"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M23,8c0,1.1 -0.9,2 -2,2c-0.18,0 -0.35,-0.02 -0.51,-0.07l-3.56,3.55C16.98,13.64 17,13.82 17,14c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2c0,-0.18 0.02,-0.36 0.07,-0.52l-2.55,-2.55C10.36,10.98 10.18,11 10,11s-0.36,-0.02 -0.52,-0.07l-4.55,4.56C4.98,15.65 5,15.82 5,16c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2s0.9,-2 2,-2c0.18,0 0.35,0.02 0.51,0.07l4.56,-4.55C8.02,9.36 8,9.18 8,9c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,0.18 -0.02,0.36 -0.07,0.52l2.55,2.55C14.64,12.02 14.82,12 15,12s0.36,0.02 0.52,0.07l3.55,-3.56C19.02,8.35 19,8.18 19,8c0,-1.1 0.9,-2 2,-2S23,6.9 23,8z"/>
|
||||||
|
</vector>
|
@ -133,6 +133,13 @@
|
|||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
tools:ignore="MissingConstraints">
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/main_activity_select_line"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:src="@drawable/baseline_timeline_24"
|
||||||
|
android:onClick="@{()->mainActivity.selectLineOnclick()}"
|
||||||
|
android:background="@drawable/shape_card_bg_default" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_voice"
|
android:id="@+id/main_activity_voice"
|
||||||
|
@ -17,4 +17,15 @@
|
|||||||
android:text="80"
|
android:text="80"
|
||||||
android:textColor="#2F2F2F"
|
android:textColor="#2F2F2F"
|
||||||
android:textSize="14.67sp" />
|
android:textSize="14.67sp" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sign_bottom_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="道路名"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14.67sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
Loading…
x
Reference in New Issue
Block a user