Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Sources/MapConductorForMapKit/MapKitMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ private struct MapKitMapViewRepresentable: UIViewRepresentable {
}
}
polygonController.tiler = polygonTiler
// Many polylines likewise, in their own raster layer in the polyline band
// (under the natively drawn polylines); taps still resolve against the original lines.
let polylineTiler = PolylineTiler()
polylineTiler.onTemplate = { [weak rasterLayerController] template, tileSize in
if let template {
await rasterLayerController?.upsert(state: PolylineTiler.rasterLayerState(template: template, tileSize: tileSize))
} else {
await rasterLayerController?.removeById(PolylineTiler.layerId)
}
}
polylineController.tiler = polylineTiler

let groundImageController = MapKitGroundImageController(mapView: mapView)
self.groundImageController = groundImageController
Expand Down Expand Up @@ -394,6 +405,8 @@ private struct MapKitMapViewRepresentable: UIViewRepresentable {
overlayScope?.polylineCollector.sync(content.polylines.map { $0.state })
overlayScope?.polygonCollector.sync(content.polygons.map { $0.state })
polygonController?.tiler?.refreshIfServerMoved()
if polylineController?.tiler?.setOptions(content.polylineTilingOptions) == true { overlayScope?.polylineCollector.flush() }
polylineController?.tiler?.refreshIfServerMoved()
for handler in content.polygonSyncHandlers {
let hullController = hullPolygonController
handler.bindPolygonSync { [weak hullController] states in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ final class MapKitMarkerController: AbstractMarkerController<MKPointAnnotation,
defaultMarkerIcon: defaultMarkerIconForTiling,
tilingEnabled: tilingOptions.enabled,
tiledMarkerIds: &localTiledMarkerIds,
addedTracker: addedTracker,
shouldTile: { [shouldTileAll] _ in shouldTileAll }
)
tiledMarkerIds = localTiledMarkerIds
Expand All @@ -211,6 +212,9 @@ final class MapKitMarkerController: AbstractMarkerController<MKPointAnnotation,
tileVersion += 1
updateTileOverlay(hasTiledMarkers: result.hasTiledMarkers)
}

// The newly tiled markers are on the map once their tile layer is.
await addedTracker.admitAndNotify(result.tiledAdded)
}

private func refreshTileLayerIfNeeded() {
Expand Down
Loading