diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt index 93fb48fd71..bd8cdb8807 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt @@ -5,23 +5,22 @@ import android.graphics.Color import android.util.AttributeSet import android.view.Gravity import android.widget.FrameLayout +import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager +import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.util.UiThreadHandler import java.util.* -/** - * @author xiaoyuzhou - * @date 2021/8/25 8:25 下午 - */ class SpeedPanelView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener { +) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener, + ILimitingVelocityListener { companion object { const val TAG = "SpeedPanelView" @@ -30,11 +29,6 @@ class SpeedPanelView @JvmOverloads constructor( var mContext: Context var mSpeedChartView: SpeedChartView var mLatLng: MogoLocation? = null - var mSpeedLimit = 60 - - private val timer by lazy { - Timer() - } init { setBackgroundResource(R.drawable.yi_biao_pan_bg_nor) @@ -50,49 +44,34 @@ class SpeedPanelView @JvmOverloads constructor( addView(mSpeedChartView) } - private var timerTask: TimerTask? = null - override fun onAttachedToWindow() { super.onAttachedToWindow() - // 注册位置回调 + CallerLimitingVelocityListenerManager.addListener(TAG, this) CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this) - // 开启定时查询速度 - timerTask?.cancel() - val task = object : TimerTask() { - override fun run() { - mLatLng?.let { - mSpeedLimit = CallerMapUIServiceManager.getMapUIController()!!.getLimitSpeed(it.longitude, it.latitude, - it.heading.toFloat() - ) - UiThreadHandler.post { - 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) - } - } - } - } - this.timerTask = task - timer.schedule(task, Date(), 200) } - override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) { - gnssInfo?.let { - mLatLng = gnssInfo + override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { + mogoLocation?.let { + mLatLng = mogoLocation + } + } + + override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) { + super.onLimitingVelocityChange(limitingVelocity, sourceType) + mLatLng?.let { + UiThreadHandler.post { + val speed = (it.gnssSpeed * 3.6f).toInt() + mSpeedChartView.setArcColor(Color.parseColor(if (speed > limitingVelocity) "#DB3137" else "#3E77F6")) + mSpeedChartView.setValues(speed) + setBackgroundResource(if (speed > limitingVelocity) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor) + } } } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - // 解除注册 + CallerLimitingVelocityListenerManager.removeListener(TAG) CallerChassisLocationGCJ02ListenerManager.removeListener(TAG) - try { - timerTask?.cancel() - } catch (e: Exception) { - e.printStackTrace() - } } - } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt index bc96ab3770..d98984e337 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt @@ -67,6 +67,11 @@ object TrackerSourceColorHelper { color = "#9900ffFF" } + //僵尸车 + if(data.addAttribute == AdditionalAttribute.ATTR_ZOMBIE){ + color = "#D1E5FDFF" + } + // pnc预警 WarningHelper.getPncColor(data.uuid.toString()) { if (it.isNotBlank()) {