[6.5.0] road cross func

This commit is contained in:
EmArrow
2024-06-21 14:49:31 +08:00
parent abd524ae57
commit 8744b0f190
34 changed files with 360 additions and 119 deletions

View File

@@ -8,7 +8,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: rootProject.file('gradle/bytex/bytex.gradle')
//apply from: rootProject.file('gradle/bytex/bytex.gradle')
Properties properties = new Properties()
properties.load(project.rootProject.file("gradle.properties").newDataInputStream())

View File

@@ -72,6 +72,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigList
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
@@ -100,6 +101,7 @@ import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import com.mogo.test.crashreport.CrashReportConstants
import com.mogo.test.crashreport.ITestCrashReportProvider
import com.zhidaoauto.map.data.road.RoadCross
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.service.chain.ChainLog
import kotlinx.android.synthetic.main.view_debug_setting.view.*
@@ -417,15 +419,17 @@ internal class DebugSettingView @JvmOverloads constructor(
* 状态中心
*/
tbStatusCenter.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示状态中心
statusCenterLayout.visibility = View.VISIBLE
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
//隐藏状态中心
statusCenterLayout.visibility = View.GONE
}
val cross = RoadCross()
CallerMapRoadListenerManager.invokeRoadChange(0, cross)
// if (isChecked) {
// buttonView.setCompoundDrawables(null, null, iconDown, null)
// //展示状态中心
// statusCenterLayout.visibility = View.VISIBLE
// } else {
// buttonView.setCompoundDrawables(null, null, iconRight, null)
// //隐藏状态中心
// statusCenterLayout.visibility = View.GONE
// }
}
/**

View File

@@ -27,7 +27,7 @@ class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
RoadCrossCameraManager.instance.init()
RoadCrossCameraManager.instance.init(context)
SpeedLimitDataManager.getInstance().start()
if(DeviceUtils.isLenovoModel() || DeviceUtils.isEB5Model()){ //todo 新增稳定设备类型需要添加目的避免在nuc设备上使用此类功能
aiCloudIdentifyDataManager.initServer(AbsMogoApplication.getApp())

View File

@@ -1,11 +1,19 @@
package com.mogo.eagle.core.function.business.roadcross
import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.road.CameraDeviceInfo
import com.mogo.eagle.core.function.business.roadcross.net.NDERoadCameraNetWorkModel.Companion.ndeRoadCameraNetWorkModel
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.view.CameraMarkerView
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.map.overlay.core.Level
import com.mogo.map.overlay.point.Point
import com.zhidaoauto.map.data.road.RoadCross
import com.zhidaoauto.map.data.road.StopLine
import com.zhjt.service.chain.ChainLog
@@ -21,13 +29,19 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
}
}
private var mContext: Context? = null
@Volatile
private var isCameraRequest = false
@Volatile
private var roadCrossCameraList:List<CameraDeviceInfo>? = null
fun init() {
CallerMapRoadListenerManager.registerRoadListener(TAG, this)
@Volatile
private var roadCrossCameraList: List<CameraDeviceInfo>? = null
private val overlayManager = CallerMapUIServiceManager.getOverlayManager()
fun init(context: Context?) {
mContext = context
CallerMapRoadListenerManager.registerRoadListener(TAG, this) //todo emArrow test note
}
//todo 记录方法执行时间
@@ -35,33 +49,88 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
if (!isCameraRequest && newV < 100) {
isCameraRequest = true
val roadCrossEnd = CallerMapRoadListenerManager.getCrossInfo()?.cross_id_end
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
Log.d(
"emArrow",
"触发接口调用 dis: $distance , roadCrossEnd: ${roadCrossEnd ?: "null"} "
)
if (roadCrossEnd != null) {
ndeRoadCameraNetWorkModel.getRoadCrossInfo(roadCrossEnd, loc.longitude, loc.latitude, onSuccess = {
// 地图上打marker(注意marker方向)marker点击获取对应ip
if(it.roadUniqueId != null && it.roadUniqueId == roadCrossEnd){
roadCrossCameraList = it.deviceInfoList
UiThreadHandler.post {
ndeRoadCameraNetWorkModel.getRoadCrossInfo(roadCrossEnd,
onSuccess = {
if (it.roadUniqueId == null) {
traceError("roadUniqueId is null")
return@getRoadCrossInfo
}
}else{
}
}, onError = {
})
if (it.deviceInfoList.isEmpty()) {
traceError("deviceInfoList isEmpty")
return@getRoadCrossInfo
}
if (it.roadUniqueId != roadCrossEnd) {
traceError("cloud roadId :${it.roadUniqueId} is not equal currentCross : $roadCrossEnd")
return@getRoadCrossInfo
}
roadCrossCameraList = it.deviceInfoList
// 地图上打marker(注意marker方向)marker点击获取对应ip
it.deviceInfoList.forEach { deviceInfo ->
addCameraDeviceMarker(deviceInfo)
}
batchRequestCrossLive(it.deviceInfoList)
},
onError = {
traceError("roadCrossInfo request errorMsg: $it")
})
} else {
roadCrossTrace(
TAG, mapOf(
"errorMsg" to "roadCross is null",
"lat" to loc.latitude,
"lon" to loc.longitude
)
)
traceError("roadCross is null")
}
} else {
Log.d("emArrow", "distance:$distance")
}
}
private fun addCameraDeviceMarker(cameraDeviceInfo: CameraDeviceInfo) {
mContext?.let {
val builder =
Point.Options.Builder(TAG, Level.MAP_MARKER)
.setId(cameraDeviceInfo.deviceIp)
.anchor(0.5f, 1f)
.scale(0.6f)
.set3DMode(false)
.flat(false)
.isUseGps(true)
.controlAngle(false)
.icon(CameraMarkerView(it))
.longitude(cameraDeviceInfo.lon)
.latitude(cameraDeviceInfo.lat)
.onClick { id ->
Log.d("emArrow", "Marker click :$id")
ndeRoadCameraNetWorkModel.singleRequestCrossLive(id,
onSuccess = {
},
onError = {
})
}
CallerLogger.d("$M_MAP$TAG", "new road cross camera=$overlayManager")
overlayManager?.showOrUpdatePoint(builder.build())
}
}
@SuppressLint("NewApi")
private fun batchRequestCrossLive(cameraDeviceInfo: List<CameraDeviceInfo>) {
val list = mutableListOf<String>()
cameraDeviceInfo.forEach {
list.add(it.deviceIp)
}
ndeRoadCameraNetWorkModel.batchRequestCrossLive(list,
onSuccess = {
it.forEach {
// overlayManager?.setInfoWindowView(it.ip,)
}
}, onError = {
})
}
override fun onStopLineInfo(info: StopLine) {
super.onStopLineInfo(info)
distance = info.distance
@@ -69,20 +138,44 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) {
super.onRoadChange(cross, roadCross)
val data = CameraDeviceInfo("172.18.1.60", 112.582913287, 26.9320508672)
addCameraDeviceMarker(data)
val data1 = CameraDeviceInfo("172.18.1.42", 112.582947017, 26.9328373092)
addCameraDeviceMarker(data1)
val data2 = CameraDeviceInfo("172.18.1.72", 112.582421, 26.932519)
addCameraDeviceMarker(data2)
// 出路口
if (!cross) {
// 停止请求摄像头数据
ndeRoadCameraNetWorkModel.cancelRequest("roadCross")
// 清除marker
roadCrossCameraList?.let {
it.forEach { camera ->
overlayManager?.removePoint(camera.deviceIp)
}
}
// 释放控制
isCameraRequest = false
}
}
private fun traceError(msg: String) {
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
roadCrossTrace(
TAG, mapOf(
"errorMsg" to msg,
"lat" to loc.latitude,
"lon" to loc.longitude
)
)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_MAP,
nodeAliasCode = ChainConstant.CHAIN_CODE_MAP_ROAD_CROSS_ERROR,
paramIndexes = [0, 1]
paramIndexes = [0]
)
private fun roadCrossTrace(tag: String, paramMap: Any) {

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.business.roadcross.net
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.road.RoadCameraLive
import com.mogo.eagle.core.data.road.RoadCrossCamera
import retrofit2.http.Body
import retrofit2.http.GET
@@ -33,7 +34,7 @@ interface INDERoadCameraApiService {
@Query("ip") ip: String,
@Query("lon") lon: Double,
@Query("lat") lat: Double
): BaseResponse<Any>
): BaseResponse<RoadCameraLive>
// 批量ip查询设备直播流与缩略图
@Headers("Content-type:application/json;charset=UTF-8")
@@ -42,6 +43,6 @@ interface INDERoadCameraApiService {
@Header("MogoAuthKey") authKey: String,
@Header("MogoReqTime") time: String,
@Body map: MutableMap<String, Any>
): BaseResponse<Any>
): BaseResponse<List<RoadCameraLive>>
}

View File

@@ -2,7 +2,9 @@ package com.mogo.eagle.core.function.business.roadcross.net
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.road.RoadCameraLive
import com.mogo.eagle.core.data.road.RoadCrossCamera
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.cancel
@@ -25,18 +27,20 @@ class NDERoadCameraNetWorkModel private constructor() {
fun getRoadCrossInfo(
crossID: String,
lon: Double,
lat: Double,
onSuccess: ((RoadCrossCamera) -> Unit),
onError: ((String) -> Unit)
) {
request<BaseResponse<RoadCrossCamera>>("roadCross") {
loader {
apiCall {
val time = System.currentTimeMillis().toString()
val md5String = "${ROAD_CAMERA.uppercase(Locale.getDefault())}$time"
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val pair = getAuth(ROAD_CAMERA)
getNetWorkApi().roadCameraRequest(
Md5Util.getMD5Result(md5String), time, crossID, lon, lat
pair.first,
pair.second,
crossID,
loc.longitude,
loc.latitude
)
}
}
@@ -49,8 +53,68 @@ class NDERoadCameraNetWorkModel private constructor() {
}
}
fun singleRequestCrossLive(
ip: String, onSuccess: ((RoadCameraLive) -> Unit),
onError: ((String) -> Unit)
) {
request<BaseResponse<RoadCameraLive>>("roadCross") {
loader {
apiCall {
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val pair = getAuth(SINGLE_LIVE)
getNetWorkApi().cameraLiveSingleRequest(
pair.first,
pair.second,
ip,
loc.longitude,
loc.latitude
)
}
}
onSuccess {
onSuccess.invoke(it.result)
}
onError {
onError.invoke(it.message.toString())
}
}
}
fun batchRequestCrossLive(
list: MutableList<String>, onSuccess: ((List<RoadCameraLive>) -> Unit),
onError: ((String) -> Unit)
) {
request<BaseResponse<List<RoadCameraLive>>>("roadCross") {
loader {
apiCall {
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val map = mutableMapOf(
"lon" to loc.longitude,
"lat" to loc.latitude,
"ipList" to list
)
val pair = getAuth(BATCH_LIVE)
getNetWorkApi().cameraLiveBatchRequest(pair.first, pair.second, map)
}
}
onSuccess {
onSuccess.invoke(it.result)
}
onError {
onError.invoke(it.message.toString())
}
}
}
fun cancelRequest(tag: String) {
cancel(tag)
}
private fun getAuth(url: String): Pair<String, String> {
val time = System.currentTimeMillis().toString()
val md5String = "${url.uppercase(Locale.getDefault())}$time"
val auth = Md5Util.getMD5Result(md5String)
return Pair(auth, time)
}
}

View File

@@ -0,0 +1,73 @@
package com.mogo.eagle.core.function.view
import android.content.Context
import android.util.AttributeSet
import android.view.ViewGroup
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.map.R
import me.jessyan.autosize.utils.AutoSizeUtils
class CameraMarkerView(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
androidx.appcompat.widget.AppCompatImageView(context, attrs, defStyleAttr),
IMoGoSkinModeChangeListener {
companion object {
private const val TAG = "CameraMarkerView"
}
init {
if (this.layoutParams == null) {
this.setLayoutParams(
ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
)
}
modeChange(CallerMoGoUiSettingManager.getDayMode())
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerSkinModeListenerManager.addListener(TAG, this)
}
override fun onSkinModeChange(skinMode: Int) {
modeChange(skinMode)
}
private fun modeChange(mode: Int) {
when (mode) {
0 -> {
setImageResource(R.drawable.map_marker_camera_view_select)
resize(106, 121)
}
1 -> {
setImageResource(R.drawable.map_marker_camera_view_right_light_select)
resize(74, 83)
}
else -> {
setImageResource(R.drawable.map_marker_camera_view_select)
resize(106, 121)
}
}
}
private fun resize(width: Int, height: Int) {
//设置宽高
val params = layoutParams
params.width = AutoSizeUtils.dp2px(context, width.toFloat())
params.height = AutoSizeUtils.dp2px(context, height.toFloat())
layoutParams = params
requestLayout()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerSkinModeListenerManager.removeListener(TAG)
}
}

View File

@@ -59,7 +59,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
//设置倾斜手势是否可用。
it.setTiltGesturesEnabled(false)
//设置双指缩放手势是否可用。
it.setZoomGesturesEnabled(false)
it.setZoomGesturesEnabled(true)
}
}
@@ -109,7 +109,10 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
// 跟新地图控件 112.582776,26.931655
gnssInfo.longitude = 112.582776
gnssInfo.latitude = 26.931655 //todo emArrow test
gnssInfo.heading = 15.0
setExtraGPSData(gnssInfo)
accLimit = gnssInfo.acceleration < accThreshold
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#FFCC00"
android:startColor="#FFA417" />
<corners android:radius="90dp" />
<padding
android:bottom="@dimen/dp_6"
android:left="@dimen/dp_6"
android:right="@dimen/dp_40"
android:top="@dimen/dp_6" />
</shape >

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!---->
<item>
<shape android:shape="oval">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<gradient
android:angle="315"
android:endColor="#151D45"
android:startColor="#151D45"
android:type="linear" />
</shape>
</item>
<!-- 中心背景 -->
<item>
<shape android:shape="oval">
<solid android:color="#323C6F" />
<corners android:radius="720dp" />
</shape>
</item>
</layer-list>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/shape_id" >
<!-- 倒三角 -->
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45" >
<shape android:shape="rectangle" >
<solid android:color="#feb712" />
</shape >
</rotate >
</item >
</layer-list >

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/road_camera_left_light_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/road_camera_left_light_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/road_camera_left_light_select" android:state_selected="true" />
<item android:drawable="@drawable/road_camera_left_light_select" android:state_focused="true" />
<item android:drawable="@drawable/road_camera_left_light" />
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/road_camera_right_light_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/road_camera_right_light_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/road_camera_right_light_select" android:state_selected="true" />
<item android:drawable="@drawable/road_camera_right_light_select" android:state_focused="true" />
<item android:drawable="@drawable/road_camera_right_light" />
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:width="@dimen/dp_106" android:height="@dimen/dp_121">
<item android:drawable="@drawable/road_camera_press" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/road_camera_press" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/road_camera_press" android:state_selected="true" />
<item android:drawable="@drawable/road_camera_press" android:state_focused="true" />
<item android:drawable="@drawable/road_camera" />
</selector>

View File

@@ -45,22 +45,25 @@ object CallerMapRoadListenerManager {
}
}
private var mStopLine:StopLine? = null
fun invokeListenersOnStopLineGet(stopLine: StopLine) {
mStopLine = stopLine
listeners.forEach { entry ->
entry.value.onStopLineInfo(stopLine)
}
}
private var mCross: Int by Delegates.observable(-1) { _, oldValue, newValue ->
if (oldValue != newValue) {
CallerLogger.d("$M_MAP onRoadChange", newValue)
// if (oldValue != newValue) {
CallerLogger.d("$M_MAP onRoadChange observable", newValue)
listeners.forEach { entry ->
when (newValue) {
1, 2 -> entry.value.onRoadChange(false, mRoadCross)
else -> entry.value.onRoadChange(true, mRoadCross)
}
}
}
// }
}
private var mRoadCross: RoadCross? = null
@@ -76,6 +79,8 @@ object CallerMapRoadListenerManager {
paramIndexes = [0, 1]
)
fun invokeRoadChange(cross: Int, roadCross: RoadCross) {
CallerLogger.d("$M_MAP onRoadChange", "oldValue: $mCross , " + "mStopLine:${mStopLine?.distance}" +
"newValue: $cross , oldCross:$mRoadCross , newCross:$roadCross")
mCross = cross
mRoadCross = roadCross

View File

@@ -1,6 +1,6 @@
apply plugin: 'LancetX'
LancetX {
enable true
enable false
enableInDebug true
blackList = [
"com.mogo.launcher.lancet.jank",

View File

@@ -2,7 +2,7 @@ if (!rootProject.isReleaseBuild()) {
apply plugin: 'bytex.matrix'
matrix {
trace {
enable = true //if you don't want to use trace canary, set false
enable = false //if you don't want to use trace canary, set false
baseMethodMapFile = "${project.buildDir}/matrix_output/customMethodMapping.txt"
blackListFile = "${project.projectDir}/matrixTrace/blackMethodList.txt"
}

View File

@@ -1,6 +1,6 @@
apply plugin: 'bytex.threadOpt'
thread_opt {
enable true
enable false
enableInDebug true
logLevel "DEBUG"
trace_enable !rootProject.isReleaseBuild()

View File

@@ -70,7 +70,7 @@ object BitmapDescriptorFactory {
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
)
view.layout(0, 0, view.measuredWidth, view.measuredHeight)
val bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888);
val canvas = Canvas(bitmap)
// canvas.drawColor(Color.WHITE);
view.draw(canvas);

View File

@@ -578,7 +578,7 @@ public class Marker(private var markerOptions: MarkerOptions,private var mMapCon
if (CompileConfig.DEBUG) {
Log.i(TAG, "markerop--matt--showInfoWindow--start:${id}")
}
val view = TextView(context);
val view = TextView(context)
view.layoutParams = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT)
view.textSize = 10.0f
view.text = id

View File

@@ -1,5 +1,6 @@
package com.mogo.map.overlay
import android.view.View
import com.mogo.map.MogoMap.Companion.DEFAULT
import com.mogo.map.overlay.core.*
import com.mogo.map.overlay.line.*
@@ -11,6 +12,8 @@ interface IMoGoOverlayManager {
fun showOrUpdatePoint(options: PointOptions, mapTag:String = DEFAULT): Point?
fun setInfoWindowView(id: String, view: View)
fun hidePoint(id: String)
fun hidePoint(p: Point)

View File

@@ -245,7 +245,7 @@ data class Point(val id: String, val owner: String, val level: Level, val option
internal var alpha = 1.0f
/**
* 设置Marker覆盖物的透明度
* 设置Marker覆盖物的缩放比
*/
internal var scale = 1.0f

