[8.0.0][feat]新增预测和AIP功能

This commit is contained in:
chenfufeng
2025-05-08 15:06:32 +08:00
parent 3d5f6dc8c9
commit 0281d261c3
20 changed files with 1016 additions and 20 deletions

View File

@@ -72,6 +72,7 @@ dependencies {
implementation project(":OCH:common:common") implementation project(":OCH:common:common")
compileOnly project(":libraries:mogo-map") compileOnly project(":libraries:mogo-map")
implementation rootProject.ext.dependencies.mogocustommap
implementation project(':core:mogo-core-res') implementation project(':core:mogo-core-res')
implementation project(":libraries:mogo-speech") implementation project(":libraries:mogo-speech")

View File

@@ -13,9 +13,11 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.unmanned.passenger.ui.bar.LeftBarView import com.mogo.och.unmanned.passenger.ui.bar.LeftBarView
import com.mogo.och.unmanned.taxi.passenger.R import com.mogo.och.unmanned.taxi.passenger.R
import kotlinx.android.synthetic.main.taxi_p_home.view.decContainer
import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_all import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_all
import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_hdmap import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_hdmap
import kotlinx.android.synthetic.main.taxi_p_home.view.hdMapView import kotlinx.android.synthetic.main.taxi_p_home.view.hdMapView
import kotlinx.android.synthetic.main.taxi_p_home.view.preContainer
import kotlinx.android.synthetic.main.taxi_p_home.view.lbv_go2_center import kotlinx.android.synthetic.main.taxi_p_home.view.lbv_go2_center
import kotlinx.android.synthetic.main.taxi_p_home.view.leftContainer import kotlinx.android.synthetic.main.taxi_p_home.view.leftContainer
import kotlinx.android.synthetic.main.taxi_p_home.view.leftEndGuideline import kotlinx.android.synthetic.main.taxi_p_home.view.leftEndGuideline
@@ -74,26 +76,38 @@ class HomeView @JvmOverloads constructor(
fun onCreate(savedInstanceState: Bundle?) { fun onCreate(savedInstanceState: Bundle?) {
hdMapView.onCreate(savedInstanceState) hdMapView.onCreate(savedInstanceState)
preContainer.onCreate(savedInstanceState)
decContainer.onCreate(savedInstanceState)
} }
fun onSaveInstanceState(outState: Bundle) { fun onSaveInstanceState(outState: Bundle) {
hdMapView.onSaveInstanceState(outState) hdMapView.onSaveInstanceState(outState)
preContainer.onSaveInstanceState(outState)
decContainer.onSaveInstanceState(outState)
} }
fun onResume() { fun onResume() {
hdMapView.onResume() hdMapView.onResume()
preContainer.onResume()
decContainer.onResume()
} }
fun onLowMemory() { fun onLowMemory() {
hdMapView.onLowMemory() hdMapView.onLowMemory()
preContainer.onLowMemory()
decContainer.onLowMemory()
} }
fun onPause() { fun onPause() {
hdMapView.onPause() hdMapView.onPause()
preContainer.onPause()
decContainer.onPause()
} }
fun onDestroy() { fun onDestroy() {
hdMapView.onDestroy() hdMapView.onDestroy()
preContainer.onDestroy()
decContainer.onDestroy()
} }

View File

@@ -33,25 +33,20 @@
app:layout_constraintStart_toEndOf="@+id/midStartGuideline" app:layout_constraintStart_toEndOf="@+id/midStartGuideline"
app:layout_constraintEnd_toStartOf="@id/rightStartGuideline"> app:layout_constraintEnd_toStartOf="@id/rightStartGuideline">
<androidx.constraintlayout.widget.ConstraintLayout <com.mogo.eagle.core.function.view.PredictionLayout
app:layout_constraintTop_toTopOf="parent" android:id="@+id/preContainer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/taxi_p_home_middle_top_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_676"> android:layout_height="638dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> <com.mogo.eagle.core.function.view.DecisionLayout
android:id="@+id/decContainer"
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent"
android:layout_height="638dp"
android:layout_marginTop="49dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/preContainer" />
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/taxi_p_home_middle_bottom_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_676">
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -55,6 +55,7 @@ dependencies {
implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxcardview
kapt rootProject.ext.dependencies.aroutercompiler kapt rootProject.ext.dependencies.aroutercompiler
implementation(rootProject.ext.dependencies.mogocustommapoperational) { implementation(rootProject.ext.dependencies.mogocustommapoperational) {

View File

@@ -11,6 +11,10 @@ interface Identify {
} }
fun renderAdasRegResult(resultList: List<TrackedObject>?, mapInstance:String) {
}
fun renderAiCloudResult(resultList: List<SocketDownData.CloudRoadDataProto>, mapInstance:String) { fun renderAiCloudResult(resultList: List<SocketDownData.CloudRoadDataProto>, mapInstance:String) {
} }

View File

@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.map.MogoMap
import com.zhjt.service.chain.ChainLog import com.zhjt.service.chain.ChainLog
import mogo.telematics.pad.MessagePad import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject import mogo.telematics.pad.MessagePad.TrackedObject
@@ -28,9 +29,28 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
internal val aiCloudDataDrawer = IdentifyAiCloudDataDrawer() internal val aiCloudDataDrawer = IdentifyAiCloudDataDrawer()
} }
// 预测
object PreDriverIdentify {
internal val preDataDrawer = IdentifyNewDataDrawer()
internal val preDataDrawer2 = IdentifyNewDataDrawer()
internal val preDataDrawer3 = IdentifyNewDataDrawer()
}
// 决策
object DesDriverIdentify {
internal val desDataDrawer = IdentifyNewDataDrawer()
}
private var identify: Identify = DriverIdentify.originDataDrawer private var identify: Identify = DriverIdentify.originDataDrawer
private var aiCloudIdentify: Identify? = null private var aiCloudIdentify: Identify? = null
private var preIdentify: Identify = PreDriverIdentify.preDataDrawer
private var preIdentify2: Identify = PreDriverIdentify.preDataDrawer2
private var preIdentify3: Identify = PreDriverIdentify.preDataDrawer3
private var desIdentify: Identify = DesDriverIdentify.desDataDrawer
private var startTime: Long = 0L private var startTime: Long = 0L
private var preStartTime: Long = 0L
private var desStartTime: Long = 0L
private var dockerVersion: String? = null private var dockerVersion: String? = null
fun initType() { fun initType() {
@@ -69,13 +89,30 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
lostFrame(internal.toString()) lostFrame(internal.toString())
identify.clearOldMarker() identify.clearOldMarker()
} }
if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - preStartTime) >= 1000) {
preIdentify.clearOldMarker()
preIdentify2.clearOldMarker()
preIdentify3.clearOldMarker()
}
if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - desStartTime) >= 1000) {
desIdentify.clearOldMarker()
}
sendEmptyMessageDelayed(MSG_CHECK, 1000L) sendEmptyMessageDelayed(MSG_CHECK, 1000L)
} }
MSG_DATA_TRACK -> { MSG_DATA_TRACK -> {
if (msg.obj is List<*>) { if (msg.obj is List<*>) {
identify.renderAdasRecognizedResult(msg.obj as List<TrackedObject>?) val objectList = msg.obj as List<TrackedObject>?
identify.renderAdasRecognizedResult(objectList)
startTime = System.nanoTime() startTime = System.nanoTime()
preIdentify.renderAdasRegResult(objectList, MogoMap.SMALL_PRED_MAP)
preIdentify2.renderAdasRegResult(objectList, MogoMap.SMALL_PRED_MAP2)
preIdentify3.renderAdasRegResult(objectList, MogoMap.SMALL_PRED_MAP3)
preStartTime = System.nanoTime()
desIdentify.renderAdasRegResult(objectList, MogoMap.SMALL_DES_MAP)
desStartTime = System.nanoTime()
} }
} }

