mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
Simplified WMS/WMTS layers
This commit is contained in:
parent
afc93704d9
commit
370618f66f
5 changed files with 66 additions and 106 deletions
|
|
@ -165,29 +165,27 @@ namespace MapControl
|
|||
|
||||
protected override async void OnViewportChanged(ViewportChangedEventArgs e)
|
||||
{
|
||||
base.OnViewportChanged(e);
|
||||
|
||||
if (e.ProjectionChanged)
|
||||
{
|
||||
ClearImages();
|
||||
|
||||
base.OnViewportChanged(e);
|
||||
|
||||
await UpdateImageAsync(); // update immediately
|
||||
}
|
||||
else
|
||||
{
|
||||
ValidateBoundingBox();
|
||||
|
||||
base.OnViewportChanged(e);
|
||||
|
||||
updateTimer.Run(!UpdateWhileViewportChanging);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task UpdateImageAsync()
|
||||
{
|
||||
if (updateInProgress) // update image on next tick
|
||||
if (updateInProgress)
|
||||
{
|
||||
updateTimer.Run(); // start timer if not running
|
||||
// update image on next tick, start timer if not running
|
||||
//
|
||||
updateTimer.Run();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -233,35 +231,6 @@ namespace MapControl
|
|||
BoundingBox = ParentMap.ViewRectToBoundingBox(rect);
|
||||
}
|
||||
|
||||
private void ValidateBoundingBox()
|
||||
{
|
||||
if (BoundingBox != null)
|
||||
{
|
||||
var offset = ParentMap.Center.Longitude - BoundingBox.Center.Longitude;
|
||||
|
||||
if (Math.Abs(offset) > 180d)
|
||||
{
|
||||
offset = 360d * Math.Sign(offset);
|
||||
|
||||
BoundingBox = new BoundingBox(
|
||||
BoundingBox.South, BoundingBox.West + offset,
|
||||
BoundingBox.North, BoundingBox.East + offset);
|
||||
|
||||
foreach (var image in Children.OfType<Image>())
|
||||
{
|
||||
var imageBbox = GetBoundingBox(image);
|
||||
|
||||
if (imageBbox != null)
|
||||
{
|
||||
SetBoundingBox(image, new BoundingBox(
|
||||
imageBbox.South, imageBbox.West + offset,
|
||||
imageBbox.North, imageBbox.East + offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearImages()
|
||||
{
|
||||
foreach (var image in Children.OfType<Image>())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue