Skip to content

feat: add Hybrid Map Editor with Natural Earth regions, manual 1° tile editing and presets - #77

Open
ricardo404 wants to merge 1 commit into
flysimdev:mainfrom
ricardo404:feat/hybrid-map-editor
Open

ricardo404 wants to merge 1 commit into
flysimdev:mainfrom
ricardo404:feat/hybrid-map-editor

Conversation

@ricardo404

Copy link
Copy Markdown

Summary

Adds a Hybrid Map editor page in the sidebar allowing users to configure prioritised regional imagery provider layers over a global fallback provider, combining Natural Earth region selection with manual 1° × 1° tile painting/erasing, undo/redo history, and JSON / Share Code preset export and import.

What Changed

  • Routing & Persistence (CustomMapSources.cs, MountSettings.cs, TileSource.cs, SettingsOptions.cs):
    • Extends regional-providers in orthostreamxp.ini to support prioritised layers (Layer|Name|ColorHex|Visible|Providers|CompactTiles) with compact coordinate range encoding while keeping backward compatibility with legacy 4-part Natural Earth entries (Kind|Name|Parent|Providers).
    • Builds combined provider rules in layer priority order for visible layers, falling back to texture-provider outside layer tiles.
  • Hybrid Map Editor UI (HybridMapView.xaml, HybridMapView.xaml.cs, HybridMapViewModel.cs, CustomMapItems.cs, MainWindow.xaml, MainViewModel.cs):
    • Adds a Hybrid Map navigation item below Packages with layer priority ordering, colour swatches, visibility toggles, and provider selection.
    • Supports adding/removing Natural Earth regions (+ Add region / - Remove region) alongside manual 1° × 1° tile editing (Pan / Click, Draw box (+), Erase box (-), Shift+drag, Ctrl+drag) and Undo / Redo (Ctrl+Z / Ctrl+Y).
    • Adds Export JSON, Import JSON, Copy code, and Paste code (OSXP-HYBRID-1:... GZip + Base64) including custom map source definitions.
    • Keeps Settings > Pictures and download focused on custom tile sources, global provider selection, and connection testing with a shortcut to Hybrid Map.
  • Tests (CustomMapSourcesTests.cs):
    • Adds unit tests covering custom source validation, Natural Earth override parsing, compact tile serialization/deserialization, layer priority/visibility ordering, and tile routing fallback.

How to Test

  1. Run dotnet test --solution OrthoStreamXP.slnx (including CustomMapSourcesTests).
  2. Stop streaming if active, open Hybrid Map, add a layer, add a Natural Earth region or draw/erase 1° tiles, and test Undo / Redo.
  3. Export a preset to JSON, copy a Share Code, clear/modify layers, and import back via Import JSON and Paste code.
  4. Start streaming and verify in the log/tiles that layer tiles use the assigned provider while remaining tiles use the global fallback.

Review Notes

  • Please review orthostreamxp.ini serialization/deserialization edge cases (especially malformed presets, share code sizes, and custom source merging).
  • Please verify WPF lifecycle/command state handling while streaming is running or transitioning states.
image image

@flysimdev

Copy link
Copy Markdown
Owner

@ricardo404
Hello, thanks for your PR; I'll review it as soon as possible.
Every contribution to the project is important and appreciated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants