SuperMap.Web.Mapping.TiledDynamicRESTLayer.GetTileUrl C# (CSharp) Method

GetTileUrl() public method

${Mapping_TiledDynamicRESTLayer_method_GetTileUrl_D}
public GetTileUrl ( int indexX, int indexY, double resolution ) : string
indexX int ${Mapping_TiledDynamicRESTLayer_method_GetTileUrl_param_indexX}
indexY int ${Mapping_TiledDynamicRESTLayer_method_GetTileUrl_param_indexY}
resolution double ${Mapping_TiledDynamicRESTLayer_method_GetTileUrl_param_resolution}
return string
        public override string GetTileUrl(int indexX, int indexY, double resolution)
        {
            double scale = 0;
            scale = ScaleHelper.ScaleConversion(resolution, this.Dpi, this.CRS.Unit, this.CRS.DatumAxis);
            string str = string.Empty;

            str = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}/tileImage.{1}?scale={2}&x={3}&y={4}&width={5}&height={5}&transparent={6}&t={7}",
                       Url, ImageFormat.ToLower(), scale.ToString(CultureInfo.InvariantCulture), indexX, indexY, TileSize, Transparent, _randomKey);

            if (!EnableServerCaching)
            {
                str += string.Format("&cacheEnabled={0}", EnableServerCaching.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
            }

            if (!string.IsNullOrEmpty(LayersID))
            {
                str += string.Format("&layersID={0}", layersID);
            }
            if (ClipRegion != null)
            {
                str += "&clipRegionEnabled=True&";
                str += string.Format("clipRegion={0}", ServerGeometry.ToJson(ClipRegion.ToServerGeometry()));
            }
            if (MaxVisibleVertex != int.MaxValue && MaxVisibleVertex >= 0)
            {
                str += string.Format(System.Globalization.CultureInfo.InvariantCulture, "&maxVisibleVertex={0}", MaxVisibleVertex);
            }
            if (!this.Origin.IsEmpty)
            {
                // origin={"x":-200,"y":45},
                str += "&origin={" + string.Format(CultureInfo.InvariantCulture, "\"x\":{0},\"y\":{1}", this.Origin.X, this.Origin.Y) + "}";
            }
            //iServer tileImage请求中只要存在prjCoordSys参数就会把图片生成到temp目录下,
            //所以如果CRS和服务端一致,就不传这个参数上去了。
            if (this.mapService != null && this.mapService.MapServiceInfo != null
                && this.mapService.MapServiceInfo.PrjCoordSys != null)
            {
                CoordinateReferenceSystem tempCRS = new CoordinateReferenceSystem();
                if (_mapServiceDefault.MapServiceInfo != null)
                {
                    tempCRS.WKID = this._mapServiceDefault.MapServiceInfo.PrjCoordSys.EpsgCode;
                    tempCRS.Unit = this._mapServiceDefault.MapServiceInfo.CoordUnit;
                }
                if (!CoordinateReferenceSystem.Equals(tempCRS, this.CRS, true))
                {
                    if (this.CRS != null && this.CRS.WKID > 0)
                    {
                        str += "&prjCoordSys={\"epsgCode\":" + this.CRS.WKID + "}";
                    }
                }
            }
            str += string.Format("&customParams={0}", CustomParams);
            return str;
        }