Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0
# Conflicts: # app/build.gradle # app/functions/och.gradle # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/ToggleDebugView.kt
This commit is contained in:
@@ -4,7 +4,7 @@ import android.os.Handler
|
||||
import android.os.Message
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoSubscriber
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMoGoIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.eagle.core.function.business.identify;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
@@ -50,7 +52,7 @@ public class TrackManager {
|
||||
* 记录每次实际绘制的交通元素UUID
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private final ConcurrentHashMap<String, Long> trafficDataUuid = new ConcurrentHashMap<>();
|
||||
private final ArraySet<String> trafficDataUuid = new ArraySet<>();
|
||||
|
||||
/**
|
||||
* 过滤后的数据集合
|
||||
@@ -71,9 +73,10 @@ public class TrackManager {
|
||||
* 过滤后的数据集合
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
public synchronized HashMap<String, MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
|
||||
public HashMap<String, MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
|
||||
//清空上次返回数据,做到缓存复用
|
||||
mFilterTrafficData.clear();
|
||||
long cost = System.currentTimeMillis();
|
||||
//进入过滤机制的感知物体,首先从缓存队列中进行查找 uuid
|
||||
for (MessagePad.TrackedObject data : trafficData) {
|
||||
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
|
||||
@@ -121,35 +124,34 @@ public class TrackManager {
|
||||
mFilterTrafficData.put(uuid, trackObj.getCache());
|
||||
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
|
||||
mMarkersCaches.put(uuid, trackObj);
|
||||
trafficDataUuid.put(uuid, System.currentTimeMillis());
|
||||
trafficDataUuid.add(uuid);
|
||||
Log.i("costTime","" + (System.currentTimeMillis() - cost));
|
||||
}
|
||||
return mFilterTrafficData;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public void clearCache(List<MessagePad.TrackedObject> resultList) {
|
||||
//过滤现有元素
|
||||
for (MessagePad.TrackedObject data : resultList) {
|
||||
String uuid = "" + data.getUuid();
|
||||
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
|
||||
continue;
|
||||
}
|
||||
if (trafficDataUuid.size() > 0) {
|
||||
if (trafficDataUuid.size() > 0 && trafficDataUuid.contains(uuid)) {
|
||||
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
|
||||
continue;
|
||||
}
|
||||
trafficDataUuid.remove(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
//清除缓存,删除marker
|
||||
Iterator<Map.Entry<String, Long>> it = trafficDataUuid.entrySet().iterator();
|
||||
Iterator<String> it = trafficDataUuid.iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Long> next = it.next();
|
||||
String key = next.getKey();
|
||||
String key = it.next();
|
||||
it.remove();
|
||||
removeKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void removeKey(String key) {
|
||||
public void removeKey(String key) {
|
||||
cellIdCaches.remove(key);
|
||||
mMarkersCaches.remove(key);
|
||||
WarningHelper.INSTANCE.remove(key);
|
||||
@@ -157,14 +159,14 @@ public class TrackManager {
|
||||
.removeMarker(key);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void clearAll() {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).clearAllMarker();
|
||||
cellIdCaches.clear();
|
||||
trafficDataUuid.clear();
|
||||
WarningHelper.INSTANCE.clear();
|
||||
mMarkersCaches.forEach((uuid, trackObj) -> {
|
||||
trackObj.clear();
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(uuid);
|
||||
});
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.business.identify
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import mogo.telematics.pad.MessagePad.*
|
||||
|
||||
object TrackerSourceColorHelper {
|
||||
@@ -65,6 +66,11 @@ object TrackerSourceColorHelper {
|
||||
//僵尸车
|
||||
if(data.addAttribute == AdditionalAttribute.ATTR_ZOMBIE){
|
||||
color = "#AE7887FF"
|
||||
CallerMapUIServiceManager.getMapUIController()?.let {
|
||||
if(it.isDayMode){
|
||||
color = "#AD7488FF"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pnc预警
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
|
||||
@@ -103,6 +104,9 @@ public class MogoRouteOverlayManager implements
|
||||
if (arrivalNotification == null) {
|
||||
return;
|
||||
}
|
||||
if(!HdMapBuildConfig.isMapLoaded){
|
||||
return;
|
||||
}
|
||||
if (!isArriveAtStation.get()) {
|
||||
isArriveAtStation.set(true);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.widget.RelativeLayout
|
||||
@@ -131,12 +132,16 @@ class SmallMapView @JvmOverloads constructor(
|
||||
.color(Color.argb(255, 31, 127, 255))
|
||||
.width(12f)
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView drawPolyline size is = ${mCoordinatesLatLng.size} ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun clearPolyline() {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView clearPolyline mPolyline -----> ")
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.remove()
|
||||
}
|
||||
@@ -294,6 +299,8 @@ class SmallMapView @JvmOverloads constructor(
|
||||
"calculateDistance=$calculateDistance"
|
||||
)
|
||||
if (calculateDistance <= 5) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "onChassisLocationGCJ02 -----> calculateDistance <= 5 ")
|
||||
clearPolyline()
|
||||
mCoordinatesLatLng.clear()
|
||||
}
|
||||
@@ -312,6 +319,8 @@ class SmallMapView @JvmOverloads constructor(
|
||||
val tempStatus = autoPilotStatusInfo.pilotmode
|
||||
if (tempStatus != 1) {
|
||||
UiThreadHandler.post {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "onAutopilotStatusResponse tempStatus = $tempStatus ---clearPolyline() ")
|
||||
clearPolyline()
|
||||
}
|
||||
} else if (tempStatus == 1 && autoPilotStatus == 0) {
|
||||
@@ -321,6 +330,8 @@ class SmallMapView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView globalPathResp = $globalPathResp")
|
||||
if (globalPathResp == null || globalPathResp.wayPointsList.size == 0) {
|
||||
return
|
||||
}
|
||||
@@ -328,6 +339,8 @@ class SmallMapView @JvmOverloads constructor(
|
||||
for (routeModel in globalPathResp.wayPointsList) {
|
||||
latLngList.add(MogoLatLng(routeModel.latitude, routeModel.longitude))
|
||||
}
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView latLngList.size = ${latLngList.size}")
|
||||
if (latLngList.size > 0) {
|
||||
UiThreadHandler.post {
|
||||
convert(latLngList)
|
||||
@@ -335,6 +348,8 @@ class SmallMapView @JvmOverloads constructor(
|
||||
}
|
||||
} else {
|
||||
UiThreadHandler.post {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_MAP + TAG, "SmallMapView latLngList.size = ${latLngList.size} clearPolyline ---->")
|
||||
clearPolyline()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,14 +352,18 @@ class OverMapView @JvmOverloads constructor(
|
||||
.icon(BitmapDescriptorFactory.fromResource(if (compassDrawable != -1) compassDrawable else R.drawable.amap_custom_corner))
|
||||
.anchor(0.5f, 0.5f)
|
||||
)
|
||||
mStartMarker = mAMap!!.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(if (startPointDrawable != -1) startPointDrawable else R.drawable.module_small_map_view_dir_start))
|
||||
)
|
||||
mEndMarker = mAMap!!.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(if (endPointDrawable != -1) endPointDrawable else R.drawable.module_small_map_view_dir_end))
|
||||
)
|
||||
if (startPointDrawable != -1) {
|
||||
mStartMarker = mAMap!!.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(startPointDrawable))
|
||||
)
|
||||
}
|
||||
if (endPointDrawable != -1) {
|
||||
mEndMarker = mAMap!!.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(endPointDrawable))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun handlePlanningData(locationList: List<MessagePad.Location>?) {
|
||||
@@ -605,20 +609,16 @@ class OverMapView @JvmOverloads constructor(
|
||||
* 绘制起始点、终点
|
||||
*/
|
||||
private fun drawStartAndEndMarker(coordinates: List<LatLng>) {
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker!!.isVisible = false
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker!!.isVisible = false
|
||||
}
|
||||
mStartMarker?.isVisible = false
|
||||
mEndMarker?.isVisible = false
|
||||
if (coordinates.size > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
val startLatLng = coordinates[0]
|
||||
val endLatLng = coordinates[coordinates.size - 1]
|
||||
mStartMarker!!.position = startLatLng
|
||||
mEndMarker!!.position = endLatLng
|
||||
mStartMarker!!.isVisible = true
|
||||
mEndMarker!!.isVisible = true
|
||||
mStartMarker?.position = startLatLng
|
||||
mEndMarker?.position = endLatLng
|
||||
mStartMarker?.isVisible = true
|
||||
mEndMarker?.isVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user