Repository navigation
Conversation
* Make bearing a clockwise map rotation bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。 * ci: build MapConductorCore from the matching branch コアの未リリースな変更に追随する PR を、コアのリリースを待たずに検証できるようにする。Package.swift が元から持っている「隣に ios-sdk-core があればそれを使う」経路に乗せるだけ。 * fix: make the CGFloat pitch conversion explicit MKMapCamera.pitch は CGFloat。暗黙変換に任せると CoreGraphics の cos(CGFloat) と Foundation の cos(Double) が両方候補になり、ツールチェーンによっては ambiguous use of 'cos' で落ちる。
* Make bearing a clockwise map rotation bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。 * ci: build MapConductorCore from the matching branch コアの未リリースな変更に追随する PR を、コアのリリースを待たずに検証できるようにする。Package.swift が元から持っている「隣に ios-sdk-core があればそれを使う」経路に乗せるだけ。 * fix: make the CGFloat pitch conversion explicit MKMapCamera.pitch は CGFloat。暗黙変換に任せると CoreGraphics の cos(CGFloat) と Foundation の cos(Double) が両方候補になり、ツールチェーンによっては ambiguous use of 'cos' で落ちる。 * Reject a re-sent identical marker list at the door SwiftUI re-evaluates map content on every camera change and hands the full marker list back to syncMarkers each time. For 144k markers the per-pass sets, dictionaries and hasEntity locks ran on the main thread for hundreds of milliseconds -- the 'pinch feels heavy on iOS' report. MarkerListIdentity (core) compares the list by reference and lets an unchanged list return in under a millisecond. Applied to every provider because fixing one just moves the report to the next one. Also pass declutterPx through to the tile renderer -- the option was silently ignored here while MapLibre honoured it -- and drop the per-subscription log line, which emitted 144k lines on first sync. * fix: account for Retina scale in MapKit raster tiles * feat: integrate vector style support and pending map fixes --------- Co-authored-by: masashi <info@mkgeeklab.com>
A tiled marker has no native marker, so the base update() only rewrote the manager and nothing reached the map: changing an icon or position in place left the drawn tiles as they were. Invalidate the tiles and rebuild the layer with a versioned URL, once per burst of updates.
Redraw tiles when a tiled marker changes
The polygon controller gets ios-sdk-core's PolygonTiler: from 2,000 polygons or 50,000 vertices they are drawn into raster tiles on the local tile server and shown as one raster layer (mc-polygon-tiles), upserted into the raster layer controller so the app's raster layers and the marker tiles are left alone. Taps still resolve against the original shapes. The content update asks the tiler to show the tiles again when the tile server has moved.
Natively drawn markers are reported by MarkerIngestionEngine once the renderer has created them; markers that went into the tiles are reported after the tile layer has been handed to the map.
clearOverlays() only removed native annotations (or map items, or did nothing at all), leaving every MapConductor overlay on the map and in its manager. It now calls clear() on the marker, polyline, polygon, ground image, circle and raster layer controllers, as android-sdk does. The controllers live in the host, so the host hands the view controller a handler when it creates them.
Make clearOverlays() clear the overlay controllers
ring(_:geodesic:) densified a geodesic ring with createInterpolatePoints, which only interpolates between neighbouring points. Rings arrive open, so the closing edge (last vertex -> first) stayed a straight chord in both fill and outline (Boston -> London -> Iceland: the Iceland -> Boston edge). Use ios-sdk-core's densifyGeodesicRing. geodesic=false is unchanged. Requires the ios-sdk-core release that adds densifyGeodesicRing.
A geodesic=false ring went through Planar.createInterpolatePoints, which only interpolates between neighbouring points, so the closing edge (last vertex -> first) stayed one straight Web Mercator segment while the other edges - and polylines with geodesic=false - follow linear lat/lng interpolation. Use ios-sdk-core's densifyPolygonRing for both modes (it replaces the unreleased densifyGeodesicRing). Requires the ios-sdk-core release that adds densifyPolygonRing.
Interpolate the closing edge of polygons, geodesic or not
clearOverlays() cleared this provider's own overlay controllers but not the strategy controller behind MarkerRenderingSupport, so markers drawn by clustering (or any other marker-rendering plugin) stayed on the map. It now ends with MapServiceRegistry.clearMarkerRendering() (ios-sdk-core fix/clear-strategy), which reaches the registered support's clearMarkers(): StrategyMarkerController.clear() (onRemove -> strategy.clear() -> onPostProcess), and the next syncMarkers sends the markers again, as the overlay collectors do after a clear. Requires the ios-sdk-core change that adds clearMarkers() to MarkerRenderingSupport.
MapKit stacks overlays by level, then by add order. Polygons, circles and polylines were added with addOverlay(_:) (level .aboveRoads, under the labels), but rasters, ground images and marker tiles with .aboveLabels, so a raster covered every polygon, circle and polyline; within a level the order followed add order. Overlays now go through MapKitOverlayStacking: everything but the marker band is placed in .aboveRoads at its band position (raster layers < ground images < polygons < circles < polylines, zIndex at add time within a band) with insertOverlay(_:at:level:); marker tiles go in .aboveLabels. Annotations stay above all overlays (MapKit). Label change this forces: rasters and ground images move under the labels (polygons, circles and polylines keep their place under the labels). The other way round - everything .aboveLabels - would instead move polygons, circles and polylines over the labels. Requires ios-sdk-core fix/overlay-stacking-order (OverlayStacking).
Clear strategy-driven markers in clearOverlays()
Stack overlays in one band order, whatever order they arrive in
MapKitMapView.Coordinator.updateContent rebuilt two dictionaries over every marker on each call, before syncMarkers reached its MarkerListIdentity gate: one with each marker's state, and one with each marker's BitmapIcon, which read the @published icon and, for markers with no icon, made a fresh DefaultMarkerIcon() and drew it again. SwiftUI calls updateContent on every body evaluation, camera moves included, so a resent identical list paid for all of it although the gate then threw the work away. Cost of one updateContent with the same content, 144,183 markers, simulator, best of 15: Debug Release 1 in 4 with no icon 2970 ms -> 12.6 ms 2608 ms -> 0.04 ms every marker an icon 111 ms -> 27.0 ms 61 ms -> 0.14 ms Neither dictionary is needed. The state cache duplicated what MapKitMarkerController already keeps from its last processed list (markerStatesById, filled synchronously when the gate lets a list through, before add() runs), now exposed as syncedMarkerState(for:). The icon cache is replaced by reading the icon off the state in mapView(_:viewFor:); toBitmapIcon() keeps the drawn image per icon, and the no-icon marker shares one default image. Reading the current state also means an annotation view recreated after an in-place icon change shows the new icon, rather than whatever the cache held at the last body evaluation. The other iOS providers already put the gate first. Checked on the iPad (Debug): the marker basic and street tree pages look the same as before, and on a check page a new marker state under the same id and an in-place icon change both show up as before.
Build no marker icons before the MarkerListIdentity gate on MapKit
Draw large polygon sets as raster tiles (PolygonTiler)
Give the polyline controller a PolylineTiler whose template is upserted as the "mc-polyline-tiles" raster layer (removed by id when nothing is tiled), as the polygon tiles are. The content's polylineTilingOptions reach the tiler on every content update; a change re-routes the current list. The tile layer stacks at the bottom of the polyline band (OverlayStacking.rasterKey).
Draw many polylines as raster tiles (PolylineTiler)
Support bulk Circles with raster tiles
Annotation views had no zPriority, so MapKit chose the order and zIndex did nothing. Map MarkerDrawOrder onto zPriority (500 + 5 x key, zIndex clamped to +-99) and reset it on reused views.
Same-zIndex markers stack lower-on-screen in front. On a heading change the renderer rewrites zPriority on the visible annotation views; views created later pick up the current frame.
MKMapCamera has no padding, so the camera center is shifted with the core CameraPaddingEmulation (using MapKit's measured vertical fov, 30°) and shifted back on read; the read camera carries paddings and fov.
MapKit's scale differs slightly from the model and its pitch limit depends on altitude, so after each move (and at the end of an animation) the camera center is corrected with the map's projection, and the target is read back from the padded center.
Back-to-back setCamera calls let MapKit fold the region-change notifications, so the state kept the camera from before the correction.
Stack markers by the shared draw order
Report camera fov and apply paddings
Release 1.4.0
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.
Merge develop into main for the 1.4.0 release.