diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt
new file mode 100644
index 0000000000..aa62c470b2
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt
@@ -0,0 +1,170 @@
+package com.mogo.eagle.core.function.hmi.ui.map
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.view.View
+import android.widget.ImageView
+import android.widget.ProgressBar
+import android.widget.TextView
+import androidx.annotation.MainThread
+import androidx.constraintlayout.widget.ConstraintLayout
+import androidx.core.content.ContextCompat
+import androidx.core.content.res.ResourcesCompat
+import androidx.core.view.marginTop
+import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
+import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
+import com.mogo.eagle.core.function.hmi.R
+import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
+import com.mogo.map.hdcache.IHdCacheListener
+import me.jessyan.autosize.utils.AutoSizeUtils
+
+/**
+ * 离线地图缓存
+ */
+class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
+
+ private var roundRootLayout: ConstraintLayout? = null
+ private var offlineTitleView: TextView? = null
+ private var leftView: TextView? = null
+ private var rightView: TextView? = null
+ private var okView: TextView? = null
+ private var vertLineView: View? = null
+ private var horizontalLineView: View? = null
+ private var cacheTipView: TextView? = null
+
+ private var progressBar: ProgressBar? = null
+ private var downloadPercentView: TextView? = null
+ private var downloadResultImg: ImageView? = null
+
+ private var isLoading = false
+ private var isConfirm = true
+ private var isRetry = false
+
+ init {
+ setContentView(R.layout.dialog_offline_map)
+ setCanceledOnTouchOutside(true)
+
+ initView()
+ }
+
+ private fun initView() {
+ roundRootLayout = findViewById(R.id.roundRootLayout)
+ offlineTitleView = findViewById(R.id.tv_cache_title)
+ progressBar = findViewById(R.id.progressBar)
+ downloadPercentView = findViewById(R.id.tvDownloadProgress)
+ leftView = findViewById(R.id.tv_cache_confirm)
+ rightView = findViewById(R.id.tv_cache_cancel)
+ okView = findViewById(R.id.tv_cache_ok)
+ vertLineView = findViewById(R.id.view_vertical_line)
+ horizontalLineView = findViewById(R.id.view_horizontal_line)
+ cacheTipView = findViewById(R.id.tv_cache_tips)
+ downloadResultImg = findViewById(R.id.iv_download_Status)
+
+ leftView?.setOnClickListener {
+ when {
+ isConfirm -> {
+ cacheHDOfflineData()
+ showNewContent(isLoading = true, false)
+ }
+ else -> {
+ dismiss()
+ }
+ }
+ }
+
+ rightView?.setOnClickListener {
+ when {
+ isRetry -> {
+ cacheHDOfflineData()
+ }
+ else -> {
+ dismiss()
+ }
+ }
+ }
+
+ okView?.setOnClickListener {
+ dismiss()
+ }
+ }
+
+ private fun cacheHDOfflineData() {
+ CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
+ override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
+ updateProgress(progress.toInt())
+ }
+ })
+ }
+
+ @SuppressLint("SetTextI18n")
+ private fun updateProgress(progress: Int) {
+ if (this@OfflineMapDialog.isShowing) {
+ progressBar?.let {
+ if (it.visibility == View.VISIBLE) {
+ it.progress = if (progress in 1..5) 5 else progress
+ }
+ }
+ downloadPercentView?.text = "$progress%"
+ if (progress == 100) {
+ showNewContent(isLoading = false, true)
+ CallerHmiManager.updateHDDataCacheStatus(true)
+ }
+ }
+ }
+
+ private fun change2NewStyle() {
+ roundRootLayout?.layoutParams?.width = AutoSizeUtils.dp2px(context, 1110f)
+ roundRootLayout?.layoutParams?.height = AutoSizeUtils.dp2px(context, 668f)
+
+ val titleParams = offlineTitleView?.layoutParams as ConstraintLayout.LayoutParams
+ titleParams.topMargin = AutoSizeUtils.dp2px(context, 51f)
+
+ val horizontalLineParams = horizontalLineView?.layoutParams as ConstraintLayout.LayoutParams
+ horizontalLineParams.topMargin = AutoSizeUtils.dp2px(context, 374f)
+
+ progressBar?.visibility = View.VISIBLE
+ downloadPercentView?.visibility = View.VISIBLE
+ okView?.visibility = View.VISIBLE
+
+ vertLineView?.visibility = View.GONE
+ leftView?.visibility = View.GONE
+ rightView?.visibility = View.GONE
+ cacheTipView?.visibility = View.INVISIBLE
+ }
+
+ @SuppressLint("UseCompatLoadingForDrawables")
+ private fun showNewContent(isLoading: Boolean, isSuccess: Boolean) {
+ change2NewStyle()
+ when {
+ isLoading -> {
+ okView?.text = context.resources.getString(R.string.cancel)
+ offlineTitleView?.text = context.resources.getString(R.string.offline_downloading)
+ downloadResultImg?.visibility = View.GONE
+ }
+ else -> {
+ downloadResultImg?.visibility = View.VISIBLE
+ when {
+ isSuccess -> {
+ okView?.visibility = View.VISIBLE
+ okView?.text = context.resources.getString(R.string.ok_tip)
+ offlineTitleView?.text = context.resources.getString(R.string.offline_download_success)
+ progressBar?.visibility = View.GONE
+ downloadPercentView?.visibility = View.GONE
+ downloadResultImg?.background = ContextCompat.getDrawable(context, R.drawable.download_success_icon)
+ }
+ else -> {
+ offlineTitleView?.text = context.resources.getString(R.string.offline_download_failure)
+ okView?.visibility = View.GONE
+ progressBar?.visibility = View.GONE
+ downloadPercentView?.visibility = View.GONE
+ leftView?.visibility = View.VISIBLE
+ rightView?.visibility = View.VISIBLE
+ vertLineView?.visibility = View.VISIBLE
+ rightView?.text = context.resources.getString(R.string.retry)
+ downloadResultImg?.background = ContextCompat.getDrawable(context, R.drawable.download_fail_icon)
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt
index b6025d5503..b9b5274d05 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt
@@ -197,6 +197,10 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
systemVersionView?.showAdUpgradeStatus(ipcUpgradeStateInfo)
}
+ fun updateHDDataCacheStatus(isCached: Boolean) {
+ systemVersionView?.updateHDDataCacheStatus(isCached)
+ }
+
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt
index 913da911a7..6875daab9d 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt
@@ -10,10 +10,15 @@ import com.mogo.eagle.core.data.bindingcar.AdUpgradeStateHelper
import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
+import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingCarListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
+import com.mogo.eagle.core.function.call.bindingcar.CallerBindingCarListenerManager
+import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
+import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
+import com.mogo.eagle.core.function.hmi.ui.map.OfflineMapDialog
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.util.AppUtils
@@ -135,6 +140,12 @@ class SystemVersionView @JvmOverloads constructor(
}
+ ivHDCache.setOnClickListener {
+ OfflineMapDialog(context).show()
+ }
+
+ updateHDDataCacheStatus(CallerMapUIServiceManager.isCityDataCached())
+
if(AdUpgradeStateHelper.isConfirmUpgrade()){
//将角标改为“下载中”
ivAdStatus?.setImageResource(R.drawable.icon_downloading)
@@ -239,6 +250,16 @@ class SystemVersionView @JvmOverloads constructor(
}
+ fun updateHDDataCacheStatus(isCached: Boolean) {
+ if (isCached) {
+ ivHDCacheStatus?.setImageResource(R.drawable.icon_latest_version)
+ ivHDCache.isEnabled = false
+ } else {
+ ivHDCacheStatus?.setImageResource(R.drawable.icon_be_updated)
+ ivHDCache.isEnabled = true
+ }
+ }
+
/**
* 展示当前鹰眼版本
*/
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/download_fail_icon.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/download_fail_icon.png
new file mode 100644
index 0000000000..809d7ee414
Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/download_fail_icon.png differ
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/download_success_icon.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/download_success_icon.png
new file mode 100644
index 0000000000..f6f1197a93
Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/download_success_icon.png differ
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_be_updated.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_be_updated.png
new file mode 100644
index 0000000000..b9268797cf
Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_be_updated.png differ
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_hd_map.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_hd_map.png
new file mode 100644
index 0000000000..ccbe7ffd56
Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_hd_map.png differ
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/progressbar_corner_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/progressbar_corner_bg.xml
new file mode 100644
index 0000000000..753149f4ea
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/progressbar_corner_bg.xml
@@ -0,0 +1,43 @@
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_offline_map.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_offline_map.xml
new file mode 100644
index 0000000000..6ae72b0a13
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/dialog_offline_map.xml
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_system_version.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_system_version.xml
index ce0064ad18..3972c865ff 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_system_version.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_system_version.xml
@@ -82,7 +82,6 @@
android:visibility="gone"
/>
-
+
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml
index 574b9fc2f3..ff8c61e6bf 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml
@@ -71,7 +71,5 @@
#FF282F62
#FFFFFF
-
-
-
+ #E63B4577
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml
index f12f7f9bc0..9af0f3ad70 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml
@@ -65,4 +65,11 @@
车辆将开启自动驾驶,并行驶至:
确认
取消
+ 离线地图缓存提醒
+ 是否缓存最新版本离线地图?
+ 离线地图下载中
+ 离线地图下载成功
+ 离线地图下载失败
+ 确定
+ 重试
diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt
new file mode 100644
index 0000000000..42b0cadcfc
--- /dev/null
+++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt
@@ -0,0 +1,20 @@
+package com.mogo.eagle.core.function.api.hmi.warning
+
+import android.view.View
+import android.view.ViewGroup
+import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
+import com.mogo.eagle.core.data.enums.WarningDirectionEnum
+import com.mogo.eagle.core.data.map.Infrastructure
+import com.mogo.eagle.core.data.notice.NoticeNormalData
+import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
+import com.mogo.eagle.core.data.report.ReportEntity
+import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy
+import com.mogo.eagle.core.function.api.hmi.view.IOchBusView
+
+/**
+ * @author xiaoyuzhou
+ * @date 2021/8/2 7:36 下午
+ */
+interface IMoGoWaringProvider : IMoGoHmiViewProxy {
+ fun updateHDDataCacheStatus(isCached: Boolean)
+}
\ No newline at end of file
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
index 8339a0c006..b6aca6f544 100644
--- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
+++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
@@ -212,4 +212,7 @@ object CallerHmiManager {
hmiProviderApi?.updateStatusBarDownloadView(insert, tag, progress)
}
+ fun updateHDDataCacheStatus(isCached: Boolean) {
+ waringProviderApi?.updateHDDataCacheStatus(isCached)
+ }
}
\ No newline at end of file
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt
index cb8288ae15..0562c116ee 100644
--- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt
+++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt
@@ -5,7 +5,9 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.map.IMogoMapService
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService
import com.mogo.eagle.core.function.call.base.CallerBase
-import com.mogo.map.location.IMogoGDLocationClient
+import com.mogo.map.hdcache.IHdCacheListener
+import com.mogo.map.listener.IMogoHosListenerRegister
+import com.mogo.map.location.IMogoLocationClient
import com.mogo.map.marker.IMogoMarkerManager
import com.mogo.map.overlay.IMogoOverlayManager
import com.mogo.map.uicontroller.IMogoMapUIController
@@ -30,6 +32,14 @@ object CallerMapUIServiceManager {
return serviceProvider?.markerService
}
+ fun cacheHDDataByCity(listener: IHdCacheListener) {
+ serviceProvider?.mapUIController?.cacheHDDataByCity(listener)
+ }
+
+ fun isCityDataCached(): Boolean {
+ return serviceProvider?.mapUIController?.isCityDataCached ?: true
+ }
+
fun getOverlayManager(): IMogoOverlayManager?{
return serviceProvider?.overlayManager
}
diff --git a/gradle.properties b/gradle.properties
index dd72d41281..9578aa5a52 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -85,7 +85,7 @@ MOGO_LOCATION_VERSION=1.4.4.2
MOGO_TELEMATIC_VERSION=1.4.4.2
######## MogoAiCloudSDK Version ########
# 自研地图
-MAP_SDK_VERSION=2.10.0.2_test_01
+MAP_SDK_VERSION=2.10.0.2
MAP_SDK_OPERATION_VERSION=1.1.4.1
# websocket
WEBSOCKET_VERSION=1.1.7
diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt
new file mode 100644
index 0000000000..4761e40fff
--- /dev/null
+++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt
@@ -0,0 +1,5 @@
+package com.mogo.map.hdcache
+
+interface IHdCacheListener {
+ fun onMapHdCacheProgress(cityId: Int, progress: Double)
+}
\ No newline at end of file
diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java
index 362b48f839..8235fe8a36 100644
--- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java
+++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java
@@ -9,6 +9,9 @@ import androidx.annotation.RawRes;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MogoLatLng;
+import com.mogo.map.hdcache.IHdCacheListener;
+
+import org.json.JSONObject;
import com.mogo.eagle.core.data.map.MogoLocation;
import java.util.List;
@@ -348,4 +351,11 @@ public interface IMogoMapUIController {
* @param color // color:"#RRGGBB*
*/
void setPointCloudColor(String color);
+ void cacheHDDataByCity(IHdCacheListener listener);
+
+ /**
+ * 当前城市离线数据是否已缓存
+ * @return
+ */
+ boolean isCityDataCached();
}
diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
index e264f883ad..e46408c5f2 100644
--- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
+++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java
@@ -23,6 +23,7 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
+import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
@@ -40,13 +41,17 @@ import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
+import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.map.listener.MogoMapListenerHandler;
+import com.mogo.map.location.GDLocationClient;
+import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
+import com.mogo.map.utils.HDMapUtils;
import com.mogo.map.utils.MogoMapUtils;
import com.mogo.map.utils.ObjectUtils;
import com.mogo.map.utils.ResIdCache;
@@ -64,6 +69,7 @@ import com.zhidaoauto.map.sdk.open.business.PointCloudHelper;
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
+import com.zhidaoauto.map.sdk.open.data.CityInfo;
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
import com.zhidaoauto.map.sdk.open.location.LocationClient;
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
@@ -115,6 +121,8 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
+ private IHdCacheListener hdCacheListener;
+
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
@@ -1035,4 +1043,47 @@ public class AMapViewWrapper implements IMogoMapView,
}
+
+ @Override
+ public void cacheHDDataByCity(IHdCacheListener listener) {
+ if (mMapView.getMapAutoViewHelper() != null) {
+ String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
+ Integer id = HDMapUtils.getHDCityCode(gdCityCode);
+ if (id != null) {
+ hdCacheListener = listener;
+ mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, (cityId, progress) -> {
+ if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
+ if (hdCacheListener != null) {
+ hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
+ }
+ } else {
+ UiThreadHandler.post(() -> {
+ if (hdCacheListener != null) {
+ hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
+ }
+ });
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public boolean isCityDataCached() {
+ if (mMapView.getMapAutoViewHelper() != null) {
+ String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
+ Integer id = HDMapUtils.getHDCityCode(gdCityCode);
+ if (id != null) {
+ List cityInfoList = mMapView.getMapAutoViewHelper().getAllCityCode();
+ if (cityInfoList != null) {
+ for (CityInfo cityInfo : cityInfoList) {
+ if (id == cityInfo.getCityCode()) {
+ return cityInfo.isCache;
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
}
diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java
index f525de00c5..fbbb4ab578 100644
--- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java
+++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java
@@ -2,12 +2,14 @@ package com.mogo.map;
import android.graphics.Point;
import android.graphics.Rect;
+import android.location.Location;
import android.view.View;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
+import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.map.uicontroller.AMapUIController;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -449,4 +451,19 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.setPointCloudColor(color);
}
}
+
+ @Override
+ public void cacheHDDataByCity(IHdCacheListener listener) {
+ if (mDelegate != null) {
+ mDelegate.cacheHDDataByCity(listener);
+ }
+ }
+
+ @Override
+ public boolean isCityDataCached() {
+ if (mDelegate != null) {
+ return mDelegate.isCityDataCached();
+ }
+ return true;
+ }
}
diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java
index 9da7c35e7a..f48f36cc66 100644
--- a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java
+++ b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java
@@ -6,6 +6,7 @@ import android.view.View;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MogoLatLng;
+import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
@@ -389,4 +390,19 @@ public class AMapUIController implements IMogoMapUIController {
mClient.setPointCloudColor(color);
}
}
+
+ @Override
+ public void cacheHDDataByCity(IHdCacheListener listener) {
+ if (mClient != null) {
+ mClient.cacheHDDataByCity(listener);
+ }
+ }
+
+ @Override
+ public boolean isCityDataCached() {
+ if (mClient != null) {
+ return mClient.isCityDataCached();
+ }
+ return true;
+ }
}
diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/utils/HDMapUtils.kt b/libraries/mogo-map/src/main/java/com/mogo/map/utils/HDMapUtils.kt
new file mode 100644
index 0000000000..b15a5c2704
--- /dev/null
+++ b/libraries/mogo-map/src/main/java/com/mogo/map/utils/HDMapUtils.kt
@@ -0,0 +1,27 @@
+package com.mogo.map.utils
+
+object HDMapUtils {
+ private val cityCodeMap by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
+ val map = HashMap()
+ map["0831"] = 5115// 宜宾市
+ map["0512"] = 3205// 苏州市
+ map["0872"] = 5329// 大理市
+ map["0711"] = 4207// 鄂州市
+ map["028"] = 5101// 成都市
+ map["0931"] = 6201// 兰州市
+ map["0535"] = 3706// 烟台市
+ map["027"] = 4201// 武汉市
+ map["010"] = 1101// 北京市
+ map["0734"] = 4304// 衡阳市
+ map
+ }
+
+ /**
+ * gdCityCode: 高德CityCode
+ * return: 高精地图CityCode
+ */
+ @JvmStatic
+ fun getHDCityCode(gdCityCode: String?): Int? {
+ return cityCodeMap[gdCityCode]
+ }
+}
\ No newline at end of file