mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.17.0: Added support for WMTS
This commit is contained in:
parent
e06e910126
commit
aff7323287
|
|
@ -203,7 +203,9 @@ namespace MapControl
|
|||
{
|
||||
TileMatrixSets.Clear();
|
||||
|
||||
var ns = capabilitiesElement.Name.Namespace;
|
||||
XNamespace ns = capabilitiesElement.Name.Namespace;
|
||||
XNamespace ows = "http://www.opengis.net/ows/1.1";
|
||||
|
||||
var contentsElement = capabilitiesElement.Element(ns + "Contents");
|
||||
|
||||
if (contentsElement == null)
|
||||
|
|
@ -211,7 +213,6 @@ namespace MapControl
|
|||
throw new ArgumentException("Contents element not found.");
|
||||
}
|
||||
|
||||
XNamespace ows = "http://www.opengis.net/ows/1.1";
|
||||
XElement layerElement;
|
||||
|
||||
if (!string.IsNullOrEmpty(LayerIdentifier))
|
||||
|
|
|
|||
|
|
@ -38,19 +38,23 @@ namespace MapControl
|
|||
|
||||
public bool SetBounds(MapProjection projection, double heading, Size mapSize)
|
||||
{
|
||||
// top/left viewport corner in map coordinates
|
||||
// top/left viewport corner in map coordinates (meters)
|
||||
//
|
||||
var tileOrigin = projection.InverseViewportTransform.Transform(new Point());
|
||||
|
||||
// top/left viewport corner in tile matrix coordinates
|
||||
// top/left viewport corner in tile matrix coordinates (tile column and row indexes)
|
||||
//
|
||||
var tileMatrixOrigin = new Point(
|
||||
TileMatrix.Scale * (tileOrigin.X - TileMatrix.TopLeft.X),
|
||||
TileMatrix.Scale * (TileMatrix.TopLeft.Y - tileOrigin.Y));
|
||||
|
||||
// relative layer scale
|
||||
//
|
||||
var scale = TileMatrix.Scale / projection.ViewportScale;
|
||||
|
||||
var transform = new MatrixTransform
|
||||
{
|
||||
Matrix = MatrixFactory.Create(1, -heading, tileMatrixOrigin)
|
||||
Matrix = MatrixFactory.Create(scale, -heading, tileMatrixOrigin)
|
||||
};
|
||||
|
||||
var bounds = transform.TransformBounds(new Rect(0d, 0d, mapSize.Width, mapSize.Height));
|
||||
|
|
@ -75,22 +79,28 @@ namespace MapControl
|
|||
XMax = xMax;
|
||||
YMax = yMax;
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("{0}: {1}..{2}, {3}..{4}", TileMatrix.Identifier, xMin, xMax, yMin, yMax);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetRenderTransform(MapProjection projection, double heading)
|
||||
{
|
||||
// XMin/YMin corner in map and viewport coordinates
|
||||
// XMin/YMin corner in map coordinates (meters)
|
||||
//
|
||||
var mapOrigin = new Point(
|
||||
TileMatrix.TopLeft.X + XMin * TileMatrix.TileWidth / TileMatrix.Scale,
|
||||
TileMatrix.TopLeft.Y - YMin * TileMatrix.TileHeight / TileMatrix.Scale);
|
||||
|
||||
// XMin/YMin corner in viewport coordinates (pixels)
|
||||
//
|
||||
var viewOrigin = projection.ViewportTransform.Transform(mapOrigin);
|
||||
|
||||
var tileScale = projection.ViewportScale / TileMatrix.Scale; // relative scale
|
||||
// relative layer scale
|
||||
//
|
||||
var scale = projection.ViewportScale / TileMatrix.Scale;
|
||||
|
||||
((MatrixTransform)RenderTransform).Matrix = MatrixFactory.Create(tileScale, heading, viewOrigin);
|
||||
((MatrixTransform)RenderTransform).Matrix = MatrixFactory.Create(scale, heading, viewOrigin);
|
||||
}
|
||||
|
||||
public void UpdateTiles()
|
||||
|
|
|
|||
Loading…
Reference in a new issue