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/MapConductorForHERE/HereMapHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ public final class HereMapHost: MapViewCoordinatorBase<HereMapViewState>, Marker
}
}
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

// Route the simple overlays through the shared collector so each
// controller subscribes to one source of truth instead of the map
Expand Down Expand Up @@ -251,6 +262,8 @@ public final class HereMapHost: MapViewCoordinatorBase<HereMapViewState>, Marker
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
4 changes: 4 additions & 0 deletions Sources/MapConductorForHERE/marker/HereMarkerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ final class HereMarkerController: AbstractMarkerController<MapMarker, HereMarker
defaultMarkerIcon: defaultMarkerIconForTiling,
tilingEnabled: tilingOptions.enabled,
tiledMarkerIds: &localTiledMarkerIds,
addedTracker: addedTracker,
shouldTile: { [shouldTileMarkers] state in
shouldTileMarkers && !state.draggable && state.getAnimation() == nil
}
Expand All @@ -144,6 +145,9 @@ final class HereMarkerController: AbstractMarkerController<MapMarker, HereMarker
} else {
removeTileLayer()
}

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

private func restoreNativeMarkersIfNeeded(states: [MarkerState]) async {
Expand Down