mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.12.1 Added AutoEquirectangularProjection
This commit is contained in:
parent
bd9a16e921
commit
ae09b0e55d
|
|
@ -23,7 +23,7 @@ using System.Windows.Threading;
|
|||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Map image layer. Fills the entire viewport with a map image, e.g. provided by a Web Map Service (WMS).
|
||||
/// Map image layer. Fills the entire viewport with a map image, e.g. provided by a Web Map Service.
|
||||
/// The image must be provided by the abstract GetImageAsync method.
|
||||
/// </summary>
|
||||
public abstract class MapImageLayer : MapPanel, IMapLayer
|
||||
|
|
|
|||
|
|
@ -150,9 +150,10 @@ namespace MapControl
|
|||
uri += "&FORMAT=" + Format;
|
||||
}
|
||||
|
||||
var crs = GetCrsValue();
|
||||
var rect = projection.BoundingBoxToRect(BoundingBox);
|
||||
|
||||
uri += "&" + GetBboxParameters(rect);
|
||||
uri += "&" + GetBboxParameters(crs, rect);
|
||||
uri += "&WIDTH=" + (int)Math.Round(projection.ViewportScale * rect.Width);
|
||||
uri += "&HEIGHT=" + (int)Math.Round(projection.ViewportScale * rect.Height);
|
||||
|
||||
|
|
@ -162,18 +163,6 @@ namespace MapControl
|
|||
return imageUri;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a query substring for the projected bounding box, which contains the CRS and BBOX or equivalent parameters.
|
||||
/// </summary>
|
||||
protected virtual string GetBboxParameters(Rect bbox)
|
||||
{
|
||||
var crsId = GetCrsValue();
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture,
|
||||
crsId == "EPSG:4326" ? "CRS={0}&BBOX={2},{1},{4},{3}" : "CRS={0}&BBOX={1},{2},{3},{4}",
|
||||
crsId, bbox.X, bbox.Y, (bbox.X + bbox.Width), (bbox.Y + bbox.Height));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the effective value of the CRS query parameter.
|
||||
/// </summary>
|
||||
|
|
@ -197,6 +186,16 @@ namespace MapControl
|
|||
return crsId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a query substring for the projected bounding box, which contains the CRS and BBOX or equivalent parameters.
|
||||
/// </summary>
|
||||
protected virtual string GetBboxParameters(string crs, Rect bbox)
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture,
|
||||
crs == "EPSG:4326" ? "CRS={0}&BBOX={2},{1},{4},{3}" : "CRS={0}&BBOX={1},{2},{3},{4}",
|
||||
crs, bbox.X, bbox.Y, (bbox.X + bbox.Width), (bbox.Y + bbox.Height));
|
||||
}
|
||||
|
||||
private string GetRequestUri(string request)
|
||||
{
|
||||
var uri = ServiceUri.ToString();
|
||||
|
|
|
|||
Loading…
Reference in a new issue