[base_3.4.0-map-sdk]
This commit is contained in:
@@ -18,9 +18,10 @@ import com.mogo.eagle.function.biz.v2x.v2n.consts.V2XConst
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerRemoveManager
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerWrapper
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.road.V2XAiRoadEventMarker
|
||||
import com.mogo.map.MogoMap
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import com.mogo.map.overlay.core.Level.ROAD_CENTER_LINE
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
@@ -55,14 +56,19 @@ class AiRoadMarker {
|
||||
}
|
||||
|
||||
private val v2nDrawHandler by lazy {
|
||||
HandlerThread("v2n_draw_thread").let { it.start(); Handler(it.looper)}
|
||||
HandlerThread("v2n_draw_thread").let { it.start(); Handler(it.looper) }
|
||||
}
|
||||
|
||||
private val checkExpiredTask = Runnable {
|
||||
val poi = this.marker.get()
|
||||
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
if (poi != null) {
|
||||
val distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, poi.poi_lon, poi.poi_lat)
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
car.longitude,
|
||||
car.latitude,
|
||||
poi.poi_lon,
|
||||
poi.poi_lat
|
||||
)
|
||||
if (distance < 500) {
|
||||
unMarker(poi)
|
||||
}
|
||||
@@ -70,7 +76,8 @@ class AiRoadMarker {
|
||||
}
|
||||
|
||||
private val builder by lazy {
|
||||
Polyline.Options.Builder(V2XConst.V2X_MARKER_OWNER, ROAD_CENTER_LINE).setIsGradient(true).setWidth(50f).setUseGps(true)
|
||||
Polyline.Options.Builder(V2XConst.V2X_MARKER_OWNER, ROAD_CENTER_LINE).setIsGradient(true)
|
||||
.setWidth(50f).setUseGps(true)
|
||||
}
|
||||
|
||||
fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false) {
|
||||
@@ -83,21 +90,33 @@ class AiRoadMarker {
|
||||
}
|
||||
if (drawRoadLine) {
|
||||
//施工中心点前方的自车行驶方向上300米距离
|
||||
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
|
||||
var l1: CenterLine? = null
|
||||
mogoMapData.get().getCenterLineRangeInfo(
|
||||
marker.poi_lon,
|
||||
marker.poi_lat,
|
||||
location.heading.toFloat(),
|
||||
300f
|
||||
)
|
||||
//施工中心点后方的自车行驶方向上300米距离
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", l1)
|
||||
val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
|
||||
300f, call = { result ->
|
||||
//施工中心点后方的自车行驶方向上300米距离
|
||||
result?.let {
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", it)
|
||||
l1 = result
|
||||
}
|
||||
})
|
||||
var l2: CenterLine? = null
|
||||
mogoMapData.get().getCenterLineRangeInfo(
|
||||
marker.poi_lon,
|
||||
marker.poi_lat,
|
||||
location.heading.toFloat(),
|
||||
-300f
|
||||
)
|
||||
if (l1.points.isEmpty() || l2.points.isEmpty()) {
|
||||
-300f, call = { result ->
|
||||
result?.let {
|
||||
l2 = result
|
||||
}
|
||||
})
|
||||
if (l1 == null || l2 == null) {
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 3 --- return ----", "")
|
||||
return@post
|
||||
}
|
||||
if(l1.points.isEmpty() || l2.points.isEmpty()){
|
||||
V2XBizTrace.onAck("$TAG --- marker --- 3 --- return ----", "")
|
||||
return@post
|
||||
}
|
||||
@@ -202,7 +221,12 @@ class AiRoadMarker {
|
||||
val poi = this.marker.get()
|
||||
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
if (poi != null) {
|
||||
val distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, poi.poi_lon, poi.poi_lat)
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
car.longitude,
|
||||
car.latitude,
|
||||
poi.poi_lon,
|
||||
poi.poi_lat
|
||||
)
|
||||
V2XBizTrace.onAck(
|
||||
"$TAG --- receive --- 2 ---",
|
||||
"car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance"
|
||||
|
||||
@@ -48,7 +48,7 @@ class SceneManager {
|
||||
init {
|
||||
//过滤所需条件
|
||||
sceneModuleTAG.map[ADAS] = SceneModule(true, M_D_C)
|
||||
sceneModuleTAG.map[DEVA] = SceneModule(false, M_DEVA)
|
||||
sceneModuleTAG.map[DEVA] = SceneModule(true, M_DEVA)
|
||||
sceneModuleTAG.map[HMI] = SceneModule(false, M_HMI)
|
||||
sceneModuleTAG.map[OBU] = SceneModule(true, M_OBU)
|
||||
sceneModuleTAG.map[V2X] = SceneModule(true, M_V2X)
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui.map
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.ProgressBar
|
||||
@@ -10,16 +11,16 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
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 com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* 离线地图缓存
|
||||
*/
|
||||
class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
|
||||
class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
|
||||
|
||||
private var roundRootLayout: ConstraintLayout? = null
|
||||
private var offlineTitleView: TextView? = null
|
||||
@@ -86,34 +87,54 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
|
||||
|
||||
okView?.setOnClickListener {
|
||||
if (isLoading) {
|
||||
CallerMapUIServiceManager.cancelDownloadCacheData()
|
||||
mogoMapData.get().cancelDownloadCacheData()
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
private fun cacheHDDataByCityByLonLat() {
|
||||
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
|
||||
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
|
||||
mogoMapData.get().cacheHDDataByCityByLonLat(location!!, { _, progress ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
updateProgress(progress.toInt())
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
updateProgress(progress.toInt())
|
||||
}
|
||||
|
||||
override fun onMapHdCacheResult(cityId: Int, state: Int) {
|
||||
}, { _, state ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
if (state == 0) {// 失败
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
if (state == 0) {// 失败
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
}
|
||||
}, location!!)
|
||||
})
|
||||
}
|
||||
|
||||
private fun cacheHDOfflineData() {
|
||||
if (location == null) {// 拿到了高德地图的cityCode
|
||||
CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
|
||||
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
|
||||
mogoMapData.get().cacheHDDataByCity({ _, progress ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
updateProgress(progress.toInt())
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
updateProgress(progress.toInt())
|
||||
}
|
||||
|
||||
override fun onMapHdCacheResult(cityId: Int, state: Int) {
|
||||
}, { _, state ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread({
|
||||
if (state == 0) {// 失败
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
if (state == 0) {// 失败
|
||||
showNewContent(isLoading = false, false)
|
||||
}
|
||||
@@ -176,15 +197,18 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
|
||||
isSuccess -> {
|
||||
okView?.visibility = View.VISIBLE
|
||||
okView?.text = context.resources.getString(R.string.ok_tip)
|
||||
offlineTitleView?.text = context.resources.getString(R.string.offline_download_success)
|
||||
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)
|
||||
downloadResultImg?.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.download_success_icon)
|
||||
}
|
||||
else -> {
|
||||
isRetry = true
|
||||
isConfirm = false
|
||||
offlineTitleView?.text = context.resources.getString(R.string.offline_download_failure)
|
||||
offlineTitleView?.text =
|
||||
context.resources.getString(R.string.offline_download_failure)
|
||||
okView?.visibility = View.GONE
|
||||
progressBar?.visibility = View.GONE
|
||||
downloadPercentView?.visibility = View.GONE
|
||||
@@ -193,7 +217,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
|
||||
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)
|
||||
downloadResultImg?.background =
|
||||
ContextCompat.getDrawable(context, R.drawable.download_fail_icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.*
|
||||
import android.os.Build
|
||||
import android.os.Looper
|
||||
import android.os.Process
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
@@ -19,7 +19,8 @@ import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.*
|
||||
import androidx.core.view.MenuCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import chassis.Chassis
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
@@ -38,19 +39,19 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_FULL_
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RAIN_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_WARNING_UPLOAD
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.report.ReportEntity
|
||||
import com.mogo.eagle.core.data.deva.scene.SceneModule
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.gnss.AccelerationEntity
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.data.deva.report.ReportEntity
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuConnectListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuInfoListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
@@ -64,7 +65,10 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.kotlin.scope
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
@@ -73,11 +77,10 @@ import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.map.hdcache.IHdCacheListener
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
|
||||
import kotlinx.coroutines.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
@@ -190,10 +193,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
*/
|
||||
private val timerTaskRefresh = object : TimerTask() {
|
||||
override fun run() {
|
||||
if(this@DebugSettingView == null){
|
||||
if (this@DebugSettingView == null) {
|
||||
return
|
||||
}
|
||||
if(!isRunCheck){
|
||||
if (!isRunCheck) {
|
||||
return
|
||||
}
|
||||
UiThreadHandler.post {
|
||||
@@ -293,9 +296,9 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
private fun initView() {
|
||||
post {
|
||||
val maxHeight = ScreenUtils.getScreenHeight()-BarUtils.getStatusBarHeight()
|
||||
val maxHeight = ScreenUtils.getScreenHeight() - BarUtils.getStatusBarHeight()
|
||||
val height = clDebugContain.height
|
||||
if(height>maxHeight){
|
||||
if (height > maxHeight) {
|
||||
val layoutParamsOther = clDebugContain.layoutParams
|
||||
layoutParamsOther.height = maxHeight
|
||||
clDebugContain.layoutParams = layoutParamsOther
|
||||
@@ -586,10 +589,11 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
ThreadUtils.getIoPool().execute {
|
||||
val isCached = CallerMapUIServiceManager.isCityDataCached()
|
||||
isHDCached = isCached
|
||||
UiThreadHandler.post {
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(${if (isCached) "已是最新版" else "待更新"}!)"
|
||||
mogoMapData.get().isCityDataCached {
|
||||
isHDCached = it
|
||||
UiThreadHandler.post {
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(${if (it) "已是最新版" else "待更新"}!)"
|
||||
}
|
||||
}
|
||||
}
|
||||
btn_cache_hd_map.visibility = View.VISIBLE
|
||||
@@ -625,9 +629,15 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
*/
|
||||
tbControlPassengerDriverMonitor.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR, "1".toByteArray())
|
||||
CallerTelematicManager.sendMsgToAllClients(
|
||||
TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR,
|
||||
"1".toByteArray()
|
||||
)
|
||||
} else {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR, "0".toByteArray())
|
||||
CallerTelematicManager.sendMsgToAllClients(
|
||||
TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR,
|
||||
"0".toByteArray()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +663,8 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
// 初始化OBU IP信息
|
||||
val ipAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, MogoObuConst.OBU_DEFAULT_IP)
|
||||
SharedPrefsMgr.getInstance(context)
|
||||
.getString(MoGoConfig.OBU_IP, MogoObuConst.OBU_DEFAULT_IP)
|
||||
|
||||
etObuIP.setText(ipAddress)
|
||||
etObuIP.text?.let { etObuIP.setSelection(it.length) }
|
||||
@@ -705,9 +716,11 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
tbIsStrictMode?.also {
|
||||
it.isChecked = SharedPrefs.getInstance(Utils.getApp()).getBoolean("MOGO_STRICT_MODE_ENABLED", false)
|
||||
it.isChecked = SharedPrefs.getInstance(Utils.getApp())
|
||||
.getBoolean("MOGO_STRICT_MODE_ENABLED", false)
|
||||
it.setOnCheckedChangeListener { _, isChecked ->
|
||||
SharedPrefs.getInstance(Utils.getApp()).putBoolean("MOGO_STRICT_MODE_ENABLED", isChecked)
|
||||
SharedPrefs.getInstance(Utils.getApp())
|
||||
.putBoolean("MOGO_STRICT_MODE_ENABLED", isChecked)
|
||||
scope.launch {
|
||||
ToastUtils.showShort("配置生效, 2秒后重启应用...")
|
||||
delay(2000)
|
||||
@@ -850,7 +863,8 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
} else {
|
||||
try {
|
||||
val cloudSizeFloat = cloudSize.toFloat()
|
||||
CallerMapUIServiceManager.getMapUIController()?.setPointCloudSize(cloudSizeFloat)
|
||||
CallerMapUIServiceManager.getMapUIController()
|
||||
?.setPointCloudSize(cloudSizeFloat)
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.showShort("点云大小格式输入不正确")
|
||||
}
|
||||
@@ -896,7 +910,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbADASLog.isChecked = CallerAutoPilotControlManager.isEnableLog()
|
||||
|
||||
//如果工控机异常上报列表窗口为展示状态,则显示上报异常布局
|
||||
if(CallerDevaToolsManager.getReportWindowStatus()){
|
||||
if (CallerDevaToolsManager.getReportWindowStatus()) {
|
||||
reportMsgLayout.visibility = View.VISIBLE
|
||||
tbReportMore.isChecked = true
|
||||
}
|
||||
@@ -929,7 +943,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
clipboardManager?.setPrimaryClip(
|
||||
ClipData.newPlainText(
|
||||
"DockVersion",
|
||||
CallerAutoPilotStatusListenerManager.getDockerVersion()?:""
|
||||
CallerAutoPilotStatusListenerManager.getDockerVersion() ?: ""
|
||||
)
|
||||
)
|
||||
ToastUtils.showLong("docker版本复制成功")
|
||||
@@ -1042,13 +1056,15 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
if (!AppIdentityModeUtils.isTaxiDriver(FunctionBuildConfig.appIdentityMode)
|
||||
&& !AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)){
|
||||
&& !AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
tbStartAutopilotCommand.visibility = GONE
|
||||
}
|
||||
|
||||
|
||||
//切换环境
|
||||
tvCurEnv.text = "当前环境:${CallerDevaToolsManager.getEnvCityName()}${CallerDevaToolsManager.getEnvNetMode()}"
|
||||
tvCurEnv.text =
|
||||
"当前环境:${CallerDevaToolsManager.getEnvCityName()}${CallerDevaToolsManager.getEnvNetMode()}"
|
||||
btChangeEnv.onClick {
|
||||
PopupMenu(context, btChangeEnv).also { p ->
|
||||
p.menuInflater.inflate(R.menu.menu_env_pop, p.menu)
|
||||
@@ -1064,13 +1080,22 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
R.id.env_reset ->
|
||||
CallerDevaToolsManager.envConfigReset()
|
||||
R.id.hy_product ->
|
||||
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_RELEASE)
|
||||
CallerDevaToolsManager.envConfigChange(
|
||||
"0734",
|
||||
DebugConfig.NET_MODE_RELEASE
|
||||
)
|
||||
R.id.hy_qa ->
|
||||
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_QA)
|
||||
R.id.hy_demo ->
|
||||
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_DEMO)
|
||||
CallerDevaToolsManager.envConfigChange(
|
||||
"0734",
|
||||
DebugConfig.NET_MODE_DEMO
|
||||
)
|
||||
R.id.bj_product ->
|
||||
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_RELEASE)
|
||||
CallerDevaToolsManager.envConfigChange(
|
||||
"010",
|
||||
DebugConfig.NET_MODE_RELEASE
|
||||
)
|
||||
R.id.bj_qa ->
|
||||
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_QA)
|
||||
R.id.bj_demo ->
|
||||
@@ -1271,7 +1296,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
* 设置是否输出高精地图日志 true-打印日志,false-不打印日志
|
||||
*/
|
||||
tbHdMapLog.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerMapUIServiceManager.getMapUIController()?.setDebugMode(isChecked)
|
||||
mogoMapData.get().setDebugMode(isChecked)
|
||||
}
|
||||
|
||||
cbTraceLog.isChecked = CallerDevaToolsManager.getTraceLogStatus()
|
||||
@@ -1391,7 +1416,14 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
activity?.startActivity(Intent.createChooser(Intent().also {
|
||||
it.action = Intent.ACTION_SEND
|
||||
it.type = "application/zip"
|
||||
it.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(activity, "${activity.packageName}.fileProvider", file))
|
||||
it.putExtra(
|
||||
Intent.EXTRA_STREAM,
|
||||
FileProvider.getUriForFile(
|
||||
activity,
|
||||
"${activity.packageName}.fileProvider",
|
||||
file
|
||||
)
|
||||
)
|
||||
}, "分享全量日志压缩包到"))
|
||||
}
|
||||
} else {
|
||||
@@ -1561,8 +1593,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
/**
|
||||
* 版本信息
|
||||
*/
|
||||
tvAppVersionName.text = "鹰眼版本:${AppUtils.getAppVersionName()} Git Hash:${AppConfigInfo.workingBranchHash} \n渠道信息:${AppConfigInfo.flavor}"
|
||||
tvAppVersionNameKey.text = "鹰眼版本:${AppUtils.getAppVersionName()} Git Hash:${AppConfigInfo.workingBranchHash}\n渠道信息:${AppConfigInfo.flavor}"
|
||||
tvAppVersionName.text =
|
||||
"鹰眼版本:${AppUtils.getAppVersionName()} Git Hash:${AppConfigInfo.workingBranchHash} \n渠道信息:${AppConfigInfo.flavor}"
|
||||
tvAppVersionNameKey.text =
|
||||
"鹰眼版本:${AppUtils.getAppVersionName()} Git Hash:${AppConfigInfo.workingBranchHash}\n渠道信息:${AppConfigInfo.flavor}"
|
||||
|
||||
tvAutopilotProtocolVersionInfo.text =
|
||||
"Autopilot协议版本:${CallerAutoPilotControlManager.getProtocolVersion()}"
|
||||
@@ -1579,9 +1613,12 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tvGitBranchInfo.text = "Git分支:${AppConfigInfo.workingBranchName}"
|
||||
tvAppBuildTimeInfo.text = "版本构建时间:${AppConfigInfo.appBuildTime}"
|
||||
|
||||
if(tbBeautyMode.isVisible){
|
||||
val version = ParseVersionUtils.parseVersion(true, CallerAutoPilotStatusListenerManager.getDockerVersion())
|
||||
if(version >= 30100 && AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
if (tbBeautyMode.isVisible) {
|
||||
val version = ParseVersionUtils.parseVersion(
|
||||
true,
|
||||
CallerAutoPilotStatusListenerManager.getDockerVersion()
|
||||
)
|
||||
if (version >= 30100 && AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbBeautyMode.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
@@ -1614,7 +1651,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
"移动数据"
|
||||
} else {
|
||||
//WiFi
|
||||
CommonUtils.getWifiName(context)?:""
|
||||
CommonUtils.getWifiName(context) ?: ""
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1689,11 +1726,14 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tvIpcInfo.text = it
|
||||
tvIpcInfoKey.text = it
|
||||
}
|
||||
tvCmdbCarInfoContent.text = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO)?:""
|
||||
tvCmdbCarInfoContent.text =
|
||||
SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO) ?: ""
|
||||
|
||||
//APP升级功能
|
||||
tvAppHost.text = "HOST地址:" + SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.HOST_ADDRESS)?:""
|
||||
tvAppContent.text = "APP升级数据:" + SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.APP_UPGRADE_CONTENT)?:""
|
||||
tvAppHost.text = "HOST地址:" + SharedPrefsMgr.getInstance(context)
|
||||
.getString(SharedPrefsConstants.HOST_ADDRESS) ?: ""
|
||||
tvAppContent.text = "APP升级数据:" + SharedPrefsMgr.getInstance(context)
|
||||
.getString(SharedPrefsConstants.APP_UPGRADE_CONTENT) ?: ""
|
||||
|
||||
tvCarInfo.text =
|
||||
"GPS时间:${(mGnssInfo?.satelliteTime?.times(1000))?.toLong()}\n" +
|
||||
@@ -1731,7 +1771,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbIsDemoMode?.text = "开启美化模式"
|
||||
}
|
||||
|
||||
if(FunctionBuildConfig.isRainMode){
|
||||
if (FunctionBuildConfig.isRainMode) {
|
||||
tbIsRainMode?.text = "关闭雨天模式"
|
||||
} else {
|
||||
tbIsRainMode?.text = "开启雨天模式"
|
||||
@@ -2107,56 +2147,71 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun restartApp() {
|
||||
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
Utils.getApp()
|
||||
.startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
|
||||
private fun cacheHDOfflineData(isGaoDe: Boolean) {
|
||||
var progss = 0
|
||||
if (isGaoDe) {// 拿到了高德地图的cityCode
|
||||
CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
|
||||
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
|
||||
// 更新进度
|
||||
progss = progress.toInt()
|
||||
if (progss == 100) {
|
||||
isHDCached = true
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(已是最新版!)"
|
||||
} else {
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(进度:${progss}%)"
|
||||
}
|
||||
mogoMapData.get().cacheHDDataByCity({ _, progress ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread(Runnable {
|
||||
cacheHDCityProgressUpdate(progress)
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
cacheHDCityProgressUpdate(progress)
|
||||
}
|
||||
|
||||
override fun onMapHdCacheResult(cityId: Int, state: Int) {
|
||||
if (state == 0) {// 失败
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(下载失败!)"
|
||||
ToastUtils.showShort("下载失败,请重试!")
|
||||
}
|
||||
}, { _, state ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread(Runnable {
|
||||
cacheHDCityResult(state)
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
cacheHDCityResult(state)
|
||||
}
|
||||
})
|
||||
} else {// 只拿到了高精的经纬度
|
||||
mGnssInfo?.let { loc ->
|
||||
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
|
||||
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
|
||||
progss = progress.toInt()
|
||||
if (progss == 100) {
|
||||
isHDCached = true
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(已是最新版!)"
|
||||
} else {
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(进度:${progss}%)"
|
||||
}
|
||||
mogoMapData.get().cacheHDDataByCityByLonLat(loc, { _, progress ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread(Runnable {
|
||||
cacheHDCityProgressUpdate(progress)
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
cacheHDCityProgressUpdate(progress)
|
||||
}
|
||||
|
||||
override fun onMapHdCacheResult(cityId: Int, state: Int) {
|
||||
if (state == 0) {// 失败
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(下载失败!)"
|
||||
ToastUtils.showShort("下载失败,请重试!")
|
||||
}
|
||||
}, { _, state ->
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
ThreadUtils.runOnUiThread(Runnable {
|
||||
cacheHDCityResult(state)
|
||||
}, ThreadUtils.MODE.QUEUE)
|
||||
} else {
|
||||
cacheHDCityResult(state)
|
||||
}
|
||||
}, loc)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun cacheHDCityProgressUpdate(progress: Double) {
|
||||
// 更新进度
|
||||
val progss = progress.toInt()
|
||||
if (progss == 100) {
|
||||
isHDCached = true
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(已是最新版!)"
|
||||
} else {
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(进度:${progss}%)"
|
||||
}
|
||||
}
|
||||
|
||||
private fun cacheHDCityResult(state: Int) {
|
||||
if (state == 0) {// 失败
|
||||
btn_cache_hd_map.text = "缓存高精离线地图(下载失败!)"
|
||||
ToastUtils.showShort("下载失败,请重试!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun fwThreadClose() {
|
||||
refreshTraceInfo()
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
if (gnssInfo != null) {
|
||||
//设置刹车信息,小于默认认为是刹车
|
||||
//设置刹车信息,小于默认认为是刹车 //todo 优化sp获取,不要每次回调都去调用sp
|
||||
brakeLight =
|
||||
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(
|
||||
MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiActio
|
||||
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.*
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import kotlinx.android.synthetic.main.view_system_version.view.*
|
||||
|
||||
|
||||
@@ -155,9 +156,10 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
ThreadUtils.getIoPool().execute {
|
||||
val isCached = CallerMapUIServiceManager.isCityDataCached()
|
||||
UiThreadHandler.post {
|
||||
updateHDDataCacheStatus(isCached)
|
||||
mogoMapData.get().isCityDataCached {
|
||||
UiThreadHandler.post {
|
||||
updateHDDataCacheStatus(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -101,7 +101,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
}
|
||||
|
||||
private fun initGDLoc() {
|
||||
CallerMapUIServiceManager.getGDLocationServer(context!!)?.start()
|
||||
CallerMapUIServiceManager.getGDLocationServer()?.start(context!!)
|
||||
}
|
||||
|
||||
private fun preparePassportEnvironment() {
|
||||
@@ -170,10 +170,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
// 更新
|
||||
httpDnsSimpleLocation = if (
|
||||
mogoLocation.cityCode.isNullOrEmpty() &&
|
||||
!CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
|
||||
!CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode.isNullOrEmpty()
|
||||
) {
|
||||
SimpleLocation(
|
||||
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
|
||||
CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode
|
||||
?: "010",
|
||||
mogoLocation.latitude,
|
||||
mogoLocation.longitude
|
||||
@@ -354,13 +354,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
})
|
||||
// 开启Socket长链服务
|
||||
val lat =
|
||||
if (location.latitude != 0.0) location.latitude else CallerMapUIServiceManager.getGDLocationServer(
|
||||
context!!
|
||||
)!!.lastLat
|
||||
if (location.latitude != 0.0) location.latitude else CallerMapUIServiceManager.getGDLocationServer()!!.lastLat
|
||||
val lon =
|
||||
if (location.longitude != 0.0) location.longitude else CallerMapUIServiceManager.getGDLocationServer(
|
||||
context!!
|
||||
)!!.lastLon
|
||||
if (location.longitude != 0.0) location.longitude else CallerMapUIServiceManager.getGDLocationServer()!!.lastLon
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
.init(context, sn, DebugConfig.getSocketAppId(), lat, lon)
|
||||
}
|
||||
@@ -381,11 +377,11 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
map["lat"] =
|
||||
if (CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude != 0.0)
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude else
|
||||
CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLat
|
||||
CallerMapUIServiceManager.getGDLocationServer()!!.lastLat
|
||||
map["lon"] =
|
||||
if (CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude != 0.0)
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude else
|
||||
CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLon
|
||||
CallerMapUIServiceManager.getGDLocationServer()!!.lastLon
|
||||
map["reason"] = msg
|
||||
return GsonUtils.toJson(map)
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.protobuf_java_util
|
||||
|
||||
implementation project(':core:mogo-core-res')
|
||||
api 'com.zhidaoauto.machine:mapdata:1.0.0.2'
|
||||
api project(":libraries:mogo-adas-data")
|
||||
api project(':core:mogo-core-utils')
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ public interface IMogoMapService extends IProvider {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoGDLocationClient getGDLocationServer(Context context);
|
||||
IMogoGDLocationClient getGDLocationServer();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.map.IMogoMapService
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.map.hdcache.IHdCacheListener
|
||||
import com.mogo.map.location.IMogoGDLocationClient
|
||||
import com.mogo.map.overlay.*
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
@@ -22,32 +19,16 @@ object CallerMapUIServiceManager {
|
||||
return serviceProvider?.mapUIController
|
||||
}
|
||||
|
||||
fun cacheHDDataByCity(listener: IHdCacheListener) {
|
||||
serviceProvider?.mapUIController?.cacheHDDataByCity(listener)
|
||||
}
|
||||
|
||||
fun cacheHDDataByCityByLonLat(listener: IHdCacheListener, location: MogoLocation) {
|
||||
serviceProvider?.mapUIController?.cacheHDDataByCity(listener, location)
|
||||
}
|
||||
|
||||
fun isCityDataCached(): Boolean {
|
||||
return serviceProvider?.mapUIController?.isCityDataCached ?: false
|
||||
}
|
||||
|
||||
fun cancelDownloadCacheData() {
|
||||
serviceProvider?.mapUIController?.cancelDownloadCacheData()
|
||||
}
|
||||
|
||||
fun getCityCode(): String? {
|
||||
return serviceProvider?.mapUIController?.cityCode
|
||||
}
|
||||
|
||||
fun getOverlayManager(): IMoGoOverlayManager? {
|
||||
return serviceProvider?.overlayManager
|
||||
}
|
||||
|
||||
fun getGDLocationServer(context: Context): IMogoGDLocationClient?{
|
||||
return serviceProvider?.getGDLocationServer(context)
|
||||
fun getGDLocationServer(): IMogoGDLocationClient?{
|
||||
return serviceProvider?.gdLocationServer
|
||||
}
|
||||
|
||||
fun getCityCode(): String? {
|
||||
return serviceProvider?.gdLocationServer?.lastCityCode
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class Scene {
|
||||
val adasMap = SceneLogCache(mutableMapOf(), true)
|
||||
sceneCache[M_D_C] = adasMap
|
||||
//初始化deva
|
||||
val devaMap = SceneLogCache(mutableMapOf(), false)
|
||||
val devaMap = SceneLogCache(mutableMapOf(), true)
|
||||
sceneCache[M_DEVA] = devaMap
|
||||
//初始化hmi
|
||||
val hmiMap = SceneLogCache(mutableMapOf(), false)
|
||||
|
||||
@@ -66,7 +66,7 @@ dependencies {
|
||||
|
||||
implementation 'com.zhidaoauto.map:net:1.0.1'
|
||||
implementation 'com.zhidaoauto.machine:mapcore:3.0.0.5'
|
||||
implementation 'com.zhidaoauto.machine:mapdata:1.0.0.1'
|
||||
implementation 'com.zhidaoauto.machine:mapdata:1.0.0.2'
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhidaoauto.map.sdk.open.data
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
@@ -20,14 +21,13 @@ import com.zhidaoauto.map.data.road.*
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object MapDataApi {
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
|
||||
private var mContext:Context? = null
|
||||
|
||||
|
||||
|
||||
fun getContext():Context?{
|
||||
return mContext
|
||||
}
|
||||
@@ -52,31 +52,6 @@ object MapDataApi {
|
||||
mContext = null
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断服务是否开启
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun isServiceRunning(context: Context, ServiceName: String): Boolean {
|
||||
if (true) {
|
||||
return false
|
||||
}
|
||||
if (TextUtils.isEmpty(ServiceName)) {
|
||||
return false
|
||||
}
|
||||
val myManager = context
|
||||
.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
val runningServices = myManager
|
||||
.getRunningServices(50) as ArrayList<ActivityManager.RunningServiceInfo>
|
||||
for (info in runningServices) {
|
||||
if (info.service.className.equals(ServiceName)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
fun getRouteInfo(
|
||||
centerLon: Float,
|
||||
centerLat: Float, coor: Int, type: Int
|
||||
|
||||
@@ -4,16 +4,15 @@ import android.graphics.Point
|
||||
import android.util.Log
|
||||
import com.autonavi.nge.map.LonLat
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
||||
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
|
||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||
import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy
|
||||
import com.zhidaoauto.map.sdk.inner.utils.MathUtils
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.math.*
|
||||
|
||||
object MapTools {
|
||||
|
||||
val TAG = javaClass.simpleName
|
||||
val TAG: String = javaClass.simpleName
|
||||
var viewHeight = 1040
|
||||
var viewWidth = 1920
|
||||
|
||||
@@ -21,13 +20,13 @@ object MapTools {
|
||||
* 屏幕坐标转经纬度
|
||||
*/
|
||||
fun fromScreenLocation(paramPoint: Point,mMapController: IMapController?): LonLatPoint {
|
||||
if (CompileConfig.DEBUG) {
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "lonlatop--fromScreenLocation--${paramPoint.toString()}")
|
||||
}
|
||||
var lonLat = mMapController?.pixelsToLonlat(paramPoint.x.toFloat(), paramPoint.y.toFloat())
|
||||
val lonLat = mMapController?.pixelsToLonlat(paramPoint.x.toFloat(), paramPoint.y.toFloat())
|
||||
lonLat?.let {
|
||||
val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(it)
|
||||
if (CompileConfig.DEBUG) {
|
||||
if (DEBUG) {
|
||||
Log.i(
|
||||
TAG,
|
||||
"lonlatop-toScreenLocation-toOuter-before:${lonLat},after:${lonLatPoint}"
|
||||
@@ -42,16 +41,16 @@ object MapTools {
|
||||
* 经纬度转屏幕坐标
|
||||
*/
|
||||
fun toScreenLocation(lonLatPoint: LonLatPoint,mMapController: IMapController?): Point {
|
||||
var lonLat: LonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||
if (CompileConfig.DEBUG) {
|
||||
val lonLat: LonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "lonlatop-toScreenLocation-toInner-before:${lonLatPoint},after:${lonLat}")
|
||||
}
|
||||
var point = mMapController?.lonlatToPixels(
|
||||
val point = mMapController?.lonlatToPixels(
|
||||
lonLat.lon,
|
||||
lonLat.lat
|
||||
)
|
||||
point?.let {
|
||||
if (CompileConfig.DEBUG) {
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "lonlatop-toScreenLocation-result-${point}")
|
||||
}
|
||||
return Point(point.x.toInt(), point.y.toInt())
|
||||
@@ -79,9 +78,9 @@ object MapTools {
|
||||
* 批量经纬度转屏幕坐标
|
||||
*/
|
||||
fun toScreenLocations(data: List<LonLatPoint>,mMapController: IMapController?): List<Point> {
|
||||
var arrayList: ArrayList<Point> = ArrayList()
|
||||
val arrayList: ArrayList<Point> = ArrayList()
|
||||
for (pp in data) {
|
||||
var point = toScreenLocation(pp,mMapController)
|
||||
val point = toScreenLocation(pp,mMapController)
|
||||
arrayList.add(point)
|
||||
}
|
||||
return arrayList
|
||||
@@ -91,9 +90,9 @@ object MapTools {
|
||||
* 批量屏幕坐标转经纬度
|
||||
*/
|
||||
fun fromScreenLocations(data: List<Point>,mMapController: IMapController?): List<LonLatPoint> {
|
||||
var arrayList: ArrayList<LonLatPoint> = ArrayList()
|
||||
val arrayList: ArrayList<LonLatPoint> = ArrayList()
|
||||
for (pp in data) {
|
||||
var lonLat = fromScreenLocation(pp,mMapController)
|
||||
val lonLat = fromScreenLocation(pp,mMapController)
|
||||
arrayList.add(lonLat)
|
||||
}
|
||||
return arrayList
|
||||
@@ -131,10 +130,10 @@ object MapTools {
|
||||
}
|
||||
|
||||
fun getLonLats(start: LonLatPoint, end: LonLatPoint): List<LonLatPoint> {
|
||||
var lonLatPoints: ArrayList<LonLatPoint> = ArrayList<LonLatPoint>()
|
||||
val lonLatPoints: ArrayList<LonLatPoint> = ArrayList()
|
||||
val x = end.latitude - start.latitude
|
||||
val y = end.longitude - start.longitude
|
||||
val dis = Math.sqrt(x * x + y * y).absoluteValue
|
||||
val dis = sqrt(x * x + y * y).absoluteValue
|
||||
val num = (dis / 0.000001).toInt()
|
||||
val numX = x / num.toDouble()
|
||||
val numY = y / num.toDouble()
|
||||
@@ -143,7 +142,7 @@ object MapTools {
|
||||
val lat = start.latitude + numX * i
|
||||
val lonlatPoint = LonLatPoint(lon, lat)
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "lonlatPoint: ${lonlatPoint}")
|
||||
Log.d(TAG, "lonlatPoint: $lonlatPoint")
|
||||
}
|
||||
lonLatPoints.add(lonlatPoint)
|
||||
|
||||
@@ -156,7 +155,7 @@ object MapTools {
|
||||
}
|
||||
|
||||
fun HaverSin(theta: Double): Double {
|
||||
val v = Math.sin(theta / 2)
|
||||
val v = sin(theta / 2)
|
||||
return v * v
|
||||
}
|
||||
|
||||
@@ -186,12 +185,12 @@ object MapTools {
|
||||
lon2 = ConvertDegreesToRadians(lon2)
|
||||
|
||||
//差值
|
||||
val vLon = Math.abs(lon1 - lon2)
|
||||
val vLat = Math.abs(lat1 - lat2)
|
||||
val vLon = abs(lon1 - lon2)
|
||||
val vLat = abs(lat1 - lat2)
|
||||
|
||||
//h is the great circle distance in radians, great circle就是一个球体上的切面,它的圆心即是球心的一个周长最大的圆。
|
||||
val h = HaverSin(vLat) + Math.cos(lat1) * Math.cos(lat2) * HaverSin(vLon)
|
||||
return 2 * EARTH_RADIUS * Math.asin(Math.sqrt(h))
|
||||
val h = HaverSin(vLat) + cos(lat1) * cos(lat2) * HaverSin(vLon)
|
||||
return 2 * EARTH_RADIUS * asin(sqrt(h))
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -212,25 +211,25 @@ object MapTools {
|
||||
val a = 6378137
|
||||
|
||||
fun getDestinceLonLat(lonlat: LonLat, angle: Double, dist: Float): LonLat {
|
||||
var angleRadHeading = angle / 180 * Math.PI
|
||||
val angleRadHeading = angle / 180 * Math.PI
|
||||
var newLat = 0.0
|
||||
var newLong = 0.0
|
||||
|
||||
val distRatio = dist / EARTH_RADIUS
|
||||
val distRatioSine = Math.sin(distRatio)
|
||||
val distRatioCosine = Math.cos(distRatio)
|
||||
val distRatioSine = sin(distRatio)
|
||||
val distRatioCosine = cos(distRatio)
|
||||
|
||||
val startLatRad = lonlat.lat / 180 * Math.PI
|
||||
val startLonRad = lonlat.lon / 180 * Math.PI
|
||||
|
||||
val startLatCos = Math.cos(startLatRad)
|
||||
val startLatSin = Math.sin(startLatRad)
|
||||
val startLatCos = cos(startLatRad)
|
||||
val startLatSin = sin(startLatRad)
|
||||
|
||||
val endLatRads = Math.asin(startLatSin * distRatioCosine + startLatCos * distRatioSine * Math.cos(angleRadHeading))
|
||||
val endLatRads = asin(startLatSin * distRatioCosine + startLatCos * distRatioSine * cos(angleRadHeading))
|
||||
val endLonRads = (startLonRad
|
||||
+ Math.atan2(
|
||||
Math.sin(angleRadHeading) * distRatioSine * startLatCos,
|
||||
distRatioCosine - startLatSin * Math.sin(endLatRads)
|
||||
+ atan2(
|
||||
sin(angleRadHeading) * distRatioSine * startLatCos,
|
||||
distRatioCosine - startLatSin * sin(endLatRads)
|
||||
))
|
||||
newLat = endLatRads / Math.PI * 180
|
||||
newLong = endLonRads / Math.PI * 180
|
||||
@@ -241,15 +240,15 @@ object MapTools {
|
||||
fun getDistance(lastLonlat: LonLat, lonlat: LonLat): Double {
|
||||
val x = lonlat.lat - lastLonlat.lat
|
||||
val y = lonlat.lon - lastLonlat.lon
|
||||
return Math.sqrt(x * x + y * y).absoluteValue
|
||||
return sqrt(x * x + y * y).absoluteValue
|
||||
}
|
||||
|
||||
fun getNextLonLat(lastLonlat: LonLat, lonlat: LonLat, length: Double): LonLat {
|
||||
val x = lonlat.lat - lastLonlat.lat
|
||||
val y = lonlat.lon - lastLonlat.lon
|
||||
val distance = Math.sqrt(x * x + y * y).absoluteValue
|
||||
val distance = sqrt(x * x + y * y).absoluteValue
|
||||
val scale = length / distance
|
||||
if(CompileConfig.DEBUG){
|
||||
if(DEBUG){
|
||||
Log.i(TAG,"centerop-mattop:length:${length},distance:${distance},scale:${scale}")
|
||||
}
|
||||
val lon = lastLonlat.lon + y * scale
|
||||
|
||||
@@ -1,28 +1,93 @@
|
||||
package com.mogo.map
|
||||
|
||||
import com.mogo.map.center.CenterLine
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
|
||||
interface IMogoData {
|
||||
|
||||
fun setDebugMode(debugMode: Boolean)
|
||||
|
||||
/**
|
||||
* 获取行驶方向一定长度的中心线
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 航向角
|
||||
* @param distance 获取车道中心线的长度,> 0: 行驶方向前方距离, <0 行驶方向后方距离
|
||||
* @return 中心线相关数据
|
||||
* 获取车道中心线数据
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getCenterLineRangeInfo(lon: Double, lat: Double, angle: Float, distance: Float): CenterLine?
|
||||
|
||||
fun getCenterLineInfo(lon: Double, lat: Double, angle: Float, call: ((CenterLine?) -> Unit))
|
||||
|
||||
/**
|
||||
* 按距离获取道路数据
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getCenterLineRangeInfo(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
angle: Float,
|
||||
distance: Float,
|
||||
call: ((Int, com.mogo.map.center.CenterLine?) -> Unit)
|
||||
call: ((CenterLine?) -> Unit)
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取车道限速
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getLimitSpeed(lon: Double, lat: Double, angle: Float, call: ((Int) -> Unit))
|
||||
|
||||
/**
|
||||
* 获取道路角度
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getRoadAngle(lon: Double, lat: Double, angle: Float, call: ((Double) -> Unit))
|
||||
|
||||
/**
|
||||
* 获取道路宽度
|
||||
*/
|
||||
fun getRoadWidth(lon: Double, lat: Double, angle: Float, isGpsLocation: Boolean, isRTK: Boolean): Float
|
||||
|
||||
/**
|
||||
* 获取行车方向
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun getAngle(startLon: Double, startLat: Double, endLon: Double, endLat: Double): Float
|
||||
|
||||
/**
|
||||
* 获取瓦片id
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return 瓦片id
|
||||
*/
|
||||
fun getTileId(lon: Double, lat: Double): Long
|
||||
|
||||
/**
|
||||
* 通过cityCode,缓存城市HDMap
|
||||
*/
|
||||
fun cacheHDDataByCity(progress:((cityId: Int, progress: Double) -> Unit), result:((cityId: Int, state: Int) -> Unit))
|
||||
|
||||
/**
|
||||
* 通过经纬度信息,缓存城市HDMap
|
||||
*/
|
||||
fun cacheHDDataByCityByLonLat(location: MogoLocation, progress:((cityId: Int, progress: Double) -> Unit), result:((cityId: Int, state: Int) -> Unit))
|
||||
|
||||
/**
|
||||
* 当前城市离线数据是否已缓存
|
||||
*/
|
||||
fun isCityDataCached(cache:((Boolean) -> Unit))
|
||||
|
||||
/**
|
||||
* 取消下载 城市HDMap
|
||||
*/
|
||||
fun cancelDownloadCacheData()
|
||||
|
||||
}
|
||||
@@ -100,7 +100,6 @@ public interface IMogoMap {
|
||||
*/
|
||||
void changeZoom(float zoom);
|
||||
|
||||
|
||||
/**
|
||||
* 改变地图缩放级别的别一种方式
|
||||
*
|
||||
@@ -115,32 +114,4 @@ public interface IMogoMap {
|
||||
*/
|
||||
float getZoomLevel();
|
||||
|
||||
/**
|
||||
* 获取道路的宽度
|
||||
*/
|
||||
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
|
||||
|
||||
/**
|
||||
* 获取行驶方向一定长度的中心线
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 航向角
|
||||
* @param distance 获取车道中心线的长度,> 0: 行驶方向前方距离, <0 行驶方向后方距离
|
||||
* @return 中心线相关数据
|
||||
*/
|
||||
CenterLine getCenterLineRangeInfo(double lon, double lat, float angle, float distance);
|
||||
|
||||
|
||||
/**
|
||||
* 根据自车经纬度和航向角,获取道路名称
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 航向角
|
||||
* @return 道路名称等相关信息
|
||||
*/
|
||||
RoadNameInfo getRoadName(double lon, double lat, float angle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MapApiPath {
|
||||
|
||||
public static final String PATH = "/mogomap/api";
|
||||
}
|
||||
@@ -16,8 +16,6 @@ import androidx.annotation.Nullable;
|
||||
*/
|
||||
public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle {
|
||||
|
||||
private static final String TAG = "MogoBaseMapView";
|
||||
|
||||
protected IMogoMapView mMapView;
|
||||
|
||||
public MogoBaseMapView( Context context ) {
|
||||
@@ -36,12 +34,14 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
private void init( Context context ) {
|
||||
addMapView( context );
|
||||
if (mMapView != null){
|
||||
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
|
||||
MogoMap.Companion.getMapInstance().initInstance( mMapView.getMap() , getInstanceTag());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void addMapView( Context context );
|
||||
|
||||
protected abstract String getInstanceTag();
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
if ( mMapView != null ) {
|
||||
@@ -68,7 +68,7 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
}
|
||||
MogoMap.getInstance().clear();
|
||||
MogoMap.Companion.getMapInstance().clear(getInstanceTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
package com.mogo.map
|
||||
|
||||
class MogoData {
|
||||
class MogoData private constructor() {
|
||||
|
||||
companion object{
|
||||
companion object {
|
||||
|
||||
val mogoData by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
val mogoMapData by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
MogoData()
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var iMogoData: IMogoData
|
||||
|
||||
fun init(iMogoData: IMogoData) {
|
||||
this.iMogoData = iMogoData
|
||||
}
|
||||
|
||||
fun get():IMogoData{
|
||||
return iMogoData
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-20
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoMap {
|
||||
|
||||
private static final String TAG = "MogoMap";
|
||||
|
||||
private IMogoMap mMap;
|
||||
private Context mContext;
|
||||
|
||||
private static volatile MogoMap sInstance;
|
||||
|
||||
private MogoMap() {
|
||||
}
|
||||
|
||||
public static MogoMap getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoMap.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
//todo 多实例
|
||||
public void init( Context context, IMogoMap map ) {
|
||||
this.mContext = context;
|
||||
this.mMap = map;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
public IMogoMap getMogoMap() {
|
||||
return mMap;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
mContext = null;
|
||||
mMap = null;
|
||||
}
|
||||
}
|
||||
58
libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt
Normal file
58
libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.mogo.map
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class MogoMap private constructor() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MogoMap"
|
||||
|
||||
const val DEFAULT = "Default"
|
||||
|
||||
val mapInstance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
MogoMap()
|
||||
}
|
||||
}
|
||||
|
||||
private val mapCache = ConcurrentHashMap<String, IMogoMap>()
|
||||
|
||||
/**
|
||||
* 缓存多实例对象
|
||||
*/
|
||||
fun initInstance(map: IMogoMap, instanceTag: String = DEFAULT) {
|
||||
if (mapCache.contains(instanceTag)) {
|
||||
CallerLogger.e(
|
||||
"$M_MAP$TAG",
|
||||
" already has map instance with tag :$instanceTag , please check"
|
||||
)
|
||||
return
|
||||
}
|
||||
mapCache[instanceTag] = map
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务使用时根据地图是否加载来判定 是否获取IMogoMap实例
|
||||
*/
|
||||
fun getMogoMap(instance: String = DEFAULT): IMogoMap {
|
||||
return if (mapCache[instance] == null) {
|
||||
CallerLogger.e("$M_MAP$TAG", "getMogoMap func has error with no instance in mapCache")
|
||||
mapCache[DEFAULT]!!
|
||||
} else {
|
||||
mapCache[instance]!!
|
||||
}
|
||||
}
|
||||
|
||||
fun clear(instance: String = DEFAULT) {
|
||||
if (mapCache.containsKey(instance)) {
|
||||
mapCache.remove(instance)
|
||||
} else {
|
||||
CallerLogger.e(
|
||||
"$M_MAP$TAG",
|
||||
"Map instance invoke destroy in clear func has no instance key"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public interface IMogoGDLocationClient {
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
*/
|
||||
void start();
|
||||
void start(Context context);
|
||||
|
||||
/**
|
||||
* 停止定位
|
||||
|
||||
@@ -7,11 +7,7 @@ import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
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;
|
||||
@@ -112,11 +108,6 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
float getZoomLevel();
|
||||
|
||||
/**
|
||||
* 获取道路的宽度
|
||||
*/
|
||||
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
|
||||
|
||||
/**
|
||||
* 获取视图东北角坐标
|
||||
*/
|
||||
@@ -213,21 +204,6 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
void changeBearing(float bearing);
|
||||
|
||||
/**
|
||||
* 修改地图中心
|
||||
* MapAutoApi.CAR_CENTER_100 = 1
|
||||
* MapAutoApi.CAR_QUARTER_100 = 2
|
||||
* MapAutoApi.CAR_TWO_FIFTHS_100 = 3
|
||||
* MapAutoApi.CAR_TWO_FIFTHS_80= 4
|
||||
* MapAutoApi.CAR_AFTER_30_FRONT_80 = 5
|
||||
* MapAutoApi.CAR_AFTER_30_FRONT_100 = 6
|
||||
* MapAutoApi.CAR_AFTER_30_FRONT_120 = 7
|
||||
* MapAutoApi.CAR_AFTER_40_FRONT_80= 8
|
||||
* MapAutoApi.CAR_AFTER_40_FRONT_100 = 9
|
||||
* MapAutoApi.CAR_AFTER_40_FRONT_120 = 10
|
||||
*/
|
||||
void changeMapViewAngle(int type);
|
||||
|
||||
/**
|
||||
* 修改高精地图自车图标
|
||||
* 传入资源ID
|
||||
@@ -314,17 +290,6 @@ public interface IMogoMapUIController {
|
||||
* @param color // color:"#RRGGBB*
|
||||
*/
|
||||
void setPointCloudColor(String color);
|
||||
void cacheHDDataByCity(IHdCacheListener listener);
|
||||
|
||||
void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location);
|
||||
|
||||
/**
|
||||
* 当前城市离线数据是否已缓存
|
||||
* @return
|
||||
*/
|
||||
boolean isCityDataCached();
|
||||
|
||||
void cancelDownloadCacheData();
|
||||
|
||||
String getCityCode();
|
||||
|
||||
|
||||
@@ -53,21 +53,16 @@ dependencies {
|
||||
// 高精地图
|
||||
// implementation rootProject.ext.dependencies.mogocustommap
|
||||
implementation project(':libraries:mapmodule')
|
||||
implementation 'com.zhidaoauto.machine:mapdata:1.0.0.1'
|
||||
|
||||
// 高德地图
|
||||
// api rootProject.ext.dependencies.amaplocation
|
||||
api rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
} else {
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':core:mogo-core-function-call') //todo 解除依赖
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.lang.reflect.Method;
|
||||
*/
|
||||
public class AMapUiSettingsWrapper implements IMogoUiSettings {
|
||||
|
||||
private MapAutoViewHelper mUiSettings;
|
||||
private final MapAutoViewHelper mUiSettings;
|
||||
|
||||
public AMapUiSettingsWrapper( MapAutoViewHelper mUiSettings ) {
|
||||
this.mUiSettings = mUiSettings;
|
||||
@@ -21,6 +21,11 @@ public class AMapUiSettingsWrapper implements IMogoUiSettings {
|
||||
@Override
|
||||
public void setScaleControlsEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
if(enabled){
|
||||
mUiSettings.showScale();
|
||||
}else{
|
||||
mUiSettings.hiddenScale();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,10 @@ import com.mogo.map.utils.HDMapUtils;
|
||||
import com.mogo.map.utils.MogoMapUtils;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.mogo.map.utils.ResIdCache;
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint;
|
||||
import com.zhidaoauto.map.data.road.RoadCross;
|
||||
import com.zhidaoauto.map.data.road.StopLine;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.abs.IResult;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
|
||||
@@ -91,7 +93,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操作对象
|
||||
public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接口操作对象
|
||||
IMogoMapUIController,
|
||||
OnMapLoadedListener,
|
||||
OnCameraChangeListener,
|
||||
@@ -163,7 +165,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
mMapView.setOnRoamStatusListener(this);
|
||||
mMapView.setOnMapViewVisualAngleChangeListener(this);
|
||||
mMapView.setOnRoadInfoListener(this, 1);
|
||||
//todo 多实例改造
|
||||
MapAutoApi.INSTANCE.registerLogListener(this, mMapView.getEventController());
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView);
|
||||
}
|
||||
@@ -239,7 +240,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
mMapView.setOnCameraChangeListener(null);
|
||||
mMapView.setOnMapStyleListener(null);
|
||||
mMapView.setOnMapViewVisualAngleChangeListener(null);
|
||||
//todo 多实例改造
|
||||
MapAutoApi.INSTANCE.unregisterLogListener(this, mMapView.getEventController());
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onDestroy");
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
MapRoadInfo.StopLine stopInfo = convert(stopLine);
|
||||
LonLatPoint p1 = points.get(0);
|
||||
LonLatPoint p2 = points.get(points.size() - 1);
|
||||
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getClosestFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.getLongitude(), p1.getLatitude(), p2.getLongitude(), p2.getLatitude()) * 10_0000;
|
||||
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.getLongitude(), p1.getLatitude(), p2.getLongitude(), p2.getLatitude()) * 10_0000;
|
||||
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
|
||||
//CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
|
||||
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
|
||||
@@ -328,9 +328,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (isVrMold()) {
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "changeZoom : " + zoom);
|
||||
getMap().changeZoom(zoom);
|
||||
return MapControlResult.SUCCESS;
|
||||
@@ -476,11 +473,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
return getMap().getZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
return ObjectUtils.fromAMap(MapTools.INSTANCE.getVisibleRegion(mMapView.getMapController()).getRightTopPoint());
|
||||
@@ -659,10 +651,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapViewAngle(int type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCurrentIcon(int iconId) {
|
||||
if (checkAMapView()) {
|
||||
@@ -888,12 +876,12 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
if (isDayMode()) {
|
||||
preVehicleStrWeiZhi =
|
||||
// 添加模型到地图中
|
||||
MogoIdentifyManager.getInstance(getContext())
|
||||
MogoIdentifyManager.getInstance()
|
||||
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DIconId());
|
||||
} else {
|
||||
preVehicleStrWeiZhi =
|
||||
// 添加模型到地图中
|
||||
MogoIdentifyManager.getInstance(getContext())
|
||||
MogoIdentifyManager.getInstance()
|
||||
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
|
||||
}
|
||||
|
||||
@@ -910,7 +898,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
@Override
|
||||
public void setLockMode(boolean isLock) {
|
||||
if (checkAMapView()) {
|
||||
Log.d("TTTTT", "setLockMode:" + isLock);
|
||||
mMapView.getMapAutoViewHelper().setLockMode(isLock);
|
||||
}
|
||||
}
|
||||
@@ -929,7 +916,6 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData(MogoLocation gnssInfo) {
|
||||
LocationClient locationClient = mMapView.getLocationClient();
|
||||
@@ -973,123 +959,9 @@ public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操
|
||||
PointCloudHelper.INSTANCE.setPointCloudColor(color, mMapView.getMapController());
|
||||
}
|
||||
|
||||
//todo 多实例改造
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener) {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "gdCityCode is:" + gdCityCode);
|
||||
Integer id = HDMapUtils.getHDCityCode(gdCityCode);
|
||||
if (id != null) {
|
||||
hdCacheListener = listener;
|
||||
mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, new OnHdDataDownByCityListener() {
|
||||
@Override
|
||||
public void onMapHDDataCacheProgressByCity(int cityId, double 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);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败,1成功
|
||||
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheResult(i, state);
|
||||
}
|
||||
} else {
|
||||
UiThreadHandler.post(() -> {
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheResult(i, state);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//todo 多实例改造
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
hdCacheListener = listener;
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "location lon is:" + location.getLongitude() + ",lat is:" + location.getLatitude());
|
||||
mMapView.getMapAutoViewHelper().cacheHDDataByCityByLonLat(location.getLongitude(), location.getLatitude(), new OnHdDataDownByCityListener() {
|
||||
@Override
|
||||
public void onMapHDDataCacheProgressByCity(int cityId, double 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);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败,1成功
|
||||
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheResult(i, state);
|
||||
}
|
||||
} else {
|
||||
UiThreadHandler.post(() -> {
|
||||
if (hdCacheListener != null) {
|
||||
hdCacheListener.onMapHdCacheResult(i, state);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCityDataCached() {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
String gdCityCode = GDLocationClient.getInstance(getContext()).getLastCityCode();
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "gdCityCode is:" + gdCityCode);
|
||||
Integer id = HDMapUtils.getHDCityCode(gdCityCode);
|
||||
if (id != null) {
|
||||
//TODO 回调改造
|
||||
mMapView.getMapAutoViewHelper().getAllCityCode((code, cityInfoList) -> {
|
||||
if (cityInfoList != null) {
|
||||
for (CityInfo cityInfo : cityInfoList) {
|
||||
if (id == cityInfo.getCityCode()) {
|
||||
// return cityInfo.isCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelDownloadCacheData() {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
mMapView.getMapAutoViewHelper().cancelCacheHDData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
return GDLocationClient.getInstance(getContext()).getLastCityCode();
|
||||
return GDLocationClient.Companion.getGdLocationClient().getLastCityCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,12 +7,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay;
|
||||
import com.mogo.map.overlay.proxy.point.IMapPointOverlay;
|
||||
import com.mogo.map.overlay.wrapper.point.AMapPointWrapper;
|
||||
import com.mogo.map.road.RoadNameInfo;
|
||||
import com.mogo.map.uicontroller.AMapUIController;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
|
||||
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint;
|
||||
import com.zhidaoauto.map.data.road.CenterLine;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
@@ -261,25 +260,4 @@ public class AMapWrapper implements IMogoMap {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(lon, lat, angle, isGpsLocation, isRTK);
|
||||
return singlePointRoadInfo != null ? singlePointRoadInfo.getLaneWidth() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CenterLine getCenterLineRangeInfo(double lon, double lat, float angle, float distance) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoadNameInfo getRoadName(double lon, double lat, float angle) {
|
||||
// com.zhidaoauto.map.sdk.open.road.RoadNameInfo info = MapDataApi.INSTANCE.getRoadName(lon, lat, angle);
|
||||
// RoadNameInfo ret = null;
|
||||
// if (info != null) {
|
||||
// ret = new RoadNameInfo(info.tile_id, info.road_id, info.road_name);
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
package com.mogo.map
|
||||
|
||||
import android.util.Pair
|
||||
import com.mogo.eagle.core.data.map.CenterLine
|
||||
import com.mogo.map.utils.ObjectUtils
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import com.mogo.map.location.GDLocationClient.Companion.gdLocationClient
|
||||
import com.mogo.map.utils.HDMapUtils.getHDCityCode
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
import com.zhidaoauto.map.data.road.RoadRectInfos
|
||||
import com.zhidaoauto.map.data.routeinfo.RoadInfo
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
import com.zhidaoauto.map.sdk.open.abs.IResult
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||
import com.zhidaoauto.map.sdk.open.data.CityInfo
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi
|
||||
import com.zhidaoauto.map.sdk.open.road.RoadRectInfos
|
||||
import com.zhidaoauto.map.sdk.open.routeinfo.RoadInfo
|
||||
|
||||
/**
|
||||
* 地图数据工具
|
||||
*/
|
||||
object MapDataWrapper {
|
||||
object MapDataWrapper : IMogoData {
|
||||
|
||||
private const val TAG = "MapDataWrapper"
|
||||
|
||||
fun init() {
|
||||
mogoMapData.init(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置debug模式
|
||||
*/
|
||||
fun setDebugMode(debugMode: Boolean) {
|
||||
override fun setDebugMode(debugMode: Boolean) {
|
||||
MapAutoApi.setDebugMode(debugMode)
|
||||
}
|
||||
|
||||
@@ -29,17 +41,22 @@ object MapDataWrapper {
|
||||
* @param call 回调
|
||||
*/
|
||||
@Synchronized
|
||||
fun getCenterLineInfo(lon: Double, lat: Double, angle: Float,call:((Int, CenterLine?) -> Unit)){
|
||||
override fun getCenterLineInfo(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
angle: Float,
|
||||
call: ((CenterLine?) -> Unit)
|
||||
) {
|
||||
MapDataApi.getCenterLineInfo(
|
||||
lon,
|
||||
lat,
|
||||
angle,
|
||||
object : IResult<com.zhidaoauto.map.sdk.open.road.CenterLine> {
|
||||
object : IResult<CenterLine> {
|
||||
override fun result(
|
||||
code: Int,
|
||||
result: com.zhidaoauto.map.sdk.open.road.CenterLine?
|
||||
result: CenterLine?
|
||||
) {
|
||||
call.invoke(0,ObjectUtils.transformCenterLine(result))
|
||||
call.invoke(result)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -51,36 +68,18 @@ object MapDataWrapper {
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getCenterLineRangeInfo(
|
||||
override fun getCenterLineRangeInfo(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
angle: Float,
|
||||
distance: Float,
|
||||
call:((Int,com.mogo.map.center.CenterLine?) -> Unit)
|
||||
call: ((CenterLine?) -> Unit)
|
||||
) {
|
||||
try {
|
||||
MapDataApi.getCenterLineRangeInfo(
|
||||
lon,
|
||||
lat,
|
||||
angle,
|
||||
distance,
|
||||
object : IResult<com.zhidaoauto.map.sdk.open.road.CenterLine> {
|
||||
override fun result(
|
||||
code: Int,
|
||||
info: com.zhidaoauto.map.sdk.open.road.CenterLine?
|
||||
) {
|
||||
var ret: com.mogo.map.center.CenterLine? = null
|
||||
if (info != null) {
|
||||
ret = com.mogo.map.center.CenterLine(
|
||||
info.id,
|
||||
info.tile_id,
|
||||
info.road_id,
|
||||
info.lane_id,
|
||||
convert(info.points),
|
||||
info.angle?:0.0
|
||||
)
|
||||
}
|
||||
call.invoke(code,ret)
|
||||
MapDataApi.getCenterLineRangeInfo(lon, lat, angle, distance,
|
||||
object : IResult<CenterLine> {
|
||||
override fun result(code: Int, result: CenterLine?) {
|
||||
call.invoke(result)
|
||||
}
|
||||
})
|
||||
} catch (t: Throwable) {
|
||||
@@ -88,17 +87,6 @@ object MapDataWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
private fun convert(points: List<LonLatPoint>?): List<Pair<Double, Double>> {
|
||||
if (points == null || points.isEmpty()) {
|
||||
return emptyList()
|
||||
}
|
||||
val ret: MutableList<Pair<Double, Double>> = ArrayList(points.size)
|
||||
for (p in points) {
|
||||
ret.add(Pair.create(p.longitude, p.latitude))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车道限速
|
||||
* @param lon 经度
|
||||
@@ -106,10 +94,10 @@ object MapDataWrapper {
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getLimitSpeed(lon: Double, lat: Double, angle: Float,call : ((Int) -> Unit)) {
|
||||
override fun getLimitSpeed(lon: Double, lat: Double, angle: Float, call: ((Int) -> Unit)) {
|
||||
MapDataApi.getLimitSpeed(lon, lat, angle, object : IResult<RoadInfo> {
|
||||
override fun result(code: Int, result: RoadInfo?) {
|
||||
call.invoke(result?.speed?:0)
|
||||
call.invoke(result?.speed ?: 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -121,20 +109,40 @@ object MapDataWrapper {
|
||||
* @param angle 角度
|
||||
* @param call 回调
|
||||
*/
|
||||
fun getRoadAngle(lon: Double, lat: Double, angle: Float,call : IResult<Double>) {
|
||||
override fun getRoadAngle(lon: Double, lat: Double, angle: Float, call: ((Double) -> Unit)) {
|
||||
MapDataApi.getRoadRectInfo(lon, lat, angle, object : IResult<RoadRectInfos> {
|
||||
override fun result(code: Int, result: RoadRectInfos?) {
|
||||
call.result(code,result?.angle?:0.0)
|
||||
call.invoke(result?.angle ?: 0.0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取道路宽度
|
||||
*/
|
||||
override fun getRoadWidth(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
angle: Float,
|
||||
isGpsLocation: Boolean,
|
||||
isRTK: Boolean
|
||||
): Float {
|
||||
val singlePointRoadInfo =
|
||||
MapDataApi.getSinglePointMatchRoad(lon, lat, angle, isGpsLocation, isRTK)
|
||||
return singlePointRoadInfo?.laneWidth ?: 0.0f
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行车方向
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun getAngle(startLon: Double, startLat: Double, endLon: Double, endLat: Double): Float {
|
||||
override fun getAngle(
|
||||
startLon: Double,
|
||||
startLat: Double,
|
||||
endLon: Double,
|
||||
endLat: Double
|
||||
): Float {
|
||||
return MapAutoApi.getAngle(startLon, startLat, endLon, endLat)
|
||||
}
|
||||
|
||||
@@ -145,8 +153,84 @@ object MapDataWrapper {
|
||||
* @param lat 纬度
|
||||
* @return 瓦片id
|
||||
*/
|
||||
fun getTileId(lon: Double, lat: Double): Long {
|
||||
override fun getTileId(lon: Double, lat: Double): Long {
|
||||
return MapAutoApi.getTileID(lon, lat, 13) // 13为默认获取瓦片层级级别
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过cityCode获取HDMap对应缓存城市
|
||||
*/
|
||||
override fun cacheHDDataByCity(
|
||||
progress: (cityId: Int, progress: Double) -> Unit,
|
||||
result: (cityId: Int, state: Int) -> Unit
|
||||
) {
|
||||
val gdCityCode = gdLocationClient.lastCityCode
|
||||
i(M_MAP + TAG, "gdCityCode is:$gdCityCode")
|
||||
val id = getHDCityCode(gdCityCode)
|
||||
id?.let {
|
||||
MapDataApi.cacheHDDataByCity(it, object : OnHdDataDownByCityListener {
|
||||
override fun onMapHDDataCacheProgressByCity(id: Int, p: Double) {
|
||||
progress.invoke(id, p)
|
||||
}
|
||||
|
||||
override fun onMapHDDataCacheStateByCity(id: Int, state: Int) {
|
||||
result.invoke(id, state)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过经纬度信息,获取HDMap对应缓存城市
|
||||
*/
|
||||
override fun cacheHDDataByCityByLonLat(
|
||||
location: MogoLocation,
|
||||
progress: (cityId: Int, progress: Double) -> Unit,
|
||||
result: (cityId: Int, state: Int) -> Unit
|
||||
) {
|
||||
i(M_MAP + TAG, "location lon is:" + location.longitude + ",lat is:" + location.latitude)
|
||||
MapDataApi.cacheHDDataByCityByLonLat(
|
||||
location.longitude, location.latitude,
|
||||
object : OnHdDataDownByCityListener {
|
||||
override fun onMapHDDataCacheProgressByCity(id: Int, p: Double) {
|
||||
progress.invoke(id, p)
|
||||
}
|
||||
|
||||
override fun onMapHDDataCacheStateByCity(id: Int, state: Int) {
|
||||
result.invoke(id, state)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前城市离线数据是否已缓存
|
||||
*/
|
||||
override fun isCityDataCached(cache: ((Boolean) -> Unit)) {
|
||||
val cityCode = gdLocationClient.lastCityCode
|
||||
i(M_MAP + TAG, "gdCityCode is:$cityCode")
|
||||
val id = getHDCityCode(cityCode)
|
||||
if (id != null) {
|
||||
MapDataApi.getAllCityCode(object : IResult<ArrayList<CityInfo>> {
|
||||
override fun result(code: Int, result: ArrayList<CityInfo>?) {
|
||||
if (result != null) {
|
||||
for (cityInfo in result) {
|
||||
if (id == cityInfo.cityCode) {
|
||||
cache.invoke(cityInfo.isCache)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
cache.invoke(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancelDownloadCacheData() {
|
||||
MapDataApi.cancelCacheHDData()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,14 +2,11 @@ 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;
|
||||
@@ -164,16 +161,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
return mDelegate.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
initDelegate();
|
||||
@@ -302,14 +289,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapViewAngle(int type) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
mDelegate.changeMapViewAngle(type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCurrentIcon(int iconId) {
|
||||
initDelegate();
|
||||
@@ -420,35 +399,6 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.cacheHDDataByCity(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.cacheHDDataByCity(listener, location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCityDataCached() {
|
||||
if (mDelegate != null) {
|
||||
return mDelegate.isCityDataCached();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelDownloadCacheData() {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.cancelDownloadCacheData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
if (mDelegate != null) {
|
||||
|
||||
@@ -54,6 +54,11 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getInstanceTag() {
|
||||
return MogoMap.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
@@ -20,13 +20,13 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
|
||||
private static volatile MogoIdentifyManager sInstance;
|
||||
|
||||
private MogoIdentifyManager(Context context) {}
|
||||
private MogoIdentifyManager() {}
|
||||
|
||||
public static MogoIdentifyManager getInstance(Context context) {
|
||||
public static MogoIdentifyManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoIdentifyManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoIdentifyManager(context);
|
||||
sInstance = new MogoIdentifyManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
@Override
|
||||
public void removeMarker(String uuidString) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().removeMarker(uuidString);
|
||||
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).removeMarker(uuidString);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
@Override
|
||||
public void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().updateBatchMarkerPosition(optionsArrayList);
|
||||
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).updateBatchMarkerPosition(optionsArrayList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
@Override
|
||||
public void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList) {
|
||||
try {
|
||||
MogoMap.getInstance().getMogoMap().updateBatchAiMarkerPosition(optionsArrayList);
|
||||
MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).updateBatchAiMarkerPosition(optionsArrayList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
@Override
|
||||
public String addPreVehicleModel(int type, int modelRes) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addPreVehicleModel(type, modelRes);
|
||||
return MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).addPreVehicleModel(type, modelRes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.zhjt.service.chain.ChainLog
|
||||
* 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20
|
||||
* 这里的数据仅用于非高精度业务
|
||||
*/
|
||||
class GDLocationClient private constructor(context: Context) : AMapLocationListener,
|
||||
class GDLocationClient private constructor() : AMapLocationListener,
|
||||
IMogoGDLocationClient {
|
||||
//声明LocationClient对象
|
||||
private lateinit var mLocationClient: AMapLocationClient
|
||||
@@ -40,7 +40,7 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
Handler(thread.looper)
|
||||
}
|
||||
|
||||
init {
|
||||
override fun start(context: Context) {
|
||||
AMapLocationClient.updatePrivacyShow(context, true, true)
|
||||
AMapLocationClient.updatePrivacyAgree(context, true)
|
||||
try {
|
||||
@@ -60,9 +60,6 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun start() {
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.startLocation()
|
||||
}
|
||||
@@ -169,20 +166,8 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Volatile
|
||||
private var gdLocationClient: GDLocationClient? = null
|
||||
private val obj = ByteArray(0)
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(context: Context): GDLocationClient? {
|
||||
if (gdLocationClient == null) {
|
||||
synchronized(obj) {
|
||||
if (gdLocationClient == null) {
|
||||
gdLocationClient = GDLocationClient(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
return gdLocationClient
|
||||
val gdLocationClient by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
GDLocationClient()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.map.overlay.point.Point.Options
|
||||
import com.mogo.map.*
|
||||
import com.mogo.map.MogoMap.Companion.mapInstance
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.mogo.map.overlay.point.Point
|
||||
@@ -29,7 +29,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
|
||||
point.setOptions(options)
|
||||
return key
|
||||
} else {
|
||||
val p = MogoMap.getInstance().mogoMap.addPoint(options)
|
||||
val p = mapInstance.getMogoMap().addPoint(options)
|
||||
if (p != null) {
|
||||
p.onRemove { removed ->
|
||||
val keys = points.filterKeys { it.id == removed }
|
||||
@@ -232,7 +232,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
|
||||
line.setOptions(options)
|
||||
return key
|
||||
} else {
|
||||
val newLine = MogoMap.getInstance().mogoMap.addLine(options)
|
||||
val newLine = mapInstance.getMogoMap().addLine(options)
|
||||
if (newLine != null) {
|
||||
newLine.onRemove { removed ->
|
||||
val keys = lines.filterKeys { it.id == removed }
|
||||
|
||||
@@ -4,11 +4,8 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,7 +44,6 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (mClient != null) {
|
||||
@@ -138,14 +134,6 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if (mClient != null) {
|
||||
return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if (mClient != null) {
|
||||
@@ -261,13 +249,6 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapViewAngle(int type) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapViewAngle(type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCurrentIcon(int iconId) {
|
||||
if (mClient != null) {
|
||||
@@ -361,35 +342,6 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener) {
|
||||
if (mClient != null) {
|
||||
mClient.cacheHDDataByCity(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
|
||||
if (mClient != null) {
|
||||
mClient.cacheHDDataByCity(listener, location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCityDataCached() {
|
||||
if (mClient != null) {
|
||||
return mClient.isCityDataCached();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelDownloadCacheData() {
|
||||
if (mClient != null) {
|
||||
mClient.cancelDownloadCacheData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
if (mClient != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.utils;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,11 +5,11 @@ import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.line.Polyline;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
@@ -213,38 +213,4 @@ public class ObjectUtils {
|
||||
}
|
||||
return new MapCameraPosition(fromAMap(position.getTarget()), position.getBearing(), position.getTilt(), position.getZoom());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换对象
|
||||
*
|
||||
* @return 转换后的对象
|
||||
*/
|
||||
public static CenterLine transformCenterLine(com.zhidaoauto.map.sdk.open.road.CenterLine centerLine) {
|
||||
CenterLine resultCenterLine = null;
|
||||
if (centerLine != null) {
|
||||
resultCenterLine = new CenterLine();
|
||||
resultCenterLine.setId(centerLine.getId());
|
||||
resultCenterLine.setLane_id(centerLine.getLane_id());
|
||||
resultCenterLine.setAngle(centerLine.getAngle());
|
||||
resultCenterLine.setRoad_id(centerLine.getRoad_id());
|
||||
resultCenterLine.setTile_id(centerLine.getTile_id());
|
||||
ArrayList<com.mogo.eagle.core.data.map.LonLatPoint> arrayList = new ArrayList<>();
|
||||
if (centerLine.getPoints() != null) {
|
||||
for (com.zhidaoauto.map.sdk.open.query.LonLatPoint point : centerLine.getPoints()) {
|
||||
com.mogo.eagle.core.data.map.LonLatPoint lonLatPoint = new com.mogo.eagle.core.data.map.LonLatPoint();
|
||||
lonLatPoint.setAltitude(point.getAltitude());
|
||||
lonLatPoint.setAngle(point.getAngle());
|
||||
lonLatPoint.setDistance(point.getDistance());
|
||||
lonLatPoint.setLatitude(point.getLatitude());
|
||||
lonLatPoint.setLongitude(point.getLongitude());
|
||||
lonLatPoint.setProvider(point.getProvider());
|
||||
lonLatPoint.setSpeed(point.getSpeed());
|
||||
lonLatPoint.setDuration(point.getDuration());
|
||||
arrayList.add(lonLatPoint);
|
||||
}
|
||||
resultCenterLine.setPoints(arrayList);
|
||||
}
|
||||
}
|
||||
return resultCenterLine;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user