[map-sdk]修改锚点切换资源问题

This commit is contained in:
jiaguofeng
2023-09-26 10:25:42 +08:00
parent 473adbaa27
commit b8be784420

View File

@@ -125,20 +125,20 @@ class MyLocationStyle(
}
@Synchronized
private fun drawCar(bitmap: Bitmap) {
private fun drawCar(bitmap: Bitmap): Boolean {
if (CompileConfig.DEBUG) {
Log.i(TAG, "markerop---selfop--drawCarstart")
}
if (mMarker != null) {
mMarker?.setIcon(bitmap)
return
return true
}
if ((mMapController?.isSurfaceCreated()) == true) {
if (executeFlag.get()) {
return
return false
}
if (mMarker != null) {
return
return false
}
executeFlag.set(true)
val lon = mLonLat.lon
@@ -154,16 +154,19 @@ class MyLocationStyle(
if (CompileConfig.DEBUG) {
Log.i(TAG, "autoop--selfop--markerop--drawCar:${mMarker?.getId()}")
}
return true
} catch (e: Exception) {
mMarker = null
return false
} finally {
executeFlag.set(false)
}
}
return false
}
private fun draw3DCar(resId: Int) {
private fun draw3DCar(resId: Int): Boolean{
if (CompileConfig.DEBUG) {
Log.i(
TAG,
@@ -196,17 +199,17 @@ class MyLocationStyle(
}
carId = resId
return
return true
}
if ((mMapController?.isSurfaceCreated()) ?: false) {
if (CompileConfig.DEBUG) {
Log.i(TAG, "markerop---selfop--draw3DCarstartmapView SurfaceCreated")
}
if (executeFlag.get()) {
return
return false
}
if (mMarker != null) {
return
return false
}
executeFlag.set(true)
val lon = mLonLat.lon
@@ -238,15 +241,18 @@ class MyLocationStyle(
"autoop--selfop--markerop--draw3DCar:${mMarker?.getId()},${resId},${options.getMarkerIconName()}"
)
}
return true
} catch (e: Exception) {
if (CompileConfig.DEBUG) {
Log.e(TAG, "autoop--selfop--markerop--draw3DCar:${mMarker?.getId()}", e)
}
mMarker = null
return false
} finally {
executeFlag.set(false)
}
}
return false
}
fun setLonLat(lonLat: LonLat, angle: Double) {
@@ -339,7 +345,7 @@ class MyLocationStyle(
mMarker?.setScale(scale)
}
fun myLocationIcon(carResId: Int, is3D: Boolean): MyLocationStyle {
fun myLocationIcon(carResId: Int, is3D: Boolean): Boolean {
mMapController?.getClerk()?.add("$is3D,$carResId")
if (CompileConfig.DEBUG) {
Log.i(
@@ -352,22 +358,23 @@ class MyLocationStyle(
this.is3D = is3D
if (is3D) {
this.car3DResId = carResId
draw3DCar(carResId)
return draw3DCar(carResId)
} else {
this.carResId = carResId
val bitmap = BitmapFactory.decodeResource(mContext?.resources, carResId)
carId = carResId
bitmap?.let {
if (this.myLocationIcon != null) {
this.myLocationIcon?.recycle()
this.myLocationIcon = null
}
drawCar(it)
return drawCar(it)
}
carId = carResId
}
}
return this
return false
}
fun myLocationIcon(carResId: Int): MyLocationStyle {