View File

@@ -1,5 +1,7 @@
package com.mogo.map.overlay.proxy
import android.view.View
interface IMapOverlay {
@@ -30,6 +32,10 @@ interface IMapOverlay {
*/
fun isVisible(): Boolean
/**
* 设置 Marker 覆盖物的 InfoWindowView
*/
fun setInfoWindowView(view: View){}
/**
* 设置当前marker在最上面。
@@ -42,5 +48,6 @@ interface IMapOverlay {
fun setUnTop()
fun onRemove(action: (id: String) -> Unit)
}

View File

@@ -7,6 +7,7 @@ import android.os.Bundle
import android.os.Handler
import android.os.HandlerThread
import android.text.TextUtils
import android.util.Log
import android.view.MotionEvent
import android.view.View
import com.autonavi.nge.map.OnMapScreenShotListener
@@ -251,6 +252,7 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
private var roadCross: RoadCross? by Delegates.observable(null) { _, oldValue, newValue ->
oldValue?.let {
Log.d("$M_MAP$TAG", "onRoadCrossInfo oldValue:$oldValue, newValue:$newValue")
//对驶入驶出路口做二次过滤,防止多次回调
if (it.status == 0 && newValue!!.status == 1) {
//径直进入路口

View File

@@ -1,6 +1,7 @@
package com.mogo.map.overlay
import android.graphics.*
import android.view.View
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.utilcode.util.*
@@ -63,6 +64,12 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
}
}
override fun setInfoWindowView(id: String, view: View) {
points.filter { it.key.id == id && it.value.isVisible() }.onEach {
it.value.setInfoWindowView(view)
}
}
override fun hidePoint(id: String) {
points.filter { it.key.id == id && it.value.isVisible() }.onEach {
it.value.setVisible(false)

View File

@@ -1,15 +1,20 @@
package com.mogo.map.overlay.wrapper.point
import com.mogo.eagle.core.data.map.*
import android.view.View
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.map.overlay.point.Point.Options
import com.mogo.map.overlay.proxy.point.*
import com.mogo.map.overlay.proxy.point.IMapPointOverlay
import com.mogo.map.utils.ObjectUtils
import com.zhidaoauto.map.data.point.LonLatPoint
import com.zhidaoauto.map.sdk.open.renders.marker.Marker
import com.zhidaoauto.map.sdk.open.view.MapAutoView
import java.util.concurrent.atomic.AtomicBoolean
import com.zhidaoauto.map.sdk.open.renders.marker.Marker
class AMapPointWrapper(private val id: String, private val delegate: Marker, private val mMapAutoView: MapAutoView): IMapPointOverlay {
class AMapPointWrapper(
private val id: String,
private val delegate: Marker,
private val mMapAutoView: MapAutoView
) : IMapPointOverlay {
private val isDestroyed by lazy { AtomicBoolean(false) }
@@ -54,6 +59,10 @@ class AMapPointWrapper(private val id: String, private val delegate: Marker, pri
return delegate.isVisible()
}
override fun setInfoWindowView(view: View) {
delegate.setInfoWindowView(view)
}
override fun setToTop() {
if (isDestroyed.get() || isRemoved.get()) {
return
@@ -72,11 +81,15 @@ class AMapPointWrapper(private val id: String, private val delegate: Marker, pri
if (isDestroyed.get() || isRemoved.get()) {
return
}
delegate.setMarkerOptions(ObjectUtils.fromMogo(opt,mMapAutoView))
delegate.setMarkerOptions(ObjectUtils.fromMogo(opt, mMapAutoView))
}
override fun addDynamicAnchorPosition(point: MogoLatLng, angle: Float, duration: Long) {
delegate.addDynamicAnchorPostion(LonLatPoint(point.lon, point.lat, angle.toDouble()), System.currentTimeMillis(), duration.toInt())
delegate.addDynamicAnchorPostion(
LonLatPoint(point.lon, point.lat, angle.toDouble()),
System.currentTimeMillis(),
duration.toInt()
)
}
override fun onRemove(action: (id: String) -> Unit) {