|
|
@@ -22,7 +22,7 @@ import kotlin.math.sin
|
|
|
class CustomStationLayer @JvmOverloads constructor(
|
|
|
mapView: MapView?, private var pointList: List<IsolationPoint> = mutableListOf()
|
|
|
) : MapBaseLayer(mapView) {
|
|
|
-
|
|
|
+ var inDraw: Boolean = false
|
|
|
private var listener: MarkIsClickListener? = null
|
|
|
private var radiusMark = 0f
|
|
|
private lateinit var paint: Paint
|
|
|
@@ -68,6 +68,10 @@ class CustomStationLayer @JvmOverloads constructor(
|
|
|
override fun draw(
|
|
|
canvas: Canvas, currentMatrix: Matrix, currentZoom: Float, currentRotateDegrees: Float
|
|
|
) {
|
|
|
+ if (inDraw) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ inDraw = true
|
|
|
this.currentZoom = currentZoom
|
|
|
currentDegree = 360 - currentRotateDegrees
|
|
|
|
|
|
@@ -77,7 +81,8 @@ class CustomStationLayer @JvmOverloads constructor(
|
|
|
// 把 mapView 本身的缩放/平移/旋转一次性 concat 到 Canvas
|
|
|
canvas.concat(currentMatrix)
|
|
|
val switchData = ModBusController.getSwitchData()
|
|
|
- pointList.forEach { point ->
|
|
|
+ val tempPointList = pointList.toList()
|
|
|
+ tempPointList.forEach { point ->
|
|
|
val switchStatus = switchData
|
|
|
.find { it.idx == point.pointSerialNumber?.toInt() }?.enabled
|
|
|
// point.pos.x/y 已经是「图内像素坐标」
|
|
|
@@ -129,6 +134,7 @@ class CustomStationLayer @JvmOverloads constructor(
|
|
|
}
|
|
|
|
|
|
canvas.restore()
|
|
|
+ inDraw = false
|
|
|
}
|
|
|
|
|
|
private fun rotatePoint(
|