View File

@@ -0,0 +1,131 @@
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import androidx.collection.ArraySet
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.map.identify.MogoIdentifyManager
import mogo.telematics.pad.MessagePad.PlanningObject
import mogo.telematics.pad.MessagePad.TrackedObject
import java.util.concurrent.ConcurrentHashMap
/**
* 域控制器识别信息绘制
*/
class IdentifyNewDataDrawer : Identify {
/**
* 上一帧数据的缓存
*/
private val mMarkersCaches = ConcurrentHashMap<String, TrackedObject>()
/**
* 记录每次实际绘制的交通元素UUID
*/
@SuppressLint("NewApi")
private val trafficDataUuidList = ArraySet<String>()
/**
* 过滤后的数据集合
*/
@SuppressLint("NewApi")
private val mFilterTrafficData = HashMap<String, TrackedObject>()
@SuppressLint("NewApi")
override fun renderPlanningWarningObj(planningObjects: List<PlanningObject>?) {
WarningHelper.renderPlanningOriginWarningObj(planningObjects, mMarkersCaches)
}
override fun renderOBUWarningObj(exist: Boolean, obuTrafficData: TrafficData) {
WarningHelper.renderOBUWarningObj(exist, obuTrafficData)
}
/**
* 渲染 adas 识别的数据
*
* @param resultList adas感知融合数据
*/
@SuppressLint("NewApi")
override fun renderAdasRegResult(resultList: List<TrackedObject>?, mapInstance:String) {
if (resultList == null || resultList.isEmpty()) {
clearOldMarker()
return
}
if (!MogoStatusManager.getInstance().isVrMode) {
clearOldMarker()
return
}
//清除缓存
for (data in resultList) {
if (trafficDataUuidList.size > 0 && trafficDataUuidList.contains(data.uuid.toString())) {
if (TrackerSourceFilterHelper.filterData(data)) {
continue
}
trafficDataUuidList.remove(data.uuid.toString())
}
}
//清除缓存,删除marker
val it: MutableIterator<*> = trafficDataUuidList.iterator()
while (it.hasNext()) {
val key = it.next() as String
it.remove()
mMarkersCaches.remove(key)
MogoIdentifyManager.getInstance()
.removeMarker(key, mapInstance)
TrackerSourceFilterHelper.removeBottomMarker(key)
}
val filterList = filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance()
.updateBatchMarkerPosition(filterList, mapInstance)
}
}
/**
* 数据过滤器
*
* @return 过滤后的数据集合
*/
@SuppressLint("NewApi")
private fun filterTrafficData(trafficData: List<TrackedObject>): HashMap<String, TrackedObject> {
mFilterTrafficData.clear()
for (data in trafficData) {
// 过滤掉未知感知数据
if (TrackerSourceFilterHelper.filterData(data)) {
continue
}
var temp: TrackedObject = data
val uuid = data.uuid.toString()
val cacheData = mMarkersCaches[uuid]
if (cacheData != null) {
val color = TrackerSourceFilterHelper.getDefaultColor(data)
temp = data.toBuilder().setColor(color).build()
}
mFilterTrafficData[uuid] = temp
mMarkersCaches[uuid] = temp
trafficDataUuidList.add(uuid)
// TrackerSourceFilterHelper.filterZombieMarker(data)
}
return mFilterTrafficData
}
/**
* 清除旧的 marker 数据
*/
@SuppressLint("NewApi")
override fun clearOldMarker() {
for (uuid in trafficDataUuidList) {
MogoIdentifyManager.getInstance()
.removeMarker(uuid)
TrackerSourceFilterHelper.removeBottomMarker(uuid)
}
trafficDataUuidList.clear()
mMarkersCaches.clear()
WarningHelper.clear()
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.business.routeoverlay; package com.mogo.eagle.core.function.business.routeoverlay;
import static com.mogo.map.MogoMap.DEFAULT; import static com.mogo.map.MogoMap.DEFAULT;
import static com.mogo.map.MogoMap.SMALL_DES_MAP;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.graphics.Color; import android.graphics.Color;
@@ -266,6 +267,7 @@ public class RouteOverlayDrawer {
mPolylineOptions = options; mPolylineOptions = options;
} }
overlayManager.showOrUpdateLine(options,DEFAULT); overlayManager.showOrUpdateLine(options,DEFAULT);
overlayManager.showOrUpdateLine(options,SMALL_DES_MAP);
} else { } else {
isExcept = true; isExcept = true;
} }

