[6.2.4]录包增加高精地图截图

This commit is contained in:
xuxinchao
2023-12-04 14:45:33 +08:00
parent 7d040d2ae0
commit f1313600d9
6 changed files with 91 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package com.zhjt.mogo_core_function_devatools.badcase.biz
import android.annotation.SuppressLint
import android.app.Activity
import android.graphics.Bitmap
import android.graphics.PixelFormat
import android.os.Bundle
import android.os.CountDownTimer
@@ -32,10 +33,13 @@ import com.mogo.eagle.core.data.deva.badcase.RecordCaseEntity
import com.mogo.eagle.core.data.deva.badcase.RecordOptionEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.devatools.badcase.BadCaseNetListener
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsNetManager
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
@@ -74,7 +78,7 @@ import java.util.*
* @since: 2022/7/13
*/
class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotRecordListener, BadCaseNetListener {
IMoGoAutopilotRecordListener, BadCaseNetListener, IMoGoMapScreenListener {
companion object {
const val TAG = "InitiativeBadCaseWindow"
@@ -192,7 +196,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
*/
BadCaseNetManager.badCaseNetManager.getRecordOption(1,AppConfigInfo.iPCMacAddress)
// BadCaseNetManager.badCaseNetManager.getRecordOption(1,"48:b0:2d:3a:9c:8f")
//高精地图屏幕截图
CallerMapScreenListenerManager.addListener(this.hashCode().toString(),this)
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
//主动录包采集原因回调监听
@@ -530,6 +535,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
mWindowManager!!.addView(mFloatLayout, mWindowParams)
//开启录包
recordKey = Random(SystemClock.elapsedRealtime()).nextInt().toLong()
//开启高精地图截图
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
if(recordCaseEntity!=null){
CallerAutoPilotControlManager.recordPackage(recordCaseEntity.caseId,recordKey.toInt(),
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration,recordCaseEntity.topicList)
@@ -563,6 +570,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
//注销采集原因回调监听
CallerDevaToolsNetManager.removeListener(this.hashCode().toString())
//注销高精地图截图监听回调
CallerMapScreenListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null){
mWindowManager!!.removeView(mFloatLayout)
@@ -644,4 +653,11 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}
}
/**
* 高精地图截图回调
*/
override fun onMapScreen(bitmap: Bitmap) {
}
}

View File

@@ -2,6 +2,7 @@ package com.zhjt.mogo_core_function_devatools.badcase.biz
import android.annotation.SuppressLint
import android.app.Activity
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.PixelFormat
import android.os.Bundle
@@ -34,9 +35,12 @@ import com.mogo.eagle.core.data.deva.badcase.RecordOptionEntity
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.function.api.devatools.badcase.BadCaseNetListener
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsNetManager
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
@@ -72,7 +76,7 @@ import java.lang.StringBuilder
* @since: 2022/7/17
*/
class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
BadCaseNetListener {
BadCaseNetListener , IMoGoMapScreenListener {
companion object {
const val TAG = "PassiveBadCaseWindow"
@@ -183,6 +187,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
*/
BadCaseNetManager.badCaseNetManager.getRecordOption(2,AppConfigInfo.iPCMacAddress)
// BadCaseNetManager.badCaseNetManager.getRecordOption(2,"48:b0:2d:3a:9c:8f")
//高精地图屏幕截图
CallerMapScreenListenerManager.addListener(this.hashCode().toString(),this)
CallerDevaToolsNetManager.addListener(this.hashCode().toString(),this)
if(BadCaseConfig.windowNum<1){
BadCaseConfig.windowNum = 1
@@ -537,6 +543,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
fun hideFloatWindow() {
//注销高精地图截图监听回调
CallerMapScreenListenerManager.removeListener(this.hashCode().toString())
//注销采集原因回调监听
CallerDevaToolsNetManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
@@ -557,6 +565,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
recordFileName = recordBagMsg.fileName
receiveTime = msgBoxBean.timestamp.toString()
stat = recordBagMsg.stat.toString()
//获取高精地图截图
CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot()
}
fun setClickListener(clickListener: ClickListener) {
@@ -619,4 +629,11 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}
}
/**
* 高精地图截图回调
*/
override fun onMapScreen(bitmap: Bitmap) {
super.onMapScreen(bitmap)
}
}

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.api.map.deva
import android.graphics.Bitmap
interface IMoGoMapScreenListener {
/**
* 高精地图监听回调
*/
fun onMapScreen(bitmap: Bitmap){}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.map
import android.graphics.Bitmap
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 高精地图屏幕截图回调监听管理
*/
object CallerMapScreenListenerManager: CallerBase<IMoGoMapScreenListener>() {
/**
* 高精地图屏幕截图回调
*/
fun invokeMapScreen(bitmap: Bitmap){
M_LISTENERS.forEach{
val listener = it.value
listener.onMapScreen(bitmap)
}
}
}

View File

@@ -330,4 +330,9 @@ interface IMogoMapUIController {
* 设置地图默认视角
*/
fun setVrAngleDefaultMode(mode: VisualAngleMode)
/**
* 获取高精地图截图
*/
fun getMapScreenShot()
}

View File

@@ -1,5 +1,6 @@
package com.mogo.map
import android.graphics.Bitmap
import android.graphics.Point
import android.graphics.Rect
import android.os.Bundle
@@ -8,6 +9,7 @@ import android.os.HandlerThread
import android.text.TextUtils
import android.view.MotionEvent
import android.view.View
import com.autonavi.nge.map.OnMapScreenShotListener
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.map.MogoLatLng
@@ -19,6 +21,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.invoke
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.invokeRoadChange
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener.invokeMapRomaRange
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener.invokeMapRomaStatus
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
@@ -61,7 +64,7 @@ import kotlin.properties.Delegates
class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIController,
OnMapLoadedListener, OnMapClickListener, OnMapTouchListener,
OnMarkClickListener, OnMapStyleListener, OnMapViewVisualAngleChangeListener, OnRoadInfoListener,
ILog, OnRoamStatusListener, OnRoadSideFenceRegionListener {
ILog, OnRoamStatusListener, OnRoadSideFenceRegionListener,OnMapScreenShotListener {
companion object {
private const val TAG = "AMapViewWrapper"
@@ -888,6 +891,12 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
}
}
override fun getMapScreenShot() {
if(checkAMapView()){
mMapView.getMapAutoViewHelper()?.toScreen()
}
}
override fun getVrAngleDefaultMode(): VisualAngleMode {
if (checkAMapView()) {
val code = mMapView.getMapStyleParams()?.getVrAngleDefaultMode()
@@ -895,4 +904,12 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
}
return MODE_MEDIUM_SIGHT
}
/**
* 高精地图屏幕截图
*/
override fun onMapScreenShot(bitmap: Bitmap?) {
bitmap?.let {
CallerMapScreenListenerManager.invokeMapScreen(it)
}
}
}