[V2X][Road]优化道路标记颜色逻辑
[V2X][Road]优化道路标记颜色逻辑2
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import android.util.*
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
@@ -65,14 +66,18 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
* 获取当前时刻WGS84 lat
|
||||
*/
|
||||
fun getCurWgs84Lat(): Double {
|
||||
return mAutopilotStatusInfo.locationLat
|
||||
val locationLat = mAutopilotStatusInfo.locationLat
|
||||
Log.d("GO", "wgs84_lat:" + locationLat)
|
||||
return locationLat
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时刻WGS84 lon
|
||||
*/
|
||||
fun getCurWgs84Lon(): Double {
|
||||
return mAutopilotStatusInfo.locationLon
|
||||
val locationLon = mAutopilotStatusInfo.locationLon
|
||||
Log.d("GO", "wgs84_lon:" + locationLon)
|
||||
return locationLon
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,10 +16,19 @@ object CallerMapLocationListenerManager : CallerBase() {
|
||||
// 记录地图最后一次位置
|
||||
private var mLocation: MogoLocation? = null
|
||||
|
||||
/**
|
||||
* 记录最后一次高精坐标的位置
|
||||
*/
|
||||
private var mGpsLocation: MogoLocation? = null
|
||||
|
||||
// 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步
|
||||
private val mMapStyleChangeListeners: ConcurrentHashMap<String, IMoGoMapLocationListener> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
|
||||
// 高精坐标回调
|
||||
private val mGpsChangedListeners: ConcurrentHashMap<String, IMoGoMapLocationListener> = ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* 获取当前经纬度
|
||||
*/
|
||||
@@ -27,44 +36,76 @@ object CallerMapLocationListenerManager : CallerBase() {
|
||||
return mLocation
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前高精坐标
|
||||
*/
|
||||
fun getCurrentGpsLocation(): MogoLocation? {
|
||||
return mGpsLocation
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加 地图样式改变 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoMapLocationListener
|
||||
) {
|
||||
if (mMapStyleChangeListeners.containsKey(tag)) {
|
||||
return
|
||||
fun addListener(@Nullable tag: String, @Nullable listener: IMoGoMapLocationListener, isGps: Boolean) {
|
||||
if (!isGps) {
|
||||
if (mMapStyleChangeListeners.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mMapStyleChangeListeners[tag] = listener
|
||||
listener.onLocationChanged(mLocation, 0, isGps)
|
||||
} else {
|
||||
if (mGpsChangedListeners.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mGpsChangedListeners[tag] = listener
|
||||
listener.onLocationChanged(mGpsLocation, 0, isGps)
|
||||
}
|
||||
mMapStyleChangeListeners[tag] = listener
|
||||
listener.onLocationChanged(mLocation, 0)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 地图样式改变 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeListener(@Nullable tag: String) {
|
||||
if (!mMapStyleChangeListeners.containsKey(tag)) {
|
||||
return
|
||||
fun removeListener(@Nullable tag: String, isGps: Boolean) {
|
||||
if (!isGps) {
|
||||
if (!mMapStyleChangeListeners.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mMapStyleChangeListeners.remove(tag)
|
||||
} else {
|
||||
if (!mGpsChangedListeners.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mGpsChangedListeners.remove(tag)
|
||||
}
|
||||
mMapStyleChangeListeners.remove(tag)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 地图样式改变 监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(@Nullable listener: IMoGoMapLocationListener) {
|
||||
if (!mMapStyleChangeListeners.containsValue(listener)) {
|
||||
return
|
||||
}
|
||||
mMapStyleChangeListeners.forEach {
|
||||
if (it.value == listener) {
|
||||
mMapStyleChangeListeners.remove(it.key)
|
||||
fun removeListener(@Nullable listener: IMoGoMapLocationListener, isGps: Boolean) {
|
||||
if (!isGps) {
|
||||
if (!mMapStyleChangeListeners.containsValue(listener)) {
|
||||
return
|
||||
}
|
||||
mMapStyleChangeListeners.forEach {
|
||||
if (it.value == listener) {
|
||||
mMapStyleChangeListeners.remove(it.key)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!mGpsChangedListeners.containsValue(listener)) {
|
||||
return
|
||||
}
|
||||
mGpsChangedListeners.forEach {
|
||||
if (it.value == listener) {
|
||||
mGpsChangedListeners.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,20 +114,25 @@ object CallerMapLocationListenerManager : CallerBase() {
|
||||
* 触发 地图样式改变 监听
|
||||
*/
|
||||
fun invokeMapLocationChangeListener() {
|
||||
invokeMapLocationChangeListener(mLocation, 0)
|
||||
invokeMapLocationChangeListener(mLocation, 0, false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发 地图样式改变 监听
|
||||
* @param location 选中状态
|
||||
*/
|
||||
fun invokeMapLocationChangeListener(location: MogoLocation?, from: Int) {
|
||||
mLocation = location
|
||||
mMapStyleChangeListeners.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onLocationChanged(location, from)
|
||||
fun invokeMapLocationChangeListener(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
if (!isGps) {
|
||||
mLocation = location
|
||||
mMapStyleChangeListeners.forEach {
|
||||
val listener = it.value
|
||||
listener.onLocationChanged(location, from, isGps)
|
||||
}
|
||||
} else {
|
||||
mGpsLocation = location
|
||||
mGpsChangedListeners.forEach {
|
||||
it.value.onLocationChanged(location, from, isGps)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user