mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
fix(map): worked cells at sub-square zoom stay line-free — grid lines skip worked segments
Lines (alpha 160 yellow) were drawn AFTER the worked fills (alpha 90 green), so at zoom>=6 every worked cell's four borders got yellow-on-green composited — the cells looked brighter than the same cells at field zoom (no square lines there). Segments bordering a worked cell are now skipped in both meridian and parallel passes.
This commit is contained in:
1 parent
1d4036e3d0
commit
ab8b072f1f
1 file changed
+36
-4
+36
-4
@@ -169,20 +169,52 @@ class MaidenheadGridOverlay : Overlay() {
|
||||
}
|
||||
}
|
||||
|
||||
// Vertical lines (meridians)
|
||||
// Vertical lines (meridians), segmented per cell row so that worked
|
||||
// grid cells stay line-free (same look as field-zoom fills: green
|
||||
// patches without square grid lines). Only relevant at sub-square
|
||||
// zoom; at field zoom cellLabel() yields 2-char fields which never
|
||||
// match the 4-char workedGrids, so all lines draw.
|
||||
for (turn in -colRepeats..colRepeats) for (col in firstCol..lastCol) {
|
||||
val lon = col * cellLon
|
||||
val x = projectionToX(projection, lon, centerLon, worldWidthPx)
|
||||
if (x == null) continue
|
||||
canvas.drawLine(x, 0f, x, canvas.height.toFloat(), linePaint)
|
||||
for (row in firstRow..lastRow) {
|
||||
val lat = row * cellLat
|
||||
if (lat < -90.0 || lat >= 90.0) continue
|
||||
val topLatCell = lat + cellLat
|
||||
if (topLatCell > 90.0) continue
|
||||
val yTop = projectionToY(projection, topLatCell) ?: continue
|
||||
val yBottom = projectionToY(projection, lat) ?: continue
|
||||
// This meridian is a border of the cell on its right (col)
|
||||
// and of the cell on its left (col-1); skip the segment if
|
||||
// either cell is a worked grid.
|
||||
val workedHere =
|
||||
cellLabel(lat, lon, zoom) in workedGrids ||
|
||||
cellLabel(lat, lon - cellLon, zoom) in workedGrids
|
||||
if (workedHere) continue
|
||||
canvas.drawLine(x, yTop, x, yBottom, linePaint)
|
||||
}
|
||||
}
|
||||
// Horizontal lines (parallels)
|
||||
// Horizontal lines (parallels), segmented per cell column so worked
|
||||
// cells have no lines through them either.
|
||||
for (row in firstRow..lastRow) {
|
||||
val lat = row * cellLat
|
||||
if (lat <= -90.0 || lat >= 90.0) continue
|
||||
val y = projectionToY(projection, lat)
|
||||
if (y == null) continue
|
||||
canvas.drawLine(0f, y, canvas.width.toFloat(), y, linePaint)
|
||||
for (turn in -colRepeats..colRepeats) for (col in firstCol..lastCol) {
|
||||
val lon = col * cellLon
|
||||
val xLeft = projectionToX(projection, lon, centerLon, worldWidthPx) ?: continue
|
||||
val xRight = projectionToX(projection, lon + cellLon, centerLon, worldWidthPx) ?: continue
|
||||
if (xRight < 0f || xLeft > canvas.width) continue
|
||||
// This parallel borders the cell above (row) and below
|
||||
// (row-1); skip the segment if either is worked.
|
||||
val workedHere =
|
||||
cellLabel(lat, lon, zoom) in workedGrids ||
|
||||
cellLabel(lat - cellLat, lon, zoom) in workedGrids
|
||||
if (workedHere) continue
|
||||
canvas.drawLine(xLeft, y, xRight, y, linePaint)
|
||||
}
|
||||
}
|
||||
|
||||
// The station's own grid square: redraw its four borders thicker on top.
|
||||
|
||||
Reference in new issue
Block a user