[V2X][Road]施工区域添加围栏
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road
|
||||
|
||||
import android.graphics.*
|
||||
import android.util.*
|
||||
import com.mogo.cloud.commons.utils.*
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
@@ -14,6 +15,7 @@ import com.mogo.module.common.utils.*
|
||||
import java.util.*
|
||||
import java.util.concurrent.atomic.*
|
||||
import kotlin.Pair
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
object V2XAiRoadEventMarker {
|
||||
|
||||
@@ -29,6 +31,8 @@ object V2XAiRoadEventMarker {
|
||||
|
||||
private val distance = AtomicInteger(0)
|
||||
|
||||
private val overlayManager by lazy { MogoOverlayManager.getInstance() }
|
||||
|
||||
fun drawMarkers(entity: V2XRoadEventEntity): Pair<IMogoPolyline?, List<IMogoMarker>?>? {
|
||||
removeMarkers(current.get())
|
||||
timerTask.get()?.cancel()
|
||||
@@ -69,7 +73,32 @@ object V2XAiRoadEventMarker {
|
||||
v2xMarker()?.drawableAlarmPOI(context(), entity, null)
|
||||
val l2 = entity.noveltyInfo?.location ?: return null
|
||||
v2xLocation.set(MogoLocation().also { it.longitude = l2.lon; it.latitude = l2.lat; it.bearing = l2.angle.toFloat() })
|
||||
current.set(Pair(null, markers))
|
||||
|
||||
val options = MogoPolylineOptions()
|
||||
val colors = ArrayList<Int>()
|
||||
colors.add(Color.argb(204, 237, 172, 21))
|
||||
colors.add(Color.argb(0, 255, 255, 255))
|
||||
options.colorValues(colors)
|
||||
val points = ArrayList<MogoLatLng>()
|
||||
|
||||
for (p in polygons) {
|
||||
points.add(MogoLatLng(p.second, p.first))
|
||||
}
|
||||
if (points.size > 2) {
|
||||
points.add(points[0])
|
||||
}
|
||||
options.points(points);
|
||||
options.useGradient(true)
|
||||
options.useFacade(true)
|
||||
options.setGps(false)
|
||||
options.width(5f)
|
||||
options.zIndex(75000f)
|
||||
options.maxIndex(800000f)
|
||||
val line = overlayManager.addPolyline(options)
|
||||
current.set(Pair(line, markers))
|
||||
if (line != null) {
|
||||
line.isVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user