[6.5.0][地图marker] 线绘制添加填充选项[TODO]

This commit is contained in:
renwj
2024-07-01 15:39:30 +08:00
parent 81e4bea8ea
commit e7f38d437b
6 changed files with 50 additions and 16 deletions

View File

@@ -91,7 +91,7 @@ class AiRoadMarker {
marker.entity?.apply { roadMarker.drawMarkers(this, wrapper) }
}
if (drawRoadLine) {
//施工中心点前方的自车行驶方向上300米距离
/* //施工中心点前方的自车行驶方向上300米距离
var l1: CenterLine? = null
var l2: CenterLine? = null
mogoMapData.get()?.getCenterLineRangeInfo(
@@ -118,7 +118,7 @@ class AiRoadMarker {
}
countDown.incrementAndGet()
realMark(marker, wrapper, l1, l2, location.heading)
})
})*/
} else {
wrapper.onRemoved = { id ->
aiMakers.remove(id)

View File

@@ -52,9 +52,25 @@ class V2XAiRoadEventMarker {
builder.setMaxIndex(800000f)
builder.setVisible(true)
val line = CallerMapUIServiceManager.getOverlayManager()?.showOrUpdateLine(builder.build())
// val colors2 = ArrayList<Int>()
// colors2.add(Color.argb(204, 237, 172, 21))
// colors2.add(Color.argb(0, 255, 255, 255))
// builder2.colors(colors2)
// builder2.points(points)
// builder2.setIsGradient(true)
// builder2.isFilledIn(true)
// builder2.useFacade(false)
// builder2.setUseGps(true)
// builder2.setWidth(10f)
//// builder2.setMaxIndex(800000f)
// builder2.setVisible(true)
// val line2 = CallerMapUIServiceManager.getOverlayManager()?.showOrUpdateLine(builder2.build())
line?.let {
current.set(Pair(line, wrapper.markers))
wrapper.addLine(line)
// wrapper.addLine(line2!!)
}
}
}

View File

@@ -21,7 +21,12 @@ enum class Level(val zIndex: Int) {
GUIDE_ROUTE_LINE(75000),
/**
* 道路围栏区域绘制
* 围栏区域绘制
*/
MAP_POLYGON(76000)
MAP_POLYGON(76000),
/**
* 围栏区域底色
*/
MAP_POLYGON_SOLID(75500)
}

View File

@@ -56,6 +56,8 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
val isShowArrow: Boolean = builder.isShowArrow
val isFilledIn: Boolean = builder.isFilledIn
fun builder(): Builder {
return builder
}
@@ -100,6 +102,8 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
internal var isShowArrow: Boolean = false
internal var isFilledIn: Boolean = false
fun setId(id: String) = apply {
this.id = id
}
@@ -176,6 +180,10 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
this.isShowArrow = show
}
fun isFilledIn(filled: Boolean) = apply {
this.isFilledIn = filled
}
fun build(): Options {
if (TextUtils.isEmpty(id)) {
id = UUID.randomUUID().toString()

View File

@@ -75,12 +75,17 @@ class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMo
e(TAG, "polyline参数为空")
return null
}
val delegate =
(if (polylineOptions.lineWidth > 0) mAMap!!.drawThickLine(polylineOptions) else mAMap!!.drawLine(
polylineOptions
))
?: return null
return AMapPolylineWrapper(options.id, delegate, mMapView)
if (options.isFilledIn) {
val delegate = mAMap?.drawPolygon(polylineOptions)
return AMapPolylineWrapper(options.id, delegate, mMapView)
} else {
val delegate =
(if (polylineOptions.lineWidth > 0) mAMap?.drawThickLine(polylineOptions) else mAMap?.drawLine(
polylineOptions
))
?: return null
return AMapPolylineWrapper(options.id, delegate, mMapView)
}
}
private val batchMarkerOptions = BatchMarkerOptions()

View File

@@ -7,7 +7,7 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView
import java.util.concurrent.atomic.*
import com.zhidaoauto.map.sdk.open.renders.poyline.Polyline
class AMapPolylineWrapper(private val id: String, private val delegate: Polyline, private val mMapAutoView: MapAutoView): IMapPolylineOverlay {
class AMapPolylineWrapper(private val id: String, private val delegate: Polyline?, private val mMapAutoView: MapAutoView): IMapPolylineOverlay {
private val isDestroyed by lazy { AtomicBoolean(false) }
@@ -19,7 +19,7 @@ class AMapPolylineWrapper(private val id: String, private val delegate: Polyline
override fun destroy() {
if (isDestroyed.compareAndSet(false, true)) {
try {
delegate.destroy()
delegate?.destroy()
} finally {
onRemoveAction?.invoke(id)
}
@@ -29,7 +29,7 @@ class AMapPolylineWrapper(private val id: String, private val delegate: Polyline
override fun remove() {
if (isRemoved.compareAndSet(false, true)) {
try {
delegate.remove()
delegate?.remove()
} finally {
onRemoveAction?.invoke(id)
}
@@ -40,7 +40,7 @@ class AMapPolylineWrapper(private val id: String, private val delegate: Polyline
if (isDestroyed.get() || isRemoved.get()) {
return
}
delegate.setVisible(visible)
delegate?.setVisible(visible)
}
override fun isDestroyed(): Boolean {
@@ -48,7 +48,7 @@ class AMapPolylineWrapper(private val id: String, private val delegate: Polyline
}
override fun isVisible(): Boolean {
return delegate.isVisible()
return delegate?.isVisible() ?: false
}
override fun setToTop() {
@@ -66,7 +66,7 @@ class AMapPolylineWrapper(private val id: String, private val delegate: Polyline
delegate.also {
val option = ObjectUtils.fromMogo(options,mMapAutoView)
if (option != null) {
it.setOption(option)
it?.setOption(option)
}
}
}