protected override string GetImageUrl()
{
Rectangle2D bounds = ViewBounds;
int width = (int)Math.Round(ViewSize.Width);
int height = (int)Math.Round(ViewSize.Height);
StringBuilder imgUrl = new StringBuilder();
imgUrl.Append(Url);
if (!Url.EndsWith("/"))
{
imgUrl.Append("/");
}
imgUrl.AppendFormat("image.{0}?", ImageFormat);
imgUrl.AppendFormat("viewBounds={0}", JsonHelper.FromRectangle2D(bounds));
imgUrl.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "&height={0}", height);
imgUrl.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "&width={0}", width);
if (!string.IsNullOrEmpty(LayersID))
{
imgUrl.AppendFormat("&layersID={0}", LayersID);
}
imgUrl.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "&transparent={0}", Transparent);
if (ClipRegion != null)
{
imgUrl.Append("&clipRegionEnabled=True&");
imgUrl.AppendFormat("clipRegion={0}", ServerGeometry.ToJson(ClipRegion.ToServerGeometry()));
}
if (MaxVisibleVertex != int.MaxValue && MaxVisibleVertex >= 0)
{
imgUrl.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "&maxVisibleVertex={0}", MaxVisibleVertex);
}
if (!EnableServerCaching)
{
imgUrl.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "&cacheEnabled={0}", EnableServerCaching);
imgUrl.AppendFormat("&t={0}", DateTime.Now.Ticks.ToString(System.Globalization.CultureInfo.InvariantCulture));
}
if (this.CRS != null && this.CRS.WKID > 0)
{
imgUrl.Append("&prjCoordSys={\"epsgCode\":" + this.CRS.WKID + "}");
}
imgUrl.AppendFormat("&customParams={0}", CustomParams);
return imgUrl.ToString();
}