[V2X][Road]优化道路标记颜色逻辑
[V2X][Road]优化道路标记颜色逻辑2
This commit is contained in:
@@ -11,7 +11,6 @@ import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -61,7 +60,6 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
|
||||
import com.mogo.eagle.core.function.hmi.ui.upgrade.UpgradeListAdapter
|
||||
import com.mogo.eagle.core.network.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
@@ -186,7 +184,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.addListener(TAG, this)
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
// 添加 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
// 添加 规划路径相关回调 监听
|
||||
@@ -221,7 +219,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
|
||||
// 移除 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
// 移除 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
// 移除 规划路径相关回调 监听
|
||||
@@ -2014,7 +2012,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int) {
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -46,7 +45,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
private var hasInit = false
|
||||
|
||||
override fun init(context: Context?) {
|
||||
CallerMapLocationListenerManager.addListener(functionName, this)
|
||||
CallerMapLocationListenerManager.addListener(functionName, this, false)
|
||||
executor.set(context?.let {
|
||||
GatherApi.also { itx ->
|
||||
itx.init(it,
|
||||
@@ -65,7 +64,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG")
|
||||
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG", false)
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
|
||||
executor.get()?.setOnTaskListener(null)
|
||||
listeners.clear()
|
||||
@@ -148,7 +147,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int) {
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
location ?: return
|
||||
executor.get()?.updateLocation(
|
||||
location.longitude,
|
||||
|
||||
@@ -130,7 +130,7 @@ public class AMapCustomView
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
initAMapView(context);
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
|
||||
//设置全览模式
|
||||
overLayerView.setOnClickListener(v -> {
|
||||
displayCustomOverView();
|
||||
@@ -258,7 +258,7 @@ public class AMapCustomView
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class AMapCustomView
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
|
||||
mLocation = location;
|
||||
MarkerDrawerManager.INSTANCE.setLonLat(new Pair(location.getLongitude(), location.getLatitude()));
|
||||
drawCarMarker(location);
|
||||
|
||||
@@ -99,14 +99,14 @@ public class SmallMapDirectionView
|
||||
initAMapView();
|
||||
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
|
||||
}
|
||||
|
||||
private void initAMapView() {
|
||||
@@ -162,7 +162,7 @@ public class SmallMapDirectionView
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.cloud.passport.IMoGoTokenCallback
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.network.ParamsUtil
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD_SHOW
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
|
||||
@@ -140,7 +139,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun registerListener() {
|
||||
V2XManager.addCallback(this)
|
||||
CallerMapLocationListenerManager.addListener(TAG, this)
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
BridgeApi.registerCenter()?.let {
|
||||
it.registerMogoMapListener(MODULE_NAME, this)
|
||||
it.registerMogoMarkerClickListener(
|
||||
@@ -160,7 +159,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun unRegisterListener() {
|
||||
V2XManager.removeCallback(this)
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
BridgeApi.registerCenter()?.let {
|
||||
it.unregisterMogoMapListener(MODULE_NAME)
|
||||
it.unregisterMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION)
|
||||
@@ -331,7 +330,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
})
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int) {
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
location ?: return
|
||||
BridgeApi.location.set(location)
|
||||
if (V2XManager.hasInit()) {
|
||||
@@ -485,7 +484,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
val p = CoordinateUtils.transformWgsToGcj(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0)
|
||||
l4.lon = p[0]
|
||||
l4.lat = p[1]
|
||||
AiRoadMarker.enqueue(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { d ->
|
||||
AiRoadMarker.enqueue(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { d ->
|
||||
android.util.Pair(d.lon, d.lat)
|
||||
}))
|
||||
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0
|
||||
|
||||
@@ -10,7 +10,6 @@ import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
|
||||
import com.mogo.eagle.core.function.api.map.listener.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
@@ -40,19 +39,19 @@ object AiRoadMarker {
|
||||
|
||||
private val overlayManager by lazy { MogoOverlayManager.getInstance() }
|
||||
|
||||
private val redLine by lazy { AtomicReference<IMogoPolyline>() }
|
||||
private val line by lazy { AtomicReference<IMogoPolyline>() }
|
||||
|
||||
private val redLineColors = arrayListOf(Color.parseColor("#002ABAD9"), Color.parseColor("#FF7A30"))
|
||||
private val colors = arrayListOf(Color.parseColor("#002ABAD9"), Color.parseColor("#FF7A30"))
|
||||
|
||||
private val markerCache = ConcurrentSet<Marker>()
|
||||
private val markers = ConcurrentSet<Marker>()
|
||||
|
||||
private val redLineOptions by lazy {
|
||||
private val options by lazy {
|
||||
MogoPolylineOptions().apply {
|
||||
zIndex(40000f)
|
||||
setGps(true)
|
||||
width(30f)
|
||||
width(50f)
|
||||
useGradient(true)
|
||||
colorValues(redLineColors)
|
||||
colorValues(colors)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,21 +69,30 @@ object AiRoadMarker {
|
||||
|
||||
pool.execute {
|
||||
var interrupted = false
|
||||
Log.d(TAG, "--- consumer --- 0 ---")
|
||||
Logger.d(TAG, "--- consumer --- 0 ---")
|
||||
while (!interrupted) {
|
||||
try {
|
||||
Log.d(TAG, "--- consumer --- 1 ---")
|
||||
Logger.d(TAG, "--- consumer --- 1 ---")
|
||||
val top = queue.take() ?: continue
|
||||
Log.d(TAG, "--- consumer --- 2 ---")
|
||||
val location = carLocation.get() ?: continue
|
||||
val isFrontOfCar = isFrontOfCar(top.poi_lon, top.poi_lat, location.first, location.second, location.third)
|
||||
val isSameRoad = isSameRoad(top.poi_lon, top.poi_lat, location.first, location.second, location.third)
|
||||
Log.d(TAG, "--- consumer --- 3 ---isFrontOfCar: $isFrontOfCar, isSameRoad: $isSameRoad")
|
||||
if (isFrontOfCar && isSameRoad) {
|
||||
Logger.d(TAG, "--- consumer --- 2 ---")
|
||||
val location = carLocation.get()
|
||||
if (location == null) {
|
||||
if (queue.isEmpty()) {
|
||||
synchronized(markers) {
|
||||
markers.clear()
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
val isTrigger = isTriggerEvent(top.poi_lon, top.poi_lat, location.first, location.second, location.third)
|
||||
Logger.d(TAG, "--- consumer --- 3 ---: isTrigger => $isTrigger")
|
||||
if (isTrigger) {
|
||||
marker.set(top)
|
||||
marker(top)
|
||||
} else {
|
||||
markerCache.remove(top)
|
||||
synchronized(markers) {
|
||||
markers.remove(top)
|
||||
}
|
||||
}
|
||||
interrupted = Thread.currentThread().isInterrupted
|
||||
} catch (e: InterruptedException) {
|
||||
@@ -95,11 +103,12 @@ object AiRoadMarker {
|
||||
}
|
||||
}
|
||||
|
||||
private fun isSameRoad(x1: Double, y1: Double, x2: Double, y2: Double, angle: Double): Boolean {
|
||||
val c1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(x1, y1, angle.toFloat(), 500f)
|
||||
val c2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(x2, y2, angle.toFloat(), 500f)
|
||||
Log.d(TAG, "isSameRoad--: [$x1, $y1, ${c1.road_id}] ==> [$x2, $y2, ${c2.road_id}]")
|
||||
return c1 != null && c2 != null && c1.road_id.isNotEmpty() && c1.road_id == c2.road_id
|
||||
private fun isTriggerEvent(x1: Double, y1: Double, x2: Double, y2: Double, a2: Double): Boolean {
|
||||
val angle = DrivingDirectionUtils.getDegreeOfCar2Poi2(x2, y2, x1, y1, a2)
|
||||
if (angle <= 60 && DrivingDirectionUtils.distance(x1, y1, x2, y2) <= 300) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private val onRoadListener = object : OnRoadListener {
|
||||
@@ -107,7 +116,7 @@ object AiRoadMarker {
|
||||
private var hasCrossRoad = false
|
||||
|
||||
override fun onRoadIdInfo(roadId: String) {
|
||||
Log.d(TAG, "--- onRoadInfo --- roadId: $roadId")
|
||||
Logger.d(TAG, "--- onRoadInfo --- roadId: $roadId")
|
||||
val oldRoadId = this.roadId
|
||||
if (oldRoadId != roadId) {
|
||||
if (hasCrossRoad) {
|
||||
@@ -117,7 +126,7 @@ object AiRoadMarker {
|
||||
this.roadId = roadId
|
||||
}
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
Log.d(TAG, "--- onStopLineInfo --- info: $info")
|
||||
Logger.d(TAG, "--- onStopLineInfo --- info: $info")
|
||||
if (!hasCrossRoad) {
|
||||
hasCrossRoad = true
|
||||
}
|
||||
@@ -127,17 +136,17 @@ object AiRoadMarker {
|
||||
private val onLocationListener = object : IMoGoMapLocationListener {
|
||||
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int) {
|
||||
if (location == null) {
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
if (location == null || !isGps) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
val loc = arrayOf(CallerAutoPilotStatusListenerManager.getCurWgs84Lon(), CallerAutoPilotStatusListenerManager.getCurWgs84Lat())
|
||||
val loc = arrayOf(location.longitude, location.latitude)
|
||||
carLocation.set(Triple(loc[0], loc[1], location.bearing.toDouble()))
|
||||
val marker = marker.get() ?: return
|
||||
val isOutOfRange = isOutOfRange(marker.poi_lon, marker.poi_lat, carLocation.get().first, carLocation.get().second, carLocation.get().third)
|
||||
if (isOutOfRange) {
|
||||
Log.d(TAG, "--- onLocationChanged: isOutOfRange --- ")
|
||||
Logger.d(TAG, "--- onLocationChanged: isOutOfRange --- ")
|
||||
unMarker(marker)
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
@@ -148,42 +157,48 @@ object AiRoadMarker {
|
||||
|
||||
private fun onCreate() {
|
||||
CallerMapRoadListenerManager.registerRoadListener(TAG, onRoadListener)
|
||||
CallerMapLocationListenerManager.addListener(TAG, onLocationListener)
|
||||
CallerMapLocationListenerManager.addListener(TAG, onLocationListener, true)
|
||||
}
|
||||
|
||||
private fun onDestroy() {
|
||||
CallerMapRoadListenerManager.unRegisterRoadListener(TAG)
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
CallerMapLocationListenerManager.removeListener(TAG, true)
|
||||
pool.shutdownNow()
|
||||
removeRedLine()
|
||||
removeLine()
|
||||
}
|
||||
|
||||
|
||||
fun enqueue(marker: Marker) {
|
||||
Log.d(TAG, "--- enqueue --- 1 ---")
|
||||
if (markerCache.contains(marker)) {
|
||||
Log.d(TAG, "--- enqueue --- cache hit ---")
|
||||
Logger.d(TAG, "--- enqueue --- 1 ---")
|
||||
if (markers.contains(marker)) {
|
||||
Logger.d(TAG, "--- enqueue --- cache hit ---")
|
||||
return
|
||||
}
|
||||
Log.d(TAG, "--- enqueue --- 2 ---")
|
||||
markerCache += marker
|
||||
Logger.d(TAG, "--- enqueue --- 2 ---")
|
||||
synchronized(markers) {
|
||||
markers += marker
|
||||
}
|
||||
pool.execute {
|
||||
Log.d(TAG, "--- enqueue --- 3 ---${Thread.currentThread().name}::${Thread.currentThread().id}")
|
||||
Logger.d(TAG, "--- enqueue --- 3 ---${Thread.currentThread().name}::${Thread.currentThread().id}")
|
||||
queue.put(marker)
|
||||
}
|
||||
}
|
||||
|
||||
private fun marker(marker: Marker) {
|
||||
Log.d(TAG, "--- marker --- 1 ---")
|
||||
val location = carLocation.get() ?: return
|
||||
Log.d(TAG, "--- marker --- 2 ---")
|
||||
removeRedLine()
|
||||
//施工中心点前方的自车行驶方向上300米距离
|
||||
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
|
||||
//施工中心点后方的自车行驶方向上300米距离
|
||||
Log.d(TAG, "--- marker --- 3 --- l1: $l1")
|
||||
Logger.d(TAG, "--- marker --- 3 --- l1: $l1")
|
||||
val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), -300f)
|
||||
Log.d(TAG, "--- marker --- 4 --- l2: $l2")
|
||||
if (l1.points.isEmpty() || l2.points.isEmpty()) {
|
||||
Logger.d(TAG, "--- marker --- 3 --- return ----")
|
||||
synchronized(markers) {
|
||||
markers.remove(marker)
|
||||
}
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "--- marker --- 4 --- l2: $l2")
|
||||
val points = LinkedList<MogoLatLng>()
|
||||
if (l2 != null && l2.points.isNotEmpty()) {
|
||||
points.addAll(l2.points.reversed().map {
|
||||
@@ -192,7 +207,7 @@ object AiRoadMarker {
|
||||
}
|
||||
val centerX= marker.poi_lon
|
||||
val centerY = marker.poi_lat
|
||||
Log.d(TAG, "--- marker --- 5 --- marker: $marker")
|
||||
Logger.d(TAG, "--- marker --- 5 --- marker: $marker")
|
||||
val farthestPoint = marker.polygon?.let {
|
||||
var find: Pair<Double, Double> = Pair(centerX, centerY)
|
||||
var min = Long.MAX_VALUE
|
||||
@@ -203,46 +218,53 @@ object AiRoadMarker {
|
||||
find = p
|
||||
}
|
||||
}
|
||||
MogoLatLng(find.second, find.second)
|
||||
MogoLatLng(find.second, find.first)
|
||||
} ?: MogoLatLng(centerY, centerX)
|
||||
marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat)
|
||||
Log.d(TAG, "--- marker --- 6 --- marker: $marker")
|
||||
Logger.d(TAG, "--- marker --- 6 --- marker: $marker")
|
||||
if (l1 != null && l1.points.isNotEmpty()) {
|
||||
for (l in l1.points) {
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(farthestPoint.lon, farthestPoint.lat, l.first, l.second, location.third) < 90L) {
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(farthestPoint.lon, farthestPoint.lat, l.first, l.second, location.third + 180) < 90L) {
|
||||
points.add(l.let { MogoLatLng(it.second, it.first) })
|
||||
}
|
||||
}
|
||||
}
|
||||
var line = redLine.get()
|
||||
redLineOptions.points(points)
|
||||
Log.d(TAG, "--- marker --- 7 --- points: ${points.size}")
|
||||
if (points.size <= 1) {
|
||||
synchronized(markers) {
|
||||
markers.remove(marker)
|
||||
}
|
||||
return
|
||||
}
|
||||
removeLine()
|
||||
var line = line.get()
|
||||
options.points(points)
|
||||
Logger.d(TAG, "--- marker --- 7 --- points: ${points.size}")
|
||||
if (line == null || line.isDestroyed) {
|
||||
val l = overlayManager.addPolyline(redLineOptions)
|
||||
this.redLine.set(l)
|
||||
val l = overlayManager.addPolyline(options)
|
||||
this.line.set(l)
|
||||
line = l
|
||||
} else {
|
||||
line.setOption(redLineOptions)
|
||||
line.setOption(options)
|
||||
}
|
||||
if (!line.isVisible) {
|
||||
line.isVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeRedLine() {
|
||||
val old = redLine.get()
|
||||
Log.d(TAG, "--- removeRedLine --- 1 ---")
|
||||
private fun removeLine() {
|
||||
val old = line.get()
|
||||
Logger.d(TAG, "--- removeRedLine --- 1 ---")
|
||||
if (old != null) {
|
||||
Log.d(TAG, "--- removeRedLine --- 2 ---")
|
||||
redLine.set(null)
|
||||
Logger.d(TAG, "--- removeRedLine --- 2 ---")
|
||||
line.set(null)
|
||||
old.isVisible = false
|
||||
old.remove()
|
||||
}
|
||||
}
|
||||
|
||||
private fun unMarker(marker: Marker) {
|
||||
markerCache -= marker
|
||||
removeRedLine()
|
||||
markers -= marker
|
||||
removeLine()
|
||||
}
|
||||
|
||||
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
|
||||
@@ -257,6 +279,7 @@ object AiRoadMarker {
|
||||
data class Marker(
|
||||
val poi_lat: Double,
|
||||
val poi_lon: Double,
|
||||
val poi_angle: Double,
|
||||
val polygon: List<Pair<Double, Double>>?,
|
||||
var farthestPoint: Pair<Double, Double>? = null
|
||||
) {
|
||||
|
||||
@@ -106,7 +106,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
|
||||
sV2XWarningMarker.onCarLocationChanged2(location);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user