From 24e8ca5adcceeedd06f0457119089a3445b53066 Mon Sep 17 00:00:00 2001 From: renwj Date: Sat, 28 Jan 2023 15:31:59 +0800 Subject: [PATCH] =?UTF-8?q?[2.13.2]=E4=BC=98=E5=8C=96MarkerManager?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/v2x/events/marker/MarkerManager.kt | 17 +++++++---------- .../scenario/scene/airoad/AiRoadMarker.kt | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/MarkerManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/MarkerManager.kt index 01387ee060..032df3a43f 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/MarkerManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/MarkerManager.kt @@ -96,43 +96,39 @@ object MarkerManager { } val currentLocation = carLoc.get() val lastLocation = if (marker.coordinateType == 0) lastCarLocation.get() else lastGpsLocation.get() - - if (marker.coordinateType == 0) { - lastCarLocation.set(currentLocation) - } else { - lastGpsLocation.set(currentLocation) - } if (currentLocation != null && lastLocation != null) { val delta = CoordinateUtils.calculateLineDistance(currentLocation.longitude, currentLocation.latitude, lastLocation.longitude, lastLocation.latitude) - Log.d(TAG, "--- checkTask --- 4 ---:delta:$delta") + Log.d(TAG, "--- checkTask --- 4 ---:delta:$delta, id:${marker.id}") var elapsed = elapsedDistances[marker] if (elapsed == null) { elapsed = delta.toDouble() } else { elapsed += delta } - Log.d(TAG, "--- checkTask --- 5 ---:delta:$delta, elapsed:${elapsed}") + Log.d(TAG, "--- checkTask --- 5 ---:delta:$delta, elapsed:${elapsed}, id: ${marker.id}") if (elapsed >= 200) { var removeMarkerError = false marker.markers?.forEach { try { + Log.e(TAG, "--- checkTask --- remove marker: $it, id: ${marker.id}") it.setVisible(false) it.destroy() } catch (t: Throwable) { t.printStackTrace() removeMarkerError = true - Log.e(TAG, "--- checkTask --- remove marker error:${t.message}") + Log.e(TAG, "--- checkTask --- remove marker error:${t.message}, id: ${marker.id}") } } var removeLineError = false marker.lines?.forEach { try { it.isVisible = false + Log.e(TAG, "--- checkTask --- remove line : $it, id:${marker.id}") it.destroy() } catch (t: Throwable) { t.printStackTrace() removeLineError = true - Log.e(TAG, "--- checkTask --- remove line error:${t.message}") + Log.e(TAG, "--- checkTask --- remove line error:${t.message}, id: ${marker.id}") } } if (!removeLineError && !removeMarkerError) { @@ -186,6 +182,7 @@ object MarkerManager { fun addMarker(marker: MarkerWrapper) { + Log.d(TAG, "=== addMarker ====: $marker") synchronized(showedMarkers) { showedMarkers.offer(marker) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt index dfbf16bf89..06bc9193de 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt @@ -144,8 +144,8 @@ class AiRoadMarker { if (line != null) { wrapper.addLine(line) } - MarkerManager.addMarker(wrapper) } + MarkerManager.addMarker(wrapper) } private fun removeLine() {