View File

@@ -0,0 +1,61 @@
package com.mogo.eagle.core.function.view
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.map.R
import kotlinx.android.synthetic.main.layout_decision_container.view.decMapView
import kotlinx.android.synthetic.main.layout_decision_container.view.preDetailView2
import kotlinx.android.synthetic.main.layout_decision_container.view.preDetailView3
class DecisionLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs) {
init {
LayoutInflater.from(context).inflate(R.layout.layout_decision_container, this, true)
initView()
}
private fun initView() {
}
fun onCreate(savedInstanceState: Bundle?) {
decMapView.onCreate(savedInstanceState)
preDetailView2.onCreate(savedInstanceState)
preDetailView3.onCreate(savedInstanceState)
}
fun onSaveInstanceState(outState: Bundle) {
decMapView.onSaveInstanceState(outState)
preDetailView2.onSaveInstanceState(outState)
preDetailView3.onSaveInstanceState(outState)
}
fun onResume() {
decMapView.onResume()
preDetailView2.onResume()
preDetailView3.onResume()
}
fun onLowMemory() {
decMapView.onLowMemory()
preDetailView2.onLowMemory()
preDetailView3.onLowMemory()
}
fun onPause() {
decMapView.onPause()
preDetailView2.onPause()
preDetailView3.onPause()
}
fun onDestroy() {
decMapView.onDestroy()
preDetailView2.onDestroy()
preDetailView3.onDestroy()
}
}

