Changes between Initial Version and Version 1 of Ticket #8464, comment 16


Ignore:
Timestamp:
2026-09-21T21:54:07+02:00 (7 days ago)
Author:
wangi

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8464, comment 16

    initial v1  
    1515
    1616==== User facing changes
    17  * View > '''Show grid''' toggles the grid (a `PreferenceToggleAction`, usable as toolbar button).
     17 * New '''View > Grid''' submenu holds everything related to the grid: '''Show''' toggles it; '''Set origin to selection''' moves the grid so a line passes through the selected node, or through the centroid (arithmetic mean position of every node reachable from the selection) otherwise, and enables the grid; '''Align rotation to selection''' rotates the grid parallel to the selected way (first to last node) or the two selected nodes, switching to a projected grid; '''Grid preferences...''' opens the preferences dialog directly to the new Grid tab.
    1818 * New '''Grid''' preferences tab, placed below Map Projection: enable, grid type, east/north spacing, rotation, origin, minimum line distance on screen, line width, blend mode.
    19  * The imagery layer popup menu (right click on the map) gets two entries: '''Set grid origin here''' (uses the mouse position, converted to the coordinates of the grid type, and enables the grid) and '''Align grid rotation to selection''' (rotates the grid parallel to the selected way, first to last node, or to the two selected nodes; switches to a projected grid).
    20  * Imagery layers get a '''Show tile borders''' checkbox in the layer list context menu and in the map popup menu (next to "Show tile info"). It draws a thin border around each tile (colour "imagery tile border"), is stored per layer in sessions like the other display settings, and replaces the previous debug-only red outline (which still appears with `--debug`).
     19 * Imagery layers get a '''Show tile borders''' checkbox in the layer list context menu and in the map popup menu (next to "Show tile info"). It draws a thin border around each tile (colour "imagery tile border"), is stored per layer in sessions like the other display settings, and replaces the previous debug-only red outline (which still appears with `--debug`). Toggling it also writes the default for new layers, so unlike the sibling settings the choice survives a restart; loading a session sets the layer only and leaves that default alone.
    2120
    22 Preferences: `draw.grid.enabled`, `draw.grid.type`, `draw.grid.spacing-x`, `draw.grid.spacing-y`, `draw.grid.rotation`, `draw.grid.origin-x`, `draw.grid.origin-y`, `draw.grid.min-pixel-spacing`, `draw.grid.line-width`, `draw.grid.blend-mode`; `imagery.generic.default_showtileborders` for the default of new imagery layers.
     21Preferences: `draw.grid.enabled`, `draw.grid.type`, `draw.grid.spacing-x`, `draw.grid.spacing-y`, `draw.grid.rotation`, `draw.grid.origin-x`, `draw.grid.origin-y`, `draw.grid.min-pixel-spacing`, `draw.grid.line-width`, `draw.grid.blend-mode`; `imagery.generic.default_showtileborders` for the default of new imagery layers, written whenever the user toggles the tile borders.
    2322
    2423==== Implementation
    2524 * `gui/layer/MapGridPaintable`: the overlay, registered as a permanent temporary layer by `MapFrame`; geometry (`getProjectedGridLines`, `getLatLonGridLines`, `projectionUnitsPerMetre`, `thinningFactor`) is in static methods so it can be tested without a GUI.
    26  * `gui/draw/BlendComposite`: the blend modes.
    27  * `actions/ShowGridAction`, `actions/SetGridOriginAction`, `actions/AlignGridRotationAction`.
     25 * `gui/draw/BlendComposite`: the blend modes. Composing follows the "source over" rule of the W3C compositing model, so a translucent destination is handled correctly and not just the opaque map view.
     26 * `actions/ShowGridAction`, `actions/SetGridOriginAction`, `actions/AlignGridRotationAction` (both `JosmAction`s wired into `MainMenu`'s new `mapMenu`).
    2827 * `gui/preferences/display/GridPreference`, registered in `PreferenceTabbedPane` after `ProjectionPreference`.
    2928 * `gui/layer/imagery/TileSourceDisplaySettings`: `showTileBorders` (session property `show-tile-borders`), `gui/layer/imagery/ShowTileBordersAction`, painting in `AbstractTileSourceLayer.paintTileText`.
    30  * One new icon `preferences/grid.svg`.
     29 * Four new icons: `preferences/grid.svg` for the preferences tab, and `grid.svg` / `gridorigin.svg` / `gridrotate.svg` for the menu entries.
    3130
    3231==== Unit tests
    3332 * `MapGridPaintableTest`: axis aligned grid (line count and positions), origin offset and 45° rotation, invalid spacings and line limits, lat/lon lines (spacing, origin, clamping to the world, antimeridian), thinning factor, projection units per metre (equator, 50°, 20.6°, outside the world), and painting both grid types with a blend mode onto an image.
    3433 * `BlendCompositeTest`: exact pixel values for every mode on three image types, alpha handling, neutral colours.
    35  * `GridActionsTest`: origin for both grid types, rotation reduction into [0, 90) including the four symmetric directions, selection handling (one way, two nodes, anything else disabled).
     34 * `GridActionsTest`: origin from a single selected node and from the centroid of a way's nodes and a relation's node members (both grid types), rotation reduction into [0, 90) including the four symmetric directions, selection handling (one way, two nodes, anything else disabled), live enabling/disabling as the selection changes.
    3635 * `GridPreferenceTest`, `TileSourceDisplaySettingsTest` (change event, session round trip, equals/hashCode).
    3736 * Existing `TMSLayerTest`, `AbstractTileSourceLayerTest`, `SessionReaderTest`, `SessionWriterTest` and the display preference tests pass unchanged; checkstyle is clean.
    3837
    39 Known limitations: the grid entries in the popup menu are only reachable while an imagery layer is present, since there is no general map context menu; the metric spacing is exact at the origin and drifts with the Mercator scale factor away from it (about 0.3 % per 50 km north/south at 20° latitude). The help topics `/MapView#Grid` and `/Preferences/Grid` still need wiki pages.
    40 
    41 
     38Known limitations: the metric spacing is exact at the origin and drifts with the Mercator scale factor away from it (about 0.3 % per 50 km north/south at 20° latitude); a latitude/longitude grid's meridians stop at the projection's usable latitude range (e.g. ±85° for Mercator) when that becomes visible, which is correct (the same limit applies to data and imagery) but can look surprising at first. The help topics `/MapView#Grid` and `/Preferences/Grid` still need wiki pages (some drafts done).