[dev_arch_opt_3.0]
[Change] [ 1、修改了高精地图的设置外部坐标的方法 2、修改了基础、出租车、Bus小地图中的位置回调,使用IMoGoChassisLocationGCJ02Listener。 3、TODO 有些需要高德地图的地方需要改为使用IMoGoChassisLocationGCJ02Listener,WGS84的坐标使用IMoGoChassisLocationWGS84Listener ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -5,13 +5,13 @@ import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,7 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr), IMoGoMapLocationListener {
|
||||
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "SpeedPanelView"
|
||||
@@ -30,7 +30,7 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
|
||||
var mContext: Context
|
||||
var mSpeedChartView: SpeedChartView
|
||||
var mLatLng: MogoLocation? = null
|
||||
var mLatLng: MessagePad.GnssInfo? = null
|
||||
var mSpeedLimit = 60
|
||||
|
||||
private val timer by lazy {
|
||||
@@ -63,15 +63,17 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow() // 注册位置回调
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
|
||||
// 开启定时查询速度
|
||||
timerTask?.cancel()
|
||||
val task = object : TimerTask() {
|
||||
override fun run() {
|
||||
mLatLng?.let {
|
||||
mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude, it.bearing)
|
||||
mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude,
|
||||
it.heading.toFloat()
|
||||
)
|
||||
UiThreadHandler.post {
|
||||
val speed = (it.speed * 3.6f).toInt()
|
||||
val speed = (it.gnssSpeed * 3.6f).toInt()
|
||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimit) "#DB3137" else "#3E77F6"))
|
||||
mSpeedChartView.setValues(speed)
|
||||
setBackgroundResource(if (speed > mSpeedLimit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||
@@ -83,16 +85,16 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
timer.schedule(task, Date(), 100)
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
location?.let {
|
||||
mLatLng = location
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
|
||||
gnssInfo?.let {
|
||||
mLatLng = gnssInfo
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 解除注册
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
|
||||
try {
|
||||
timerTask?.cancel()
|
||||
} catch (e: Exception) {
|
||||
@@ -100,4 +102,5 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user