Skip to content

MapWinGIS6 — Map Model and Basic Navigation - #34

Merged
pmeems merged 2 commits into
developmentfrom
phase-1-map-model-and-layer-collection
Oct 31, 2026
Merged

pmeems merged 2 commits into
developmentfrom
phase-1-map-model-and-layer-collection

Conversation

@pmeems

@pmeems pmeems commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Phase 1 of the Map Model and Basic Navigation plan.

Motivation

Core had no notion of a map. ActiveX holds one dataset and its extent directly. Later phases (viewport, multi-layer rendering, navigation, drag-and-drop) need one authoritative Core model that owns the layers and their combined extent.

What changes

  • mwg::Map / mwg::MapLayer (mapwingis/map/Map.h): an ordered layer collection with add, remove by identity, clear, count, position lookup, find, and visibility.
  • Map::GetExtent(ExtentScope): the union of valid layer extents. VisibleLayers (the default, used for zoom-to-map) excludes hidden layers; AllLayers includes them.
  • Extent::IsValid(): non-empty with all bounds finite.
  • Test fixture MakeRectanglesDataset and MapTests.cpp (20 tests). No window and no ActiveX.
  • docs/ARCHITECTURE.md gets a "Map model" section on identity, ordering, ownership, duplicates, visibility, extents, and coordinates.

Key design decisions

  • Stable identity: LayerId is a monotonically increasing value that is never reused, not even after Clear. Positions shift; identities don't.
  • Ordering: position 0 is the bottom layer and is drawn first. AddLayer appends on top.
  • Ownership: MapLayer holds a shared_ptr<VectorDataset>, so the source layer outlives the caller's handle. Layers are stored as unique_ptr, so removing one layer never invalidates references to the others.
  • Duplicates: the same source layer may be added more than once. Each addition gets its own identity and visibility.
  • Extents are computed on each call rather than cached, so visibility changes and source edits never leave a stale extent. VectorLayer already caches its own extent.
  • No reprojection: layers are assumed to share compatible coordinates, as documented.
  • Pimpl classes keep the DLL ABI stable, in line with the existing Core types.

Dependencies / follow-up

  • Based on development. Later phases stack on this branch.
  • ActiveX is not switched to Map yet; that is Phase 3.

Build: Debug|x64, 0 warnings. Tests: 190 passed, 3 skipped (opt-in suites).

Introduce mwg::Map and mwg::MapLayer: an ordered layer collection with stable LayerId identities, visibility, shared dataset ownership, and a combined extent of valid layer extents. Add Extent::IsValid, a MakeRectanglesDataset test fixture, map tests, and architecture docs.

Co-authored-by: Junie <junie@jetbrains.com>

@Julian-MW Julian-MW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source review complete. I left two inline comments: one for the LayerId overflow edge case and one for missing coverage of a successful non-zero source-layer index.

Comment thread src/MapWinGIS.Core/src/map/Map.cpp Resolved
Comment thread tests/MapWinGIS.Core.Tests/MapTests.cpp Resolved
@pmeems
pmeems added this pull request to stack #36 October 31, 2026 08:43
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pmeems
pmeems merged commit 67a154f into development Oct 31, 2026
1 check passed
@pmeems
pmeems deleted the phase-1-map-model-and-layer-collection branch October 31, 2026 11:52
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