mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 06:26:41 +00:00
Avalonia WmsImageLayer
This commit is contained in:
parent
5c3ebbc083
commit
838f77738b
7 changed files with 52 additions and 30 deletions
|
|
@ -41,5 +41,10 @@ namespace MapControl
|
|||
return LoadImage(stream);
|
||||
});
|
||||
}
|
||||
|
||||
internal static Task<IImage> LoadMergedImageAsync(Uri uri1, Uri uri2, IProgress<double> progress)
|
||||
{
|
||||
return Task.FromResult<IImage>(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Avalonia.Animation;
|
|||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -121,8 +122,8 @@ namespace MapControl
|
|||
{
|
||||
var scale = GetScale(location);
|
||||
|
||||
return new Matrix(scale.X, 0d, 0d, scale.Y, 0d, 0d)
|
||||
.Append(Matrix.CreateRotation(ViewTransform.Rotation));
|
||||
return Matrix.CreateScale(scale.X, scale.Y)
|
||||
* Matrix.CreateRotation(ViewTransform.Rotation * Math.PI / 180d);
|
||||
}
|
||||
|
||||
private void CenterPropertyChanged(Location center)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
<Compile Include="..\Shared\ViewportChangedEventArgs.cs" Link="ViewportChangedEventArgs.cs" />
|
||||
<Compile Include="..\Shared\ViewRect.cs" Link="ViewRect.cs" />
|
||||
<Compile Include="..\Shared\WebMercatorProjection.cs" Link="WebMercatorProjection.cs" />
|
||||
<Compile Include="..\Shared\WmsImageLayer.cs" Link="WmsImageLayer.cs" />
|
||||
<Compile Include="..\WPF\Timer.WPF.cs" Link="Timer.WPF.cs" />
|
||||
<Compile Include="..\WPF\TypeConverters.WPF.cs" Link="TypeConverters.WPF.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ namespace MapControl
|
|||
{
|
||||
var animation = new Animation
|
||||
{
|
||||
FillMode = FillMode.Forward,
|
||||
Duration = MapBase.ImageFadeDuration,
|
||||
Children =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,9 +64,11 @@ namespace MapControl
|
|||
Scale = scale;
|
||||
Rotation = ((rotation % 360d) + 360d) % 360d;
|
||||
|
||||
MapToViewMatrix = new Matrix(Scale, 0d, 0d, -Scale, -Scale * mapCenter.X, Scale * mapCenter.Y)
|
||||
.Append(Matrix.CreateRotation(Rotation * Math.PI / 180d))
|
||||
.Append(Matrix.CreateTranslation(viewCenter.X, viewCenter.Y));
|
||||
MapToViewMatrix
|
||||
= Matrix.CreateTranslation(-mapCenter.X, -mapCenter.Y)
|
||||
* Matrix.CreateScale(scale, -scale)
|
||||
* Matrix.CreateRotation(Rotation * Math.PI / 180d)
|
||||
* Matrix.CreateTranslation(viewCenter.X, viewCenter.Y);
|
||||
|
||||
ViewToMapMatrix = MapToViewMatrix.Invert();
|
||||
}
|
||||
|
|
@ -85,9 +87,9 @@ namespace MapControl
|
|||
|
||||
var transformScale = Scale / tileMatrixScale;
|
||||
|
||||
return new Matrix(transformScale, 0d, 0d, transformScale, 0d, 0d)
|
||||
.Append(Matrix.CreateRotation(Rotation * Math.PI / 180d))
|
||||
.Append(Matrix.CreateTranslation(viewOrigin.X, viewOrigin.Y));
|
||||
return Matrix.CreateScale(transformScale, transformScale)
|
||||
* Matrix.CreateRotation(Rotation * Math.PI / 180d)
|
||||
* Matrix.CreateTranslation(viewOrigin.X, viewOrigin.Y);
|
||||
}
|
||||
|
||||
public Rect GetTileMatrixBounds(double tileMatrixScale, Point tileMatrixTopLeft, Size viewSize)
|
||||
|
|
@ -98,14 +100,15 @@ namespace MapControl
|
|||
|
||||
var transformScale = tileMatrixScale / Scale;
|
||||
|
||||
var transform = new Matrix(transformScale, 0d, 0d, transformScale, 0d, 0d)
|
||||
.Append(Matrix.CreateRotation(-Rotation * Math.PI / 180d));
|
||||
var transform
|
||||
= Matrix.CreateScale(transformScale, transformScale)
|
||||
* Matrix.CreateRotation(-Rotation * Math.PI / 180d);
|
||||
|
||||
// Translate origin to tile matrix origin in pixels.
|
||||
//
|
||||
transform = transform.Append(Matrix.CreateTranslation(
|
||||
transform *= Matrix.CreateTranslation(
|
||||
tileMatrixScale * (origin.X - tileMatrixTopLeft.X),
|
||||
tileMatrixScale * (tileMatrixTopLeft.Y - origin.Y)));
|
||||
tileMatrixScale * (tileMatrixTopLeft.Y - origin.Y));
|
||||
|
||||
// Transform view bounds to tile pixel bounds.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue