[6.7.0][地图sdk] 更改自车模型添加nt3d字节数组支持

This commit is contained in:
renwj
2024-10-25 17:29:45 +08:00
parent bf2659d6e2
commit 39088b7ed8
4 changed files with 114 additions and 1 deletions

View File

@@ -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<MainLauncherActivity>
@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))
}
}

View File

@@ -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

View File

@@ -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)
/**
* 自研地图是否匹配道路
*

View File

@@ -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)
}