View File

@@ -0,0 +1,110 @@
package com.mogo.eagle.core.function.view
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.map.MogoMap.Companion.SMALL_DES_MAP
import com.mogo.map.MogoMapView
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener
import com.zhidaoauto.map.sdk.open.view.HDTypes
import com.zhidaoauto.map.sdk.open.view.MapAutoView
import com.zhjt.service.chain.ChainLog
/**
* 决策地图View
*/
class DecisionMapView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs),
LifecycleObserver, IMoGoMapRoadListener, OnMapLoadedListener,
IMoGoChassisLocationWGS84Listener {
companion object {
private const val TAG = "DecisionMapView"
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
initMapView()
}
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 10, this)
}
private fun initMapView() {
map?.uiController?.showMyLocation(true)
map?.uiSettings?.let {
it.setAllGesturesEnabled(false)
//设置指南针是否可见。
it.setCompassEnabled(false)
//设置室内地图楼层切换控件是否可见。
it.setIndoorSwitchEnabled(false)
//设置定位按钮是否可见。
it.setMyLocationButtonEnabled(false)
//设置比例尺控件是否可见
it.setScaleControlsEnabled(false)
}
(mMapView?.mapView as MapAutoView).setOnMapLoadedListener(this)
}
override fun getInstanceTag(): String {
return SMALL_DES_MAP
}
@SuppressLint("ObsoleteSdkInt")
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
var size = 12f
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
size = 16f
} else if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
size = 12f
}
this.outlineProvider = TextureVideoViewOutlineProvider(size)
this.clipToOutline = true
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ROAD_ROMA,
paramIndexes = [0, 1]
)
private fun trace(tag: String, obj: Any) {
CallerLogger.d("$M_MAP$tag", "$obj")
}
override fun onMapInit() {}
override fun onMapLoaded() {
(mMapView.mapView as MapAutoView).getMapView()?.getMapEngine()?.setHDTypeVisible(
intArrayOf(
HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
HDTypes.regional.type
)
)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
setExtraGPSData(gnssInfo)
}
}

View File

