Version 4.12.1 Added AutoEquirectangularProjection

This commit is contained in:
ClemensF 2019-04-05 22:47:22 +02:00
parent bd9a16e921
commit ae09b0e55d
2 changed files with 13 additions and 14 deletions

View file

@ -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

View file

@ -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();