diff --git a/app/src/androidTest/java/com/mogo/functions/test/Nt3dByteArrayTest.kt b/app/src/androidTest/java/com/mogo/functions/test/Nt3dByteArrayTest.kt new file mode 100644 index 0000000000..1ae5c111e2 --- /dev/null +++ b/app/src/androidTest/java/com/mogo/functions/test/Nt3dByteArrayTest.kt @@ -0,0 +1,81 @@ +package com.mogo.functions.test + +import androidx.test.core.app.ActivityScenario +import androidx.test.platform.app.InstrumentationRegistry +import com.mogo.eagle.core.data.enums.Carmodel +import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager +import com.mogo.eagle.core.function.main.MainLauncherActivity +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhidaoauto.map.sdk.open.renders.marker.BitmapDescriptorFactory +import kotlinx.coroutines.delay +import kotlinx.coroutines.runBlocking +import okio.use +import org.junit.Before +import org.junit.Test +import java.util.concurrent.TimeUnit + +class Nt3dByteArrayTest { + + + companion object { + private const val TAG = "NT3D_TEST" + } + + lateinit var launch: ActivityScenario + + @Before fun before() { + launch = ActivityScenario.launch(MainLauncherActivity::class.java) + } + + @Test fun testAllNt3d(): Unit = runBlocking { + val arguments = InstrumentationRegistry.getArguments() + val millis = arguments.getString("delay", "0").toLong() + Logger.d(TAG, "-- testAllNt3d --- 0 ---") + if (millis > 0) { + delay(millis) + } + Logger.d(TAG, "-- testAllNt3d --- 1 ---") + val interval = arguments.getString("interval", "0").toLong() + Carmodel.values().iterator().forEach { + Logger.d(TAG, "-- testAllNt3d --- 2 ---") + delay(interval) + Logger.d(TAG, "-- testAllNt3d --- 3 ---") + BitmapDescriptorFactory.from3DResource(InstrumentationRegistry.getInstrumentation().targetContext, it.rawValue)?.also { data -> + CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(data, true) + } + } + delay(TimeUnit.MINUTES.toMillis(10)) + } + + + @Test fun testAllNt3d2(): Unit = runBlocking { + val arguments = InstrumentationRegistry.getArguments() + val millis = arguments.getString("delay", "0").toLong() + Logger.d(TAG, "-- testAllNt3d2 --- 0 ---") + if (millis > 0) { + delay(millis) + } + Logger.d(TAG, "-- testAllNt3d2 --- 1 ---") + val interval = arguments.getString("interval", "0").toLong() + val step = arguments.getString("step", "0").toInt() + var index = 0 + Carmodel.values().iterator().forEach { + Logger.d(TAG, "-- testAllNt3d2 --- 2 ---") + var useByteArray = false + if ((index % step) == 0) { + useByteArray = true + } + delay(interval) + Logger.d(TAG, "-- testAllNt3d2 --- 3 ---:useByteArray -> $useByteArray") + if (useByteArray) { + BitmapDescriptorFactory.from3DResource(InstrumentationRegistry.getInstrumentation().targetContext, it.rawValue)?.also { data -> + CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(data, true) + } + } else { + CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(it.rawValue) + } + index ++ + } + delay(TimeUnit.MINUTES.toMillis(10)) + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 4c0bce9973..fe439f20c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -83,7 +83,7 @@ MOGO_TELEMATIC_VERSION=1.4.7.42 MOGO_SKIN_VERSION=1.4.7.49.14-debug ######## MogoAiCloudSDK Version ######## # 自研地图 -MAP_SDK_VERSION=3.4.1.18 +MAP_SDK_VERSION=3.4.1.19 MAP_SDK_DATA_VERSION=1.0.0.9 MAP_SDK_OPERATION_VERSION=1.1.4.1 # websocket diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.kt index 9544100094..33ad96be44 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.kt @@ -205,6 +205,17 @@ interface IMogoMapUIController { */ fun changeCurrentIcon(@RawRes iconId: Int) + /** + * 修改高精地图自车图标 + * @param data: 对应的资源的字节数组 + * @param is3D: + * 1. true + * 3d资源对应的格式为nt3d, 对应的data也需要为其二进制原始数组; + * 2. false + * 对应的是一个图片原始数组 + */ + fun changeCurrentIcon(data: ByteArray, is3D: Boolean) + /** * 自研地图是否匹配道路 * diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt index c8ab5dc2cb..1294d9a89e 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt @@ -627,6 +627,27 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle } } + override fun changeCurrentIcon(data: ByteArray, is3D: Boolean) { + if (checkAMapView()) { + handler.post { + val changeResult = mMapView.getMapAutoViewHelper()!!.getMyLocationStyle()!! + .myLocationIcon(data, is3D) + if (!changeResult) { + val count = reChangeIconCount.incrementAndGet() + MapTraceUtil.log( + "", ChainConstant.CHAIN_CODE_HD_MAP_ICON_SET, TAG, + mapOf("changeCurrentIcon-count" to "$count") + ) + if (count >= 3) { + return@post + } + handler.postDelayed({ changeCurrentIcon(data, is3D) }, 300L) + reChangeIconCount.set(0) + } + } + } + } + override fun result(path: String) { invokeUploadLogFile(path) }