@@ -0,0 +1,47 @@
package com.mogo.eagle.core.function.view
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.map.R
import kotlinx.android.synthetic.main.layout_prediction_container.view.preDetailView
class PredictionLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs) {
init {
LayoutInflater.from(context).inflate(R.layout.layout_prediction_container, this, true)
initView()
}
private fun initView() {
}
fun onCreate(savedInstanceState: Bundle?) {
preDetailView.onCreate(savedInstanceState)
}
fun onSaveInstanceState(outState: Bundle) {
preDetailView.onSaveInstanceState(outState)
}
fun onResume() {
preDetailView.onResume()
}
fun onLowMemory() {
preDetailView.onLowMemory()
}
fun onPause() {
preDetailView.onPause()
}
fun onDestroy() {
preDetailView.onDestroy()
}
}

View File

@@ -0,0 +1,115 @@
package com.mogo.eagle.core.function.view
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.map.MogoMap.Companion.SMALL_PRED_MAP2
import com.mogo.map.MogoMapView
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener
import com.zhidaoauto.map.sdk.open.view.HDTypes
import com.zhidaoauto.map.sdk.open.view.MapAutoView
import com.zhjt.service.chain.ChainLog
/**
* 预测地图View
*/
class PredictionMap2View(context: Context, attrs: AttributeSet) : MogoMapView(context, attrs),
LifecycleObserver, IMoGoMapRoadListener, OnMapLoadedListener,
IMoGoChassisLocationWGS84Listener {
companion object {
private const val TAG = "PredictionMap2View"
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
initMapView()
}
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 10, this)
}
private fun initMapView() {
map?.uiController?.showMyLocation(true)
map?.uiSettings?.let {
it.setAllGesturesEnabled(false)
//设置指南针是否可见。
it.setCompassEnabled(false)
//设置室内地图楼层切换控件是否可见。
it.setIndoorSwitchEnabled(false)
//设置定位按钮是否可见。
it.setMyLocationButtonEnabled(false)
//设置比例尺控件是否可见
it.setScaleControlsEnabled(false)
}
(mMapView?.mapView as MapAutoView).setOnMapLoadedListener(this)
}
/**
* 渲染的时候用到
*/
override fun getInstanceTag(): String {
return SMALL_PRED_MAP2
}
@SuppressLint("ObsoleteSdkInt")
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
var size = 12f
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
size = 16f
} else if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
size = 12f
}
this.outlineProvider = TextureVideoViewOutlineProvider(size)
this.clipToOutline = true
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ROAD_ROMA,
paramIndexes = [0, 1]
)
private fun trace(tag: String, obj: Any) {
CallerLogger.d("$M_MAP$tag", "$obj")
}
override fun onMapInit() {}
override fun onMapLoaded() {
(mMapView.mapView as MapAutoView).getMapView()?.getMapEngine()?.setHDTypeVisible(
intArrayOf(
HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
HDTypes.regional.type
)
)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
setExtraGPSData(gnssInfo)
}
}

View File

@@ -0,0 +1,115 @@
package com.mogo.eagle.core.function.view
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.map.MogoMap.Companion.SMALL_PRED_MAP3
import com.mogo.map.MogoMapView
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener
import com.zhidaoauto.map.sdk.open.view.HDTypes
import com.zhidaoauto.map.sdk.open.view.MapAutoView
import com.zhjt.service.chain.ChainLog
/**
* 预测地图View
*/
class PredictionMap3View(context: Context, attrs: AttributeSet) : MogoMapView(context, attrs),
LifecycleObserver, IMoGoMapRoadListener, OnMapLoadedListener,
IMoGoChassisLocationWGS84Listener {
companion object {
private const val TAG = "PredictionMap3View"
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
initMapView()
}
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 10, this)
}
private fun initMapView() {
map?.uiController?.showMyLocation(true)
map?.uiSettings?.let {
it.setAllGesturesEnabled(false)
//设置指南针是否可见。
it.setCompassEnabled(false)
//设置室内地图楼层切换控件是否可见。
it.setIndoorSwitchEnabled(false)
//设置定位按钮是否可见。
it.setMyLocationButtonEnabled(false)
//设置比例尺控件是否可见
it.setScaleControlsEnabled(false)
}
(mMapView?.mapView as MapAutoView).setOnMapLoadedListener(this)
}
/**
* 渲染的时候用到
*/
override fun getInstanceTag(): String {
return SMALL_PRED_MAP3
}
@SuppressLint("ObsoleteSdkInt")
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
var size = 12f
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
size = 16f
} else if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
size = 12f
}
this.outlineProvider = TextureVideoViewOutlineProvider(size)
this.clipToOutline = true
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ROAD_ROMA,
paramIndexes = [0, 1]
)
private fun trace(tag: String, obj: Any) {
CallerLogger.d("$M_MAP$tag", "$obj")
}
override fun onMapInit() {}
override fun onMapLoaded() {
(mMapView.mapView as MapAutoView).getMapView()?.getMapEngine()?.setHDTypeVisible(
intArrayOf(
HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
HDTypes.regional.type
)
)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
setExtraGPSData(gnssInfo)
}
}

