|
|
@@ -12,6 +12,7 @@ import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.util.BitmapUtil
|
|
|
import com.onlylemi.mapview.library.MapView
|
|
|
import com.onlylemi.mapview.library.layer.MapBaseLayer
|
|
|
+import java.util.Collections
|
|
|
import kotlin.math.cos
|
|
|
import kotlin.math.sin
|
|
|
|
|
|
@@ -47,35 +48,8 @@ class CustomStationLayer @JvmOverloads constructor(
|
|
|
paint.style = Paint.Style.FILL_AND_STROKE
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
override fun onTouch(event: MotionEvent) {
|
|
|
- if (pointList.isNotEmpty()) {
|
|
|
- val goal = mapView.convertMapXYToScreenXY(event.x, event.y)
|
|
|
-
|
|
|
- for (i in pointList.indices) {
|
|
|
- var continueOuterLoop = false // 双循环跳出标志变量
|
|
|
-
|
|
|
- // 计算文字点击
|
|
|
- val width = paint.measureText(pointList[i].entityName) / currentZoom
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 计算图标点击
|
|
|
|
|
|
- // 跳出外层循环
|
|
|
- if (continueOuterLoop) break
|
|
|
-
|
|
|
- if (i == pointList.size - 1) {
|
|
|
- isClickMark = false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (listener != null && isClickMark) {
|
|
|
- listener!!.markIsClick(num, btnIndex)
|
|
|
- mapView.refresh()
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
override fun draw(
|
|
|
@@ -88,8 +62,9 @@ class CustomStationLayer @JvmOverloads constructor(
|
|
|
currentDegree = 360 - currentRotateDegrees
|
|
|
if (isVisible) {
|
|
|
canvas.save()
|
|
|
- if (pointList.isNotEmpty()) {
|
|
|
- pointList.forEach { point ->
|
|
|
+ val synchronizedList = Collections.synchronizedList(pointList)
|
|
|
+ if (synchronizedList.isNotEmpty()) {
|
|
|
+ for (point in synchronizedList) {
|
|
|
val mark = point.pos
|
|
|
val goal = floatArrayOf(mark.x, mark.y)
|
|
|
currentMatrix.mapPoints(goal)
|