Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskViewModel.kt
@ -94,7 +94,15 @@
|
||||
"2202":{
|
||||
"table": "OMDB_TUNNEL",
|
||||
"code": 2202,
|
||||
"name": "隧道"
|
||||
"name": "隧道",
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "generateS2EReferencePoint()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"4001": {
|
||||
"table": "OMDB_INTERSECTION",
|
||||
@ -269,7 +277,15 @@
|
||||
"5001":{
|
||||
"table": "OMDB_LANE_LINK_LG",
|
||||
"code": 5001,
|
||||
"name": "车道中心线"
|
||||
"name": "车道中心线",
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "generateAddWidthLine()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"5002":{
|
||||
"table": "OMDB_AREA",
|
||||
|
||||
@ -51,10 +51,10 @@ data class EvaluationInfo(
|
||||
val evaluationWay: Int = 2,//测评方式 1生产测评 2现场测评 服务字段定义为Integer,使用包装类,对应无值情况为空
|
||||
|
||||
@SerializedName("roadClassfcation")
|
||||
val roadClassfcation: String = "",//道路种别
|
||||
val roadClassfcation: Int = 1,//道路种别
|
||||
|
||||
@SerializedName("roadFunctionGrade")
|
||||
val roadFunctionGrade: String = "",//道路功能等级
|
||||
val roadFunctionGrade: Int = 1,//道路功能等级
|
||||
|
||||
@SerializedName("noEvaluationreason")
|
||||
val noEvaluationreason: String = "",//未测评原因
|
||||
@ -63,7 +63,7 @@ data class EvaluationInfo(
|
||||
val linkLength: Double = 0.0,//link长度(m 保留3位小数)
|
||||
|
||||
@SerializedName("dataLevel")
|
||||
val dataLevel: String = "",//数据级别
|
||||
val dataLevel: Int = 1,//数据级别
|
||||
|
||||
@SerializedName("linstringLength")
|
||||
val linstringLength: Double = 0.0,//错误要素长度(m)
|
||||
|
||||
@ -152,6 +152,34 @@ class ImportPreProcess {
|
||||
Realm.getDefaultInstance().insert(startEndReference)
|
||||
}
|
||||
|
||||
fun generateS2EReferencePoint(renderEntity: RenderEntity) {
|
||||
val geometry = GeometryTools.createGeometry(renderEntity.properties["geometry"])
|
||||
|
||||
val pointEnd = geometry!!.coordinates[geometry.numPoints-1] // 获取这个geometry对应的结束点坐标
|
||||
val pointStart = geometry!!.coordinates[0] // 获取这个geometry对应的起点
|
||||
|
||||
// 将这个起终点的线记录在数据中
|
||||
val startReference = ReferenceEntity()
|
||||
startReference.renderEntityId = renderEntity.id
|
||||
startReference.name = "${renderEntity.name}参考线"
|
||||
startReference.table = renderEntity.table
|
||||
// 起点坐标
|
||||
startReference.geometry = GeometryTools.createGeometry(GeoPoint(pointStart.y,pointStart.x)).toString()
|
||||
startReference.properties["qi_table"] = renderEntity.table
|
||||
startReference.properties["type"] = "s_2_p"
|
||||
Realm.getDefaultInstance().insert(startReference)
|
||||
|
||||
val endReference = ReferenceEntity()
|
||||
endReference.renderEntityId = renderEntity.id
|
||||
endReference.name = "${renderEntity.name}参考线"
|
||||
endReference.table = renderEntity.table
|
||||
// 终点坐标
|
||||
endReference.geometry = GeometryTools.createGeometry(GeoPoint(pointEnd.y,pointEnd.x)).toString()
|
||||
endReference.properties["qi_table"] = renderEntity.table
|
||||
endReference.properties["type"] = "e_2_p"
|
||||
Realm.getDefaultInstance().insert(endReference)
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成与对应方向相同的方向线,用以绘制方向箭头
|
||||
* */
|
||||
@ -299,6 +327,22 @@ class ImportPreProcess {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成车道中心线面宽度
|
||||
* */
|
||||
fun generateAddWidthLine(renderEntity: RenderEntity) {
|
||||
// 添加车道中心面渲染原则,根据车道宽度进行渲染
|
||||
val angleReference = ReferenceEntity()
|
||||
angleReference.renderEntityId = renderEntity.id
|
||||
angleReference.name = "${renderEntity.name}车道中线面"
|
||||
angleReference.table = renderEntity.table
|
||||
angleReference.geometry = renderEntity.geometry
|
||||
angleReference.properties["qi_table"] = renderEntity.table
|
||||
angleReference.properties["width"] = "3"
|
||||
Realm.getDefaultInstance().insert(angleReference)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成默认路口数据的参考数据
|
||||
* */
|
||||
|
||||
@ -123,54 +123,13 @@ class TaskUploadScope(
|
||||
}
|
||||
|
||||
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
||||
val objects = realm.where(QsRecordBean::class.java)
|
||||
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
||||
if (objects != null&&objects.size>0) {
|
||||
val copyList = realm.copyFromRealm(objects)
|
||||
copyList.forEach {
|
||||
var problemType = 0
|
||||
if(it.problemType=="错误"){
|
||||
problemType = 0
|
||||
}else if(it.problemType=="多余"){
|
||||
problemType = 1
|
||||
}else if(it.problemType=="遗漏"){
|
||||
problemType = 2
|
||||
}
|
||||
var evaluationWay = 2
|
||||
val evaluationInfo = EvaluationInfo(
|
||||
evaluationTaskId = taskBean.id.toString(),
|
||||
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||
linkStatus = 1,
|
||||
markId = hadLinkDvoBean.mesh,//"20065597"
|
||||
trackPhotoNumber = "",
|
||||
markGeometry = it.geometry,
|
||||
featureName = it.classCode,
|
||||
problemType = problemType,
|
||||
problemPhenomenon = it.phenomenon,
|
||||
problemDesc = it.description,
|
||||
problemLink = it.problemLink,
|
||||
preliminaryAnalysis = it.cause,
|
||||
evaluatorName = it.checkUserId,
|
||||
evaluationDate = it.checkTime,
|
||||
evaluationWay = evaluationWay,
|
||||
roadClassfcation = "",
|
||||
roadFunctionGrade = "",
|
||||
noEvaluationreason = "",
|
||||
linkLength = 0.0,
|
||||
dataLevel = "",
|
||||
linstringLength = 0.0,
|
||||
)
|
||||
|
||||
bodyList.add(evaluationInfo)
|
||||
}
|
||||
}else{
|
||||
val linkStatus = 1
|
||||
//存在原因标记未测评
|
||||
if(hadLinkDvoBean.reason.isNotEmpty()){
|
||||
val linkStatus = 0
|
||||
}else{
|
||||
val linkStatus = 1
|
||||
}
|
||||
val linkStatus = 1
|
||||
//存在原因标记未测评
|
||||
if(hadLinkDvoBean.reason.isNotEmpty()){
|
||||
//未测评
|
||||
val linkStatus = 0
|
||||
|
||||
val evaluationInfo = EvaluationInfo(
|
||||
evaluationTaskId = taskBean.id.toString(),
|
||||
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||
@ -187,15 +146,65 @@ class TaskUploadScope(
|
||||
evaluatorName = "",
|
||||
evaluationDate = "",
|
||||
evaluationWay = 2,
|
||||
roadClassfcation = "",
|
||||
roadFunctionGrade = "",
|
||||
roadClassfcation = 1,
|
||||
roadFunctionGrade = 0,
|
||||
noEvaluationreason = hadLinkDvoBean.reason,
|
||||
linkLength = 0.0,
|
||||
dataLevel = "",
|
||||
dataLevel = 0,
|
||||
linstringLength = 0.0,
|
||||
)
|
||||
|
||||
bodyList.add(evaluationInfo)
|
||||
|
||||
}else{
|
||||
|
||||
val linkStatus = hadLinkDvoBean.linkStatus
|
||||
|
||||
var s: String = "%.3f".format(hadLinkDvoBean.linkLength)//保留一位小数(且支持四舍五入)
|
||||
|
||||
val objects = realm.where(QsRecordBean::class.java).equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
||||
|
||||
if (objects != null&&objects.size>0) {
|
||||
val copyList = realm.copyFromRealm(objects)
|
||||
copyList.forEach {
|
||||
var problemType = 0
|
||||
if(it.problemType=="错误"){
|
||||
problemType = 0
|
||||
}else if(it.problemType=="多余"){
|
||||
problemType = 1
|
||||
}else if(it.problemType=="遗漏"){
|
||||
problemType = 2
|
||||
}
|
||||
var evaluationWay = 2
|
||||
val evaluationInfo = EvaluationInfo(
|
||||
evaluationTaskId = taskBean.id.toString(),
|
||||
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||
linkStatus = linkStatus,
|
||||
markId = hadLinkDvoBean.mesh,//"20065597"
|
||||
trackPhotoNumber = "",
|
||||
markGeometry = it.geometry,
|
||||
featureName = it.classCode,
|
||||
problemType = problemType,
|
||||
problemPhenomenon = it.phenomenon,
|
||||
problemDesc = it.description,
|
||||
problemLink = it.problemLink,
|
||||
preliminaryAnalysis = it.cause,
|
||||
evaluatorName = it.checkUserId,
|
||||
evaluationDate = it.checkTime,
|
||||
evaluationWay = evaluationWay,
|
||||
roadClassfcation = 1,
|
||||
roadFunctionGrade = 3,
|
||||
noEvaluationreason = "",
|
||||
linkLength = s.toDouble(),
|
||||
dataLevel = 3,
|
||||
linstringLength = 0.0,
|
||||
)
|
||||
|
||||
bodyList.add(evaluationInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(bodyList.size>0){
|
||||
|
||||
@ -12,6 +12,7 @@ import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -38,6 +39,8 @@ import com.navinfo.omqs.util.FlowEventBus
|
||||
import com.navinfo.omqs.util.SpeakMode
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.renderer.GLViewport
|
||||
import org.videolan.vlc.Util
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
@ -143,6 +146,7 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@ -218,6 +222,12 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//捕捉列表变化回调
|
||||
viewModel.liveDataNILocationList.observe(this) {
|
||||
Toast.makeText(this,"轨迹被点击了",Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
//右上角菜单是否被点击
|
||||
viewModel.liveDataMenuState.observe(this) {
|
||||
binding.mainActivityMenu.isSelected = it
|
||||
@ -362,6 +372,7 @@ class MainActivity : BaseActivity() {
|
||||
mapController.mMapView.onPause()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
viewModel.speakMode?.shutdown()
|
||||
@ -392,6 +403,7 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 打开相机预览
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun openCamera() {
|
||||
//显示轨迹图层
|
||||
viewModel.onClickCameraButton(this)
|
||||
@ -400,6 +412,7 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 开关菜单
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun onClickMenu() {
|
||||
//显示菜单图层
|
||||
viewModel.onClickMenu()
|
||||
@ -525,11 +538,17 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
binding.mainActivityBottomSheetGroup.visibility = View.GONE
|
||||
|
||||
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 5)
|
||||
} else {
|
||||
binding.mainActivityBottomSheetGroup.visibility = View.VISIBLE
|
||||
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 65)
|
||||
}
|
||||
mapController.mMapView.vtmMap.animator()
|
||||
.animateTo(GeoPoint( mapController.mMapView.vtmMap.mapPosition.geoPoint.latitude,mapController.mMapView.vtmMap.mapPosition.geoPoint.longitude))
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun voiceOnTouchStart() {
|
||||
viewModel.startSoundMetter(this, binding.mainActivityVoice)
|
||||
}
|
||||
@ -612,6 +631,7 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 打开道路名称属性看板,选择的道路在viewmodel里记录,不用
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun openRoadNameFragment() {
|
||||
if (viewModel.liveDataRoadName.value != null) {
|
||||
viewModel.showSignMoreInfo(viewModel.liveDataRoadName.value!!)
|
||||
@ -630,7 +650,6 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
fun onClickTaskLink() {
|
||||
rightController.navigate(R.id.TaskLinkFragment)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -16,7 +16,6 @@ import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.PopupWindow
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -24,6 +23,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import androidx.navigation.findNavController
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.data.entity.NoteBean
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
@ -35,7 +35,6 @@ import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.bean.ImportConfig
|
||||
import com.navinfo.omqs.bean.RoadNameBean
|
||||
import com.navinfo.omqs.bean.SignBean
|
||||
import com.navinfo.omqs.db.RealmOperateHelper
|
||||
import com.navinfo.omqs.ui.dialog.CommonDialog
|
||||
@ -80,6 +79,9 @@ class MainViewModel @Inject constructor(
|
||||
//地图点击捕捉到的标签ID列表
|
||||
val liveDataNoteIdList = MutableLiveData<List<String>>()
|
||||
|
||||
//地图点击捕捉到的轨迹列表
|
||||
val liveDataNILocationList = MutableLiveData<List<NiLocation>>()
|
||||
|
||||
//左侧看板数据
|
||||
val liveDataSignList = MutableLiveData<List<SignBean>>()
|
||||
|
||||
@ -123,6 +125,8 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
private var linkIdCache = ""
|
||||
|
||||
private var lastNiLocaion: NiLocation? = null
|
||||
|
||||
init {
|
||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
when (e) {
|
||||
@ -141,8 +145,14 @@ class MainViewModel @Inject constructor(
|
||||
override fun onNoteList(list: MutableList<String>) {
|
||||
liveDataNoteIdList.value = list
|
||||
}
|
||||
|
||||
override fun onNiLocationList(list: MutableList<NiLocation>) {
|
||||
liveDataNILocationList.value = list
|
||||
}
|
||||
})
|
||||
|
||||
initLocation()
|
||||
|
||||
//处理地图点击操作
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
mapController.onMapClickFlow.collectLatest {
|
||||
@ -159,6 +169,7 @@ class MainViewModel @Inject constructor(
|
||||
initTaskData()
|
||||
initQsRecordData()
|
||||
initNoteData()
|
||||
initNILocationData()
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,6 +184,7 @@ class MainViewModel @Inject constructor(
|
||||
val taskBean = realm.copyFromRealm(res)
|
||||
mapController.lineHandler.showTaskLines(taskBean.hadLinkDvoList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,11 +213,25 @@ class MainViewModel @Inject constructor(
|
||||
list = realm.copyFromRealm(objects)
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (item in list) {
|
||||
mapController.markerHandle.addOrUpdateNoteMark(item)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun initNILocationData() {
|
||||
//加载轨迹数据
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
val list: List<NiLocation>? = TraceDataBase.getDatabase(
|
||||
mapController.mMapView.context,
|
||||
Constant.USER_DATA_PATH
|
||||
).niLocationDao.findToTaskIdAll(id.toString())
|
||||
list!!.forEach {
|
||||
mapController.markerHandle.addNiLocationMarkerItem(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化定位信息
|
||||
*/
|
||||
@ -236,14 +262,38 @@ class MainViewModel @Inject constructor(
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
traceDataBase.niLocationDao.insert(location)
|
||||
mapController.mMapView.vtmMap.updateMap(true)
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
location.taskId = id.toString()
|
||||
//增加间距判断
|
||||
if (lastNiLocaion != null) {
|
||||
val disance = GeometryTools.distanceToDouble(
|
||||
GeoPoint(location.latitude, location.longitude), GeoPoint(
|
||||
lastNiLocaion!!.latitude, lastNiLocaion!!.longitude
|
||||
)
|
||||
)
|
||||
//相距差距大于0.5米以上进行存储
|
||||
if (disance > 0.5) {
|
||||
traceDataBase.niLocationDao.insert(location)
|
||||
mapController.markerHandle.addNiLocationMarkerItem(location)
|
||||
}
|
||||
} else {
|
||||
traceDataBase.niLocationDao.insert(location)
|
||||
mapController.markerHandle.addNiLocationMarkerItem(location)
|
||||
}
|
||||
|
||||
lastNiLocaion = location
|
||||
//mapController.mMapView.vtmMap.updateMap(true)
|
||||
}
|
||||
}
|
||||
//用于定位点捕捉道路
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
|
||||
if (!isSelectRoad()) captureLink(GeoPoint(location.latitude, location.longitude))
|
||||
if (!isSelectRoad()) captureLink(
|
||||
GeoPoint(
|
||||
location.latitude,
|
||||
location.longitude
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,101 +313,102 @@ class MainViewModel @Inject constructor(
|
||||
* 捕获道路和面板
|
||||
*/
|
||||
private suspend fun captureLink(point: GeoPoint) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val linkList = realmOperateHelper.queryLink(
|
||||
point = point,
|
||||
)
|
||||
var hisRoadName = false
|
||||
if (linkList.isNotEmpty()) {
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
val topSignList = mutableListOf<SignBean>()
|
||||
mapController.lineHandler.linksLayer.clear()
|
||||
|
||||
val link = linkList[0]
|
||||
val linkList = realmOperateHelper.queryLink(
|
||||
point = point,
|
||||
)
|
||||
var hisRoadName = false
|
||||
if (linkList.isNotEmpty()) {
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
val topSignList = mutableListOf<SignBean>()
|
||||
mapController.lineHandler.linksLayer.clear()
|
||||
|
||||
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||
val link = linkList[0]
|
||||
|
||||
if (linkIdCache != linkId) {
|
||||
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
for (element in elementList) {
|
||||
if (linkIdCache != linkId) {
|
||||
|
||||
if (element.code == 2011) {
|
||||
hisRoadName = true
|
||||
liveDataRoadName.postValue(element)
|
||||
continue
|
||||
}
|
||||
|
||||
val distance = GeometryTools.distanceToDouble(
|
||||
point, GeometryTools.createGeoPoint(element.geometry)
|
||||
)
|
||||
|
||||
val signBean = SignBean(
|
||||
iconId = SignUtil.getSignIcon(element),
|
||||
iconText = SignUtil.getSignIconText(element),
|
||||
distance = distance.toInt(),
|
||||
linkId = linkId,
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
renderEntity = element,
|
||||
isMoreInfo = SignUtil.isMoreInfo(element),
|
||||
index = SignUtil.getRoadInfoIndex(element)
|
||||
)
|
||||
Log.e("jingo", "捕捉到的数据code ${element.code}")
|
||||
when (element.code) {
|
||||
//车道数,种别,功能等级,线限速,道路方向
|
||||
2041, 2008, 2002, 2019, 2010 -> topSignList.add(
|
||||
signBean
|
||||
)
|
||||
4002, 4003, 4004, 4010, 4022, 4601 -> signList.add(
|
||||
signBean
|
||||
)
|
||||
}
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
for (element in elementList) {
|
||||
|
||||
if (element.code == 2011) {
|
||||
hisRoadName = true
|
||||
liveDataRoadName.postValue(element)
|
||||
continue
|
||||
}
|
||||
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val entity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RESTRICTION").and().equalTo(
|
||||
"properties['linkIn']", it
|
||||
val distance = GeometryTools.distanceToDouble(
|
||||
point, GeometryTools.createGeoPoint(element.geometry)
|
||||
)
|
||||
|
||||
val signBean = SignBean(
|
||||
iconId = SignUtil.getSignIcon(element),
|
||||
iconText = SignUtil.getSignIconText(element),
|
||||
distance = distance.toInt(),
|
||||
linkId = linkId,
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
renderEntity = element,
|
||||
isMoreInfo = SignUtil.isMoreInfo(element),
|
||||
index = SignUtil.getRoadInfoIndex(element)
|
||||
)
|
||||
Log.e("jingo", "捕捉到的数据code ${element.code}")
|
||||
when (element.code) {
|
||||
//车道数,种别,功能等级,线限速,道路方向
|
||||
2041, 2008, 2002, 2019, 2010 -> topSignList.add(
|
||||
signBean
|
||||
)
|
||||
|
||||
4002, 4003, 4004, 4010, 4022, 4601 -> signList.add(
|
||||
signBean
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val entity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RESTRICTION").and().equalTo(
|
||||
"properties['linkIn']", it
|
||||
).findFirst()
|
||||
if (entity != null) {
|
||||
val outLink = entity.properties["linkOut"]
|
||||
val linkOutEntity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RD_LINK").and().equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
).findFirst()
|
||||
if (entity != null) {
|
||||
val outLink = entity.properties["linkOut"]
|
||||
val linkOutEntity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RD_LINK").and().equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
).findFirst()
|
||||
if (linkOutEntity != null) {
|
||||
mapController.lineHandler.linksLayer.addLine(
|
||||
linkOutEntity.geometry, 0x7DFF0000
|
||||
)
|
||||
}
|
||||
if (linkOutEntity != null) {
|
||||
mapController.lineHandler.linksLayer.addLine(
|
||||
linkOutEntity.geometry, 0x7DFF0000
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||
.sortedBy { it.index })
|
||||
|
||||
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
withContext(Dispatchers.Main) {
|
||||
speakMode?.speakText(speechText)
|
||||
}
|
||||
linkIdCache = linkId ?: ""
|
||||
}
|
||||
} else {
|
||||
mapController.lineHandler.removeLine()
|
||||
linkIdCache = ""
|
||||
}
|
||||
//如果没有捕捉到道路名
|
||||
if (!hisRoadName) {
|
||||
liveDataRoadName.postValue(null)
|
||||
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||
.sortedBy { it.index })
|
||||
|
||||
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
withContext(Dispatchers.Main) {
|
||||
speakMode?.speakText(speechText)
|
||||
}
|
||||
linkIdCache = linkId ?: ""
|
||||
}
|
||||
} else {
|
||||
mapController.lineHandler.removeLine()
|
||||
linkIdCache = ""
|
||||
}
|
||||
//如果没有捕捉到道路名
|
||||
if (!hisRoadName) {
|
||||
liveDataRoadName.postValue(null)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -405,9 +456,13 @@ class MainViewModel @Inject constructor(
|
||||
mCameraDialog!!.stopVideo()
|
||||
try {
|
||||
if (!mCameraDialog!!.getmShareUtil().connectstate) {
|
||||
mCameraDialog!!.updateCameraResources(1, mCameraDialog!!.getmDeviceNum())
|
||||
mCameraDialog!!.updateCameraResources(
|
||||
1,
|
||||
mCameraDialog!!.getmDeviceNum()
|
||||
)
|
||||
}
|
||||
TakePhotoManager.getInstance().getCameraVedioClent(mCameraDialog!!.getmDeviceNum())
|
||||
TakePhotoManager.getInstance()
|
||||
.getCameraVedioClent(mCameraDialog!!.getmDeviceNum())
|
||||
.StopSearch()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
@ -542,4 +597,5 @@ class MainViewModel @Inject constructor(
|
||||
liveDataSignMoreInfo.value = data
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -113,9 +113,10 @@ class PersonalCenterFragment(private var backListener: (() -> Unit?)? = null) :
|
||||
}
|
||||
R.id.personal_center_menu_test -> {
|
||||
viewModel.readRealmData()
|
||||
//108.91056000267433 34.29635901721207
|
||||
// 定位到指定位置
|
||||
niMapController.mMapView.vtmMap.animator()
|
||||
.animateTo(GeoPoint( 39.799624915997725, 116.51407667184905 ))
|
||||
.animateTo(GeoPoint( 34.29635901721207, 108.91056000267433))
|
||||
}
|
||||
// R.id.personal_center_menu_task_list -> {
|
||||
// findNavController().navigate(R.id.TaskManagerFragment)
|
||||
|
||||
@ -195,7 +195,11 @@ class TaskListAdapter(
|
||||
binding.taskDeleteLayout.setOnClickListener {
|
||||
//重置状态
|
||||
leftDeleteView?.resetDeleteStatus()
|
||||
itemListener?.invoke(position, ItemClickStatus.DELETE_LAYOUT_CLICK, taskBean)
|
||||
if(taskBean.syncStatus != FileUploadStatus.DONE){
|
||||
Toast.makeText(binding.taskUploadBtn.context, "数据未上传,不允许关闭!", Toast.LENGTH_SHORT).show()
|
||||
}else{
|
||||
itemListener?.invoke(position, ItemClickStatus.DELETE_LAYOUT_CLICK, taskBean)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,11 +40,13 @@ class TaskListFragment : BaseFragment() {
|
||||
if (taskBean.hadLinkDvoList.isEmpty()) {
|
||||
Toast.makeText(context, "数据错误,无Link数据!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
when (status) {
|
||||
TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK -> {
|
||||
viewModel.setSelectTaskBean(taskBean)
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK -> {
|
||||
showLoadingDialog("正在关闭")
|
||||
context?.let { viewModel.removeTask(it, taskBean) }
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK -> {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||
@ -9,7 +10,9 @@ import androidx.annotation.RequiresApi
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
@ -50,6 +53,10 @@ class TaskViewModel @Inject constructor(
|
||||
|
||||
// private val colors =
|
||||
// arrayOf(Color.RED, Color.YELLOW, Color.BLUE, Color.MAGENTA, Color.GREEN, Color.CYAN)
|
||||
/**
|
||||
* 用来确定是否关闭
|
||||
*/
|
||||
val liveDataCloseTask = MutableLiveData<Boolean>()
|
||||
|
||||
/**
|
||||
* 当前选中的任务
|
||||
@ -177,6 +184,7 @@ class TaskViewModel @Inject constructor(
|
||||
private fun showTaskLinks(taskBean: TaskBean) {
|
||||
|
||||
mapController.lineHandler.removeAllTaskLine()
|
||||
mapController.markerHandle.clearNiLocationLayer()
|
||||
if (taskBean.hadLinkDvoList.isNotEmpty()) {
|
||||
mapController.lineHandler.showTaskLines(taskBean.hadLinkDvoList)
|
||||
var maxX = 0.0
|
||||
@ -208,6 +216,17 @@ class TaskViewModel @Inject constructor(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//重新加载轨迹
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val list: List<NiLocation>? = TraceDataBase.getDatabase(
|
||||
mapController.mMapView.context,
|
||||
Constant.USER_DATA_PATH
|
||||
).niLocationDao.findToTaskIdAll(taskBean.id.toString())
|
||||
list!!.forEach {
|
||||
mapController.markerHandle.addNiLocationMarkerItem(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,6 +318,58 @@ class TaskViewModel @Inject constructor(
|
||||
* 关闭任务
|
||||
*/
|
||||
fun removeTask(context: Context, taskBean: TaskBean) {
|
||||
if (taskBean != null) {
|
||||
val mDialog = FirstDialog(context)
|
||||
mDialog.setTitle("提示?")
|
||||
mDialog.setMessage("是否关闭,请确认!")
|
||||
mDialog.setPositiveButton("确定", object : FirstDialog.OnClickListener {
|
||||
override fun onClick(dialog: Dialog?, which: Int) {
|
||||
mDialog.dismiss()
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
realm.executeTransaction {
|
||||
val objects = it.where(TaskBean::class.java)
|
||||
.equalTo("id", taskBean.id).findFirst()
|
||||
objects?.deleteFromRealm()
|
||||
}
|
||||
//遍历删除对应的数据
|
||||
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
||||
val qsRecordList = realm.where(QsRecordBean::class.java)
|
||||
.equalTo("linkId", hadLinkDvoBean.linkPid).findAll()
|
||||
if (qsRecordList != null && qsRecordList.size > 0) {
|
||||
val copyList = realm.copyFromRealm(qsRecordList)
|
||||
copyList.forEach {
|
||||
it.deleteFromRealm()
|
||||
mapController.markerHandle.removeQsRecordMark(it)
|
||||
mapController.mMapView.vtmMap.updateMap(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
//过滤掉已上传的超过90天的数据
|
||||
var nowTime: Long = DateTimeUtil.getNowDate().time
|
||||
var beginNowTime: Long = nowTime - 90 * 3600 * 24 * 1000L
|
||||
var syncUpload: Int = FileManager.Companion.FileUploadStatus.DONE
|
||||
val objects = realm.where(TaskBean::class.java)
|
||||
.notEqualTo("syncStatus", syncUpload).or()
|
||||
.between("operationTime", beginNowTime, nowTime)
|
||||
.equalTo("syncStatus", syncUpload).findAll()
|
||||
val taskList = realm.copyFromRealm(objects)
|
||||
for (item in taskList) {
|
||||
FileManager.checkOMDBFileInfo(item)
|
||||
}
|
||||
liveDataTaskList.postValue(taskList)
|
||||
liveDataCloseTask.postValue(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
mDialog.setNegativeButton("取消", object : FirstDialog.OnClickListener {
|
||||
override fun onClick(dialog: Dialog?, which: Int) {
|
||||
liveDataCloseTask.postValue(false)
|
||||
mDialog.dismiss()
|
||||
}
|
||||
})
|
||||
mDialog.show()
|
||||
}
|
||||
val mDialog = FirstDialog(context)
|
||||
mDialog.setTitle("提示?")
|
||||
mDialog.setMessage("是否关闭,请确认!")
|
||||
|
||||
@ -45,7 +45,7 @@ class SignUtil {
|
||||
*获取道路功能等级文字
|
||||
*/
|
||||
private fun getLinkFunctionClassText(data: RenderEntity): String {
|
||||
return "等级${data.properties["functionClass"]}"
|
||||
return "FC${data.properties["functionClass"]}"
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,9 +55,9 @@ class SignUtil {
|
||||
val direct = data.properties["direct"]
|
||||
when (direct?.toInt()) {
|
||||
0 -> return "不应用"
|
||||
1 -> return "双方向"
|
||||
2 -> return "顺方向"
|
||||
3 -> return "逆方向"
|
||||
1 -> return "双"
|
||||
2 -> return "顺"
|
||||
3 -> return "逆"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@ -1560,7 +1560,7 @@
|
||||
<m k="qi_table">
|
||||
<!--车道数-->
|
||||
<m v="OMDB_LANE_NUM">
|
||||
<m k="laneNum">
|
||||
<!-- <m k="laneNum">
|
||||
<m v="1">
|
||||
<line stroke="#545D6C" width="3" />
|
||||
</m>
|
||||
@ -1597,7 +1597,7 @@
|
||||
<m v="12">
|
||||
<line stroke="#545D6C" width="36" />
|
||||
</m>
|
||||
</m>
|
||||
</m>-->
|
||||
</m>
|
||||
<!-- 道路线 -->
|
||||
<m v="OMDB_RD_LINK">
|
||||
@ -1698,11 +1698,57 @@
|
||||
</m>
|
||||
<!--车道中心线-->
|
||||
<m v="OMDB_LANE_LINK_LG">
|
||||
<line dasharray="35,35" stroke="#ecf0f1" width="0.1" />
|
||||
</m>
|
||||
<!-- <m k="eLaneNodePid">
|
||||
<line dasharray="35,35" stroke="#ecf0f1" width="0.1" />
|
||||
</m>-->
|
||||
<m k="width">
|
||||
<line stroke="#545D6C" width="3" />
|
||||
</m>
|
||||
</m>0
|
||||
<!-- 道路边界类型 -->
|
||||
<m v="OMDB_RDBOUND_BOUNDARYTYPE">
|
||||
<line stroke="#ffffff" width="0.1" />
|
||||
<outline-layer id="boundaryType" stroke="#fcba5a" width="0.2" />
|
||||
<m k="boundaryType" v="0">
|
||||
<!--不应用-->
|
||||
<line stroke="#fcba5a" use="boundaryType"/>
|
||||
<lineSymbol repeat-gap="12" repeat-start="12" symbol-height="16" symbol-width="16" src="assets:omdb/icon_2083_0.svg" />
|
||||
</m>
|
||||
<m k="boundaryType" v="1">
|
||||
<!--无标线无可区分边界-->
|
||||
<line dasharray="10,2,2,2,2,2,2,2" repeat-start="0" stroke="#fcba5a" width="0.2" />
|
||||
</m>
|
||||
<m k="boundaryType" v="2">
|
||||
<!--标线-->
|
||||
<line stroke="#fcba5a" use="boundaryType"/>
|
||||
</m>
|
||||
<m k="boundaryType" v="3">
|
||||
<!--路牙-->
|
||||
<line dasharray="10,4" repeat-start="0" stroke="#fcba5a" width="0.2" />
|
||||
</m>
|
||||
<m k="boundaryType" v="4">
|
||||
<!--护栏-->
|
||||
<line dasharray="10,2,2,2" repeat-start="0" stroke="#fcba5a" width="0.2"/>
|
||||
</m>
|
||||
<m k="boundaryType" v="5">
|
||||
<!--墙-->
|
||||
<line stroke="#fcba5a" use="boundaryType"/>
|
||||
<line dasharray="10,5" stroke="#fcba5a" width="0.5" />
|
||||
</m>
|
||||
<m k="boundaryType" v="6">
|
||||
<!--道路面铺设边缘-->
|
||||
<line stroke="#fcba5a" use="boundaryType"/>
|
||||
<lineSymbol repeat-gap="32" repeat-start="0" symbol-height="32" src="assets:omdb/icon_2083_6.svg" />
|
||||
</m>
|
||||
<m k="boundaryType" v="7">
|
||||
<!--虚拟三角岛-->
|
||||
<line stroke="#fcba5a" use="boundaryType"/>
|
||||
<line src="assets:omdb/icon_2083_7_1.svg" symbol-height="12" symbol-width="12" symbol-percent="20" width="1" />
|
||||
</m>
|
||||
<m k="boundaryType" v="9">
|
||||
<!--杆状障碍物-->
|
||||
<line stroke="#fcba5a" use="boundaryType"/>
|
||||
<lineSymbol repeat-gap="16" repeat-start="12" symbol-height="24" symbol-width="8" src="assets:omdb/icon_2083_9.svg" />
|
||||
</m>
|
||||
</m>
|
||||
<!-- 车道边界类型 -->
|
||||
<m v="OMDB_LANE_MARK_BOUNDARYTYPE">
|
||||
@ -1770,6 +1816,22 @@
|
||||
</m>
|
||||
</m>
|
||||
</m>
|
||||
|
||||
<!--隧道-->
|
||||
<m v="OMDB_TUNNEL">
|
||||
<m k="formOfWay">
|
||||
<line dasharray="0.2,0.2" stroke="#d4237a" width="0.2" />
|
||||
</m>
|
||||
<m k="type" v="s_2_p">
|
||||
<symbol repeat="false" repeat-start="0" rotate="false"
|
||||
src="assets:omdb/icon_2202_0.svg" symbol-height="32" symbol-width="32"></symbol>
|
||||
</m>
|
||||
<m k="type" v="e_2_p">
|
||||
<symbol repeat="false" repeat-start="0" rotate="false"
|
||||
src="assets:omdb/icon_2202_1.svg" symbol-height="32" symbol-width="32"></symbol>
|
||||
</m>
|
||||
</m>
|
||||
|
||||
<!--道路方向-->
|
||||
<m v="OMDB_LINK_DIRECT">
|
||||
<m k="direct">
|
||||
@ -1803,6 +1865,7 @@
|
||||
<line use="s2e" />
|
||||
</m>
|
||||
</m>
|
||||
|
||||
<!--电子眼-->
|
||||
<m v="OMDB_ELECTRONICEYE">
|
||||
<!-- <m k="angle">-->
|
||||
|
||||
1
collect-library/src/main/assets/omdb/icon_2083_0.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1689041545166" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="30665" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M512.005117 958.708971C265.683035 958.708971 65.290005 758.316965 65.290005 511.99386c0-246.310825 200.39303-446.703855 446.715111-446.703855 246.310825 0 446.703855 200.39303 446.703855 446.703855C958.708971 758.316965 758.316965 958.708971 512.005117 958.708971zM512.005117 169.716356c-188.738595 0-342.289784 153.545048-342.289784 342.277504 0 188.738595 153.551188 342.289784 342.289784 342.289784 188.733479 0 342.278527-153.551188 342.278527-342.289784C854.283644 323.261405 700.738595 169.716356 512.005117 169.716356z" p-id="30666" fill="#fcba5a"></path></svg>
|
||||
|
After Width: | Height: | Size: 900 B |
13
collect-library/src/main/assets/omdb/icon_2083_6.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="4" height="58.142" viewBox="0 0 4 58.142">
|
||||
<defs>
|
||||
<style>.a{fill:none;stroke:#ebb972;stroke-width:4px;}.b{opacity:0.001;}</style>
|
||||
</defs>
|
||||
<g transform="translate(-401.035 -35.964)">
|
||||
<g transform="translate(313.535 166.535) rotate(-90)">
|
||||
<line class="a" x2="29.071" transform="translate(101.5 89.5)" />
|
||||
</g>
|
||||
<g class="b" transform="translate(313.535 195.605) rotate(-90)">
|
||||
<line class="a" x2="29.071" transform="translate(101.5 89.5)" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 580 B |
10
collect-library/src/main/assets/omdb/icon_2083_7.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="b" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<defs>
|
||||
<style>.e{fill:#fcba5a;}</style>
|
||||
</defs>
|
||||
<g id="c">
|
||||
<path id="d" class="e"
|
||||
d="M31.9,0l-14.3,23.2-1.6,2.6-1.6-2.6L0,0h0V6.1L14.1,28.9l1.9,3.1h0s1.9-3.1,1.9-3.1L32,6V0h0Z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 365 B |
8
collect-library/src/main/assets/omdb/icon_2083_7_1.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<defs>
|
||||
<style>.a{fill:#fcba5a;}</style>
|
||||
</defs>
|
||||
<path class="a"
|
||||
d="M31.94,0,17.6,23.21l-1.62,2.622L14.4,23.274.021,0H0V6.084L14.09,28.891l1.869,3.094.024.015,1.888-3.109L32,6.021V0Z"
|
||||
transform="translate(0 0)" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 339 B |
6
collect-library/src/main/assets/omdb/icon_2083_9.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="48" viewBox="0 0 15 48">
|
||||
<defs>
|
||||
<style>.a{fill:#ebb972;}</style>
|
||||
</defs>
|
||||
<rect class="a" width="15" height="48" rx="7.5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 209 B |
18
collect-library/src/main/assets/omdb/icon_2202_0.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80">
|
||||
<defs>
|
||||
<style>
|
||||
.a{fill:#fceaa0;stroke:#1b23b4;stroke-width:3px;}.b{fill:#1b23b4;}.c{stroke:none;}.d{fill:none;}
|
||||
</style>
|
||||
</defs>
|
||||
<g transform="translate(-126 -381)">
|
||||
<g transform="translate(9304 7585)">
|
||||
<g class="a" transform="translate(-9178 -7204)">
|
||||
<circle class="c" cx="40" cy="40" r="40" />
|
||||
<circle class="d" cx="40" cy="40" r="38.5" />
|
||||
</g>
|
||||
</g>
|
||||
<path class="b"
|
||||
d="M257.043,173.635V146.2c0-9.344-8.378-16.918-18.708-16.918s-18.712,7.574-18.712,16.918v27.436H214.94V145.378c0-11.808,10.6-21.378,23.684-21.378s23.683,9.57,23.683,21.378v28.257Zm-18.13-42.773c13.594-.133,16.377,13.195,16.377,13.195v29.579H254.7l-9.934-14.271V144.584s-.436-4.223-5.851-4.223-6.431,4.223-6.431,4.223v14.779l-10.2,14.271h-.913V144.06S223.714,131.009,238.913,130.861Zm5.049,28.5,10.159,14.271h-31.21l10.159-14.272h10.893Zm0,0"
|
||||
transform="translate(-72.624 269.184)" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
collect-library/src/main/assets/omdb/icon_2202_1.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80"><defs><style>.a{fill:#1b23b4;stroke:#fceaa0;stroke-width:3px;}.b{fill:#fceaa0;}.c{stroke:none;}.d{fill:none;}</style></defs><g transform="translate(-268 -381)"><g transform="translate(9446 7585)"><g class="a" transform="translate(-9178 -7204)"><circle class="c" cx="40" cy="40" r="40"/><circle class="d" cx="40" cy="40" r="38.5"/></g></g><path class="b" d="M257.043,173.635V146.2c0-9.344-8.378-16.918-18.708-16.918s-18.712,7.574-18.712,16.918v27.436H214.94V145.378c0-11.808,10.6-21.378,23.684-21.378s23.683,9.57,23.683,21.378v28.257Zm-18.13-42.773c13.594-.133,16.377,13.195,16.377,13.195v29.579H254.7l-9.934-14.271V144.584s-.436-4.223-5.851-4.223-6.431,4.223-6.431,4.223v14.779l-10.2,14.271h-.913V144.06S223.714,131.009,238.913,130.861Zm5.049,28.5,10.159,14.271h-31.21l10.159-14.272h10.893Zm0,0" transform="translate(69.376 269.184)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 928 B |
@ -46,4 +46,7 @@ public interface INiLocationDao {
|
||||
|
||||
@Query("SELECT * FROM niLocation")
|
||||
List<NiLocation> findAll();
|
||||
|
||||
@Query("SELECT * FROM niLocation where taskId =:taskId")
|
||||
List<NiLocation> findToTaskIdAll(String taskId);
|
||||
}
|
||||
|
||||
@ -65,6 +65,10 @@ public class NiLocation extends Feature{
|
||||
private String groupId;
|
||||
@ColumnInfo(name = "timeStamp")
|
||||
private String timeStamp;
|
||||
@ColumnInfo(name = "media")
|
||||
private int media;
|
||||
@ColumnInfo(name = "taskId")
|
||||
private String taskId;
|
||||
|
||||
private boolean isAccouracy;
|
||||
private boolean isSpeed;
|
||||
@ -318,4 +322,20 @@ public class NiLocation extends Feature{
|
||||
public void setTimeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public int getMedia() {
|
||||
return media;
|
||||
}
|
||||
|
||||
public void setMedia(int media) {
|
||||
this.media = media;
|
||||
}
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelTileLoaderHook;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.scalebar.MapScaleBarLayer;
|
||||
import org.oscim.theme.IRenderTheme;
|
||||
import org.oscim.theme.ThemeLoader;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
@ -198,6 +199,11 @@ public final class NIMapView extends RelativeLayout {
|
||||
*/
|
||||
private OnMapTouchListener touchListener;
|
||||
|
||||
/**
|
||||
* 比例尺控件
|
||||
*/
|
||||
private MapScaleBarLayer mapScaleBarLayer;
|
||||
|
||||
public NIMapView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
@ -252,7 +258,7 @@ public final class NIMapView extends RelativeLayout {
|
||||
|
||||
// 增加比例尺图层
|
||||
NaviMapScaleBar naviMapScaleBar = new NaviMapScaleBar(getVtmMap());
|
||||
naviMapScaleBar.initScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 5);
|
||||
mapScaleBarLayer = naviMapScaleBar.initScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 5);
|
||||
|
||||
// if (gridLayer == null) {
|
||||
// gridLayer = new TileGridLayer(getVtmMap());
|
||||
@ -878,6 +884,21 @@ public final class NIMapView extends RelativeLayout {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置比例尺位置
|
||||
* @param position
|
||||
* @param xOffset
|
||||
* @param yOffset
|
||||
*/
|
||||
public void setScaleBarLayer(GLViewport.Position position, int xOffset, int yOffset){
|
||||
if(mapScaleBarLayer!=null&&mapView.map().layers().contains(mapScaleBarLayer)){
|
||||
mapView.map().layers().remove(mapScaleBarLayer);
|
||||
mapScaleBarLayer = null;
|
||||
}
|
||||
NaviMapScaleBar naviMapScaleBar = new NaviMapScaleBar(getVtmMap());
|
||||
mapScaleBarLayer = naviMapScaleBar.initScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, xOffset, yOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示缩放控件
|
||||
*
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
@ -8,6 +9,8 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.data.entity.NoteBean
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
@ -30,11 +33,19 @@ import org.oscim.backend.CanvasAdapter
|
||||
import org.oscim.backend.canvas.Bitmap
|
||||
import org.oscim.backend.canvas.Paint
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.layers.marker.*
|
||||
import org.oscim.layers.marker.ItemizedLayer
|
||||
import org.oscim.layers.marker.ItemizedLayer.OnItemGestureListener
|
||||
import org.oscim.layers.vector.geometries.*
|
||||
import org.oscim.layers.marker.MarkerInterface
|
||||
import org.oscim.layers.marker.MarkerItem
|
||||
import org.oscim.layers.marker.MarkerRendererFactory
|
||||
import org.oscim.layers.marker.MarkerSymbol
|
||||
import org.oscim.layers.vector.geometries.Drawable
|
||||
import org.oscim.layers.vector.geometries.LineDrawable
|
||||
import org.oscim.layers.vector.geometries.PointDrawable
|
||||
import org.oscim.layers.vector.geometries.PolygonDrawable
|
||||
import org.oscim.layers.vector.geometries.Style
|
||||
import org.oscim.map.Map
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* marker 操作
|
||||
@ -42,7 +53,6 @@ import java.util.*
|
||||
class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
BaseHandler(context, mapView) {
|
||||
|
||||
|
||||
/**
|
||||
* 默认文字颜色
|
||||
*/
|
||||
@ -98,6 +108,10 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
layer
|
||||
}
|
||||
|
||||
private var niLocationBitmap: Bitmap? = null
|
||||
private var niLocationBitmap1: Bitmap? = null
|
||||
private var niLocationBitmap2: Bitmap? = null
|
||||
private var niLocationBitmap3: Bitmap? = null
|
||||
|
||||
/**
|
||||
* 评测数据marker 图层
|
||||
@ -140,6 +154,61 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
layer
|
||||
}
|
||||
|
||||
/**
|
||||
* 评测数据marker 图层
|
||||
*/
|
||||
private val niLocationItemizedLayer: MyItemizedLayer by lazy {
|
||||
|
||||
niLocationBitmap =
|
||||
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.icon_gps))
|
||||
niLocationBitmap1 =
|
||||
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.icon_gps_1))
|
||||
niLocationBitmap2 =
|
||||
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.icon_nilocation))
|
||||
niLocationBitmap3 = AndroidBitmap(
|
||||
BitmapFactory.decodeResource(
|
||||
context.resources,
|
||||
R.mipmap.icon_nilocation_1
|
||||
)
|
||||
)
|
||||
|
||||
val layer = MyItemizedLayer(
|
||||
mMapView.vtmMap,
|
||||
mutableListOf(),
|
||||
markerRendererFactory,
|
||||
object : MyItemizedLayer.OnItemGestureListener {
|
||||
override fun onItemSingleTapUp(
|
||||
list: MutableList<Int>,
|
||||
nearest: Int
|
||||
): Boolean {
|
||||
itemListener?.let {
|
||||
val idList = mutableListOf<NiLocation>()
|
||||
if (list.size == 0) {
|
||||
} else {
|
||||
for (i in list) {
|
||||
val markerInterface: MarkerInterface =
|
||||
niLocationItemizedLayer.itemList[i]
|
||||
if (markerInterface is MarkerItem) {
|
||||
idList.add(markerInterface.uid as NiLocation)
|
||||
}
|
||||
}
|
||||
it.onNiLocationList(idList.distinct().toMutableList())
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onItemLongPress(
|
||||
list: MutableList<Int>?,
|
||||
nearest: Int
|
||||
): Boolean {
|
||||
return true
|
||||
}
|
||||
})
|
||||
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||
layer
|
||||
}
|
||||
|
||||
/**
|
||||
* 便签线图层
|
||||
*/
|
||||
@ -212,9 +281,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
org.oscim.backend.canvas.Color.BLUE
|
||||
)
|
||||
) {
|
||||
// override fun getClusterBitmap(size: Int): Bitmap? {
|
||||
// return super.getclusterbitmap(size)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -233,6 +299,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
if (e == Map.SCALE_EVENT) {
|
||||
qsRecordItemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12
|
||||
niLocationItemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -402,6 +469,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 添加质检数据marker
|
||||
*/
|
||||
@ -445,53 +513,18 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
when (geometry.geometryType.uppercase(Locale.getDefault())) {
|
||||
"POINT" -> geoPoint =
|
||||
GeoPoint(geometry.coordinate.y, geometry.coordinate.x)
|
||||
// "LINESTRING" -> {
|
||||
// val lineString = geometry as LineString
|
||||
// if (lineString != null && lineString.coordinates.size > 0) {
|
||||
// geoPoint = GeoPoint(
|
||||
// lineString.coordinates[0].y,
|
||||
// lineString.coordinates[0].x
|
||||
// )
|
||||
// }
|
||||
// val drawableLine: Drawable =
|
||||
// convertGeometry2Drawable(geometry, lineStyle)
|
||||
// if (drawableLine != null) {
|
||||
// dataVectorLayer.add(drawableLine)
|
||||
// }
|
||||
// }
|
||||
// "POLYGON" -> {
|
||||
// val polygon = geometry as Polygon
|
||||
// if (polygon != null && polygon.coordinates.size > 0) {
|
||||
// geoPoint = GeoPoint(
|
||||
// polygon.coordinates[0].y,
|
||||
// polygon.coordinates[0].x
|
||||
// )
|
||||
// }
|
||||
// val drawablePolygon: Drawable =
|
||||
// convertGeometry2Drawable(geometry, polygonStyle)
|
||||
// if (drawablePolygon != null) {
|
||||
// dataVectorLayer.add(drawablePolygon)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (geoPoint != null) {
|
||||
|
||||
val geoMarkerItem: MarkerItem
|
||||
// if (item.getType() === 1) {
|
||||
geoMarkerItem = ClusterMarkerItem(
|
||||
1, item.id, item.description, geoPoint
|
||||
)
|
||||
// } else {
|
||||
// geoMarkerItem = MarkerItem(
|
||||
// ePointTemp.getType(),
|
||||
// ePointTemp.getId(),
|
||||
// ePointTemp.getStyleText(),
|
||||
// geoPoint
|
||||
// )
|
||||
// }
|
||||
val markerSymbol =
|
||||
MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
|
||||
geoMarkerItem = ClusterMarkerItem(1, item.id, item.description, geoPoint)
|
||||
|
||||
val markerSymbol = MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
|
||||
geoMarkerItem.marker = markerSymbol
|
||||
|
||||
qsRecordItemizedLayer.itemList.add(geoMarkerItem)
|
||||
}
|
||||
}
|
||||
@ -499,6 +532,64 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
qsRecordItemizedLayer.populate()
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加质检数据marker
|
||||
*/
|
||||
public suspend fun addNiLocationMarkerItem(niLocation: NiLocation) {
|
||||
|
||||
var itemizedLayer: ItemizedLayer? = null
|
||||
|
||||
val direction: Double = niLocation.direction
|
||||
|
||||
val geoMarkerItem: MarkerItem = ClusterMarkerItem(
|
||||
niLocation,
|
||||
niLocation.id,
|
||||
niLocation.time,
|
||||
GeoPoint(niLocation.latitude, niLocation.longitude)
|
||||
)
|
||||
|
||||
//角度
|
||||
when (niLocation.media) {
|
||||
0 -> {
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
if (direction != 0.0) {
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
geoMarkerItem.marker = symbolGpsTemp
|
||||
geoMarkerItem.setRotation(direction.toFloat())
|
||||
} else {
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap2, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
geoMarkerItem.marker = symbolGpsTemp
|
||||
}
|
||||
niLocationItemizedLayer.addItem(geoMarkerItem)
|
||||
itemizedLayer = niLocationItemizedLayer
|
||||
}
|
||||
|
||||
1 -> {
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
if (direction != 0.0) {
|
||||
val symbolLidarTemp =
|
||||
MarkerSymbol(niLocationBitmap1, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
geoMarkerItem.marker = symbolLidarTemp
|
||||
geoMarkerItem.setRotation(direction.toFloat())
|
||||
} else {
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap3, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
geoMarkerItem.marker = symbolGpsTemp
|
||||
}
|
||||
niLocationItemizedLayer.addItem(geoMarkerItem)
|
||||
itemizedLayer = niLocationItemizedLayer
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
itemizedLayer!!.update()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文字和图片拼装,文字换行
|
||||
@ -709,9 +800,19 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
bitmap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除轨迹图层
|
||||
*/
|
||||
fun clearNiLocationLayer() {
|
||||
niLocationItemizedLayer.removeAllItems()
|
||||
niLocationItemizedLayer.update()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface OnQsRecordItemClickListener {
|
||||
fun onQsRecordList(list: MutableList<String>)
|
||||
fun onNoteList(list: MutableList<String>)
|
||||
fun onNiLocationList(list: MutableList<NiLocation>)
|
||||
}
|
||||
|
||||
@ -115,10 +115,13 @@ public class MyItemizedLayer extends ItemizedLayer {
|
||||
// it = this.mMarkerRenderer.mDefaultMarker;
|
||||
}
|
||||
|
||||
if (it.isInside(dx, dy)) {// && this.mTmpPoint.y > insideY) {
|
||||
// insideY = this.mTmpPoint.y;
|
||||
inside = i;
|
||||
list.add(i);
|
||||
try{
|
||||
if (it.isInside(dx, dy)) {
|
||||
inside = i;
|
||||
list.add(i);
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
if (inside < 0) {
|
||||
|
||||
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_gps.png
Normal file
|
After Width: | Height: | Size: 401 B |
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_gps_1.png
Normal file
|
After Width: | Height: | Size: 377 B |
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_nilocation.png
Normal file
|
After Width: | Height: | Size: 492 B |
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_nilocation_1.png
Normal file
|
After Width: | Height: | Size: 611 B |
2
vtm
@ -1 +1 @@
|
||||
Subproject commit 1ee201a41f78f169873848209a3f3bdac36f185a
|
||||
Subproject commit dd13e533c38b5738ab404c2737d7ccadeff01323
|
||||