迁移感知绘制数据监听MapIdentifySubscriber

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-04-06 20:11:50 +08:00
parent ef8109543b
commit 9620e428ef
4 changed files with 75 additions and 29 deletions

View File

@@ -38,7 +38,7 @@ public class MapFrameController implements IMogoMapFrameController {
@Override
public void init(Context context) {
MapIdentifySubscriber.Companion.getInstance();
}
@Override

View File

@@ -0,0 +1,57 @@
package com.mogo.eagle.core.function.map
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.base.IMoGoSubscriber
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.module.common.drawer.IdentifyDataDrawer
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
/**
* 订阅感知数据的订阅者
* 数据来源工控机、OBU、云端下发
*
* @author donghongyu
*/
class MapIdentifySubscriber private constructor() : IMoGoSubscriber, IMoGoAutopilotIdentifyListener {
private val TAG = "MapIdentifySubscriber"
init {
onCrate()
}
companion object {
val instance: MapIdentifySubscriber by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
MapIdentifySubscriber()
}
}
override fun onCrate() {
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
}
override fun onDestroy() {
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
}
override fun onAutopilotIdentifyDataUpdate(trafficData: List<TrackedObject>?) {
try {
if (FunctionBuildConfig.isDrawIdentifyData) {
ThreadUtils.getSinglePool().execute { IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) }
} else {
IdentifyDataDrawer.getInstance().clearOldMarker()
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onAutopilotWarnMessage(warn: MessagePad.Warn?) {
}
}