[base_3.4.0-map-sdk]

This commit is contained in:
zhongchao
2023-08-18 18:42:12 +08:00
parent 10b5933c03
commit fc25630dc4
43 changed files with 644 additions and 790 deletions

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.map.MapDataWrapper
@Route(path = MogoServicePaths.PATH_MAP_BIZ)
class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
@@ -21,6 +22,7 @@ class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
get() = "MapBizProvider"
override fun init(context: Context?) {
MapDataWrapper.init()
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance

View File

@@ -1,58 +1,52 @@
package com.mogo.eagle.core.function.business.cachemap
import android.util.Log
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.map.hdcache.IHdCacheListener
import com.mogo.map.MogoData.Companion.mogoMapData
object CacheHDMapManager: IMoGoChassisLocationWGS84Listener {
//todo emaArrow 多实例影响到的业务,进行测试
object CacheHDMapManager {
private const val TAG = "CacheHDMapManager"
@Volatile
private var location: MogoLocation? = null
fun scheduleGetLocation() {
if (!AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
ThreadUtils.getIoPool().execute {
if (!CallerMapUIServiceManager.isCityDataCached()) {
while (true) {
if (location != null) {
Log.d(TAG, "开始下载")
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
Log.d(TAG, "下载进度:${progress.toInt()}")
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {
Log.d(TAG, "下载失败")
}
}
}, location!!)
Log.d(TAG, "移除监听并关闭循环")
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
return@execute
ThreadUtils.getIoPool().execute {
mogoMapData.get().isCityDataCached {
if(!it){
while (true) {
val loc =
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (loc.latitude != 0.0 || loc.longitude != 0.0) {
CallerLogger.d(TAG, "开始下载")
mogoMapData.get().cacheHDDataByCityByLonLat(loc,
{ _, progress ->
CallerLogger.i(M_MAP + TAG, "下载进度:${progress.toInt()}")
},
{ _, state ->
if (state == 0) {
CallerLogger.i(M_MAP + TAG, "下载失败")
}
})
CallerLogger.i(M_MAP + TAG, "移除监听并关闭循环")
break
}
try {
CallerLogger.i(M_MAP + TAG, "开始休眠...")
Thread.sleep(1500)
} catch (e: Exception) {
}
}
try {
Log.d(TAG, "开始休眠...")
Thread.sleep(1500)
} catch (e: Exception) {}
}else{
CallerLogger.i(M_MAP + TAG, "高精地图缓存已下载!")
}
} else {
Log.d(TAG, "高精地图缓存已下载!")
}
}
}
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
location = gnssInfo
}
}

View File

@@ -55,14 +55,14 @@ class IdentifyAiCloudDataDrawer : Identify {
val key = it.next() as String
it.remove()
mMarkersCaches.remove(key)
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(key.hashCode().toString())
}
val filterList = filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.updateBatchAiMarkerPosition(filterList)
}
}
@@ -90,7 +90,7 @@ class IdentifyAiCloudDataDrawer : Identify {
trafficDataUuidList.clear()
mMarkersCaches.forEach { (uuid, _) ->
mMarkersCaches.remove(uuid)
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(uuid.hashCode().toString())
}
mFilterTrafficData.clear()

View File

@@ -46,7 +46,7 @@ class IdentifyBeautifyDataDrawer : Identify {
val filterList = TrackManager.getInstance().filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.updateBatchMarkerPosition(filterList)
}
}

View File

@@ -79,14 +79,14 @@ class IdentifyOriginDataDrawer : Identify {
val key = it.next() as String
it.remove()
mMarkersCaches.remove(key)
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(key)
}
val filterList = filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.updateBatchMarkerPosition(filterList)
}
}
@@ -124,7 +124,7 @@ class IdentifyOriginDataDrawer : Identify {
@SuppressLint("NewApi")
override fun clearOldMarker() {
for (uuid in trafficDataUuidList) {
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(uuid)
}
trafficDataUuidList.clear()

View File

@@ -150,7 +150,7 @@ public class TrackManager {
cellIdCaches.remove(key);
mMarkersCaches.remove(key);
WarningHelper.INSTANCE.remove(key);
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(key);
}
@@ -160,7 +160,7 @@ public class TrackManager {
WarningHelper.INSTANCE.clear();
mMarkersCaches.forEach((uuid, trackObj) -> {
trackObj.clear();
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(uuid);
});
mMarkersCaches.clear();

View File

@@ -21,6 +21,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
@Route(path = MogoServicePaths.PATH_SERVICES_MAP)
public class MogoMapService implements IMogoMapService {
//todo 多实例主动设置IMap对象下面接口返回对应IMap实例的接口数据
@Override
public IMogoMapUIController getMapUIController() {
@@ -33,8 +34,8 @@ public class MogoMapService implements IMogoMapService {
}
@Override
public IMogoGDLocationClient getGDLocationServer(Context context) {
return GDLocationClient.getInstance(context);
public IMogoGDLocationClient getGDLocationServer() {
return GDLocationClient.Companion.getGdLocationClient();
}
@Override