Repository navigation
MapWinGIS6 — Map Model and Basic Navigation - #38
Merged
Merged
Conversation
pmeems
force-pushed
the
phase-4-programmatic-navigation
branch
from
October 31, 2026 11:52
32e0968 to
32d3aa4
Compare
Add mwg::MapView as the single owner of the map, its viewport, and its render scene, and CreateMapRenderScene to build an owned multi-layer scene with per-layer skip reasons. GDI and OpenGL backends now draw every layer through the same Viewport; GDI skips only layers it cannot draw. The ActiveX control delegates loading, resizing, and redraw decisions to MapView and no longer keeps its own extent or transform. LoadVectorDataset now adds a layer on top of the map. Co-authored-by: Junie <junie@jetbrains.com>
Add Pan, Zoom, and anchored ZoomAt to Viewport, and ZoomToLayer, ZoomIn, ZoomOut, ZoomAt, and Pan to MapView on top of the existing FitToMap. Every operation returns whether the view changed, clamps to the viewport limits, and handles empty maps, missing layers, and invalid extents without changing the view. A pending fit can target the map or one layer, and navigation that changes the view cancels it. Co-authored-by: Junie <junie@jetbrains.com>
pmeems
force-pushed
the
phase-4-programmatic-navigation
branch
from
October 31, 2026 15:44
32d3aa4 to
57186bf
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cancel deferred fits for missing layers, document resize error state and anchored zoom limits, and multiply zoom-out resolution directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 4 of the map model and basic navigation plan: programmatic navigation in Core. Stacked on #37 (Phase 3).
Motivation
Phase 5 needs mouse-wheel zoom, drag-to-pan, and zoom-to-map/layer in the ActiveX control. This PR puts navigation math in Core, where tests need no window, COM, or renderer. Hosts use the return values to decide whether to redraw.
Changes
Viewportprimitives:Pan(dx, dy)takes a map-unit delta.Zoom(factor)divides the resolution around the center, andZoomOut(factor)multiplies it directly without an inexact reciprocal.ZoomAt(anchor, factor)keeps the map coordinate under a screen point in place unless the limits intervene.MapViewnavigation builds on the Phase 3FitToMap. New calls areZoomToLayer(LayerId, padding),ZoomIn,ZoomOut,ZoomAt, andPan. The center-zoom calls require a factor above 1 and default tokDefaultZoomFactor = 2.falsepreserves it.Design decisions
Zoom-to-map uses only visible layers. Zoom-to-layer also fits a hidden layer because the caller names it. Empty maps, missing layers, and layers without a valid extent return
falseand keep the view. Non-finite input and invalid factors or padding throwInvalidArgument.Resizecan propagate an extent-read error while completing a pending fit. The new size stays applied, the pending fit is discarded, and the center and resolution stay unchanged. The host must redraw after this error. The public header and architecture documentation describe this contract.ZoomAtclamps the requested resolution against the old center, then clamps it again against the new center. Moving the center can raise the minimum resolution and move the anchored coordinate, even without center clamping. This limit behavior is documented and tested.Pantakes map units and does not depend on input events. Phase 5 converts pixel drag deltas itself.ZoomAtrequires a valid viewport, while pan and center zoom only require a view.Tests
The updated Debug x64 solution builds with 0 warnings. The native suite runs 304 tests: 301 pass and 3 opt-in tests skip. The skips are the network GDAL test, registered ActiveX hosting check, and rendering performance baseline.
Navigation tests cover map and layer fitting, padding, hidden and empty layers, missing layers, factors, centers, anchors, pan deltas, and limits. The review follow-up adds 10 tests and extends existing cases. Pending fits now have coverage for replacement in both directions, cancellation by pan and center zoom, and cancellation by missing or empty layers.
Unchanged navigation at a resolution limit preserves the pending fit.
ZoomAtalso preserves it on a zero-sized viewport because that call cannot change the view. A changingZoomAtcannot coexist with a pending fit: fits only wait when the viewport has no size. The tests cover this reachable state rather than changing the viewport-validity contract.Additional tests cover anchor movement when the new center raises the minimum resolution and direct zoom-out multiplication, including overflow and resolution limits.
README.md,docs/ARCHITECTURE.md, anddocs/TESTING.mddescribe the current behavior.Known limits
COM and mouse navigation remain Phase 5 work. There is no clipping, so deep zoom can push a layer past the GDI coordinate range. There are no snapped scales or navigation history.