From 7c66a3deed78b2e21909354e7bb8b47819110079 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Tue, 4 Apr 2023 16:24:10 +0800 Subject: [PATCH] =?UTF-8?q?[m2][3.0.0]=E6=96=B0=E5=A2=9E=E7=94=BB=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eagle/core/function/view/OverMapView.kt | 19 +++++++++++++++++++ .../core/function/view/SiteMarkerBean.kt | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/SiteMarkerBean.kt diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt index 3cef39a6a1..cbf19c021a 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt @@ -215,6 +215,25 @@ class OverMapView @JvmOverloads constructor( siteMarkerList = mAMap!!.addMarkers(markerOptionsList, false) } + @MainThread + fun drawSiteMarkers( + siteMarkers: List?, + ) { + if (siteMarkers.isNullOrEmpty()) return + clearSiteMarkers() + val markerOptionsList = ArrayList() + for (siteMarkerBean in siteMarkers) { + val markerOption = MarkerOptions() + markerOption.position(siteMarkerBean.latLng) + markerOption.anchor(siteMarkerBean.anchorX, siteMarkerBean.anchorY) + markerOption.icon( + BitmapDescriptorFactory.fromBitmap(siteMarkerBean.bitmap) + ) + markerOptionsList.add(markerOption) + } + siteMarkerList = mAMap!!.addMarkers(markerOptionsList, false) + } + @MainThread fun clearSiteMarkers() { if (siteMarkerList != null) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/SiteMarkerBean.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/SiteMarkerBean.kt new file mode 100644 index 0000000000..cc6d5592fe --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/SiteMarkerBean.kt @@ -0,0 +1,6 @@ +package com.mogo.eagle.core.function.view + +import android.graphics.Bitmap +import com.amap.api.maps.model.LatLng + +data class SiteMarkerBean(var latLng: LatLng, var bitmap: Bitmap, var anchorX: Float, var anchorY: Float)