评测数据增加任务id
评测数据根据所选任务显隐 修改评测link和评测数据的联动维护
This commit is contained in:
@@ -15,6 +15,7 @@ import io.realm.annotations.PrimaryKey
|
||||
*/
|
||||
//@RealmClass
|
||||
open class QsRecordBean @JvmOverloads constructor(
|
||||
var taskId: Int = -1,
|
||||
/**
|
||||
* id 主键
|
||||
*
|
||||
@@ -97,6 +98,7 @@ open class QsRecordBean @JvmOverloads constructor(
|
||||
|
||||
fun copy(): QsRecordBean {
|
||||
val qs = QsRecordBean(
|
||||
taskId = taskId,
|
||||
id = id,
|
||||
elementId = elementId,
|
||||
linkId = linkId,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
interface BaseClickListener
|
||||
@@ -1,12 +1,8 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.navinfo.collect.library.map.handler.*
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
|
||||
/**
|
||||
* 地图控制器
|
||||
@@ -23,7 +19,7 @@ class NIMapController {
|
||||
lateinit var viewportHandler: ViewportHandler
|
||||
lateinit var measureLayerHandler: MeasureLayerHandler
|
||||
|
||||
val onMapClickFlow = MutableSharedFlow<GeoPoint>()
|
||||
// val onMapClickFlow = MutableSharedFlow<GeoPoint>()
|
||||
|
||||
fun init(
|
||||
context: AppCompatActivity,
|
||||
@@ -43,13 +39,26 @@ class NIMapController {
|
||||
measureLayerHandler = MeasureLayerHandler(context, mapView)
|
||||
mMapView = mapView
|
||||
mMapView.setOnMapClickListener {
|
||||
context.lifecycleScope.launch {
|
||||
onMapClickFlow.emit(it)
|
||||
if (mapView.listenerTagList.isNotEmpty()) {
|
||||
val tag = mapView.listenerTagList.last()
|
||||
val listenerList = mapView.listenerList[tag]
|
||||
if (listenerList != null) {
|
||||
for (listener in listenerList) {
|
||||
if (listener is OnGeoPointClickListener) {
|
||||
listener.onMapClick(tag, it)
|
||||
return@setOnMapClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// context.lifecycleScope.launch {
|
||||
// onMapClickFlow.emit(it)
|
||||
// }
|
||||
|
||||
}
|
||||
mapView.setOptions(options)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.navinfo.collect.library.map;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -12,12 +12,12 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.navinfo.collect.library.R;
|
||||
import com.navinfo.collect.library.data.entity.NiLocation;
|
||||
import com.navinfo.collect.library.map.layers.NaviMapScaleBar;
|
||||
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
import org.oscim.android.MapView;
|
||||
@@ -29,22 +29,14 @@ import org.oscim.event.Gesture;
|
||||
import org.oscim.event.GestureListener;
|
||||
import org.oscim.layers.GroupLayer;
|
||||
import org.oscim.layers.Layer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.OsmTileLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
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;
|
||||
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
||||
import org.oscim.tiling.source.mapfile.MultiMapFileTileSource;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -91,11 +83,6 @@ public final class NIMapView extends RelativeLayout {
|
||||
* 地图状态设置
|
||||
*/
|
||||
private NIMapOptions options;
|
||||
/**
|
||||
* 地图图层管理器
|
||||
*/
|
||||
// private NILayerManager mLayerManager;
|
||||
// private Layer baseRasterLayer, defaultVectorTileLayer, defaultVectorLabelLayer, gridLayer;
|
||||
/**
|
||||
* 地图网格图层
|
||||
*/
|
||||
@@ -109,6 +96,23 @@ public final class NIMapView extends RelativeLayout {
|
||||
protected String mapFilePath = "/map";
|
||||
protected GroupLayer baseGroupLayer; // 用于盛放所有基础底图的图层组,便于统一管理
|
||||
|
||||
|
||||
private HashMap<String, BaseClickListener[]> listenerList = new HashMap();
|
||||
private List<String> listenerTagList = new ArrayList();
|
||||
|
||||
public HashMap<String, BaseClickListener[]> getListenerList() {
|
||||
return listenerList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有tag
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<String> getListenerTagList() {
|
||||
return listenerTagList;
|
||||
}
|
||||
|
||||
public void setOptions(NIMapOptions option) {
|
||||
this.options = option;
|
||||
initOptions();
|
||||
@@ -812,8 +816,6 @@ public final class NIMapView extends RelativeLayout {
|
||||
|
||||
/**
|
||||
* 设置logo显隐
|
||||
*
|
||||
* @param position 按钮位置
|
||||
*/
|
||||
public void setLogoVisable(int visable) {
|
||||
if (logoImage != null) {
|
||||
@@ -886,12 +888,13 @@ 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)){
|
||||
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;
|
||||
}
|
||||
@@ -1029,4 +1032,39 @@ public final class NIMapView extends RelativeLayout {
|
||||
mapView.map().updateMap(redraw);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加地图点击监听
|
||||
*/
|
||||
public boolean addOnNIMapClickListener(@NonNull String tag, @NonNull BaseClickListener... listeners) {
|
||||
if (TextUtils.equals(tag, "")) {
|
||||
return false;
|
||||
}
|
||||
for (Object s : listenerTagList) {
|
||||
if (s == tag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
listenerTagList.add(tag);
|
||||
listenerList.put(tag, listeners);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除点击监听
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
public void removeOnNIMapClickListener(@NonNull String tag) {
|
||||
listenerList.remove(tag);
|
||||
for (String t : listenerTagList) {
|
||||
if (t.equals(tag)) {
|
||||
listenerTagList.remove(t);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
import org.oscim.core.GeoPoint
|
||||
|
||||
interface OnGeoPointClickListener : BaseClickListener {
|
||||
fun onMapClick(tag: String, point: GeoPoint)
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.collect.library.map.BaseClickListener
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.layers.MultiLinesLayer
|
||||
import com.navinfo.collect.library.map.layers.OmdbTaskLinkLayer
|
||||
@@ -19,21 +20,23 @@ import org.oscim.layers.vector.geometries.Style
|
||||
|
||||
class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(context, mapView) {
|
||||
|
||||
//绘制线 样式
|
||||
private val lineStyle: Style
|
||||
|
||||
//高亮线绘制线 样式
|
||||
private val defaultLineStyle: Style
|
||||
|
||||
/**
|
||||
* 高亮线图层,同时只高亮一条线,如线选择
|
||||
*/
|
||||
private val mDefaultPathLayer: PathLayer
|
||||
private val mDefaultPathLayer: PathLayer by lazy {
|
||||
//高亮线绘制线 样式
|
||||
val defaultLineStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.draw_line_blue2_color))
|
||||
.strokeWidth(10f)
|
||||
.fillColor(context.resources.getColor(R.color.teal_200))
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(context.resources.getColor(R.color.teal_200))
|
||||
.fixed(true).build()
|
||||
|
||||
private var onTaskLinkItemClickListener: OnTaskLinkItemClickListener? = null
|
||||
|
||||
fun setOnTaskLinkItemClickListener(listener: OnTaskLinkItemClickListener) {
|
||||
onTaskLinkItemClickListener = listener
|
||||
val layer = PathLayer(mMapView.vtmMap, defaultLineStyle)
|
||||
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||
layer
|
||||
}
|
||||
|
||||
|
||||
@@ -84,12 +87,18 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
||||
markerSymbol,
|
||||
object : OnItemGestureListener<MarkerInterface> {
|
||||
override fun onItemSingleTapUp(index: Int, item: MarkerInterface?): Boolean {
|
||||
onTaskLinkItemClickListener?.let {
|
||||
if (item is MarkerItem) {
|
||||
it.onTaskLink(item.title)
|
||||
val tag = mMapView.listenerTagList.last()
|
||||
val listenerList = mMapView.listenerList[tag]
|
||||
if (listenerList != null) {
|
||||
for (listener in listenerList) {
|
||||
if (listener is OnTaskLinkItemClickListener) {
|
||||
if (item is MarkerItem) {
|
||||
listener.onTaskLink(tag, item.title)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -103,30 +112,6 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
||||
layer
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
//新增线数据图层和线样式
|
||||
lineStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.draw_line_blue1_color))
|
||||
.strokeWidth(4f)
|
||||
.fillColor(context.resources.getColor(R.color.draw_line_blue2_color))
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color))
|
||||
.fixed(true).build()
|
||||
|
||||
|
||||
defaultLineStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.draw_line_blue2_color))
|
||||
.strokeWidth(10f)
|
||||
.fillColor(context.resources.getColor(R.color.teal_200))
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(context.resources.getColor(R.color.teal_200))
|
||||
.fixed(true).build()
|
||||
|
||||
mDefaultPathLayer = PathLayer(mMapView.vtmMap, defaultLineStyle)
|
||||
addLayer(mDefaultPathLayer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 高亮一条线
|
||||
@@ -226,6 +211,6 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
||||
}
|
||||
}
|
||||
|
||||
interface OnTaskLinkItemClickListener {
|
||||
fun onTaskLink(taskLinkId: String)
|
||||
interface OnTaskLinkItemClickListener : BaseClickListener {
|
||||
fun onTaskLink(tag: String, taskLinkId: String)
|
||||
}
|
||||
@@ -11,6 +11,7 @@ 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.BaseClickListener
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerItem
|
||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerRenderer
|
||||
@@ -145,18 +146,22 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
list: MutableList<Int>,
|
||||
nearest: Int
|
||||
): Boolean {
|
||||
itemListener?.let {
|
||||
val idList = mutableListOf<String>()
|
||||
if (list.size == 0) {
|
||||
} else {
|
||||
for (i in list) {
|
||||
val markerInterface: MarkerInterface =
|
||||
qsRecordItemizedLayer.itemList[i]
|
||||
if (markerInterface is MarkerItem) {
|
||||
idList.add(markerInterface.title)
|
||||
val tag = mMapView.listenerTagList.last()
|
||||
val listenerList = mMapView.listenerList[tag]
|
||||
if (listenerList != null) {
|
||||
for (listener in listenerList) {
|
||||
if (listener is OnQsRecordItemClickListener) {
|
||||
val idList = mutableListOf<String>()
|
||||
for (i in list) {
|
||||
val markerInterface: MarkerInterface =
|
||||
qsRecordItemizedLayer.itemList[i]
|
||||
if (markerInterface is MarkerItem) {
|
||||
idList.add(markerInterface.title)
|
||||
}
|
||||
}
|
||||
listener.onQsRecordList(tag, idList.distinct().toMutableList())
|
||||
break
|
||||
}
|
||||
it.onQsRecordList(idList.distinct().toMutableList())
|
||||
}
|
||||
}
|
||||
return true
|
||||
@@ -185,8 +190,18 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
)
|
||||
layer.setOnItemGestureListener(object : OnItemGestureListener<MarkerInterface> {
|
||||
override fun onItemSingleTapUp(index: Int, item: MarkerInterface?): Boolean {
|
||||
itemListener?.let {
|
||||
it.onNiLocation((niLocationItemizedLayer.itemList[index] as MarkerItem).uid as NiLocation)
|
||||
val tag = mMapView.listenerTagList.last()
|
||||
val listenerList = mMapView.listenerList[tag]
|
||||
if (listenerList != null) {
|
||||
for (listener in listenerList) {
|
||||
if (listener is OnNiLocationItemListener) {
|
||||
listener.onNiLocation(
|
||||
tag,
|
||||
(niLocationItemizedLayer.itemList[index] as MarkerItem).uid as NiLocation
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -222,10 +237,17 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
)
|
||||
layer.setOnItemGestureListener(object : OnItemGestureListener<MarkerInterface> {
|
||||
override fun onItemSingleTapUp(index: Int, item: MarkerInterface?): Boolean {
|
||||
itemListener?.let {
|
||||
val marker = layer.itemList[index]
|
||||
if (marker is MarkerItem)
|
||||
it.onNote(marker.title)
|
||||
val tag = mMapView.listenerTagList.last()
|
||||
val listenerList = mMapView.listenerList[tag]
|
||||
if (listenerList != null) {
|
||||
for (listener in listenerList) {
|
||||
if (listener is ONNoteItemClickListener) {
|
||||
val marker = layer.itemList[index]
|
||||
if (marker is MarkerItem)
|
||||
listener.onNote(tag, marker.title)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -241,7 +263,6 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
|
||||
private val resId = R.mipmap.map_icon_report
|
||||
private val noteResId = R.drawable.icon_note_marker
|
||||
private var itemListener: OnQsRecordItemClickListener? = null
|
||||
|
||||
/**
|
||||
* 文字大小
|
||||
@@ -259,17 +280,10 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置marker 点击回调
|
||||
*/
|
||||
fun setOnQsRecordItemClickListener(listener: OnQsRecordItemClickListener?) {
|
||||
itemListener = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加marker
|
||||
*/
|
||||
|
||||
fun addMarker(
|
||||
geoPoint: GeoPoint,
|
||||
title: String?,
|
||||
@@ -753,10 +767,24 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
niLocationItemizedLayer.update()
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除所有质检数据
|
||||
*/
|
||||
fun removeAllQsMarker() {
|
||||
qsRecordItemizedLayer.removeAllItems()
|
||||
mMapView.updateMap(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface OnQsRecordItemClickListener {
|
||||
fun onQsRecordList(list: MutableList<String>)
|
||||
fun onNote(noteId: String)
|
||||
fun onNiLocation(it: NiLocation)
|
||||
interface OnQsRecordItemClickListener : BaseClickListener {
|
||||
fun onQsRecordList(tag: String, list: MutableList<String>)
|
||||
}
|
||||
|
||||
interface ONNoteItemClickListener : BaseClickListener {
|
||||
fun onNote(tag: String, noteId: String)
|
||||
}
|
||||
|
||||
interface OnNiLocationItemListener : BaseClickListener {
|
||||
fun onNiLocation(tag: String, it: NiLocation)
|
||||
}
|
||||
Reference in New Issue
Block a user