View File

@@ -0,0 +1,124 @@
package com.mogo.eagle.core.function.view
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.view.PredictionMap2View.Companion
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.map.MogoMap.Companion.SMALL_PRED_MAP
import com.mogo.map.MogoMapView
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener
import com.zhidaoauto.map.sdk.open.view.HDTypes
import com.zhidaoauto.map.sdk.open.view.MapAutoView
import com.zhjt.service.chain.ChainLog
/**
* 预测地图View
*/
class PredictionMapView(context: Context, attrs: AttributeSet) : MogoMapView(context, attrs),
LifecycleObserver, IMoGoMapRoadListener, OnMapLoadedListener,
IMoGoChassisLocationWGS84Listener {
companion object {
private const val TAG = "PredictionMapView"
}
// private var index: Int = 1
//
// init {
// val typedArray = context.obtainStyledAttributes(attrs, R.styleable.PredictionMapView)
// index = typedArray.getInt(R.styleable.PredictionMapView_index, 1)
// typedArray.recycle()
// }
override fun onAttachedToWindow() {
super.onAttachedToWindow()
initMapView()
}
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 10, this)
}
private fun initMapView() {
map?.uiController?.showMyLocation(true)
map?.uiSettings?.let {
it.setAllGesturesEnabled(false)
//设置指南针是否可见。
it.setCompassEnabled(false)
//设置室内地图楼层切换控件是否可见。
it.setIndoorSwitchEnabled(false)
//设置定位按钮是否可见。
it.setMyLocationButtonEnabled(false)
//设置比例尺控件是否可见
it.setScaleControlsEnabled(false)
}
(mMapView?.mapView as MapAutoView).setOnMapLoadedListener(this)
}
/**
* 渲染的时候用到
*/
override fun getInstanceTag(): String {
return SMALL_PRED_MAP
}
@SuppressLint("ObsoleteSdkInt")
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
var size = 12f
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
size = 16f
} else if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
size = 12f
}
this.outlineProvider = TextureVideoViewOutlineProvider(size)
this.clipToOutline = true
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ROAD_ROMA,
paramIndexes = [0, 1]
)
private fun trace(tag: String, obj: Any) {
CallerLogger.d("$M_MAP$tag", "$obj")
}
override fun onMapInit() {}
override fun onMapLoaded() {
(mMapView.mapView as MapAutoView).getMapView()?.getMapEngine()?.setHDTypeVisible(
intArrayOf(
HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
HDTypes.regional.type
)
)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
setExtraGPSData(gnssInfo)
}
}

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<!-- <com.mogo.eagle.core.function.view.PredictionMap2View-->
<!-- android:id="@+id/preDetailView2"-->
<!-- android:layout_width="238dp"-->
<!-- android:layout_height="458dp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginStart="@dimen/dp_27"-->
<!-- android:layout_marginBottom="24dp"-->
<!-- app:carPosition="6"-->
<!-- app:isAutoLocation="false"-->
<!-- app:isDisplayAnim="false"-->
<!-- app:isWeatherEnable="false"-->
<!-- app:styleMode="MAP_STYLE_DAY_VR_AIP"-->
<!-- app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />-->
<!-- <com.mogo.eagle.core.function.view.DecisionMapView-->
<!-- android:id="@+id/decMapView"-->
<!-- android:layout_width="238dp"-->
<!-- android:layout_height="458dp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginBottom="24dp"-->
<!-- android:focusable="false"-->
<!-- android:focusableInTouchMode="false"-->
<!-- app:carPosition="6"-->
<!-- app:isAutoLocation="false"-->
<!-- app:isDisplayAnim="false"-->
<!-- app:isWeatherEnable="false"-->
<!-- app:styleMode="MAP_STYLE_DAY_VR_AIP"-->
<!-- app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />-->
<!-- <com.mogo.eagle.core.function.view.PredictionMap3View-->
<!-- android:id="@+id/preDetailView3"-->
<!-- android:layout_width="238dp"-->
<!-- android:layout_height="458dp"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginEnd="@dimen/dp_27"-->
<!-- android:layout_marginBottom="20dp"-->
<!-- app:carPosition="6"-->
<!-- app:isAutoLocation="false"-->
<!-- app:isDisplayAnim="false"-->
<!-- app:isWeatherEnable="false"-->
<!-- app:styleMode="MAP_STYLE_DAY_VR_AIP"-->
<!-- app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />-->
<androidx.cardview.widget.CardView
android:id="@+id/decContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="#D7F1FF"
app:cardCornerRadius="20dp"
app:cardElevation="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<com.mogo.eagle.core.function.view.PredictionMap2View
android:id="@+id/preDetailView2"
android:layout_width="238dp"
android:layout_height="458dp"
android:layout_gravity="start|bottom"
android:layout_marginStart="@dimen/dp_27"
android:layout_marginBottom="24dp"
app:carPosition="6"
app:isAutoLocation="false"
app:isDisplayAnim="false"
app:isWeatherEnable="false"
app:styleMode="MAP_STYLE_DAY_VR_AIP"
app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />
<com.mogo.eagle.core.function.view.DecisionMapView
android:id="@+id/decMapView"
android:layout_width="238dp"
android:layout_height="458dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="24dp"
android:focusable="false"
android:focusableInTouchMode="false"
app:carPosition="6"
app:isAutoLocation="false"
app:isDisplayAnim="false"
app:isWeatherEnable="false"
app:styleMode="MAP_STYLE_DAY_VR_AIP"
app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />
<com.mogo.eagle.core.function.view.PredictionMap3View
android:id="@+id/preDetailView3"
android:layout_width="238dp"
android:layout_height="458dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="@dimen/dp_27"
android:layout_marginBottom="20dp"
app:carPosition="6"
app:isAutoLocation="false"
app:isDisplayAnim="false"
app:isWeatherEnable="false"
app:styleMode="MAP_STYLE_DAY_VR_AIP"
app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tvDecTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AIP 规划与决策"
android:textColor="#394047"
android:textStyle="bold"
android:textSize="32dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_39"
/>
<TextView
android:id="@+id/tvPre1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDecTitle"
android:layout_marginStart="@dimen/dp_116"
android:layout_marginTop="@dimen/dp_30"
android:text="11%"
android:textColor="#63707D"
android:textSize="33dp"
/>
<TextView
android:id="@+id/tvPre2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDecTitle"
android:layout_marginTop="@dimen/dp_30"
android:text="86%"
android:textColor="#63707D"
android:textSize="33dp"
/>
<TextView
android:id="@+id/tvPre3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDecTitle"
android:layout_marginEnd="@dimen/dp_116"
android:layout_marginTop="@dimen/dp_30"
android:text="3%"
android:textColor="#63707D"
android:textSize="33dp"
/>
</merge>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="#D7F1FF"
app:cardCornerRadius="20dp"
app:cardElevation="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.eagle.core.function.view.PredictionMapView
android:id="@+id/preDetailView"
android:layout_width="756dp"
android:layout_height="500dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="26dp"
app:carPosition="6"
app:isAutoLocation="false"
app:isDisplayAnim="false"
app:isWeatherEnable="false"
app:styleMode="MAP_STYLE_DAY_VR_AIP"
app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Prediction 预测"
android:textColor="#394047"
android:textStyle="bold"
android:textSize="@dimen/dp_32"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_41"
/>
<!-- <com.mogo.eagle.core.function.view.PredictionMapView-->
<!-- android:id="@+id/preDetailView"-->
<!-- android:layout_width="756dp"-->
<!-- android:layout_height="500dp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginBottom="26dp"-->
<!-- app:carPosition="6"-->
<!-- app:isAutoLocation="false"-->
<!-- app:isDisplayAnim="false"-->
<!-- app:isWeatherEnable="false"-->
<!-- app:styleMode="MAP_STYLE_DAY_VR_AIP"-->
<!-- app:vrAngleMode="MAP_STYLE_VR_ANGLE_TOP" />-->
</merge>

