mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
fix: correct longitude bounds in Maidenhead grid overlay (left/right were swapped, so meridians and worked-grid fills never drew)
This commit is contained in:
1 parent
13df0dfcec
commit
366edd8bbb
1 file changed
+6
-4
+6
-4
@@ -25,6 +25,8 @@ import org.osmdroid.views.Projection
|
|||||||
import org.osmdroid.views.overlay.Overlay
|
import org.osmdroid.views.overlay.Overlay
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
import kotlin.math.max
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maidenhead locator grid overlay, drawn directly on the map canvas.
|
* Maidenhead locator grid overlay, drawn directly on the map canvas.
|
||||||
@@ -71,10 +73,10 @@ class MaidenheadGridOverlay : Overlay() {
|
|||||||
// Visible bounding box in geographic coordinates
|
// Visible bounding box in geographic coordinates
|
||||||
val north = projection.fromPixels(0, 0)
|
val north = projection.fromPixels(0, 0)
|
||||||
val south = projection.fromPixels(canvas.width, canvas.height)
|
val south = projection.fromPixels(canvas.width, canvas.height)
|
||||||
val topLat = north.latitude.coerceIn(-90.0, 90.0)
|
val topLat = max(north.latitude, south.latitude).coerceIn(-90.0, 90.0)
|
||||||
val bottomLat = south.latitude.coerceIn(-90.0, 90.0)
|
val bottomLat = min(north.latitude, south.latitude).coerceIn(-90.0, 90.0)
|
||||||
val leftLon = south.longitude
|
val leftLon = min(north.longitude, south.longitude)
|
||||||
val rightLon = north.longitude
|
val rightLon = max(north.longitude, south.longitude)
|
||||||
|
|
||||||
val firstRow = floor(bottomLat / cellLat).toInt()
|
val firstRow = floor(bottomLat / cellLat).toInt()
|
||||||
val lastRow = ceil(topLat / cellLat).toInt()
|
val lastRow = ceil(topLat / cellLat).toInt()
|
||||||
|
|||||||
Reference in new issue
Block a user