SuperMap.Web.Mapping.DynamicWMSLayer.GetImageUrl C# (CSharp) Method

GetImageUrl() protected method

${mapping_DynamicWMSLayer_method_getImageUrl_D}
protected GetImageUrl ( ) : string
return string
        protected override string GetImageUrl()
        {
            Rectangle2D bounds = ViewBounds;
            int width = (int)Math.Round(ViewSize.Width);
            int height = (int)Math.Round(ViewSize.Height);

            if (CRS == null)
            {
                //TODO:Resource
                //throw new ArgumentNullException("CRS");
                throw new ArgumentNullException(ExceptionStrings.CRSIsNull);
            }

            int wkid = CRS.WKID;
            StringBuilder imgURL = new StringBuilder();

            //string stimgURLr = this.httpGetResource ?? this.Url;
            //imgURL.Append(stimgURLr);
            imgURL.Append(ProxyUrl + this.Url);
            if (!Url.EndsWith("?"))
            {
                imgURL.Append("?");
            }
            imgURL.Append("service=WMS&request=GetMap");
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&width={0}", width);
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&height={0}", height);
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&format=image/{0}", ImageFormat);
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&layers={0}", new object[] { (this.Layers == null) ? "" : String.Join(",", Layers) });//数组元素间用逗号分隔
            imgURL.Append("&styles=");
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&bgcolor={0}", BgColor);
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&transparent={0}", Transparent);
            imgURL.AppendFormat(CultureInfo.InvariantCulture, "&version={0}", this.Version);

            if (this.LowerThan13Version())
            {
                imgURL.AppendFormat(CultureInfo.InvariantCulture, "&SRS=EPSG:{0}", wkid);
                imgURL.AppendFormat(CultureInfo.InvariantCulture, "&bbox={0},{1},{2},{3}", bounds.Left, bounds.Bottom, bounds.Right, bounds.Top);
            }
            else
            {
                imgURL.AppendFormat(CultureInfo.InvariantCulture, "&CRS=EPSG:{0}", wkid);
                bool flag = false;
                int num = LatLongCRSRanges.Length / 2;
                for (int i = 0; i < num; i++)
                {
                    if ((wkid >= LatLongCRSRanges[i, 0]) && (wkid <= LatLongCRSRanges[i, 1]))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    imgURL.AppendFormat(CultureInfo.InvariantCulture, "&bbox={0},{1},{2},{3}", bounds.Bottom, bounds.Left, bounds.Top, bounds.Right);
                }
                else
                {
                    imgURL.AppendFormat(CultureInfo.InvariantCulture, "&bbox={0},{1},{2},{3}", bounds.Left, bounds.Bottom, bounds.Right, bounds.Top);
                }
            }
            return imgURL.ToString();
        }