MapTilePyramidLayer.UpdateTiles

This commit is contained in:
ClemensFischer 2025-09-21 12:58:16 +02:00
parent 7e9d60328d
commit a231add5d3
3 changed files with 8 additions and 8 deletions

View file

@ -115,7 +115,7 @@ namespace MapControl
return finalSize; return finalSize;
} }
protected override void UpdateTileLayerAsync(bool resetTiles) protected override void UpdateTiles(bool resetTiles)
{ {
if (ParentMap == null || !SupportedCrsIds.Contains(ParentMap.MapProjection.CrsId)) if (ParentMap == null || !SupportedCrsIds.Contains(ParentMap.MapProjection.CrsId))
{ {

View file

@ -30,7 +30,7 @@ namespace MapControl
{ {
public static readonly DependencyProperty TileSourceProperty = public static readonly DependencyProperty TileSourceProperty =
DependencyPropertyHelper.Register<MapTilePyramidLayer, TileSource>(nameof(TileSource), null, DependencyPropertyHelper.Register<MapTilePyramidLayer, TileSource>(nameof(TileSource), null,
(layer, oldValue, newValue) => layer.UpdateTileLayer(true)); (layer, oldValue, newValue) => layer.Update(true));
public static readonly DependencyProperty SourceNameProperty = public static readonly DependencyProperty SourceNameProperty =
DependencyPropertyHelper.Register<MapTilePyramidLayer, string>(nameof(SourceName)); DependencyPropertyHelper.Register<MapTilePyramidLayer, string>(nameof(SourceName));
@ -69,7 +69,7 @@ namespace MapControl
loadingProgress = new Progress<double>(p => SetValue(LoadingProgressProperty, p)); loadingProgress = new Progress<double>(p => SetValue(LoadingProgressProperty, p));
updateTimer = this.CreateTimer(UpdateInterval); updateTimer = this.CreateTimer(UpdateInterval);
updateTimer.Tick += (s, e) => UpdateTileLayer(false); updateTimer.Tick += (s, e) => Update(false);
MapPanel.SetRenderTransform(this, new MatrixTransform()); MapPanel.SetRenderTransform(this, new MatrixTransform());
#if WPF #if WPF
@ -210,20 +210,20 @@ namespace MapControl
protected abstract void SetRenderTransform(); protected abstract void SetRenderTransform();
protected abstract void UpdateTileLayerAsync(bool resetTiles); protected abstract void UpdateTiles(bool resetTiles);
private void UpdateTileLayer(bool resetTiles) private void Update(bool resetTiles)
{ {
updateTimer.Stop(); updateTimer.Stop();
UpdateTileLayerAsync(resetTiles); UpdateTiles(resetTiles);
} }
private void OnViewportChanged(object sender, ViewportChangedEventArgs e) private void OnViewportChanged(object sender, ViewportChangedEventArgs e)
{ {
if (e.TransformCenterChanged || e.ProjectionChanged || Children.Count == 0) if (e.TransformCenterChanged || e.ProjectionChanged || Children.Count == 0)
{ {
UpdateTileLayer(false); // update immediately Update(false); // update immediately
} }
else else
{ {

View file

@ -102,7 +102,7 @@ namespace MapControl
return finalSize; return finalSize;
} }
protected override void UpdateTileLayerAsync(bool resetTiles) protected override void UpdateTiles(bool resetTiles)
{ {
// resetTiles is ignored here because it is always false. // resetTiles is ignored here because it is always false.