View File

@@ -83,8 +83,8 @@ MOGO_TELEMATIC_VERSION=1.4.7.58
MOGO_SKIN_VERSION=1.4.7.50 MOGO_SKIN_VERSION=1.4.7.50
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 自研地图 # 自研地图
MAP_SDK_VERSION=3.5.0.3 MAP_SDK_VERSION=multi-3.5.0.4
MAP_SDK_CORE_VERSION=3.5.0.4 MAP_SDK_CORE_VERSION=multi-3.5.0.4
MAP_SDK_DATA_VERSION=1.0.0.9 MAP_SDK_DATA_VERSION=1.0.0.9
MAP_SDK_OPERATION_VERSION=1.1.4.1 MAP_SDK_OPERATION_VERSION=1.1.4.1
# websocket # websocket

View File

@@ -11,6 +11,10 @@ class MogoMap private constructor() {
const val DEFAULT = "Default" const val DEFAULT = "Default"
const val MAP_ROAM = "MapRoam" //漫游地图实例 const val MAP_ROAM = "MapRoam" //漫游地图实例
const val SMALL_DES_MAP = "DecisionMap"//决策地图实例
const val SMALL_PRED_MAP = "PredictionMap"//预测地图实例
const val SMALL_PRED_MAP2 = "PredictionMap2"//预测地图实例
const val SMALL_PRED_MAP3 = "PredictionMap3"//预测地图实例
@JvmStatic @JvmStatic
val mapInstance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { val mapInstance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {

View File

@@ -12,6 +12,8 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
@Volatile @Volatile
var delegate: IMapPolylineOverlay? = null var delegate: IMapPolylineOverlay? = null
var mapTag: String = ""
class Options private constructor(private val builder: Builder) { class Options private constructor(private val builder: Builder) {
val id: String = builder.id ?: throw AssertionError("id must not be null.") val id: String = builder.id ?: throw AssertionError("id must not be null.")
@@ -213,6 +215,14 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
var result = id.hashCode() var result = id.hashCode()
result = 31 * result + owner.hashCode() result = 31 * result + owner.hashCode()
result = 31 * result + level.hashCode() result = 31 * result + level.hashCode()
return result return result + str2Int(mapTag)
}
private fun str2Int(tag: String): Int {
var sum = 0
for (c in tag) {
sum += c.code
}
return sum
} }
} }

View File

@@ -235,6 +235,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
override fun showOrUpdateLine(options: Polyline.Options,mapTag:String): Polyline? { override fun showOrUpdateLine(options: Polyline.Options,mapTag:String): Polyline? {
synchronized(lines) { synchronized(lines) {
val key = Polyline(options.id, options.owner, options.level, options) val key = Polyline(options.id, options.owner, options.level, options)
key.mapTag = mapTag
var line = lines[key] var line = lines[key]
try { try {
if (line != null) { if (line != null) {