[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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user