[dev_arch_opt_3.0]
[Change] [ 1、修改底盘数据Gnss回调为定位回调 2、增加WGS84转GCJ02高德坐标系方法 3、增加底盘数据转换为GCJ02坐标系后的回调 ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -160,6 +160,11 @@ class ConfigStartUp : AndroidStartup<Boolean>() {
|
||||
} else {
|
||||
mapParams.setStyleMode(MapParams.MAP_STYLE_NIGHT_VR)
|
||||
}
|
||||
//todo 临时放在这 @梁利辉
|
||||
if (AppIdentityModeUtils.isBusPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
mapParams.setShadowEnable(false)
|
||||
}
|
||||
|
||||
MapAutoApi.init(context, mapParams)
|
||||
|
||||
}
|
||||
|
||||
@@ -42,11 +42,12 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListe
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyPlanningObj
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager.invokePNCActions
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager.invokeAutopilotCarStateData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager.invokeChassisLocationGCJ02
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager.invokePNCActions
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager.invokeAutopilotRotting
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed
|
||||
@@ -128,7 +129,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
|
||||
invokeAutopilotCarStateData(gnssInfo)
|
||||
// WGS84坐标系高精度位置信息
|
||||
invokeChassisLocationWGS84(gnssInfo)
|
||||
// GCJ02高德坐标系位置信息
|
||||
invokeChassisLocationGCJ02(gnssInfo)
|
||||
if (gnssInfo != null) {
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
// 同步给MAP地图
|
||||
@@ -153,12 +157,12 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
* @param vehicleState 数据
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE,
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE,
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onVehicleState(header: MessagePad.Header, vehicleState: VehicleStateOuterClass.VehicleState?) {
|
||||
if (vehicleState != null) {
|
||||
@@ -196,12 +200,12 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
* @param vehicleState 数据
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE,
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE,
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onChassisStates(header: MessagePad.Header, chassisStates: ChassisStatesOuterClass.ChassisStates?) {
|
||||
if (chassisStates != null) {
|
||||
@@ -503,6 +507,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
invokePNCActions(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重构后的功能状态
|
||||
*
|
||||
@@ -512,6 +517,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
override fun onFunctionStates(header: MessagePad.Header?, functionStates: FunctionStates.FSMFunctionStates?) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 清扫车指标数据
|
||||
*
|
||||
@@ -521,6 +527,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
override fun onSweeperTaskIndexData(header: MessagePad.Header?, roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex?) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Bag管理应答
|
||||
*
|
||||
|
||||
@@ -10,10 +10,10 @@ import android.widget.RadioButton
|
||||
import android.widget.TextView
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
@@ -37,7 +37,7 @@ import java.util.*
|
||||
* @since: 2022/7/12
|
||||
*/
|
||||
class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
IMoGoAutopilotRecordListener, IMoGoChassisGnssInfoListener {
|
||||
IMoGoAutopilotRecordListener, IMoGoChassisLocationWGS84Listener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AIDataCollectWindow"
|
||||
@@ -117,7 +117,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
//采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.addListener(this.hashCode().toString(), this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
|
||||
//开始录制AI数据采集Bag包
|
||||
CallerAutoPilotManager.recordPackage(
|
||||
99,
|
||||
@@ -341,7 +341,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
//注销采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.removeListener(this.hashCode().toString())
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(this.hashCode().toString())
|
||||
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
latitude = gnssInfo?.latitude
|
||||
longitude = gnssInfo?.longitude
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ import android.widget.TextView
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
@@ -47,7 +47,7 @@ import java.util.*
|
||||
* @since: 2022/7/13
|
||||
*/
|
||||
class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
IMoGoAutopilotRecordListener, IMoGoChassisGnssInfoListener {
|
||||
IMoGoAutopilotRecordListener, IMoGoChassisLocationWGS84Listener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "InitiativeBadCaseWindow"
|
||||
@@ -140,7 +140,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
//采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.addListener(this.hashCode().toString(), this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
|
||||
viewAudioButton.setOnClickListener {
|
||||
audioStatus = !audioStatus
|
||||
setAudio(audioStatus)
|
||||
@@ -367,7 +367,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
//注销采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.removeListener(this.hashCode().toString())
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(this.hashCode().toString())
|
||||
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
latitude = gnssInfo?.latitude
|
||||
longitude = gnssInfo?.longitude
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
|
||||
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.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
@@ -44,7 +44,7 @@ import java.io.File
|
||||
* @since: 2022/7/17
|
||||
*/
|
||||
class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
IMoGoChassisGnssInfoListener, CompoundButton.OnCheckedChangeListener {
|
||||
IMoGoChassisLocationWGS84Listener, CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "PassiveBadCaseWindow"
|
||||
@@ -117,7 +117,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
tvPassiveIdentity.text = "身份:${BadCaseConfig.identity}"
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
viewAudioButton.setOnClickListener {
|
||||
audioStatus = !audioStatus
|
||||
setAudio(audioStatus)
|
||||
@@ -361,7 +361,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
|
||||
fun hideFloatWindow() {
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
latitude = gnssInfo?.latitude
|
||||
longitude = gnssInfo?.longitude
|
||||
}
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.flow.rtk
|
||||
|
||||
import android.content.*
|
||||
import android.util.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RTKStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import mogo.telematics.pad.MessagePad.GnssInfo
|
||||
import system_master.SystemStatusInfo.HealthInfo
|
||||
import system_master.SystemStatusInfo.StatusInfo
|
||||
import java.util.concurrent.atomic.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatusListener, IMoGoChassisGnssInfoListener {
|
||||
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatusListener, IMoGoChassisLocationWGS84Listener {
|
||||
companion object {
|
||||
const val TAG = "RTKImpl"
|
||||
}
|
||||
@@ -34,7 +41,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
|
||||
send(RTKStatus(getDesc(), getCode()))
|
||||
CallerLogger.d("$M_DEVA$TAG", "-- onCreate --")
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
if (CallerAutoPilotManager.isConnected()) {
|
||||
check()
|
||||
}
|
||||
@@ -78,7 +85,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: GnssInfo?) {
|
||||
if (isOldVersion.get()) {
|
||||
if (isRTKEnabled()) {
|
||||
send(RTKStatus("RTK", 0))
|
||||
@@ -95,7 +102,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
|
||||
|
||||
private fun isRTKEnabled(): Boolean {
|
||||
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
|
||||
val gnssInfo = CallerChassisGnssInfoListenerManager.getCurrentGnssInfo()
|
||||
val gnssInfo = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
return CallerAutoPilotManager.isConnected() && (
|
||||
code != "EHW_RTK" &&
|
||||
code != "EHW_GNSS" &&
|
||||
@@ -117,6 +124,6 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
|
||||
isOldVersion.set(false)
|
||||
CallerLogger.d("$M_DEVA$TAG", "-- onDestroy --")
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerChassisGnssInfoListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr),
|
||||
IMoGoObuStatusListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoChassisGnssInfoListener,
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoMapLocationListener,
|
||||
IMoGoAutopilotIdentifyListener,
|
||||
IMoGoPlanningRottingListener,
|
||||
@@ -198,7 +198,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
// 添加 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
// 添加 域控制器感知数据 监听
|
||||
@@ -241,7 +241,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
// 移除 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerChassisGnssInfoListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
// 移除 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
// 移除 域控制器感知数据 监听
|
||||
@@ -1973,7 +1973,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
mGnssInfo = gnssInfo
|
||||
//实时加速度列表
|
||||
ThreadUtils.runOnUiThread {
|
||||
|
||||
@@ -226,7 +226,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
// MogoModulePaths.addModuleFunction(new MogoModule("/driver/api", "IMoGoFunctionProvider"));
|
||||
// MogoModulePaths.addModuleFunction(new MogoModule("/passenger/api", "IMoGoFunctionProvider"));
|
||||
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
|
||||
// MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
|
||||
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
|
||||
|
||||
// OBU 模块
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.map.CenterLine
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
|
||||
@@ -17,7 +17,7 @@ import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
|
||||
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.autopilot.CallerChassisGnssInfoListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight
|
||||
@@ -54,7 +54,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
MapView,
|
||||
IMoGoMapFragmentProvider,
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisGnssInfoListener,
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoPlanningRottingListener,
|
||||
IMoGoChassisLamplightListener {
|
||||
|
||||
@@ -115,7 +115,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(Companion.functionName, this)
|
||||
CallerPlanningRottingListenerManager.addListener(Companion.functionName, this)
|
||||
CallerChassisGnssInfoListenerManager.addListener(Companion.functionName, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(Companion.functionName, this)
|
||||
CallerChassisLamplightListenerManager.addListener(Companion.functionName, this)
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
override fun onDestroyView() {
|
||||
CallerSkinModeListenerManager.removeListener(Companion.functionName)
|
||||
CallerPlanningRottingListenerManager.removeListener(Companion.functionName)
|
||||
CallerChassisGnssInfoListenerManager.removeListener(Companion.functionName)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(Companion.functionName)
|
||||
CallerChassisLamplightListenerManager.removeListener(Companion.functionName)
|
||||
|
||||
if (mMogoMapView != null) {
|
||||
@@ -361,7 +361,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
private var isShowTurnLight = false
|
||||
private var brakeLight = -1
|
||||
|
||||
override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
if (gnssInfo != null) {
|
||||
//设置刹车信息
|
||||
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f)) {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
*@date 2021/11/2 2:06 下午
|
||||
* 车辆定位 数据 数据 回调监听
|
||||
*/
|
||||
interface IMoGoChassisGnssInfoListener {
|
||||
|
||||
/**
|
||||
* 车辆状态&定位 数据
|
||||
*
|
||||
* @param gnssInfo
|
||||
*/
|
||||
fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2023/1/11 2:06 下午
|
||||
* 车辆定位 GCJ02 坐标系-高德坐标系 数据 回调监听
|
||||
*/
|
||||
interface IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
/**
|
||||
* 车辆定位 GCJ02 坐标系-高德坐标系 数据
|
||||
*
|
||||
* @param gnssInfo
|
||||
*/
|
||||
fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2023/1/11 2:06 下午
|
||||
* 车辆定位 WGS84 坐标系-高精度坐标系 数据 回调监听
|
||||
*/
|
||||
interface IMoGoChassisLocationWGS84Listener {
|
||||
|
||||
/**
|
||||
* 车辆定位 WGS84 坐标系-高精度坐标系 数据
|
||||
*
|
||||
* @param gnssInfo
|
||||
*/
|
||||
fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?)
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* 车辆定位 WGS84 坐标系-高精度坐标系 数据 回调监听
|
||||
*/
|
||||
object CallerChassisLocationGCJ20ListenerManager : CallerBase<IMoGoChassisLocationGCJ02Listener>() {
|
||||
|
||||
val TAG = "CallerChassisLocationGCJ20ListenerManager"
|
||||
|
||||
@Volatile
|
||||
private var mGnssInfo: MessagePad.GnssInfo? = null
|
||||
|
||||
fun getChassisLocationGCJ02(): MessagePad.GnssInfo? {
|
||||
return mGnssInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆定位 WGS84 坐标系-高精度坐标系 数据
|
||||
* @param gnssInfo
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
|
||||
gnssInfo?.let {
|
||||
// 转换 WGS84-->GCJ02 坐标
|
||||
val gcj20Location = CoordinateTransform.WGS84ToGCJ02(gnssInfo.longitude, gnssInfo.latitude)
|
||||
|
||||
val gnssBuilder = gnssInfo.toBuilder()
|
||||
gnssBuilder.longitude = gcj20Location[0]
|
||||
gnssBuilder.latitude = gcj20Location[1]
|
||||
|
||||
this.mGnssInfo = gnssBuilder.build()
|
||||
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onChassisLocationGCJ02(this.mGnssInfo)
|
||||
}
|
||||
} ?: let {
|
||||
Logger.e(TAG, "定位数据为Null")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +1,34 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* 车辆状态&定位 数据 数据 回调监听
|
||||
* 车辆定位 WGS84 坐标系-高精度坐标系 数据 回调监听
|
||||
*/
|
||||
object CallerChassisGnssInfoListenerManager : CallerBase<IMoGoChassisGnssInfoListener>() {
|
||||
object CallerChassisLocationWGS84ListenerManager : CallerBase<IMoGoChassisLocationWGS84Listener>() {
|
||||
|
||||
@Volatile
|
||||
private var gnssInfo: MessagePad.GnssInfo? = null
|
||||
|
||||
fun getCurrentGnssInfo(): MessagePad.GnssInfo? {
|
||||
fun getChassisLocationWGS84(): MessagePad.GnssInfo? {
|
||||
return gnssInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆状态数据 回调
|
||||
* 车辆定位 WGS84 坐标系-高精度坐标系 数据
|
||||
* @param gnssInfo
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
|
||||
fun invokeChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
this.gnssInfo = gnssInfo
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onAutopilotCarStateData(gnssInfo)
|
||||
listener.onChassisLocationWGS84(gnssInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.mogo.eagle.core.utilcode.util;
|
||||
|
||||
/**
|
||||
*
|
||||
* -----------------------------------------------------------------------------------------
|
||||
* 坐标系 |解释 |使用地图
|
||||
* -----------------------------------------------------------------------------------------
|
||||
* WGS84 |地球坐标系,国际上通用的坐标系。设备一般包含GPS芯片或者北斗芯片获取 |GPS/谷歌地图卫星
|
||||
* |的经纬度为WGS84地理坐标系,最基础的坐标,谷歌地图在非中国地区使用的坐标系 |
|
||||
* -----------------------------------------------------------------------------------------
|
||||
* GCJ02 |火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。 |腾讯(搜搜)地图,
|
||||
* |并要求在中国使用的地图产品使用的都必须是加密后的坐标, |阿里云地图,高德地图,
|
||||
* |而这套WGS84加密后的坐标就是gcj02。 |谷歌国内地图
|
||||
* -----------------------------------------------------------------------------------------
|
||||
* BD09 |百度坐标系,百度在GCJ02的基础上进行了二次加密, |百度地图
|
||||
* |官方解释是为了进一步保护用户隐私(我差点就信了) |
|
||||
* -----------------------------------------------------------------------------------------
|
||||
* 小众坐标系 |类似于百度地图,在GCJ02基础上使用自己的加密算法进行二次加密的坐标系 |搜狗地图、图吧地图 等
|
||||
* -----------------------------------------------------------------------------------------
|
||||
* 墨卡托坐标 |墨卡托投影以整个世界范围,赤道作为标准纬线,本初子午线作为中央经线,
|
||||
* |两者交点为坐标原点,向东向北为正,向西向南为负。
|
||||
* |南北极在地图的正下、上方,而东西方向处于地图的正右、左。
|
||||
*
|
||||
* 你可以通过这个工具类将上述坐标系进行互相转换。
|
||||
*
|
||||
* 百度地图地图投影采用的依然是Web Mercator投影,地图瓦片的切片规则遵循TMS标准,瓦片坐标原点在经纬度为0的附近,
|
||||
* 但却做了一定的偏移处理,经测算此偏移量约为(-865,15850),
|
||||
* 即地图瓦片(0, 0)是从Web Mercator投影坐标系的(-865,15850)点开始的。
|
||||
*
|
||||
* 顺便提供百度地图的地图等级从18级到1级
|
||||
* 18级,1个像素代表1米,17级,1个像素代表2米,16级代表4米,依此类推
|
||||
* Author: kong
|
||||
*/
|
||||
public class CoordinateTransform {
|
||||
private static double x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
||||
private static double PI = 3.1415926535897932384626;
|
||||
private static double a = 6378245.0;
|
||||
private static double ee = 0.00669342162296594323;
|
||||
|
||||
/**
|
||||
* 百度坐标系 (BD-09) 与 火星坐标系 (GCJ-02)的转换
|
||||
* 即 百度 转 谷歌、高德
|
||||
*
|
||||
* @param bd_lon
|
||||
* @param bd_lat
|
||||
* @return Double[lon, lat]
|
||||
*/
|
||||
public static Double[] BD09ToGCJ02(Double bd_lon, Double bd_lat) {
|
||||
double x = bd_lon - 0.0065;
|
||||
double y = bd_lat - 0.006;
|
||||
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
|
||||
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
|
||||
Double[] arr = new Double[2];
|
||||
arr[0] = z * Math.cos(theta);
|
||||
arr[1] = z * Math.sin(theta);
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
|
||||
* 即谷歌、高德 转 百度
|
||||
*
|
||||
* @param gcj_lon
|
||||
* @param gcj_lat
|
||||
* @return Double[lon, lat]
|
||||
*/
|
||||
public static Double[] GCJ02ToBD09(Double gcj_lon, Double gcj_lat) {
|
||||
double z = Math.sqrt(gcj_lon * gcj_lon + gcj_lat * gcj_lat) + 0.00002 * Math.sin(gcj_lat * x_PI);
|
||||
double theta = Math.atan2(gcj_lat, gcj_lon) + 0.000003 * Math.cos(gcj_lon * x_PI);
|
||||
Double[] arr = new Double[2];
|
||||
arr[0] = z * Math.cos(theta) + 0.0065;
|
||||
arr[1] = z * Math.sin(theta) + 0.006;
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* WGS84转GCJ02
|
||||
*
|
||||
* @param wgs_lon
|
||||
* @param wgs_lat
|
||||
* @return Double[lon, lat]
|
||||
*/
|
||||
public static Double[] WGS84ToGCJ02(Double wgs_lon, Double wgs_lat) {
|
||||
if (outOfChina(wgs_lon, wgs_lat)) {
|
||||
return new Double[]{wgs_lon, wgs_lat};
|
||||
}
|
||||
double dlat = transformlat(wgs_lon - 105.0, wgs_lat - 35.0);
|
||||
double dlng = transformlng(wgs_lon - 105.0, wgs_lat - 35.0);
|
||||
double radlat = wgs_lat / 180.0 * PI;
|
||||
double magic = Math.sin(radlat);
|
||||
magic = 1 - ee * magic * magic;
|
||||
double sqrtmagic = Math.sqrt(magic);
|
||||
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
|
||||
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
|
||||
Double[] arr = new Double[2];
|
||||
arr[0] = wgs_lon + dlng;
|
||||
arr[1] = wgs_lat + dlat;
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* GCJ02转WGS84
|
||||
*
|
||||
* @param gcj_lon
|
||||
* @param gcj_lat
|
||||
* @return Double[lon, lat]
|
||||
*/
|
||||
public static Double[] GCJ02ToWGS84(Double gcj_lon, Double gcj_lat) {
|
||||
if (outOfChina(gcj_lon, gcj_lat)) {
|
||||
return new Double[]{gcj_lon, gcj_lat};
|
||||
}
|
||||
double dlat = transformlat(gcj_lon - 105.0, gcj_lat - 35.0);
|
||||
double dlng = transformlng(gcj_lon - 105.0, gcj_lat - 35.0);
|
||||
double radlat = gcj_lat / 180.0 * PI;
|
||||
double magic = Math.sin(radlat);
|
||||
magic = 1 - ee * magic * magic;
|
||||
double sqrtmagic = Math.sqrt(magic);
|
||||
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
|
||||
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
|
||||
double mglat = gcj_lat + dlat;
|
||||
double mglng = gcj_lon + dlng;
|
||||
return new Double[]{gcj_lon * 2 - mglng, gcj_lat * 2 - mglat};
|
||||
}
|
||||
|
||||
private static Double transformlat(double lng, double lat) {
|
||||
double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
|
||||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
|
||||
ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
|
||||
ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static Double transformlng(double lng, double lat) {
|
||||
double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
|
||||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
|
||||
ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
|
||||
ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* outOfChina
|
||||
*
|
||||
* @param lng
|
||||
* @param lat
|
||||
* @return {boolean}
|
||||
* @描述: 判断是否在国内,不在国内则不做偏移
|
||||
*/
|
||||
private static boolean outOfChina(Double lng, Double lat) {
|
||||
return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 地图实例构建
|
||||
*/
|
||||
public interface IMogoMapApiBuilder extends IProvider {
|
||||
|
||||
IMogoLocationClient getLocationClient( Context context );
|
||||
|
||||
IMogoMapUIController getMapUIController();
|
||||
|
||||
void destroy();
|
||||
|
||||
IMogoMapView getMapView( Context context );
|
||||
|
||||
}
|
||||
@@ -2,13 +2,11 @@ package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.location.ALocationClient;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.uicontroller.AMapUIController;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -16,66 +14,40 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = MapApiPath.PATH)
|
||||
public class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
public class CustomMapApiBuilder {
|
||||
|
||||
private static final String TAG = "CustomMapApiBuilder";
|
||||
|
||||
@Override
|
||||
private static CustomMapApiBuilder sApiBuilder;
|
||||
|
||||
private static CustomMapApiBuilder getApiBuilder() {
|
||||
if (sApiBuilder == null) {
|
||||
synchronized (CustomMapApiBuilder.class) {
|
||||
if (sApiBuilder == null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "init");
|
||||
sApiBuilder = new CustomMapApiBuilder();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sApiBuilder;
|
||||
}
|
||||
|
||||
public IMogoLocationClient getLocationClient(Context context) {
|
||||
return new ALocationClient(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getMapUIController() {
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView(Context context) {
|
||||
// MapParams mapParams = MapParams.Companion.init();
|
||||
// mapParams.setDebugMode(false)
|
||||
// //todo 1-使用本地地图数据,0-使用在线地图数据
|
||||
// //.setDataFileSource(1)
|
||||
// .setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
|
||||
// .setPerspectiveMode(MapParams.MAP_PERSPECTIVE_3D)
|
||||
// .setHDVisibileArray(new int[]{HDTypes.DIVIDER.type,
|
||||
// HDTypes.ROAD_AREA.type,
|
||||
// HDTypes.STOP_LINE.type,
|
||||
// HDTypes.ARROW.type,
|
||||
// HDTypes.STATION_BRIDGE.type,
|
||||
// HDTypes.ZEBRA_LINE.type,
|
||||
// HDTypes.GREEN_BELT.type,
|
||||
// HDTypes.DIVERSION.type,
|
||||
// HDTypes.SAFE_ISLAND.type,
|
||||
// HDTypes.ALPHANUMERIC.type,
|
||||
// HDTypes.GUARDBAR.type,
|
||||
// HDTypes.TRAFFIC_DEVICE.type,
|
||||
// HDTypes.CABLE.type,
|
||||
// HDTypes.SIGNAL_LINE.type})
|
||||
// // .setZoom( 20 )
|
||||
// // .setPointToCenter( 0.734375f, 0.5f )
|
||||
// //todo 2D模式下需要注意ADAS部分遮挡
|
||||
// //.setPointToCenter(0.5f, 0.5f)
|
||||
// // 根据 FunctionBuildConfig 配置的皮肤样式设置题图的样式
|
||||
// .setStyleMode(FunctionBuildConfig.skinMode == 0 ? MapParams.MAP_STYLE_NIGHT_VR : MapParams.MAP_STYLE_DAY_VR);
|
||||
//
|
||||
// MapAutoApi.INSTANCE.init(context, mapParams);
|
||||
//
|
||||
MapAutoView mapAutoView = new MapAutoView(context);
|
||||
//mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l));
|
||||
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
|
||||
return mapView;
|
||||
public static IMogoLocationClient getLocationClientDelegate(Context context) {
|
||||
return getApiBuilder().getLocationClient(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
public static IMogoMapUIController getMapUIControllerDelegate() {
|
||||
return getApiBuilder().getMapUIController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
CallerLogger.INSTANCE.d(TAG, "init");
|
||||
public static void destroy() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.location.MogoLocationListenerRegister;
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ public class MogoLocationClient implements IMogoLocationClient {
|
||||
private static volatile MogoLocationClient sInstance;
|
||||
|
||||
public MogoLocationClient( Context context ) {
|
||||
mDelegate = MogoMapDelegateFactory.getLocationClientDelegate( context );
|
||||
mDelegate = CustomMapApiBuilder.getLocationClientDelegate( context );
|
||||
}
|
||||
|
||||
public static MogoLocationClient getInstance( Context context ) {
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class MogoMapDelegateFactory {
|
||||
|
||||
private static final String TAG = "MogoMapDelegateFactory";
|
||||
|
||||
private static IMogoMapApiBuilder sApiBuilder;
|
||||
|
||||
private static IMogoMapApiBuilder getApiBuilder() {
|
||||
if (sApiBuilder == null) {
|
||||
synchronized (MogoMapDelegateFactory.class) {
|
||||
if (sApiBuilder == null) {
|
||||
sApiBuilder = ARouter.getInstance().navigation(IMogoMapApiBuilder.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sApiBuilder;
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClientDelegate(Context context) {
|
||||
return getApiBuilder().getLocationClient(context);
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIControllerDelegate() {
|
||||
return getApiBuilder().getMapUIController();
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
getApiBuilder().destroy();
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView(Context context) {
|
||||
return getApiBuilder().getMapView(context);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
|
||||
private void initDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
|
||||
mDelegate = CustomMapApiBuilder.getMapUIControllerDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.widget.FrameLayout;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -33,27 +34,24 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
private MapAutoView mapAutoView;
|
||||
|
||||
@Override
|
||||
protected void addMapView(Context context) {
|
||||
mMapView = MogoMapDelegateFactory.getMapView(context);
|
||||
if (mMapView != null) {
|
||||
if (mapAutoView == null) {
|
||||
mapAutoView = new MapAutoView(context);
|
||||
}
|
||||
if (mMapView == null) {
|
||||
mMapView = new AMapViewWrapper(mapAutoView);
|
||||
final View mapView = mMapView.getMapView();
|
||||
if (mapView != null) {
|
||||
addView(mapView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(TAG, "create MapView instance failed.");
|
||||
}
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(TAG, "create IMogoMapView instance failed.");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isVrMode() {
|
||||
return mIsVrMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
Reference in New Issue
Block a user