From ab8b072f1f9622615d053438a35269a0377df86a Mon Sep 17 00:00:00 2001 From: atsunatsu Date: Tue, 8 Sep 2026 03:44:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(map):=20worked=20cells=20at=20sub-square=20?= =?UTF-8?q?zoom=20stay=20line-free=20=E2=80=94=20grid=20lines=20skip=20wor?= =?UTF-8?q?ked=20segments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../feature/map/MaidenheadGridOverlay.kt | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt b/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt index ecfe3879..65de3f9d 100644 --- a/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt +++ b/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt @@ -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.