[Feat]新增高精地图缓存功能

This commit is contained in:
chenfufeng
2023-02-10 19:32:22 +08:00
parent f063088954
commit fc7732e8f5
22 changed files with 565 additions and 6 deletions

View File

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

View File

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

View File

@@ -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
}
}
/**
* 展示当前鹰眼版本
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 设置背景色 -->
<item android:id="@android:id/background">
<shape>
<corners android:radius="21dp" />
<solid android:color="@android:color/transparent" />
<stroke android:color="#7CF6FF" android:width="2dp" />
</shape>
</item>
<!-- <item android:id="@android:id/secondaryProgress"-->
<!-- android:start="1.5dp"-->
<!-- android:end="1.5dp"-->
<!-- android:top="1.5dp"-->
<!-- android:bottom="1.5dp"-->
<!-- >-->
<!-- <scale android:scaleWidth="100%">-->
<!-- <shape>-->
<!-- <corners android:radius="21dp" />-->
<!-- <solid android:color="@android:color/holo_green_light" />-->
<!-- </shape>-->
<!-- </scale>-->
<!-- </item>-->
<!-- 设置进度条颜色 -->
<item android:id="@android:id/progress"
android:start="2dp"
android:end="2dp"
android:top="2dp"
android:bottom="2dp"
>
<scale android:scaleWidth="100%">
<shape>
<corners android:radius="21dp" />
<gradient
android:angle="0"
android:endColor="#00E5FF"
android:startColor="#374171" />
</shape>
</scale>
</item>
</layer-list>

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/roundRootLayout"
android:layout_width="840dp"
android:layout_height="488dp"
android:background="@color/dialog_bg_color_90_percent"
app:roundLayoutRadius="32dp">
<TextView
android:id="@+id/tv_cache_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="66dp"
android:text="@string/offline_map_cache_tip"
android:textColor="#FFFFFF"
android:textSize="56dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_cache_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="52dp"
android:text="@string/cache_offline_map_content"
android:textColor="#FFFFFFFF"
android:textSize="43dp"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_cache_title" />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="800dp"
android:layout_height="42dp"
style="?android:attr/progressBarStyleHorizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_cache_title"
android:layout_marginTop="113dp"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/progressbar_corner_bg"
android:visibility="gone"
/>
<TextView
android:id="@+id/tvDownloadProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/progressBar"
android:layout_marginTop="50dp"
android:text="0%"
android:textColor="#06D1ED"
android:textSize="43dp"
android:visibility="gone"
/>
<ImageView
android:id="@+id/iv_download_Status"
android:layout_width="174dp"
android:layout_height="174dp"
android:layout_marginTop="96dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_cache_title"
android:visibility="gone"
/>
<View
android:id="@+id/view_horizontal_line"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="205dp"
android:background="#66B8BFE8"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_cache_title" />
<View
android:id="@+id/view_vertical_line"
android:layout_width="2dp"
android:layout_height="0dp"
android:background="#66B8BFE8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line" />
<TextView
android:id="@+id/tv_cache_confirm"
android:layout_width="419dp"
android:layout_height="137dp"
android:gravity="center"
android:text="@string/confirm"
android:textColor="#FFFFFFFF"
android:textSize="46dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/view_vertical_line"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line" />
<TextView
android:id="@+id/tv_cache_cancel"
android:layout_width="419dp"
android:layout_height="137dp"
android:gravity="center"
android:text="@string/cancel"
android:textColor="#FFFFFFFF"
android:textSize="46dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/view_vertical_line"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line" />
<TextView
android:id="@+id/tv_cache_ok"
android:layout_width="match_parent"
android:layout_height="100dp"
android:gravity="center"
android:text="@string/ok_tip"
android:textColor="#FFFFFFFF"
android:textSize="46dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/view_vertical_line"
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line" />
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -82,7 +82,6 @@
android:visibility="gone"
/>
<ImageView
android:id="@+id/ivAdStatus"
android:layout_width="120dp"
@@ -120,4 +119,27 @@
android:textSize="32dp"
/>
<ImageView
android:id="@+id/ivHDCache"
android:layout_width="150dp"
android:layout_height="150dp"
app:layout_constraintTop_toTopOf="@id/ivAdVersion"
app:layout_constraintBottom_toBottomOf="@id/ivAdVersion"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="680dp"
android:src="@drawable/icon_hd_map"
android:padding="12dp"
android:background="@drawable/version_latest_background"
/>
<ImageView
android:id="@+id/ivHDCacheStatus"
android:layout_width="120dp"
android:layout_height="50dp"
android:src="@drawable/icon_be_updated"
app:layout_constraintCircle="@id/ivHDCache"
app:layout_constraintCircleAngle="50"
app:layout_constraintCircleRadius="90dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -71,7 +71,5 @@
<color name="hmi_check_keyboard_input_field">#FF282F62</color>
<color name="bus_autopilot_text_color_normal">#FFFFFF</color>
<color name="dialog_bg_color_90_percent">#E63B4577</color>
</resources>

View File

@@ -65,4 +65,11 @@
<string name="dispatch_cars_remind_content">车辆将开启自动驾驶,并行驶至:</string>
<string name="dispatch_cars_affirm">确认</string>
<string name="dispatch_cars_cancel">取消</string>
<string name="offline_map_cache_tip">离线地图缓存提醒</string>
<string name="cache_offline_map_content">是否缓存最新版本离线地图?</string>
<string name="offline_downloading">离线地图下载中</string>
<string name="offline_download_success">离线地图下载成功</string>
<string name="offline_download_failure">离线地图下载失败</string>
<string name="ok_tip">确定</string>
<string name="retry">重试</string>
</resources>

View File

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

View File

@@ -212,4 +212,7 @@ object CallerHmiManager {
hmiProviderApi?.updateStatusBarDownloadView(insert, tag, progress)
}
fun updateHDDataCacheStatus(isCached: Boolean) {
waringProviderApi?.updateHDDataCacheStatus(isCached)
}
}

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
package com.mogo.map.hdcache
interface IHdCacheListener {
fun onMapHdCacheProgress(cityId: Int, progress: Double)
}

View File

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

View File

@@ -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<CityInfo> cityInfoList = mMapView.getMapAutoViewHelper().getAllCityCode();
if (cityInfoList != null) {
for (CityInfo cityInfo : cityInfoList) {
if (id == cityInfo.getCityCode()) {
return cityInfo.isCache;
}
}
}
}
}
return true;
}
}

View File

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

View File

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

View File

@@ -0,0 +1,27 @@
package com.mogo.map.utils
object HDMapUtils {
private val cityCodeMap by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
val map = HashMap<String, Int>()
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]
}
}