diff --git a/OCH/taxi/unmanned-passenger/build.gradle b/OCH/taxi/unmanned-passenger/build.gradle index 98611c69ab..b5cad78f93 100644 --- a/OCH/taxi/unmanned-passenger/build.gradle +++ b/OCH/taxi/unmanned-passenger/build.gradle @@ -72,6 +72,7 @@ dependencies { implementation project(":OCH:common:common") compileOnly project(":libraries:mogo-map") + implementation rootProject.ext.dependencies.mogocustommap implementation project(':core:mogo-core-res') implementation project(":libraries:mogo-speech") diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt index 7bc001f0d4..a6af7ddbc8 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt @@ -13,9 +13,11 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.och.unmanned.passenger.ui.bar.LeftBarView 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_hdmap 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.leftContainer import kotlinx.android.synthetic.main.taxi_p_home.view.leftEndGuideline @@ -74,26 +76,38 @@ class HomeView @JvmOverloads constructor( fun onCreate(savedInstanceState: Bundle?) { hdMapView.onCreate(savedInstanceState) + preContainer.onCreate(savedInstanceState) + decContainer.onCreate(savedInstanceState) } fun onSaveInstanceState(outState: Bundle) { hdMapView.onSaveInstanceState(outState) + preContainer.onSaveInstanceState(outState) + decContainer.onSaveInstanceState(outState) } fun onResume() { hdMapView.onResume() + preContainer.onResume() + decContainer.onResume() } fun onLowMemory() { hdMapView.onLowMemory() + preContainer.onLowMemory() + decContainer.onLowMemory() } fun onPause() { hdMapView.onPause() + preContainer.onPause() + decContainer.onPause() } fun onDestroy() { hdMapView.onDestroy() + preContainer.onDestroy() + decContainer.onDestroy() } diff --git a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml index bc0d779395..44146f3d0d 100644 --- a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml +++ b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml @@ -33,25 +33,20 @@ app:layout_constraintStart_toEndOf="@+id/midStartGuideline" app:layout_constraintEnd_toStartOf="@id/rightStartGuideline"> - + android:layout_height="638dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - - + app:layout_constraintTop_toBottomOf="@id/preContainer" /> diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 3f498788b7..5557b65989 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -55,6 +55,7 @@ dependencies { implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid + implementation rootProject.ext.dependencies.androidxcardview kapt rootProject.ext.dependencies.aroutercompiler implementation(rootProject.ext.dependencies.mogocustommapoperational) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt index ecf47c3ecc..ec16126610 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt @@ -11,6 +11,10 @@ interface Identify { } + fun renderAdasRegResult(resultList: List?, mapInstance:String) { + + } + fun renderAiCloudResult(resultList: List, mapInstance:String) { } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt index a63c633aa1..151b381a8a 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt @@ -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.obu.CallerObuWarningListenerManager import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler +import com.mogo.map.MogoMap import com.zhjt.service.chain.ChainLog import mogo.telematics.pad.MessagePad import mogo.telematics.pad.MessagePad.TrackedObject @@ -28,9 +29,28 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf 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 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 preStartTime: Long = 0L + private var desStartTime: Long = 0L private var dockerVersion: String? = null fun initType() { @@ -69,13 +89,30 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf lostFrame(internal.toString()) 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) } MSG_DATA_TRACK -> { if (msg.obj is List<*>) { - identify.renderAdasRecognizedResult(msg.obj as List?) + val objectList = msg.obj as List? + identify.renderAdasRecognizedResult(objectList) 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() } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyNewDataDrawer.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyNewDataDrawer.kt new file mode 100644 index 0000000000..2dd2d79e0a --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyNewDataDrawer.kt @@ -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() + + /** + * 记录每次实际绘制的交通元素UUID + */ + @SuppressLint("NewApi") + private val trafficDataUuidList = ArraySet() + + /** + * 过滤后的数据集合 + */ + @SuppressLint("NewApi") + private val mFilterTrafficData = HashMap() + + @SuppressLint("NewApi") + override fun renderPlanningWarningObj(planningObjects: List?) { + 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?, 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): HashMap { + 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() + } + +} \ 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/routeoverlay/RouteOverlayDrawer.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java index 29983c3fd9..546d37b638 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/routeoverlay/RouteOverlayDrawer.java @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.business.routeoverlay; import static com.mogo.map.MogoMap.DEFAULT; +import static com.mogo.map.MogoMap.SMALL_DES_MAP; import android.annotation.SuppressLint; import android.graphics.Color; @@ -266,6 +267,7 @@ public class RouteOverlayDrawer { mPolylineOptions = options; } overlayManager.showOrUpdateLine(options,DEFAULT); + overlayManager.showOrUpdateLine(options,SMALL_DES_MAP); } else { isExcept = true; } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/DecisionLayout.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/DecisionLayout.kt new file mode 100644 index 0000000000..20b2c5b6c0 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/DecisionLayout.kt @@ -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() + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/DecisionMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/DecisionMapView.kt new file mode 100644 index 0000000000..743725356f --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/DecisionMapView.kt @@ -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) + } +} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionLayout.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionLayout.kt new file mode 100644 index 0000000000..bcc2e5595a --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionLayout.kt @@ -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() + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMap2View.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMap2View.kt new file mode 100644 index 0000000000..5c197ccb8e --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMap2View.kt @@ -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) + } + +} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMap3View.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMap3View.kt new file mode 100644 index 0000000000..c30344b442 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMap3View.kt @@ -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) + } + +} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMapView.kt new file mode 100644 index 0000000000..27e0981c8c --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/PredictionMapView.kt @@ -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) + } + +} diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_decision_container.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_decision_container.xml new file mode 100644 index 0000000000..bcfb42187a --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_decision_container.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_prediction_container.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_prediction_container.xml new file mode 100644 index 0000000000..93cae8b304 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_prediction_container.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 258c4be3b9..afb0b58c88 100644 --- a/gradle.properties +++ b/gradle.properties @@ -83,8 +83,8 @@ MOGO_TELEMATIC_VERSION=1.4.7.58 MOGO_SKIN_VERSION=1.4.7.50 ######## MogoAiCloudSDK Version ######## # 自研地图 -MAP_SDK_VERSION=3.5.0.3 -MAP_SDK_CORE_VERSION=3.5.0.4 +MAP_SDK_VERSION=multi-3.5.0.4 +MAP_SDK_CORE_VERSION=multi-3.5.0.4 MAP_SDK_DATA_VERSION=1.0.0.9 MAP_SDK_OPERATION_VERSION=1.1.4.1 # websocket diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt index e26b3a4341..44c2bf26bd 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt @@ -11,6 +11,10 @@ class MogoMap private constructor() { const val DEFAULT = "Default" 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 val mapInstance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/overlay/line/Polyline.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/overlay/line/Polyline.kt index b64427be77..c33b48ed8e 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/overlay/line/Polyline.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/overlay/line/Polyline.kt @@ -12,6 +12,8 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt @Volatile var delegate: IMapPolylineOverlay? = null + var mapTag: String = "" + class Options private constructor(private val builder: Builder) { 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() result = 31 * result + owner.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 } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/overlay/MoGoOverlayManagerImpl.kt b/libraries/mogo-map/src/main/java/com/mogo/map/overlay/MoGoOverlayManagerImpl.kt index 8cf4ca2034..bb98933a47 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/overlay/MoGoOverlayManagerImpl.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/overlay/MoGoOverlayManagerImpl.kt @@ -235,6 +235,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager { override fun showOrUpdateLine(options: Polyline.Options,mapTag:String): Polyline? { synchronized(lines) { val key = Polyline(options.id, options.owner, options.level, options) + key.mapTag = mapTag var line = lines[key] try { if (line != null) {