Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
This commit is contained in:
commit
5d0ce1e4ce
@ -4,43 +4,43 @@
|
|||||||
"table": "OMDB_CHECKPOINT",
|
"table": "OMDB_CHECKPOINT",
|
||||||
"code": 1012,
|
"code": 1012,
|
||||||
"name": "检查点",
|
"name": "检查点",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23
|
"zoomMax": 19
|
||||||
},
|
},
|
||||||
"2001": {
|
"2001": {
|
||||||
"table": "OMDB_RD_LINK",
|
"table": "OMDB_RD_LINK",
|
||||||
"code": 2001,
|
"code": 2001,
|
||||||
"name": "道路线",
|
"name": "道路线",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2002": {
|
"2002": {
|
||||||
"table": "OMDB_RD_LINK_FUNCTION_CLASS",
|
"table": "OMDB_RD_LINK_FUNCTION_CLASS",
|
||||||
"code": 2002,
|
"code": 2002,
|
||||||
"name": "道路功能等级",
|
"name": "道路功能等级",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2008": {
|
"2008": {
|
||||||
"table": "OMDB_RD_LINK_KIND",
|
"table": "OMDB_RD_LINK_KIND",
|
||||||
"code": 2008,
|
"code": 2008,
|
||||||
"name": "道路种别",
|
"name": "道路种别",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2010": {
|
"2010": {
|
||||||
"table": "OMDB_LINK_DIRECT",
|
"table": "OMDB_LINK_DIRECT",
|
||||||
"code": 2010,
|
"code": 2010,
|
||||||
"name": "道路方向",
|
"name": "道路方向",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2011": {
|
"2011": {
|
||||||
"table": "OMDB_LINK_NAME",
|
"table": "OMDB_LINK_NAME",
|
||||||
"code": 2011,
|
"code": 2011,
|
||||||
"name": "道路名",
|
"name": "道路名",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -54,8 +54,8 @@
|
|||||||
"table": "OMDB_LANE_MARK_BOUNDARYTYPE",
|
"table": "OMDB_LANE_MARK_BOUNDARYTYPE",
|
||||||
"code": 2013,
|
"code": 2013,
|
||||||
"name": "车道边界类型",
|
"name": "车道边界类型",
|
||||||
"zoomMin": 20,
|
"zoomMin": 18,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -69,22 +69,22 @@
|
|||||||
"table": "OMDB_LINK_SPEEDLIMIT",
|
"table": "OMDB_LINK_SPEEDLIMIT",
|
||||||
"code": 2019,
|
"code": 2019,
|
||||||
"name": "常规线限速",
|
"name": "常规线限速",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2020": {
|
"2020": {
|
||||||
"table": "OMDB_LINK_SPEEDLIMIT_COND",
|
"table": "OMDB_LINK_SPEEDLIMIT_COND",
|
||||||
"code": 2020,
|
"code": 2020,
|
||||||
"name": "条件线限速",
|
"name": "条件线限速",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2021": {
|
"2021": {
|
||||||
"table": "OMDB_LINK_SPEEDLIMIT_VAR",
|
"table": "OMDB_LINK_SPEEDLIMIT_VAR",
|
||||||
"code": 2021,
|
"code": 2021,
|
||||||
"name": "可变线限速",
|
"name": "可变线限速",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2022": {
|
"2022": {
|
||||||
"table": "OMDB_CON_ACCESS",
|
"table": "OMDB_CON_ACCESS",
|
||||||
@ -110,8 +110,8 @@
|
|||||||
"table": "OMDB_RDBOUND_BOUNDARYTYPE",
|
"table": "OMDB_RDBOUND_BOUNDARYTYPE",
|
||||||
"code": 2083,
|
"code": 2083,
|
||||||
"name": "道路边界类型",
|
"name": "道路边界类型",
|
||||||
"zoomMin": 20,
|
"zoomMin": 18,
|
||||||
"zoomMax": 23
|
"zoomMax": 21
|
||||||
},
|
},
|
||||||
"2201":{
|
"2201":{
|
||||||
"table": "OMDB_BRIDGE",
|
"table": "OMDB_BRIDGE",
|
||||||
@ -122,8 +122,8 @@
|
|||||||
"table": "OMDB_TUNNEL",
|
"table": "OMDB_TUNNEL",
|
||||||
"code": 2202,
|
"code": 2202,
|
||||||
"name": "隧道",
|
"name": "隧道",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -137,8 +137,8 @@
|
|||||||
"table": "OMDB_INTERSECTION",
|
"table": "OMDB_INTERSECTION",
|
||||||
"code": 4001,
|
"code": 4001,
|
||||||
"name": "路口",
|
"name": "路口",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -152,8 +152,8 @@
|
|||||||
"table": "OMDB_SPEEDLIMIT",
|
"table": "OMDB_SPEEDLIMIT",
|
||||||
"code": 4002,
|
"code": 4002,
|
||||||
"name": "常规点限速",
|
"name": "常规点限速",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "maxSpeed",
|
"k": "maxSpeed",
|
||||||
@ -173,8 +173,8 @@
|
|||||||
"table": "OMDB_SPEEDLIMIT_COND",
|
"table": "OMDB_SPEEDLIMIT_COND",
|
||||||
"code": 4003,
|
"code": 4003,
|
||||||
"name": "条件点限速",
|
"name": "条件点限速",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "maxSpeed",
|
"k": "maxSpeed",
|
||||||
@ -188,8 +188,8 @@
|
|||||||
"table": "OMDB_SPEEDLIMIT_VAR",
|
"table": "OMDB_SPEEDLIMIT_VAR",
|
||||||
"code": 4004,
|
"code": 4004,
|
||||||
"name": "可变点限速",
|
"name": "可变点限速",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "location",
|
"k": "location",
|
||||||
@ -215,8 +215,8 @@
|
|||||||
"table": "OMDB_RESTRICTION",
|
"table": "OMDB_RESTRICTION",
|
||||||
"code": 4006,
|
"code": 4006,
|
||||||
"name": "普通交限",
|
"name": "普通交限",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -254,8 +254,8 @@
|
|||||||
"table": "OMDB_ELECTRONICEYE",
|
"table": "OMDB_ELECTRONICEYE",
|
||||||
"code": 4010,
|
"code": 4010,
|
||||||
"name": "电子眼",
|
"name": "电子眼",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -287,8 +287,8 @@
|
|||||||
"table": "OMDB_TRAFFICLIGHT",
|
"table": "OMDB_TRAFFICLIGHT",
|
||||||
"code": 4022,
|
"code": 4022,
|
||||||
"name": "交通灯",
|
"name": "交通灯",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -296,8 +296,8 @@
|
|||||||
"table": "OMDB_LANEINFO",
|
"table": "OMDB_LANEINFO",
|
||||||
"code": 4601,
|
"code": 4601,
|
||||||
"name": "车信",
|
"name": "车信",
|
||||||
"zoomMin": 18,
|
"zoomMin": 16,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -323,8 +323,8 @@
|
|||||||
"table": "OMDB_LANE_LINK_LG",
|
"table": "OMDB_LANE_LINK_LG",
|
||||||
"code": 5001,
|
"code": 5001,
|
||||||
"name": "车道中心线",
|
"name": "车道中心线",
|
||||||
"zoomMin": 20,
|
"zoomMin": 18,
|
||||||
"zoomMax": 23,
|
"zoomMax": 21,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
|
@ -119,8 +119,8 @@ class ImportConfig {
|
|||||||
class TableInfo {
|
class TableInfo {
|
||||||
val table: String = ""
|
val table: String = ""
|
||||||
val code: Int = 0
|
val code: Int = 0
|
||||||
val zoomMin: Int = 18
|
val zoomMin: Int = 16
|
||||||
val zoomMax: Int = 23
|
val zoomMax: Int = 21
|
||||||
val name: String = ""
|
val name: String = ""
|
||||||
var checked : Boolean = true
|
var checked : Boolean = true
|
||||||
var transformer: MutableList<Transform> = mutableListOf()
|
var transformer: MutableList<Transform> = mutableListOf()
|
||||||
|
@ -79,7 +79,6 @@ class OfflineMapDownloadManager(
|
|||||||
}
|
}
|
||||||
launchNext(id)
|
launchNext(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ class OfflineMapDownloadScope(
|
|||||||
/**
|
/**
|
||||||
* 管理观察者,同时只有一个就行了
|
* 管理观察者,同时只有一个就行了
|
||||||
*/
|
*/
|
||||||
private val observer = Observer<Any> {}
|
// private val observer = Observer<Any> {}
|
||||||
// private var lifecycleOwner: LifecycleOwner? = null
|
// private var lifecycleOwner: LifecycleOwner? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,8 +58,14 @@ class OfflineMapDownloadScope(
|
|||||||
*/
|
*/
|
||||||
fun pause() {
|
fun pause() {
|
||||||
downloadJob?.cancel("pause")
|
downloadJob?.cancel("pause")
|
||||||
|
launch {
|
||||||
|
if (cityBean.fileSize == 0L) {
|
||||||
|
change(FileDownloadStatus.NONE)
|
||||||
|
} else {
|
||||||
change(FileDownloadStatus.PAUSE)
|
change(FileDownloadStatus.PAUSE)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动协程进行下载
|
* 启动协程进行下载
|
||||||
@ -99,7 +105,6 @@ class OfflineMapDownloadScope(
|
|||||||
* 添加下载任务观察者
|
* 添加下载任务观察者
|
||||||
*/
|
*/
|
||||||
fun observer(owner: LifecycleOwner, ob: Observer<OfflineMapCityBean>) {
|
fun observer(owner: LifecycleOwner, ob: Observer<OfflineMapCityBean>) {
|
||||||
removeObserver()
|
|
||||||
// this.lifecycleOwner = owner
|
// this.lifecycleOwner = owner
|
||||||
downloadData.observe(owner, ob)
|
downloadData.observe(owner, ob)
|
||||||
}
|
}
|
||||||
@ -167,11 +172,15 @@ class OfflineMapDownloadScope(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun removeObserver() {
|
fun removeObserver() {
|
||||||
downloadData.observeForever(observer)
|
// downloadData.observeForever(observer)
|
||||||
// lifecycleOwner?.let {
|
//// lifecycleOwner?.let {
|
||||||
downloadData.removeObserver(observer)
|
// downloadData.removeObserver(observer)
|
||||||
// null
|
//// null
|
||||||
|
//// }
|
||||||
|
// if (lifecycleOwner != null) {
|
||||||
|
// downloadData.removeObservers(lifecycleOwner!!)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -83,6 +83,12 @@ class TaskDownloadManager constructor(
|
|||||||
* 只有等待中的任务和正在下载中的任务才可以进行暂停操作
|
* 只有等待中的任务和正在下载中的任务才可以进行暂停操作
|
||||||
*/
|
*/
|
||||||
fun pause(id: Int) {
|
fun pause(id: Int) {
|
||||||
|
if (scopeMap.containsKey(id)) {
|
||||||
|
val downloadScope = scopeMap[id]
|
||||||
|
downloadScope?.let {
|
||||||
|
downloadScope.pause()
|
||||||
|
}
|
||||||
|
}
|
||||||
if (taskScopeMap.containsKey(id)) {
|
if (taskScopeMap.containsKey(id)) {
|
||||||
val downloadScope = taskScopeMap[id]
|
val downloadScope = taskScopeMap[id]
|
||||||
downloadScope?.let {
|
downloadScope?.let {
|
||||||
@ -104,7 +110,6 @@ class TaskDownloadManager constructor(
|
|||||||
|
|
||||||
|
|
||||||
fun addTask(taskBean: TaskBean) {
|
fun addTask(taskBean: TaskBean) {
|
||||||
Log.e("jingo", "下载线程 ${taskBean.id}")
|
|
||||||
if (!scopeMap.containsKey(taskBean.id)) {
|
if (!scopeMap.containsKey(taskBean.id)) {
|
||||||
scopeMap[taskBean.id] = TaskDownloadScope(this, taskBean)
|
scopeMap[taskBean.id] = TaskDownloadScope(this, taskBean)
|
||||||
}
|
}
|
||||||
@ -114,7 +119,6 @@ class TaskDownloadManager constructor(
|
|||||||
fun observer(
|
fun observer(
|
||||||
id: Int, lifecycleOwner: LifecycleOwner, observer: Observer<TaskBean>
|
id: Int, lifecycleOwner: LifecycleOwner, observer: Observer<TaskBean>
|
||||||
) {
|
) {
|
||||||
Log.e("jingo", "监听线程 ${id}")
|
|
||||||
if (scopeMap.containsKey(id)) {
|
if (scopeMap.containsKey(id)) {
|
||||||
scopeMap[id]!!.observer(lifecycleOwner, observer)
|
scopeMap[id]!!.observer(lifecycleOwner, observer)
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,12 @@ class TaskDownloadScope(
|
|||||||
fun pause() {
|
fun pause() {
|
||||||
downloadJob?.cancel("pause")
|
downloadJob?.cancel("pause")
|
||||||
launch {
|
launch {
|
||||||
|
if (taskBean.fileSize == 0L) {
|
||||||
|
change(FileDownloadStatus.NONE)
|
||||||
|
} else {
|
||||||
change(FileDownloadStatus.PAUSE)
|
change(FileDownloadStatus.PAUSE)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +127,7 @@ class TaskDownloadScope(
|
|||||||
/**
|
/**
|
||||||
* 导入数据
|
* 导入数据
|
||||||
*/
|
*/
|
||||||
private suspend fun importData(file: File? = null, taskId: Int?=0) {
|
private suspend fun importData(file: File? = null, taskId: Int? = 0) {
|
||||||
try {
|
try {
|
||||||
Log.e("jingo", "importData SSS")
|
Log.e("jingo", "importData SSS")
|
||||||
change(FileDownloadStatus.IMPORTING)
|
change(FileDownloadStatus.IMPORTING)
|
||||||
@ -135,7 +139,7 @@ class TaskDownloadScope(
|
|||||||
fileNew
|
fileNew
|
||||||
)
|
)
|
||||||
if (taskId != null) {
|
if (taskId != null) {
|
||||||
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile,taskId).collect {
|
importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, taskId).collect {
|
||||||
Log.e("jingo", "数据安装 $it")
|
Log.e("jingo", "数据安装 $it")
|
||||||
if (it == "finish") {
|
if (it == "finish") {
|
||||||
change(FileDownloadStatus.DONE)
|
change(FileDownloadStatus.DONE)
|
||||||
@ -183,7 +187,7 @@ class TaskDownloadScope(
|
|||||||
startPosition = 0
|
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,taskBean.id)
|
importData(fileTemp, taskBean.id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,10 +248,6 @@ class TaskDownloadScope(
|
|||||||
//// null
|
//// null
|
||||||
//// }
|
//// }
|
||||||
if (lifecycleOwner != null) {
|
if (lifecycleOwner != null) {
|
||||||
Log.e(
|
|
||||||
"jingo",
|
|
||||||
"移除的上一个监听者 ${lifecycleOwner.hashCode()} ${(lifecycleOwner as BaseViewHolder).tag}"
|
|
||||||
)
|
|
||||||
downloadData.removeObservers(lifecycleOwner!!)
|
downloadData.removeObservers(lifecycleOwner!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,10 @@ class LoginActivity : CheckPermissionsActivity() {
|
|||||||
LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP -> {
|
LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP -> {
|
||||||
loginDialog("检查离线地图...")
|
loginDialog("检查离线地图...")
|
||||||
}
|
}
|
||||||
|
LoginStatus.LOGIN_STATUS_NET_GET_TASK_LIST -> {
|
||||||
|
loginDialog("获取任务列表...")
|
||||||
|
}
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +117,7 @@ class LoginActivity : CheckPermissionsActivity() {
|
|||||||
*/
|
*/
|
||||||
private fun loginDialog(message: String) {
|
private fun loginDialog(message: String) {
|
||||||
if (loginDialog == null) {
|
if (loginDialog == null) {
|
||||||
|
Log.e("jingo", "登录dialog显示")
|
||||||
loginDialog = MaterialAlertDialogBuilder(
|
loginDialog = MaterialAlertDialogBuilder(
|
||||||
this, com.google.android.material.R.style.MaterialAlertDialog_Material3
|
this, com.google.android.material.R.style.MaterialAlertDialog_Material3
|
||||||
).setTitle("登录").setMessage(message).show()
|
).setTitle("登录").setMessage(message).show()
|
||||||
|
@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.blankj.utilcode.util.ResourceUtils
|
import com.blankj.utilcode.util.ResourceUtils
|
||||||
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.bean.LoginUserBean
|
import com.navinfo.omqs.bean.LoginUserBean
|
||||||
import com.navinfo.omqs.bean.SysUserBean
|
import com.navinfo.omqs.bean.SysUserBean
|
||||||
@ -17,6 +18,7 @@ import com.navinfo.omqs.http.DefaultResponse
|
|||||||
import com.navinfo.omqs.http.NetResult
|
import com.navinfo.omqs.http.NetResult
|
||||||
import com.navinfo.omqs.http.NetworkService
|
import com.navinfo.omqs.http.NetworkService
|
||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
|
import com.navinfo.omqs.util.DateTimeUtil
|
||||||
import com.navinfo.omqs.util.NetUtils
|
import com.navinfo.omqs.util.NetUtils
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
@ -37,6 +39,11 @@ enum class LoginStatus {
|
|||||||
*/
|
*/
|
||||||
LOGIN_STATUS_NET_OFFLINE_MAP,
|
LOGIN_STATUS_NET_OFFLINE_MAP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问任务列表
|
||||||
|
*/
|
||||||
|
LOGIN_STATUS_NET_GET_TASK_LIST,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化文件夹
|
* 初始化文件夹
|
||||||
*/
|
*/
|
||||||
@ -108,11 +115,12 @@ class LoginViewModel @Inject constructor(
|
|||||||
val userCodeCache = sharedPreferences?.getString("userCode", null)
|
val userCodeCache = sharedPreferences?.getString("userCode", null)
|
||||||
val userRealName = sharedPreferences?.getString("userRealName", null)
|
val userRealName = sharedPreferences?.getString("userRealName", null)
|
||||||
//增加缓存记录,不用每次连接网络登录
|
//增加缓存记录,不用每次连接网络登录
|
||||||
if (userNameCache != null && passwordCache != null && userCodeCache != null&&userRealName!=null) {
|
if (userNameCache != null && passwordCache != null && userCodeCache != null && userRealName != null) {
|
||||||
if (userNameCache == userName && passwordCache == password) {
|
if (userNameCache == userName && passwordCache == password) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
createUserFolder(context, userCodeCache,userRealName)
|
createUserFolder(context, userCodeCache, userRealName)
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
|
getOfflineCityList(context)
|
||||||
|
// loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -156,6 +164,14 @@ class LoginViewModel @Inject constructor(
|
|||||||
} else {
|
} else {
|
||||||
userCode = defaultUserResponse.obj?.userCode.toString()
|
userCode = defaultUserResponse.obj?.userCode.toString()
|
||||||
userRealName = defaultUserResponse.obj?.userName.toString()
|
userRealName = defaultUserResponse.obj?.userName.toString()
|
||||||
|
folderInit(
|
||||||
|
context = context,
|
||||||
|
userName = userName,
|
||||||
|
password = password,
|
||||||
|
userCode = userCode,
|
||||||
|
userRealName = userRealName
|
||||||
|
)
|
||||||
|
getOfflineCityList(context)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
@ -197,21 +213,13 @@ class LoginViewModel @Inject constructor(
|
|||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
//文件夹初始化
|
|
||||||
try {
|
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_INIT)
|
|
||||||
sharedPreferences?.edit()?.putString("userName", userName)?.commit()
|
|
||||||
sharedPreferences?.edit()?.putString("passWord", password)?.commit()
|
|
||||||
sharedPreferences?.edit()?.putString("userCode", userCode)?.commit()
|
|
||||||
sharedPreferences?.edit()?.putString("userRealName", userRealName)?.commit()
|
|
||||||
|
|
||||||
createUserFolder(context, userCode,userRealName)
|
|
||||||
} catch (e: IOException) {
|
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//假装解压文件等
|
/**
|
||||||
delay(1000)
|
* 获取离线地图
|
||||||
|
*/
|
||||||
|
private suspend fun getOfflineCityList(context: Context) {
|
||||||
|
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP)
|
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_OFFLINE_MAP)
|
||||||
when (val result = networkService.getOfflineMapCityList()) {
|
when (val result = networkService.getOfflineMapCityList()) {
|
||||||
is NetResult.Success -> {
|
is NetResult.Success -> {
|
||||||
@ -222,6 +230,7 @@ class LoginViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
roomAppDatabase.getOfflineMapDao().insertOrUpdate(result.data)
|
roomAppDatabase.getOfflineMapDao().insertOrUpdate(result.data)
|
||||||
}
|
}
|
||||||
|
getTaskList(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
is NetResult.Error<*> -> {
|
is NetResult.Error<*> -> {
|
||||||
@ -229,6 +238,7 @@ class LoginViewModel @Inject constructor(
|
|||||||
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
getTaskList(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
is NetResult.Failure<*> -> {
|
is NetResult.Failure<*> -> {
|
||||||
@ -236,18 +246,101 @@ class LoginViewModel @Inject constructor(
|
|||||||
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
getTaskList(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
is NetResult.Loading -> {}
|
is NetResult.Loading -> {}
|
||||||
else -> {}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取任务列表
|
||||||
|
*/
|
||||||
|
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) {
|
||||||
|
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
|
||||||
|
task.hadLinkDvoList = item.hadLinkDvoList
|
||||||
|
//已上传后不在更新操作时间
|
||||||
|
if (task.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
|
||||||
|
//赋值时间,用于查询过滤
|
||||||
|
task.operationTime = DateTimeUtil.getNowDate().time
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//赋值时间,用于查询过滤
|
||||||
|
task.operationTime = DateTimeUtil.getNowDate().time
|
||||||
|
}
|
||||||
|
realm.copyToRealmOrUpdate(task)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
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 -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化文件夹
|
||||||
|
*/
|
||||||
|
private fun folderInit(
|
||||||
|
context: Context,
|
||||||
|
userName: String,
|
||||||
|
password: String,
|
||||||
|
userCode: String,
|
||||||
|
userRealName: String
|
||||||
|
) {
|
||||||
|
//文件夹初始化
|
||||||
|
try {
|
||||||
|
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_INIT)
|
||||||
|
sharedPreferences?.edit()?.putString("userName", userName)?.commit()
|
||||||
|
sharedPreferences?.edit()?.putString("passWord", password)?.commit()
|
||||||
|
sharedPreferences?.edit()?.putString("userCode", userCode)?.commit()
|
||||||
|
sharedPreferences?.edit()?.putString("userRealName", userRealName)?.commit()
|
||||||
|
|
||||||
|
createUserFolder(context, userCode, userRealName)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建用户目录
|
* 创建用户目录
|
||||||
*/
|
*/
|
||||||
private fun createUserFolder(context: Context, userId: String,userRealName:String) {
|
private fun createUserFolder(context: Context, userId: String, userRealName: String) {
|
||||||
Constant.IS_VIDEO_SPEED = false
|
Constant.IS_VIDEO_SPEED = false
|
||||||
Constant.USER_ID = userId
|
Constant.USER_ID = userId
|
||||||
Constant.USER_REAL_NAME = userRealName
|
Constant.USER_REAL_NAME = userRealName
|
||||||
@ -269,6 +362,7 @@ class LoginViewModel @Inject constructor(
|
|||||||
.directory(userFolder)
|
.directory(userFolder)
|
||||||
.name("OMQS.realm")
|
.name("OMQS.realm")
|
||||||
.encryptionKey(password)
|
.encryptionKey(password)
|
||||||
|
.allowQueriesOnUiThread(true)
|
||||||
// .modules(Realm.getDefaultModule(), MyRealmModule())
|
// .modules(Realm.getDefaultModule(), MyRealmModule())
|
||||||
.schemaVersion(2)
|
.schemaVersion(2)
|
||||||
.build()
|
.build()
|
||||||
|
@ -59,6 +59,7 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.locationtech.jts.geom.Point
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
import org.oscim.core.MapPosition
|
import org.oscim.core.MapPosition
|
||||||
import org.oscim.layers.marker.MarkerItem
|
import org.oscim.layers.marker.MarkerItem
|
||||||
@ -173,7 +174,7 @@ class MainViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
private var bSelectPauseTrace = false
|
private var bSelectPauseTrace = false
|
||||||
|
|
||||||
private var linkIdCache = ""
|
var linkIdCache = ""
|
||||||
|
|
||||||
private var lastNiLocaion: NiLocation? = null
|
private var lastNiLocaion: NiLocation? = null
|
||||||
|
|
||||||
@ -189,6 +190,8 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
private var disTime: Long = 1000
|
private var disTime: Long = 1000
|
||||||
|
|
||||||
|
private var currentMapZoomLevel: Int = 0
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
||||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||||
@ -196,8 +199,13 @@ class MainViewModel @Inject constructor(
|
|||||||
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT -> liveDataCenterPoint.value =
|
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT -> liveDataCenterPoint.value =
|
||||||
mapPosition
|
mapPosition
|
||||||
}
|
}
|
||||||
|
if(mapController.mMapView.vtmMap.mapPosition.zoomLevel>=16){
|
||||||
|
|
||||||
|
}
|
||||||
|
currentMapZoomLevel = mapController.mMapView.vtmMap.mapPosition.zoomLevel
|
||||||
})
|
})
|
||||||
|
|
||||||
|
currentMapZoomLevel = mapController.mMapView.vtmMap.mapPosition.zoomLevel
|
||||||
|
|
||||||
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
||||||
|
|
||||||
@ -215,6 +223,8 @@ class MainViewModel @Inject constructor(
|
|||||||
//线选择状态
|
//线选择状态
|
||||||
if (bSelectRoad) {
|
if (bSelectRoad) {
|
||||||
captureLink(point)
|
captureLink(point)
|
||||||
|
} else {
|
||||||
|
captureItem(point)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,10 +392,11 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location.taskId = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1).toString()
|
location.taskId =
|
||||||
|
sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1).toString()
|
||||||
|
|
||||||
//判断如果是连接状态并处于录像模式,标记为有效点
|
//判断如果是连接状态并处于录像模式,标记为有效点
|
||||||
if (shareUtil?.connectstate == true&&shareUtil?.takeCameraMode==0) {
|
if (shareUtil?.connectstate == true && shareUtil?.takeCameraMode == 0) {
|
||||||
location.media = 1
|
location.media = 1
|
||||||
}
|
}
|
||||||
var disance = 0.0
|
var disance = 0.0
|
||||||
@ -432,6 +443,23 @@ class MainViewModel @Inject constructor(
|
|||||||
mapController.layerManagerHandler.showNiLocationLayer()
|
mapController.layerManagerHandler.showNiLocationLayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 捕捉要素数据
|
||||||
|
*/
|
||||||
|
private suspend fun captureItem(point: GeoPoint) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
val itemList = realmOperateHelper.queryElement(
|
||||||
|
GeometryTools.createPoint(
|
||||||
|
point.longitude,
|
||||||
|
point.latitude
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if(itemList.size == 1){
|
||||||
|
SignUtil.getSignNameText(itemList[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 捕获道路和面板
|
* 捕获道路和面板
|
||||||
|
@ -6,8 +6,10 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.OnClickListener
|
import android.view.View.OnClickListener
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.transition.AutoTransition
|
import androidx.transition.AutoTransition
|
||||||
import androidx.transition.Scene
|
import androidx.transition.Scene
|
||||||
import androidx.transition.TransitionManager
|
import androidx.transition.TransitionManager
|
||||||
@ -15,11 +17,8 @@ import com.navinfo.omqs.R
|
|||||||
import com.navinfo.omqs.databinding.FragmentConsoleBinding
|
import com.navinfo.omqs.databinding.FragmentConsoleBinding
|
||||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||||
import com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultFragment
|
|
||||||
import com.navinfo.omqs.ui.fragment.layermanager.LayerManagerFragment
|
import com.navinfo.omqs.ui.fragment.layermanager.LayerManagerFragment
|
||||||
import com.navinfo.omqs.ui.fragment.offlinemap.OfflineMapFragment
|
|
||||||
import com.navinfo.omqs.ui.fragment.personalcenter.PersonalCenterFragment
|
import com.navinfo.omqs.ui.fragment.personalcenter.PersonalCenterFragment
|
||||||
import com.navinfo.omqs.ui.fragment.qsrecordlist.QsRecordListFragment
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@ -33,6 +32,8 @@ class ConsoleFragment : BaseFragment(), OnClickListener {
|
|||||||
private var mFragment: Fragment? = null
|
private var mFragment: Fragment? = null
|
||||||
private val fragmentId = R.id.console_fragment
|
private val fragmentId = R.id.console_fragment
|
||||||
|
|
||||||
|
private val viewModel by viewModels<ConsoleViewModel>()
|
||||||
|
|
||||||
// 创建a场景
|
// 创建a场景
|
||||||
private val aScene by lazy {
|
private val aScene by lazy {
|
||||||
Scene.getSceneForLayout(
|
Scene.getSceneForLayout(
|
||||||
@ -72,6 +73,7 @@ class ConsoleFragment : BaseFragment(), OnClickListener {
|
|||||||
|
|
||||||
override fun onTransitionEnd(transition: androidx.transition.Transition) {
|
override fun onTransitionEnd(transition: androidx.transition.Transition) {
|
||||||
initOnClickListener()
|
initOnClickListener()
|
||||||
|
initLiveData()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransitionCancel(transition: androidx.transition.Transition) {
|
override fun onTransitionCancel(transition: androidx.transition.Transition) {
|
||||||
@ -95,6 +97,7 @@ class ConsoleFragment : BaseFragment(), OnClickListener {
|
|||||||
|
|
||||||
override fun onTransitionEnd(transition: androidx.transition.Transition) {
|
override fun onTransitionEnd(transition: androidx.transition.Transition) {
|
||||||
initOnClickListener()
|
initOnClickListener()
|
||||||
|
initLiveData()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransitionCancel(transition: androidx.transition.Transition) {
|
override fun onTransitionCancel(transition: androidx.transition.Transition) {
|
||||||
@ -108,8 +111,26 @@ class ConsoleFragment : BaseFragment(), OnClickListener {
|
|||||||
|
|
||||||
})
|
})
|
||||||
initOnClickListener()
|
initOnClickListener()
|
||||||
|
|
||||||
|
initLiveData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initLiveData(){
|
||||||
|
/**
|
||||||
|
* 任务数量统计
|
||||||
|
*/
|
||||||
|
viewModel.liveDataTaskCount.observe(viewLifecycleOwner) {
|
||||||
|
binding.consoleRoot.findViewById<TextView>(R.id.console_task_count_text).text =
|
||||||
|
"共 ${it} 条"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 评测数据数量统计
|
||||||
|
*/
|
||||||
|
viewModel.liveDataEvaluationResultCount.observe(viewLifecycleOwner) {
|
||||||
|
binding.consoleRoot.findViewById<TextView>(R.id.console_evaluation_count_text).text =
|
||||||
|
"共 ${it} 条"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置点击事件
|
* 设置点击事件
|
||||||
@ -193,12 +214,13 @@ class ConsoleFragment : BaseFragment(), OnClickListener {
|
|||||||
R.id.console_personal_center_bg, R.id.console_personal_center_icon_bg -> {
|
R.id.console_personal_center_bg, R.id.console_personal_center_icon_bg -> {
|
||||||
if (sceneFlag) {
|
if (sceneFlag) {
|
||||||
mFragment = PersonalCenterFragment {
|
mFragment = PersonalCenterFragment {
|
||||||
if(it){
|
if (it) {
|
||||||
activity?.let { a ->
|
activity?.let { a ->
|
||||||
a.supportFragmentManager.beginTransaction().remove(this).commit()
|
a.supportFragmentManager.beginTransaction().remove(this)
|
||||||
|
.commit()
|
||||||
(a as MainActivity).showIndoorDataLayout()
|
(a as MainActivity).showIndoorDataLayout()
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
TransitionManager.go(aScene, aTransition)
|
TransitionManager.go(aScene, aTransition)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,12 +230,13 @@ class ConsoleFragment : BaseFragment(), OnClickListener {
|
|||||||
} else {
|
} else {
|
||||||
if (mFragment !is PersonalCenterFragment) {
|
if (mFragment !is PersonalCenterFragment) {
|
||||||
mFragment = PersonalCenterFragment {
|
mFragment = PersonalCenterFragment {
|
||||||
if(it){
|
if (it) {
|
||||||
activity?.let { a ->
|
activity?.let { a ->
|
||||||
a.supportFragmentManager.beginTransaction().remove(this).commit()
|
a.supportFragmentManager.beginTransaction().remove(this)
|
||||||
|
.commit()
|
||||||
(a as MainActivity).showIndoorDataLayout()
|
(a as MainActivity).showIndoorDataLayout()
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
TransitionManager.go(aScene, aTransition)
|
TransitionManager.go(aScene, aTransition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.navinfo.omqs.ui.fragment.console
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
|
import com.navinfo.omqs.tools.FileManager
|
||||||
|
import com.navinfo.omqs.util.DateTimeUtil
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import io.realm.Realm
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class ConsoleViewModel @Inject constructor() : ViewModel() {
|
||||||
|
/**
|
||||||
|
* 当前任务量统计
|
||||||
|
*/
|
||||||
|
val liveDataTaskCount = MutableLiveData(0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作业数据统计
|
||||||
|
*/
|
||||||
|
val liveDataEvaluationResultCount = MutableLiveData(0)
|
||||||
|
|
||||||
|
init {
|
||||||
|
viewModelScope.launch {
|
||||||
|
val realm = Realm.getDefaultInstance()
|
||||||
|
val nowTime: Long = DateTimeUtil.getNowDate().time
|
||||||
|
val beginNowTime: Long = nowTime - 90 * 3600 * 24 * 1000L
|
||||||
|
val syncUpload: Int = FileManager.Companion.FileUploadStatus.DONE
|
||||||
|
val count =
|
||||||
|
realm.where(TaskBean::class.java).notEqualTo("syncStatus", syncUpload).or()
|
||||||
|
.between("operationTime", beginNowTime, nowTime)
|
||||||
|
.equalTo("syncStatus", syncUpload).count()
|
||||||
|
liveDataTaskCount.postValue(count.toInt())
|
||||||
|
val count2 = realm.where(QsRecordBean::class.java).count()
|
||||||
|
liveDataEvaluationResultCount.postValue(count2.toInt())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -444,10 +444,11 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
fun initData(id: String) {
|
fun initData(id: String) {
|
||||||
|
Log.e("jingo", "捕捉到的要素 id = $id")
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
|
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
|
|
||||||
val objects = realm.where(QsRecordBean::class.java).equalTo("id", id).findFirst()
|
val objects = realm.where(QsRecordBean::class.java).equalTo("id", id).findFirst()
|
||||||
Log.e("jingo", "查询数据 id= $id")
|
Log.e("jingo", "查询数据 id= $id")
|
||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
@ -491,10 +492,10 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
} else {
|
} else {
|
||||||
liveDataToastMessage.postValue("数据读取失败")
|
liveDataToastMessage.postValue("数据读取失败")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询问题类型列表
|
* 查询问题类型列表
|
||||||
*/
|
*/
|
||||||
private suspend fun getChatMsgEntityList() {
|
private suspend fun getChatMsgEntityList() {
|
||||||
@ -509,9 +510,9 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
listDataChatMsgEntityList.postValue(chatMsgEntityList)
|
listDataChatMsgEntityList.postValue(chatMsgEntityList)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addChatMsgEntity(filePath: String) {
|
fun addChatMsgEntity(filePath: String) {
|
||||||
|
|
||||||
if (filePath.isNotEmpty()) {
|
if (filePath.isNotEmpty()) {
|
||||||
var chatMsgEntityList: MutableList<ChatMsgEntity> = ArrayList()
|
var chatMsgEntityList: MutableList<ChatMsgEntity> = ArrayList()
|
||||||
@ -539,9 +540,9 @@ fun addChatMsgEntity(filePath: String) {
|
|||||||
|
|
||||||
listDataChatMsgEntityList.postValue(chatMsgEntityList)
|
listDataChatMsgEntityList.postValue(chatMsgEntityList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun startSoundMetter(activity: Activity, v: View) {
|
fun startSoundMetter(activity: Activity, v: View) {
|
||||||
|
|
||||||
if (mSpeakMode == null) {
|
if (mSpeakMode == null) {
|
||||||
mSpeakMode = SpeakMode(activity)
|
mSpeakMode = SpeakMode(activity)
|
||||||
@ -602,11 +603,11 @@ fun startSoundMetter(activity: Activity, v: View) {
|
|||||||
mSoundMeter!!.start(Constant.USER_DATA_ATTACHEMNT_PATH + name)
|
mSoundMeter!!.start(Constant.USER_DATA_ATTACHEMNT_PATH + name)
|
||||||
ToastUtils.showLong("开始录音")
|
ToastUtils.showLong("开始录音")
|
||||||
mSpeakMode!!.speakText("开始录音")
|
mSpeakMode!!.speakText("开始录音")
|
||||||
}
|
}
|
||||||
|
|
||||||
//停止语音录制
|
//停止语音录制
|
||||||
@RequiresApi(api = Build.VERSION_CODES.Q)
|
@RequiresApi(api = Build.VERSION_CODES.Q)
|
||||||
fun stopSoundMeter() {
|
fun stopSoundMeter() {
|
||||||
//先重置标识,防止按钮抬起时触发语音结束
|
//先重置标识,防止按钮抬起时触发语音结束
|
||||||
Constant.IS_VIDEO_SPEED = false
|
Constant.IS_VIDEO_SPEED = false
|
||||||
if (mSoundMeter != null && mSoundMeter!!.isStartSound) {
|
if (mSoundMeter != null && mSoundMeter!!.isStartSound) {
|
||||||
@ -617,10 +618,10 @@ fun stopSoundMeter() {
|
|||||||
it.dismiss()
|
it.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun savePhoto(bitmap: Bitmap) {
|
fun savePhoto(bitmap: Bitmap) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
// 创建一个名为 "MyApp" 的文件夹
|
// 创建一个名为 "MyApp" 的文件夹
|
||||||
val myAppDir = File(Constant.USER_DATA_ATTACHEMNT_PATH)
|
val myAppDir = File(Constant.USER_DATA_ATTACHEMNT_PATH)
|
||||||
@ -651,15 +652,20 @@ fun savePhoto(bitmap: Bitmap) {
|
|||||||
* 监听任务选择变化
|
* 监听任务选择变化
|
||||||
*/
|
*/
|
||||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||||
if (key == Constant.SELECT_TASK_ID && oldBean == null) {
|
if (key == Constant.SELECT_TASK_ID) {
|
||||||
|
if (oldBean == null) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val taskId = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
val taskId = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
val objects = realm.where(TaskBean::class.java).equalTo("id", taskId).findFirst()
|
val objects =
|
||||||
|
realm.where(TaskBean::class.java).equalTo("id", taskId).findFirst()
|
||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
liveDataTaskBean.postValue(realm.copyFromRealm(objects))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
liveDataFinish.postValue(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -5,6 +5,7 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.databinding.AdapterOfflineMapCityBinding
|
import com.navinfo.omqs.databinding.AdapterOfflineMapCityBinding
|
||||||
@ -14,6 +15,7 @@ import com.navinfo.omqs.tools.FileManager
|
|||||||
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
||||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||||
|
import com.navinfo.omqs.ui.other.OnLifecycleStateListener
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +70,26 @@ class OfflineMapCityListAdapter(
|
|||||||
|
|
||||||
changeViews(binding, cityBean)
|
changeViews(binding, cityBean)
|
||||||
downloadManager.addTask(cityBean)
|
downloadManager.addTask(cityBean)
|
||||||
downloadManager.observer(cityBean.id, holder, DownloadObserver(cityBean.id, holder))
|
|
||||||
|
holder.addObserver(object : OnLifecycleStateListener {
|
||||||
|
override fun onState(tag: String, state: Lifecycle.State) {
|
||||||
|
when (state) {
|
||||||
|
Lifecycle.State.STARTED -> {
|
||||||
|
downloadManager.observer(
|
||||||
|
cityBean.id,
|
||||||
|
holder,
|
||||||
|
DownloadObserver(cityBean.id, holder)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Lifecycle.State.DESTROYED -> {
|
||||||
|
downloadManager.removeObserver(cityBean.id)
|
||||||
|
}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
binding.offlineMapDownloadBtn.tag = position
|
binding.offlineMapDownloadBtn.tag = position
|
||||||
binding.offlineMapDownloadBtn.setOnClickListener(downloadBtnClick)
|
binding.offlineMapDownloadBtn.setOnClickListener(downloadBtnClick)
|
||||||
binding.offlineMapCityName.text = cityBean.name
|
binding.offlineMapCityName.text = cityBean.name
|
||||||
|
@ -51,6 +51,23 @@ class OfflineMapCityListFragment : Fragment() {
|
|||||||
viewModel.cityListLiveData.observe(viewLifecycleOwner) {
|
viewModel.cityListLiveData.observe(viewLifecycleOwner) {
|
||||||
adapter.refreshData(it)
|
adapter.refreshData(it)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
viewModel.getCityList()
|
viewModel.getCityList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,18 @@ class OfflineMapStateListFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
_binding = null
|
_binding = null
|
||||||
|
@ -29,12 +29,7 @@ class OfflineMapStateListViewModel @Inject constructor(
|
|||||||
fun getCityList() {
|
fun getCityList() {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val list = roomDatabase.getOfflineMapDao().getOfflineMapListWithOutNone()
|
val list = roomDatabase.getOfflineMapDao().getOfflineMapListWithOutNone()
|
||||||
if (cityListLiveData.value != null) {
|
|
||||||
if (cityListLiveData.value!!.size != list.size)
|
|
||||||
cityListLiveData.postValue(list)
|
cityListLiveData.postValue(list)
|
||||||
}else{
|
|
||||||
cityListLiveData.postValue(list)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,8 +5,11 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
|
import com.navinfo.omqs.bean.SignBean
|
||||||
import com.navinfo.omqs.databinding.FragmentSignInfoBinding
|
import com.navinfo.omqs.databinding.FragmentSignInfoBinding
|
||||||
import com.navinfo.omqs.ui.activity.map.MainViewModel
|
import com.navinfo.omqs.ui.activity.map.MainViewModel
|
||||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||||
@ -53,7 +56,7 @@ class SignMoreInfoFragment : BaseFragment() {
|
|||||||
adapter.refreshData(SignUtil.getRoadNameList(it))
|
adapter.refreshData(SignUtil.getRoadNameList(it))
|
||||||
}
|
}
|
||||||
//常规点限速
|
//常规点限速
|
||||||
4002->{
|
4002 -> {
|
||||||
val adapter = ElectronicEyeInfoAdapter()
|
val adapter = ElectronicEyeInfoAdapter()
|
||||||
binding.signInfoRecyclerview.adapter = adapter
|
binding.signInfoRecyclerview.adapter = adapter
|
||||||
adapter.refreshData(SignUtil.getSpeedLimitMoreInfoText(it))
|
adapter.refreshData(SignUtil.getSpeedLimitMoreInfoText(it))
|
||||||
@ -91,6 +94,33 @@ class SignMoreInfoFragment : BaseFragment() {
|
|||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.signInfoTitle.setOnClickListener {
|
||||||
|
activity?.run {
|
||||||
|
val rightController = findNavController(R.id.main_activity_right_fragment)
|
||||||
|
rightController.currentDestination?.let {
|
||||||
|
if (it.id == R.id.RightEmptyFragment) {
|
||||||
|
val bundle = Bundle()
|
||||||
|
val element = viewModel.liveDataSignMoreInfo.value
|
||||||
|
if (element != null) {
|
||||||
|
val signBean = SignBean(
|
||||||
|
iconId = SignUtil.getSignIcon(element),
|
||||||
|
iconText = SignUtil.getSignIconText(element),
|
||||||
|
linkId = element.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||||
|
?: "",
|
||||||
|
name = SignUtil.getSignNameText(element),
|
||||||
|
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||||
|
renderEntity = element,
|
||||||
|
isMoreInfo = SignUtil.isMoreInfo(element),
|
||||||
|
index = SignUtil.getRoadInfoIndex(element)
|
||||||
|
)
|
||||||
|
bundle.putParcelable("SignBean", signBean)
|
||||||
|
bundle.putBoolean("AutoSave", false)
|
||||||
|
rightController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -306,7 +306,11 @@ class TaskListAdapter(
|
|||||||
binding.taskProgressText.text =
|
binding.taskProgressText.text =
|
||||||
"$progress%"
|
"$progress%"
|
||||||
binding.taskDownloadBtn.setProgress(progress)
|
binding.taskDownloadBtn.setProgress(progress)
|
||||||
|
} else {
|
||||||
|
binding.taskDownloadBtn.setProgress(0)
|
||||||
|
binding.taskProgressText.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
when (taskBean.status) {
|
when (taskBean.status) {
|
||||||
FileDownloadStatus.NONE -> {
|
FileDownloadStatus.NONE -> {
|
||||||
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
|
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
|
@ -95,55 +95,6 @@ class TaskViewModel @Inject constructor(
|
|||||||
fun getTaskList(context: Context) {
|
fun getTaskList(context: Context) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|
||||||
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) {
|
|
||||||
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
|
|
||||||
task.hadLinkDvoList = item.hadLinkDvoList
|
|
||||||
//已上传后不在更新操作时间
|
|
||||||
if (task.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
|
|
||||||
//赋值时间,用于查询过滤
|
|
||||||
task.operationTime = DateTimeUtil.getNowDate().time
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//赋值时间,用于查询过滤
|
|
||||||
task.operationTime = DateTimeUtil.getNowDate().time
|
|
||||||
}
|
|
||||||
realm.copyToRealmOrUpdate(task)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is NetResult.Error<*> -> {
|
|
||||||
withContext(Dispatchers.Main) {
|
|
||||||
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is NetResult.Failure<*> -> {
|
|
||||||
withContext(Dispatchers.Main) {
|
|
||||||
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is NetResult.Loading -> {}
|
|
||||||
}
|
|
||||||
getLocalTaskList()
|
getLocalTaskList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.omqs.ui.other
|
package com.navinfo.omqs.ui.other
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
|
@ -80,6 +80,8 @@ class SignUtil {
|
|||||||
2008 -> "种别"
|
2008 -> "种别"
|
||||||
//道路方向
|
//道路方向
|
||||||
2010 -> "方向"
|
2010 -> "方向"
|
||||||
|
//车道边界类型
|
||||||
|
2013 -> "车道边界类型"
|
||||||
//常规线限速
|
//常规线限速
|
||||||
2019 -> "线限速"
|
2019 -> "线限速"
|
||||||
//车道数
|
//车道数
|
||||||
@ -404,7 +406,16 @@ class SignUtil {
|
|||||||
return stringBuffer.toString()
|
return stringBuffer.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车道边界线详细信息
|
||||||
|
*/
|
||||||
|
fun getLaneBoundaryInfo(data:RenderEntity){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取道路名列表
|
||||||
|
*/
|
||||||
fun getRoadNameList(data: RenderEntity): MutableList<RoadNameBean> {
|
fun getRoadNameList(data: RenderEntity): MutableList<RoadNameBean> {
|
||||||
val list = mutableListOf<RoadNameBean>()
|
val list = mutableListOf<RoadNameBean>()
|
||||||
if (data.code == 2011) {
|
if (data.code == 2011) {
|
||||||
|
@ -234,7 +234,7 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/main_activity_geometry"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_bottom_sheet"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/main_activity_top_sign_recyclerview" />
|
app:layout_constraintLeft_toLeftOf="@id/main_activity_top_sign_recyclerview" />
|
||||||
|
|
||||||
|
|
||||||
@ -387,7 +387,7 @@
|
|||||||
<View
|
<View
|
||||||
android:id="@+id/main_activity_bottom_sheet"
|
android:id="@+id/main_activity_bottom_sheet"
|
||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="30dp"
|
||||||
android:background="@drawable/baseline_minimize_24"
|
android:background="@drawable/baseline_minimize_24"
|
||||||
android:onClick="@{()->mainActivity.onSwitchSheet()}"
|
android:onClick="@{()->mainActivity.onSwitchSheet()}"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="10dp"
|
||||||
|
@ -338,7 +338,6 @@
|
|||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="共 387 条"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/console_task_count_bg"
|
app:layout_constraintBottom_toBottomOf="@id/console_task_count_bg"
|
||||||
@ -384,7 +383,6 @@
|
|||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="共 387 条"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/console_evaluation_count_bg"
|
app:layout_constraintBottom_toBottomOf="@id/console_evaluation_count_bg"
|
||||||
|
@ -343,7 +343,6 @@
|
|||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="共 387 条"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/console_task_count_bg"
|
app:layout_constraintBottom_toBottomOf="@id/console_task_count_bg"
|
||||||
@ -390,7 +389,6 @@
|
|||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="共 387 条"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/console_evaluation_count_bg"
|
app:layout_constraintBottom_toBottomOf="@id/console_evaluation_count_bg"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#f4f4f4"
|
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#bfbfbf"
|
||||||
version="1" xmlns="http://opensciencemap.org/rendertheme" xsi:schemaLocation="http://opensciencemap.org/rendertheme
|
version="1" xmlns="http://opensciencemap.org/rendertheme" xsi:schemaLocation="http://opensciencemap.org/rendertheme
|
||||||
https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
|
https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
|
||||||
|
|
||||||
@ -1483,18 +1483,18 @@
|
|||||||
|
|
||||||
<m k="qi_table">
|
<m k="qi_table">
|
||||||
<!-- 道路线 -->
|
<!-- 道路线 -->
|
||||||
<m v="OMDB_RD_LINK" zoom-max="19">
|
<m v="OMDB_RD_LINK">
|
||||||
<line stroke="#9c9c9c" width="1" />
|
<line stroke="#9c9c9c" width="1" />
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 检查点 -->
|
<!-- 检查点 -->
|
||||||
<m v="OMDB_CHECKPOINT" zoom-max="19">
|
<m v="OMDB_CHECKPOINT">
|
||||||
<symbol src="assets:omdb/icon_1012_0.svg" symbol-height="64"
|
<symbol src="assets:omdb/icon_1012_0.svg" symbol-height="64"
|
||||||
symbol-width="64"></symbol>
|
symbol-width="64"></symbol>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--道路种别-->
|
<!--道路种别-->
|
||||||
<m v="OMDB_RD_LINK_KIND" zoom-max="19">
|
<m v="OMDB_RD_LINK_KIND">
|
||||||
<outline-layer id="kind0" stroke="#44000000" width="0.1" />
|
<outline-layer id="kind0" stroke="#44000000" width="0.1" />
|
||||||
<outline-layer id="kind1" stroke="#aa807040" width="0.1" />
|
<outline-layer id="kind1" stroke="#aa807040" width="0.1" />
|
||||||
<m k="kind" v="1">
|
<m k="kind" v="1">
|
||||||
@ -1527,7 +1527,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--常规点限速-->
|
<!--常规点限速-->
|
||||||
<m v="OMDB_SPEEDLIMIT" zoom-max="19">
|
<m v="OMDB_SPEEDLIMIT">
|
||||||
<m k="speedFlag" v="0">
|
<m k="speedFlag" v="0">
|
||||||
<caption fill="#000000" k="maxSpeed" priority="0" size="12" stroke="#ffffff"
|
<caption fill="#000000" k="maxSpeed" priority="0" size="12" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
@ -1559,7 +1559,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--可变点限速-->
|
<!--可变点限速-->
|
||||||
<m v="OMDB_SPEEDLIMIT_VAR" zoom-max="19">
|
<m v="OMDB_SPEEDLIMIT_VAR" >
|
||||||
<m k="speedFlag" v="0">
|
<m k="speedFlag" v="0">
|
||||||
<caption fill="#000000" k="maxSpeed" priority="0" size="12" stroke="#ffffff"
|
<caption fill="#000000" k="maxSpeed" priority="0" size="12" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
@ -1575,14 +1575,14 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--车道中心线-->
|
<!--车道中心线-->
|
||||||
<m v="OMDB_LANE_LINK_LG" zoom-min="20">
|
<m v="OMDB_LANE_LINK_LG">
|
||||||
<m k="width" v="~">
|
<m k="width" v="~">
|
||||||
<line stroke="#7A88A0" width="5" />
|
<line stroke="#7A88A0" width="5" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 道路边界类型 -->
|
<!-- 道路边界类型 -->
|
||||||
<m v="OMDB_RDBOUND_BOUNDARYTYPE" zoom-min="20">
|
<m v="OMDB_RDBOUND_BOUNDARYTYPE">
|
||||||
<outline-layer id="boundaryType" stroke="#8e44ad" width="0.1" />
|
<outline-layer id="boundaryType" stroke="#8e44ad" width="0.1" />
|
||||||
<m k="boundaryType" v="0|2|3|4|5|6|7|8|9">
|
<m k="boundaryType" v="0|2|3|4|5|6|7|8|9">
|
||||||
<line stroke="#ffffff" use="boundaryType" width="0.1"/>
|
<line stroke="#ffffff" use="boundaryType" width="0.1"/>
|
||||||
@ -1594,7 +1594,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 车道边界类型 -->
|
<!-- 车道边界类型 -->
|
||||||
<m v="OMDB_LANE_MARK_BOUNDARYTYPE" zoom-min="20">
|
<m v="OMDB_LANE_MARK_BOUNDARYTYPE">
|
||||||
<outline-layer id="boundary" stroke="#ffffff" width="0.1" />
|
<outline-layer id="boundary" stroke="#ffffff" width="0.1" />
|
||||||
<m k="boundaryType" v="2">
|
<m k="boundaryType" v="2">
|
||||||
<!--标线-->
|
<!--标线-->
|
||||||
@ -1657,7 +1657,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--隧道-->
|
<!--隧道-->
|
||||||
<m v="OMDB_TUNNEL" zoom-max="19">
|
<m v="OMDB_TUNNEL">
|
||||||
<m k="formOfWay">
|
<m k="formOfWay">
|
||||||
<line dasharray="0.2,0.2" stroke="#d4237a" width="0.2" />
|
<line dasharray="0.2,0.2" stroke="#d4237a" width="0.2" />
|
||||||
</m>
|
</m>
|
||||||
@ -1684,13 +1684,13 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--交通灯-->
|
<!--交通灯-->
|
||||||
<m v="OMDB_TRAFFICLIGHT" zoom-max="19">
|
<m v="OMDB_TRAFFICLIGHT">
|
||||||
<symbol repeat="false" rotate="false" src="assets:omdb/icon_4022_0.svg"
|
<symbol repeat="false" rotate="false" src="assets:omdb/icon_4022_0.svg"
|
||||||
symbol-height="69" symbol-width="69"></symbol>
|
symbol-height="69" symbol-width="69"></symbol>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--普通交限-->
|
<!--普通交限-->
|
||||||
<m v="OMDB_RESTRICTION" zoom-max="19">
|
<m v="OMDB_RESTRICTION">
|
||||||
<m k="angle">
|
<m k="angle">
|
||||||
<symbol repeat="false" repeat-start="0" rotate="false"
|
<symbol repeat="false" repeat-start="0" rotate="false"
|
||||||
src="assets:omdb/icon_4006_0.svg" symbol-height="69" symbol-width="69"></symbol>
|
src="assets:omdb/icon_4006_0.svg" symbol-height="69" symbol-width="69"></symbol>
|
||||||
@ -1706,7 +1706,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!--电子眼-->
|
<!--电子眼-->
|
||||||
<m v="OMDB_ELECTRONICEYE" zoom-max="19">
|
<m v="OMDB_ELECTRONICEYE">
|
||||||
<caption dy="-30" fill="#000000" k="name" priority="0" size="14"
|
<caption dy="-30" fill="#000000" k="name" priority="0" size="14"
|
||||||
stroke="#ffffff" stroke-width="1.0"></caption>
|
stroke="#ffffff" stroke-width="1.0"></caption>
|
||||||
<m k="type" v="angle">
|
<m k="type" v="angle">
|
||||||
@ -1719,7 +1719,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 路口 -->
|
<!-- 路口 -->
|
||||||
<m v="OMDB_INTERSECTION" zoom-max="19">
|
<m v="OMDB_INTERSECTION">
|
||||||
<m k="type" v="node">
|
<m k="type" v="node">
|
||||||
<symbol src="assets:symbols/dot_blue_dark.svg"></symbol>
|
<symbol src="assets:symbols/dot_blue_dark.svg"></symbol>
|
||||||
</m>
|
</m>
|
||||||
@ -1734,7 +1734,7 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 车信 -->
|
<!-- 车信 -->
|
||||||
<m v="OMDB_LANEINFO" zoom-max="19">
|
<m v="OMDB_LANEINFO" >
|
||||||
<m k="currentType" v="0">
|
<m k="currentType" v="0">
|
||||||
<m k="currentDirect" v="1">
|
<m k="currentDirect" v="1">
|
||||||
<symbol repeat="false" repeat-start="0" repeat-gap="2000"
|
<symbol repeat="false" repeat-start="0" repeat-gap="2000"
|
||||||
|
@ -604,11 +604,10 @@ public final class NIMapView extends RelativeLayout {
|
|||||||
BASE(0)/*底图图层组*/,
|
BASE(0)/*底图图层组*/,
|
||||||
VECTOR_TILE(1)/*矢量瓦片组*/,
|
VECTOR_TILE(1)/*矢量瓦片组*/,
|
||||||
VECTOR(2)/*高亮组*/,
|
VECTOR(2)/*高亮组*/,
|
||||||
OPERATE_LINE(3)/*操作图层组*/,
|
NAVIGATION(3)/*定位导航组*/,
|
||||||
OPERATE_MARKER(4)/*操作图层组*/,
|
LABEL(4)/*图标,文字图层*/,
|
||||||
NAVIGATION(5)/*定位导航组*/,
|
OPERATE_LINE(5)/*操作图层组*/,
|
||||||
LABEL(6)/*图标,文字图层*/;
|
OPERATE_MARKER(6)/*操作图层组*/;
|
||||||
|
|
||||||
int groupIndex;
|
int groupIndex;
|
||||||
|
|
||||||
LAYER_GROUPS(int groupIndex) {
|
LAYER_GROUPS(int groupIndex) {
|
||||||
|
@ -61,7 +61,7 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
public boolean decode(int zoomLevel,Tile tile, ITileDataSink sink, List<RenderEntity> listResult) {
|
public boolean decode(int mapLevel,Tile tile, ITileDataSink sink, List<RenderEntity> listResult) {
|
||||||
mTileDataSink = sink;
|
mTileDataSink = sink;
|
||||||
mTileScale = 1 << tile.zoomLevel;
|
mTileScale = 1 << tile.zoomLevel;
|
||||||
mTileX = tile.tileX / mTileScale;
|
mTileX = tile.tileX / mTileScale;
|
||||||
@ -71,10 +71,12 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
listResult.stream().iterator().forEachRemaining(new Consumer<RenderEntity>() {
|
listResult.stream().iterator().forEachRemaining(new Consumer<RenderEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void accept(RenderEntity renderEntity) {
|
public void accept(RenderEntity renderEntity) {
|
||||||
if(zoomLevel>=renderEntity.getZoomMin()&&zoomLevel<=renderEntity.getZoomMax()){
|
if(!(mapLevel<renderEntity.getZoomMin()||mapLevel>renderEntity.getZoomMax())){
|
||||||
Map<String, Object> properties= new HashMap<>(renderEntity.getProperties().size());
|
Map<String, Object> properties= new HashMap<>(renderEntity.getProperties().size());
|
||||||
properties.putAll(renderEntity.getProperties());
|
properties.putAll(renderEntity.getProperties());
|
||||||
parseGeometry(renderEntity.getTable(), renderEntity.getWkt(), properties);
|
parseGeometry(renderEntity.getTable(), renderEntity.getWkt(), properties);
|
||||||
|
}else{
|
||||||
|
Log.e("qj","render"+renderEntity.name+"=="+renderEntity.getZoomMin()+"==="+renderEntity.getZoomMax());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -186,4 +188,10 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
if (!hasName && fallbackName != null)
|
if (!hasName && fallbackName != null)
|
||||||
mMapElement.tags.add(new Tag(Tag.KEY_NAME, fallbackName, false));
|
mMapElement.tags.add(new Tag(Tag.KEY_NAME, fallbackName, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clean(){
|
||||||
|
if(mTileDataSink!=null){
|
||||||
|
mTileDataSink.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class OMDBReferenceDecoder extends TileDecoder {
|
|||||||
listResult.stream().iterator().forEachRemaining(new Consumer<ReferenceEntity>() {
|
listResult.stream().iterator().forEachRemaining(new Consumer<ReferenceEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void accept(ReferenceEntity renderEntity) {
|
public void accept(ReferenceEntity renderEntity) {
|
||||||
if(mapLevel>=renderEntity.getZoomMin()&&mapLevel<=renderEntity.getZoomMax()){
|
if(!(mapLevel<renderEntity.getZoomMin()||mapLevel>renderEntity.getZoomMax())){
|
||||||
Map<String, Object> properties= new HashMap<>(renderEntity.getProperties().size());
|
Map<String, Object> properties= new HashMap<>(renderEntity.getProperties().size());
|
||||||
properties.putAll(renderEntity.getProperties());
|
properties.putAll(renderEntity.getProperties());
|
||||||
parseGeometry(renderEntity.getTable(), renderEntity.getWkt(), properties);
|
parseGeometry(renderEntity.getTable(), renderEntity.getWkt(), properties);
|
||||||
|
@ -31,7 +31,7 @@ public class Constant {
|
|||||||
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
||||||
public static final int OVER_ZOOM = 21;
|
public static final int OVER_ZOOM = 21;
|
||||||
public static final int MAX_ZOOM = 23;
|
public static final int MAX_ZOOM = 23;
|
||||||
public static final int OMDB_MIN_ZOOM = 18;
|
public static final int OMDB_MIN_ZOOM = 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务器地址
|
* 服务器地址
|
||||||
|
Loading…
x
Reference in New Issue
Block a user