Reworked WmsImageLayer

This commit is contained in:
ClemensF 2018-06-09 00:11:44 +02:00
parent 37b42b3c1b
commit 8048eb123f
4 changed files with 91 additions and 65 deletions

View file

@ -147,19 +147,18 @@ namespace MapControl
}
/// <summary>
/// Gets a WMS 1.3.0 query parameter string from the specified bounding box,
/// e.g. "CRS=...&BBOX=...&WIDTH=...&HEIGHT=..."
/// Gets a WMS query parameter string from the specified bounding box, e.g. "CRS=...&BBOX=...&WIDTH=...&HEIGHT=..."
/// </summary>
public virtual string WmsQueryParameters(BoundingBox boundingBox, string version = "1.3.0")
public virtual string WmsQueryParameters(BoundingBox boundingBox, bool useSrs = false)
{
if (string.IsNullOrEmpty(CrsId) || !boundingBox.HasValidBounds)
{
return null;
}
var format = "CRS={0}&BBOX={1},{2},{3},{4}&WIDTH={5}&HEIGHT={6}";
string format;
if (version.StartsWith("1.1."))
if (useSrs)
{
format = "SRS={0}&BBOX={1},{2},{3},{4}&WIDTH={5}&HEIGHT={6}";
}
@ -167,6 +166,10 @@ namespace MapControl
{
format = "CRS={0}&BBOX={2},{1},{4},{3}&WIDTH={5}&HEIGHT={6}";
}
else
{
format = "CRS={0}&BBOX={1},{2},{3},{4}&WIDTH={5}&HEIGHT={6}";
}
var rect = BoundingBoxToRect(boundingBox);
var width = (int)Math.Round(ViewportScale * rect.Width);