Skip to content
Merged
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
14 changes: 13 additions & 1 deletion Sources/MapConductorForMapKit/MapKitMapView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Combine
import MapKit
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore
import QuartzCore
import SwiftUI
import UIKit
Expand Down Expand Up @@ -269,6 +269,17 @@ private struct MapKitMapViewRepresentable: UIViewRepresentable {

let rasterLayerController = MapKitRasterLayerController(mapView: mapView)
self.rasterLayerController = rasterLayerController
// Many polygons are drawn into raster tiles and shown as one raster
// layer; taps still resolve against the original shapes.
let polygonTiler = PolygonTiler()
polygonTiler.onTemplate = { [weak rasterLayerController] template, tileSize in
if let template {
await rasterLayerController?.upsert(state: PolygonTiler.rasterLayerState(template: template, tileSize: tileSize))
} else {
await rasterLayerController?.removeById(PolygonTiler.layerId)
}
}
polygonController.tiler = polygonTiler

let groundImageController = MapKitGroundImageController(mapView: mapView)
self.groundImageController = groundImageController
Expand Down Expand Up @@ -382,6 +393,7 @@ private struct MapKitMapViewRepresentable: UIViewRepresentable {
overlayScope?.circleCollector.sync(content.circles.map { $0.state })
overlayScope?.polylineCollector.sync(content.polylines.map { $0.state })
overlayScope?.polygonCollector.sync(content.polygons.map { $0.state })
polygonController?.tiler?.refreshIfServerMoved()
for handler in content.polygonSyncHandlers {
let hullController = hullPolygonController
handler.bindPolygonSync { [weak hullController] states in
Expand Down
Loading