MapControl floating map toolbar plugin - #238
Open
CarsonDavis wants to merge 1 commit into
Open
Conversation
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.
Description
Second half of the split of #115 (by @BhattaraiSijan) — the MapControl plugin itself, stacked on #237, which provides the core APIs it consumes. All 27 files are byte-identical to the original branch; commits are attributed to the original author. Do not merge before #237.
Closes #98.
Adds MapControl, a floating toolbar over the map with four features, each enabled/disabled per-mission from the Configure page. The plugin is bus-only: the React component is MMGIS-independent and a thin wrapper translates its callbacks into
mmgisAPIcalls (all provided by #237).Geocode search
On each keystroke we hit the Nominatim API with the URL-encoded query — debounced 300ms, only firing for queries ≥2 chars,
limit=5. No API key or backend (public endpoint). On selecting a result we reorder Nominatim's bbox into Leaflet order, fly to it viamap:fitBounds, and drop a pin viamap:createLayer.Basemap switching
Lists the styles from
msv.basemap.styles[](or provider defaults) viamap:getBasemapStylesand switches withmap:setBasemap— deck.gl swaps the vector style in place; Leaflet rebuilds the tile layer.Measure
Subscribes to
map:click/map:mousemove, collects two points, and draws the line + endpoints as a vector layer viamap:createLayer. Distance is computed with Turf; the label is positioned by projecting the segment midpoint viamap:latLngToContainerPoint.Zoom
map:zoomIn/map:zoomOut, clamped to the engine's min/max zoom.Dependency on #90 (imapengine-drawing)
Vector overlays (the measure line and the search pin) are drawn via
map:createLayer/map:removeLayer, which are provided by #90. Until #90 merges these two features no-op (guarded, no crash); the rest of the plugin is self-contained. See #115 for the full rationale on why this usesmap:createLayerrather than its own overlay channels.Known limitation / future work
MapControl is a floating overlay, not a docked panel, so it bypasses the normal panel-mount path: it self-mounts at bundle load by polling for the map container and rendering into a
position:fixedlayer ondocument.body. This works but should be replaced by a proper "floating tool" mount path in the Modern layout so overlays don't have to self-mount.Testing
Unit suite and
npm run buildpass on the stacked branch. Manual checks (from #115):