1、适配上传接口2、代码融合
This commit is contained in:
parent
c3f299222a
commit
c8ac5c9582
@ -54,7 +54,7 @@ data class EvaluationInfo(
|
||||
val roadClassfcation: String = "",//道路种别
|
||||
|
||||
@SerializedName("roadFunctionGrade")
|
||||
val roadFunctionGrade: String = "",//道路功能等级
|
||||
val roadFunctionGrade: Int = 3,//道路功能等级
|
||||
|
||||
@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 = 3,//数据级别
|
||||
|
||||
@SerializedName("linstringLength")
|
||||
val linstringLength: Double = 0.0,//错误要素长度(m)
|
||||
|
@ -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"
|
||||
@ -188,14 +147,64 @@ class TaskUploadScope(
|
||||
evaluationDate = "",
|
||||
evaluationWay = 2,
|
||||
roadClassfcation = "",
|
||||
roadFunctionGrade = "",
|
||||
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 = "",
|
||||
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
|
||||
@ -145,6 +146,7 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@ -370,6 +372,7 @@ class MainActivity : BaseActivity() {
|
||||
mapController.mMapView.onPause()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
viewModel.speakMode?.shutdown()
|
||||
@ -400,6 +403,7 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 打开相机预览
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun openCamera() {
|
||||
//显示轨迹图层
|
||||
viewModel.onClickCameraButton(this)
|
||||
@ -408,6 +412,7 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 开关菜单
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun onClickMenu() {
|
||||
//显示菜单图层
|
||||
viewModel.onClickMenu()
|
||||
@ -543,6 +548,7 @@ class MainActivity : BaseActivity() {
|
||||
.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)
|
||||
}
|
||||
@ -625,6 +631,7 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 打开道路名称属性看板,选择的道路在viewmodel里记录,不用
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun openRoadNameFragment() {
|
||||
if (viewModel.liveDataRoadName.value != null) {
|
||||
viewModel.showSignMoreInfo(viewModel.liveDataRoadName.value!!)
|
||||
@ -643,7 +650,6 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
fun onClickTaskLink() {
|
||||
rightController.navigate(R.id.TaskLinkFragment)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +151,9 @@ class MainViewModel @Inject constructor(
|
||||
liveDataNILocationList.value = list
|
||||
}
|
||||
})
|
||||
|
||||
initLocation()
|
||||
|
||||
//处理地图点击操作
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
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() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||
if (res != null) {
|
||||
val taskBean = realm.copyFromRealm(res)
|
||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
|
||||
}
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||
if (res != null) {
|
||||
val taskBean = realm.copyFromRealm(res)
|
||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,6 +221,7 @@ class MainViewModel @Inject constructor(
|
||||
/**
|
||||
* 初始化定位信息
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
private fun initLocation() {
|
||||
//用于定位点存储到数据库
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
@ -290,7 +275,12 @@ class MainViewModel @Inject constructor(
|
||||
//用于定位点捕捉道路
|
||||
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
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,9 +449,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) {
|
||||
}
|
||||
@ -598,4 +592,5 @@ class MainViewModel @Inject constructor(
|
||||
liveDataSignMoreInfo.value = data
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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
|
||||
@ -33,7 +34,7 @@ class TaskViewModel @Inject constructor(
|
||||
private val networkService: NetworkService,
|
||||
private val mapController: NIMapController,
|
||||
private val sharedPreferences: SharedPreferences
|
||||
) : ViewModel() {
|
||||
) : ViewModel(), OnSharedPreferenceChangeListener {
|
||||
|
||||
/**
|
||||
* 用来更新任务列表
|
||||
@ -57,9 +58,6 @@ class TaskViewModel @Inject constructor(
|
||||
*/
|
||||
val liveDataCloseTask = MutableLiveData<Boolean>()
|
||||
|
||||
private val colors =
|
||||
arrayOf(Color.RED, Color.YELLOW, Color.BLUE, Color.MAGENTA, Color.GREEN, Color.CYAN)
|
||||
|
||||
/**
|
||||
* 当前选中的任务
|
||||
*/
|
||||
|
@ -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 ""
|
||||
}
|
||||
|
@ -53,9 +53,6 @@ import java.util.Locale
|
||||
class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
BaseHandler(context, mapView) {
|
||||
|
||||
// //默认marker图层
|
||||
private var mDefaultMarkerLayer: ItemizedLayer
|
||||
|
||||
/**
|
||||
* 默认文字颜色
|
||||
*/
|
||||
@ -111,12 +108,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
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 niLocationBitmap1: Bitmap? = null
|
||||
private var niLocationBitmap2: Bitmap? = null
|
||||
@ -163,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
|
||||
}
|
||||
|
||||
/**
|
||||
* 便签线图层
|
||||
*/
|
||||
@ -235,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)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -252,48 +295,13 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
|
||||
|
||||
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级以上才显示
|
||||
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
if (e == Map.SCALE_EVENT) {
|
||||
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
|
||||
@ -545,54 +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)
|
||||
// }
|
||||
// }
|
||||
org.oscim.core.GeoPoint(geometry.coordinate.y, geometry.coordinate.x)
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
@ -604,40 +536,51 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
* 添加质检数据marker
|
||||
*/
|
||||
public suspend fun addNiLocationMarkerItem(niLocation: NiLocation) {
|
||||
val item = MarkerItem(niLocation, niLocation.id, "", GeoPoint(niLocation.latitude, niLocation.longitude))
|
||||
|
||||
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->{
|
||||
when (niLocation.media) {
|
||||
0 -> {
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
if (direction != 0.0) {
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
item.marker = symbolGpsTemp
|
||||
item.setRotation(direction.toFloat())
|
||||
}else{
|
||||
geoMarkerItem.marker = symbolGpsTemp
|
||||
geoMarkerItem.setRotation(direction.toFloat())
|
||||
} else {
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap2, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
item.marker = symbolGpsTemp
|
||||
geoMarkerItem.marker = symbolGpsTemp
|
||||
}
|
||||
niLocationItemizedLayer.addItem(item)
|
||||
niLocationItemizedLayer.addItem(geoMarkerItem)
|
||||
itemizedLayer = niLocationItemizedLayer
|
||||
}
|
||||
1->{
|
||||
|
||||
1 -> {
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
//角度不为0时需要预先设置marker样式并进行角度设置,否则使用图层默认的sym即可
|
||||
if (direction != 0.0) {
|
||||
val symbolLidarTemp = MarkerSymbol(niLocationBitmap1, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
item.marker = symbolLidarTemp
|
||||
item.setRotation(direction.toFloat())
|
||||
}else{
|
||||
val symbolLidarTemp =
|
||||
MarkerSymbol(niLocationBitmap1, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
geoMarkerItem.marker = symbolLidarTemp
|
||||
geoMarkerItem.setRotation(direction.toFloat())
|
||||
} else {
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap3, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
item.marker = symbolGpsTemp
|
||||
geoMarkerItem.marker = symbolGpsTemp
|
||||
}
|
||||
niLocationItemizedLayer.addItem(item)
|
||||
niLocationItemizedLayer.addItem(geoMarkerItem)
|
||||
itemizedLayer = niLocationItemizedLayer
|
||||
}
|
||||
|
||||
@ -871,4 +814,5 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user