增加轨迹存储
This commit is contained in:
parent
d1f7129549
commit
7ebdfc93ff
@ -40,6 +40,7 @@ class TaskListFragment : BaseFragment() {
|
||||
if (taskBean.hadLinkDvoList.isEmpty()) {
|
||||
Toast.makeText(context, "数据错误,无Link数据!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
when (status) {
|
||||
TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
@ -48,6 +49,7 @@ class TaskListFragment : BaseFragment() {
|
||||
}
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK -> {
|
||||
showLoadingDialog("正在关闭")
|
||||
context?.let { viewModel.removeTask(it, taskBean) }
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK -> {
|
||||
@ -56,15 +58,6 @@ class TaskListFragment : BaseFragment() {
|
||||
viewModel.checkUploadTask(binding.root.context, taskBean)
|
||||
}
|
||||
else -> {
|
||||
if(status==TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK){
|
||||
viewModel.setSelectTaskBean(taskBean as TaskBean)
|
||||
}else if(status==TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK){
|
||||
showLoadingDialog("正在关闭")
|
||||
context?.let { viewModel.removeTask(it, taskBean as TaskBean) }
|
||||
}else if(status==TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK){
|
||||
showLoadingDialog("正在校验")
|
||||
viewModel.checkUploadTask(binding.root.context,taskBean)
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ 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.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 +31,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 操作
|
||||
@ -60,10 +69,16 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
private lateinit var canvas: org.oscim.backend.canvas.Canvas
|
||||
private lateinit var itemizedLayer: MyItemizedLayer
|
||||
|
||||
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
|
||||
private var niLocationBitmap3: Bitmap? = null
|
||||
|
||||
/**
|
||||
* 文字大小
|
||||
@ -123,13 +138,17 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
init {
|
||||
//新增marker图标样式
|
||||
val mDefaultBitmap =
|
||||
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.marker));
|
||||
|
||||
AndroidBitmap(BitmapFactory.decodeResource(context.resources, R.mipmap.marker))
|
||||
val markerSymbol = MarkerSymbol(
|
||||
mDefaultBitmap,
|
||||
MarkerSymbol.HotspotPlace.BOTTOM_CENTER
|
||||
);
|
||||
//新增marker图层
|
||||
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>(),
|
||||
@ -156,6 +175,8 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
}
|
||||
})
|
||||
initNoteData()
|
||||
//初始化加载轨迹
|
||||
initNiLocationDataLayer()
|
||||
mMapView.updateMap()
|
||||
}
|
||||
|
||||
@ -413,6 +434,52 @@ 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<String>()
|
||||
if (list.size == 0) {
|
||||
} else {
|
||||
for (i in list) {
|
||||
val markerInterface: MarkerInterface =
|
||||
itemizedLayer.itemList[i]
|
||||
if (markerInterface is MarkerItem) {
|
||||
idList.add(markerInterface.title)
|
||||
}
|
||||
}
|
||||
it.onQsRecordList(idList.distinct().toMutableList())
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onItemLongPress(
|
||||
list: MutableList<Int>?,
|
||||
nearest: Int
|
||||
): Boolean {
|
||||
return true
|
||||
}
|
||||
})
|
||||
addLayer(niLocationItemizedLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||
mContext.lifecycleScope.launch(Dispatchers.IO) {
|
||||
var list = mutableListOf<QsRecordBean>()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加质检数据marker
|
||||
*/
|
||||
@ -456,34 +523,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
when (geometry.geometryType.uppercase(Locale.getDefault())) {
|
||||
"POINT" -> geoPoint =
|
||||
org.oscim.core.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) {
|
||||
@ -492,14 +531,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
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.marker = markerSymbol
|
||||
@ -510,6 +541,53 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
itemizedLayer.populate()
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加质检数据marker
|
||||
*/
|
||||
private suspend fun addNiLocationMarkerItem(niLocation: NiLocation) {
|
||||
val item = MarkerItem(niLocation.id, "", GeoPoint(niLocation.latitude, niLocation.longitude))
|
||||
var itemizedLayer: ItemizedLayer? = null
|
||||
val direction: Double = niLocation.direction
|
||||
//角度
|
||||
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{
|
||||
val symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap2, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
item.marker = symbolGpsTemp
|
||||
}
|
||||
niLocationItemizedLayer.addItem(item)
|
||||
itemizedLayer = niLocationItemizedLayer
|
||||
}
|
||||
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 symbolGpsTemp =
|
||||
MarkerSymbol(niLocationBitmap3, MarkerSymbol.HotspotPlace.CENTER, false)
|
||||
item.marker = symbolGpsTemp
|
||||
}
|
||||
niLocationItemizedLayer.addItem(item)
|
||||
itemizedLayer = niLocationItemizedLayer
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
itemizedLayer!!.update()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文字和图片拼装,文字换行
|
||||
@ -720,6 +798,25 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
bitmap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加质检数据marker
|
||||
*/
|
||||
private suspend fun createTrackMarkerItem(item: NiLocation) {
|
||||
for (item in itemizedLayer.itemList) {
|
||||
if (item is MarkerItem) {
|
||||
if (item.title == item.uid) {
|
||||
itemizedLayer.itemList.remove(item)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
//createMarkerItem(data)
|
||||
withContext(Dispatchers.Main) {
|
||||
mMapView.updateMap(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface OnQsRecordItemClickListener {
|
||||
|
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_gps.png
Normal file
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_gps.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 401 B |
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_gps_1.png
Normal file
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_gps_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 377 B |
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_nilocation.png
Normal file
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_nilocation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 492 B |
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_nilocation_1.png
Normal file
BIN
collect-library/src/main/res/mipmap-xxhdpi/icon_nilocation_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 611 B |
2
vtm
2
vtm
@ -1 +1 @@
|
||||
Subproject commit 1ee201a41f78f169873848209a3f3bdac36f185a
|
||||
Subproject commit dd13e533c38b5738ab404c2737d7ccadeff01323
|
Loading…
x
Reference in New Issue
Block a user