1、适配上传接口2、代码融合

This commit is contained in:
qiji4215 2023-07-14 14:20:34 +08:00
parent c3f299222a
commit c8ac5c9582
8 changed files with 193 additions and 238 deletions

View File

@ -54,7 +54,7 @@ data class EvaluationInfo(
val roadClassfcation: String = "",//道路种别 val roadClassfcation: String = "",//道路种别
@SerializedName("roadFunctionGrade") @SerializedName("roadFunctionGrade")
val roadFunctionGrade: String = "",//道路功能等级 val roadFunctionGrade: Int = 3,//道路功能等级
@SerializedName("noEvaluationreason") @SerializedName("noEvaluationreason")
val noEvaluationreason: String = "",//未测评原因 val noEvaluationreason: String = "",//未测评原因
@ -63,7 +63,7 @@ data class EvaluationInfo(
val linkLength: Double = 0.0,//link长度(m 保留3位小数) val linkLength: Double = 0.0,//link长度(m 保留3位小数)
@SerializedName("dataLevel") @SerializedName("dataLevel")
val dataLevel: String = "",//数据级别 val dataLevel: Int = 3,//数据级别
@SerializedName("linstringLength") @SerializedName("linstringLength")
val linstringLength: Double = 0.0,//错误要素长度m val linstringLength: Double = 0.0,//错误要素长度m

View File

@ -123,54 +123,13 @@ class TaskUploadScope(
} }
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean -> 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) val linkStatus = 1
} //存在原因标记未测评
}else{ if(hadLinkDvoBean.reason.isNotEmpty()){
val linkStatus = 1 //未测评
//存在原因标记未测评 val linkStatus = 0
if(hadLinkDvoBean.reason.isNotEmpty()){
val linkStatus = 0
}else{
val linkStatus = 1
}
val evaluationInfo = EvaluationInfo( val evaluationInfo = EvaluationInfo(
evaluationTaskId = taskBean.id.toString(), evaluationTaskId = taskBean.id.toString(),
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331" linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
@ -188,14 +147,64 @@ class TaskUploadScope(
evaluationDate = "", evaluationDate = "",
evaluationWay = 2, evaluationWay = 2,
roadClassfcation = "", roadClassfcation = "",
roadFunctionGrade = "", roadFunctionGrade = 0,
noEvaluationreason = hadLinkDvoBean.reason, noEvaluationreason = hadLinkDvoBean.reason,
linkLength = 0.0, linkLength = 0.0,
dataLevel = "", dataLevel = 0,
linstringLength = 0.0, linstringLength = 0.0,
) )
bodyList.add(evaluationInfo) 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 = "",
roadFunctionGrade = 3,
noEvaluationreason = "",
linkLength = s.toDouble(),
dataLevel = 3,
linstringLength = 0.0,
)
bodyList.add(evaluationInfo)
}
}
} }
} }
if(bodyList.size>0){ if(bodyList.size>0){

View File

@ -12,6 +12,7 @@ import android.widget.EditText
import android.widget.Toast import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
@ -145,6 +146,7 @@ class MainActivity : BaseActivity() {
} }
@RequiresApi(Build.VERSION_CODES.M)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -370,6 +372,7 @@ class MainActivity : BaseActivity() {
mapController.mMapView.onPause() mapController.mMapView.onPause()
} }
@RequiresApi(Build.VERSION_CODES.M)
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
viewModel.speakMode?.shutdown() viewModel.speakMode?.shutdown()
@ -400,6 +403,7 @@ class MainActivity : BaseActivity() {
/** /**
* 打开相机预览 * 打开相机预览
*/ */
@RequiresApi(Build.VERSION_CODES.M)
fun openCamera() { fun openCamera() {
//显示轨迹图层 //显示轨迹图层
viewModel.onClickCameraButton(this) viewModel.onClickCameraButton(this)
@ -408,6 +412,7 @@ class MainActivity : BaseActivity() {
/** /**
* 开关菜单 * 开关菜单
*/ */
@RequiresApi(Build.VERSION_CODES.M)
fun onClickMenu() { fun onClickMenu() {
//显示菜单图层 //显示菜单图层
viewModel.onClickMenu() viewModel.onClickMenu()
@ -543,6 +548,7 @@ class MainActivity : BaseActivity() {
.animateTo(GeoPoint( mapController.mMapView.vtmMap.mapPosition.geoPoint.latitude,mapController.mMapView.vtmMap.mapPosition.geoPoint.longitude)) .animateTo(GeoPoint( mapController.mMapView.vtmMap.mapPosition.geoPoint.latitude,mapController.mMapView.vtmMap.mapPosition.geoPoint.longitude))
} }
@RequiresApi(Build.VERSION_CODES.M)
private fun voiceOnTouchStart() { private fun voiceOnTouchStart() {
viewModel.startSoundMetter(this, binding.mainActivityVoice) viewModel.startSoundMetter(this, binding.mainActivityVoice)
} }
@ -625,6 +631,7 @@ class MainActivity : BaseActivity() {
/** /**
* 打开道路名称属性看板选择的道路在viewmodel里记录不用 * 打开道路名称属性看板选择的道路在viewmodel里记录不用
*/ */
@RequiresApi(Build.VERSION_CODES.M)
fun openRoadNameFragment() { fun openRoadNameFragment() {
if (viewModel.liveDataRoadName.value != null) { if (viewModel.liveDataRoadName.value != null) {
viewModel.showSignMoreInfo(viewModel.liveDataRoadName.value!!) viewModel.showSignMoreInfo(viewModel.liveDataRoadName.value!!)
@ -643,7 +650,6 @@ class MainActivity : BaseActivity() {
*/ */
fun onClickTaskLink() { fun onClickTaskLink() {
rightController.navigate(R.id.TaskLinkFragment) rightController.navigate(R.id.TaskLinkFragment)
} }
/** /**

View File

@ -151,7 +151,9 @@ class MainViewModel @Inject constructor(
liveDataNILocationList.value = list liveDataNILocationList.value = list
} }
}) })
initLocation() initLocation()
//处理地图点击操作 //处理地图点击操作
viewModelScope.launch(Dispatchers.Default) { viewModelScope.launch(Dispatchers.Default) {
mapController.onMapClickFlow.collectLatest { mapController.onMapClickFlow.collectLatest {
@ -172,33 +174,15 @@ class MainViewModel @Inject constructor(
/** /**
* 初始化选中的任务高亮高亮 * 初始化选中的任务高亮高亮
*/ */
@RequiresApi(Build.VERSION_CODES.M)
private fun initTaskData() {
viewModelScope.launch {
val realm = Realm.getDefaultInstance()
val results = realm.where(TaskBean::class.java).findAll()
val list = realm.copyFromRealm(results)
results.addChangeListener { changes ->
val list2 = realm.copyFromRealm(changes)
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
for (item in list2) {
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
}
}
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
for (item in list) {
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
}
private suspend fun initTaskData() { private suspend fun initTaskData() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1) val realm = Realm.getDefaultInstance()
val realm = Realm.getDefaultInstance() val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst() if (res != null) {
if (res != null) { val taskBean = realm.copyFromRealm(res)
val taskBean = realm.copyFromRealm(res) mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
}
} }
} }
/** /**
@ -237,6 +221,7 @@ class MainViewModel @Inject constructor(
/** /**
* 初始化定位信息 * 初始化定位信息
*/ */
@RequiresApi(Build.VERSION_CODES.N)
private fun initLocation() { private fun initLocation() {
//用于定位点存储到数据库 //用于定位点存储到数据库
viewModelScope.launch(Dispatchers.Default) { viewModelScope.launch(Dispatchers.Default) {
@ -290,7 +275,12 @@ class MainViewModel @Inject constructor(
//用于定位点捕捉道路 //用于定位点捕捉道路
viewModelScope.launch(Dispatchers.Default) { viewModelScope.launch(Dispatchers.Default) {
mapController.locationLayerHandler.niLocationFlow.collectLatest { location -> mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
if (!isSelectRoad()) captureLink(GeoPoint(location.latitude, location.longitude)) if (!isSelectRoad()) captureLink(
GeoPoint(
location.latitude,
location.longitude
)
)
} }
} }
@ -459,9 +449,13 @@ class MainViewModel @Inject constructor(
mCameraDialog!!.stopVideo() mCameraDialog!!.stopVideo()
try { try {
if (!mCameraDialog!!.getmShareUtil().connectstate) { 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() .StopSearch()
} catch (e: Exception) { } catch (e: Exception) {
} }
@ -598,4 +592,5 @@ class MainViewModel @Inject constructor(
liveDataSignMoreInfo.value = data liveDataSignMoreInfo.value = data
} }
} }

View File

@ -1,5 +1,6 @@
package com.navinfo.omqs.ui.fragment.tasklist package com.navinfo.omqs.ui.fragment.tasklist
import android.app.Dialog
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener import android.content.SharedPreferences.OnSharedPreferenceChangeListener
@ -33,7 +34,7 @@ class TaskViewModel @Inject constructor(
private val networkService: NetworkService, private val networkService: NetworkService,
private val mapController: NIMapController, private val mapController: NIMapController,
private val sharedPreferences: SharedPreferences private val sharedPreferences: SharedPreferences
) : ViewModel() { ) : ViewModel(), OnSharedPreferenceChangeListener {
/** /**
* 用来更新任务列表 * 用来更新任务列表
@ -57,9 +58,6 @@ class TaskViewModel @Inject constructor(
*/ */
val liveDataCloseTask = MutableLiveData<Boolean>() val liveDataCloseTask = MutableLiveData<Boolean>()
private val colors =
arrayOf(Color.RED, Color.YELLOW, Color.BLUE, Color.MAGENTA, Color.GREEN, Color.CYAN)
/** /**
* 当前选中的任务 * 当前选中的任务
*/ */

View File

@ -45,7 +45,7 @@ class SignUtil {
*获取道路功能等级文字 *获取道路功能等级文字
*/ */
private fun getLinkFunctionClassText(data: RenderEntity): String { 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"] val direct = data.properties["direct"]
when (direct?.toInt()) { when (direct?.toInt()) {
0 -> return "不应用" 0 -> return "不应用"
1 -> return "方向" 1 -> return ""
2 -> return "方向" 2 -> return ""
3 -> return "方向" 3 -> return ""
} }
return "" return ""
} }

View File

@ -53,9 +53,6 @@ import java.util.Locale
class MarkHandler(context: AppCompatActivity, mapView: NIMapView) : class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
BaseHandler(context, mapView) { BaseHandler(context, mapView) {
// //默认marker图层
private var mDefaultMarkerLayer: ItemizedLayer
/** /**
* 默认文字颜色 * 默认文字颜色
*/ */
@ -111,12 +108,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
layer layer
} }
private lateinit var niLocationItemizedLayer: MyItemizedLayer
private lateinit var markerRendererFactory: MarkerRendererFactory
private val resId = R.mipmap.map_icon_report
private val noteResId = R.drawable.icon_note_marker
private var itemListener: OnQsRecordItemClickListener? = null
private var niLocationBitmap: Bitmap? = null private var niLocationBitmap: Bitmap? = null
private var niLocationBitmap1: Bitmap? = null private var niLocationBitmap1: Bitmap? = null
private var niLocationBitmap2: Bitmap? = null private var niLocationBitmap2: Bitmap? = null
@ -163,6 +154,61 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
layer 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
}
/** /**
* 便签线图层 * 便签线图层
*/ */
@ -235,9 +281,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
org.oscim.backend.canvas.Color.BLUE org.oscim.backend.canvas.Color.BLUE
) )
) { ) {
// override fun getClusterBitmap(size: Int): Bitmap? {
// return super.getclusterbitmap(size)
// }
} }
} }
} }
@ -252,48 +295,13 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
init { init {
//新增marker图标样式
val mDefaultBitmap =
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.marker))
val markerSymbol = MarkerSymbol(
mDefaultBitmap,
MarkerSymbol.HotspotPlace.BOTTOM_CENTER)
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))
//新增marker图层
mDefaultMarkerLayer = ItemizedLayer(
mapView.vtmMap,
ArrayList<MarkerInterface>(),
markerSymbol,
object : OnItemGestureListener<MarkerInterface> {
override fun onItemSingleTapUp(index: Int, item: MarkerInterface?): Boolean {
return false
}
override fun onItemLongPress(index: Int, item: MarkerInterface?): Boolean {
return false
}
}
)
//初始化之间数据图层
initQsRecordDataLayer()
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER);
// 设置矢量图层均在12级以上才显示 // 设置矢量图层均在12级以上才显示
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition -> mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
if (e == Map.SCALE_EVENT) { if (e == Map.SCALE_EVENT) {
qsRecordItemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12 qsRecordItemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12
niLocationItemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12
} }
}) })
initNoteData()
//初始化加载轨迹
initNiLocationDataLayer()
mMapView.updateMap()
} }
/** /**
@ -461,46 +469,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
// //
// } // }
/**
* 初始化定位图层
*/
private fun initNiLocationDataLayer() {
niLocationItemizedLayer =
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(niLocationItemizedLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
}
/** /**
* 添加质检数据marker * 添加质检数据marker
@ -545,54 +513,18 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
when (geometry.geometryType.uppercase(Locale.getDefault())) { when (geometry.geometryType.uppercase(Locale.getDefault())) {
"POINT" -> geoPoint = "POINT" -> geoPoint =
GeoPoint(geometry.coordinate.y, geometry.coordinate.x) 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)
// }
// }
org.oscim.core.GeoPoint(geometry.coordinate.y, geometry.coordinate.x)
} }
} }
if (geoPoint != null) { if (geoPoint != null) {
val geoMarkerItem: MarkerItem val geoMarkerItem: MarkerItem
// if (item.getType() === 1) {
geoMarkerItem = ClusterMarkerItem( geoMarkerItem = ClusterMarkerItem(1, item.id, item.description, geoPoint)
1, item.id, item.description, geoPoint
) val markerSymbol = MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.CENTER)
// } else {
// geoMarkerItem = MarkerItem(
// ePointTemp.getType(),
// ePointTemp.getId(),
// ePointTemp.getStyleText(),
// geoPoint
// )
// }
val markerSymbol =
MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.CENTER)
geoMarkerItem.marker = markerSymbol geoMarkerItem.marker = markerSymbol
qsRecordItemizedLayer.itemList.add(geoMarkerItem) qsRecordItemizedLayer.itemList.add(geoMarkerItem)
} }
} }
@ -604,40 +536,51 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
* 添加质检数据marker * 添加质检数据marker
*/ */
public suspend fun addNiLocationMarkerItem(niLocation: NiLocation) { public suspend fun addNiLocationMarkerItem(niLocation: NiLocation) {
val item = MarkerItem(niLocation, niLocation.id, "", GeoPoint(niLocation.latitude, niLocation.longitude))
var itemizedLayer: ItemizedLayer? = null var itemizedLayer: ItemizedLayer? = null
val direction: Double = niLocation.direction val direction: Double = niLocation.direction
val geoMarkerItem: MarkerItem = ClusterMarkerItem(
niLocation,
niLocation.id,
niLocation.time,
GeoPoint(niLocation.latitude, niLocation.longitude)
)
//角度 //角度
when(niLocation.media){ when (niLocation.media) {
0->{ 0 -> {
//角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可 //角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可
//角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可 //角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可
if (direction != 0.0) { if (direction != 0.0) {
val symbolGpsTemp = val symbolGpsTemp =
MarkerSymbol(niLocationBitmap, MarkerSymbol.HotspotPlace.CENTER, false) MarkerSymbol(niLocationBitmap, MarkerSymbol.HotspotPlace.CENTER, false)
item.marker = symbolGpsTemp geoMarkerItem.marker = symbolGpsTemp
item.setRotation(direction.toFloat()) geoMarkerItem.setRotation(direction.toFloat())
}else{ } else {
val symbolGpsTemp = val symbolGpsTemp =
MarkerSymbol(niLocationBitmap2, MarkerSymbol.HotspotPlace.CENTER, false) MarkerSymbol(niLocationBitmap2, MarkerSymbol.HotspotPlace.CENTER, false)
item.marker = symbolGpsTemp geoMarkerItem.marker = symbolGpsTemp
} }
niLocationItemizedLayer.addItem(item) niLocationItemizedLayer.addItem(geoMarkerItem)
itemizedLayer = niLocationItemizedLayer itemizedLayer = niLocationItemizedLayer
} }
1->{
1 -> {
//角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可 //角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可
//角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可 //角度不为0时需要预先设置marker样式并进行角度设置否则使用图层默认的sym即可
if (direction != 0.0) { if (direction != 0.0) {
val symbolLidarTemp = MarkerSymbol(niLocationBitmap1, MarkerSymbol.HotspotPlace.CENTER, false) val symbolLidarTemp =
item.marker = symbolLidarTemp MarkerSymbol(niLocationBitmap1, MarkerSymbol.HotspotPlace.CENTER, false)
item.setRotation(direction.toFloat()) geoMarkerItem.marker = symbolLidarTemp
}else{ geoMarkerItem.setRotation(direction.toFloat())
} else {
val symbolGpsTemp = val symbolGpsTemp =
MarkerSymbol(niLocationBitmap3, MarkerSymbol.HotspotPlace.CENTER, false) MarkerSymbol(niLocationBitmap3, MarkerSymbol.HotspotPlace.CENTER, false)
item.marker = symbolGpsTemp geoMarkerItem.marker = symbolGpsTemp
} }
niLocationItemizedLayer.addItem(item) niLocationItemizedLayer.addItem(geoMarkerItem)
itemizedLayer = niLocationItemizedLayer itemizedLayer = niLocationItemizedLayer
} }
@ -871,4 +814,5 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
interface OnQsRecordItemClickListener { interface OnQsRecordItemClickListener {
fun onQsRecordList(list: MutableList<String>) fun onQsRecordList(list: MutableList<String>)
fun onNoteList(list: MutableList<String>) fun onNoteList(list: MutableList<String>)
fun onNiLocationList(list: MutableList<NiLocation>)
} }

View File

@ -115,10 +115,13 @@ public class MyItemizedLayer extends ItemizedLayer {
// it = this.mMarkerRenderer.mDefaultMarker; // it = this.mMarkerRenderer.mDefaultMarker;
} }
if (it.isInside(dx, dy)) {// && this.mTmpPoint.y > insideY) { try{
// insideY = this.mTmpPoint.y; if (it.isInside(dx, dy)) {
inside = i; inside = i;
list.add(i); list.add(i);
}
}catch (Exception e){
} }
if (inside < 0) { if (inside < 0) {