public void setDownloadExtend(string dataSourceType, PBS.Util.Envelope e) { string key = dataSourceType == null ? "default" : dataSourceType; SameTypeSchemas s1 = schemas[key]; s1.setDownloadExtend(e); }
public void ReadTilingScheme() { string configName = AppDomain.CurrentDomain.BaseDirectory + "CustomTile.xml"; if (!File.Exists(configName)) { throw new FileNotFoundException(configName + " does not exist!"); } XDocument xDoc = XDocument.Load(configName); XElement schemaElement = xDoc.Element("Services"); foreach (XElement se in schemaElement.Elements()) { string type = se.Attribute("type").Value; string subType = se.Attribute("subType").Value; string name = se.Attribute("name").Value; var lods = from map in se.Descendants("Lods").Elements() select new { Level = map.Attribute("level").Value, Resolution = map.Attribute("resolution").Value, Scale = map.Attribute("scale").Value }; TilingScheme tilingScheme = new TilingScheme(); StringBuilder sb; tilingScheme.Path = "N/A"; tilingScheme.CacheTileFormat = PBS.DataSource.ImageFormat.PNG; tilingScheme.CompressionQuality = 75; tilingScheme.DPI = Convert.ToInt32(se.Element("Dpi").Attribute("value").Value); tilingScheme.LODs = new LODInfo[lods.Count()]; sb = new StringBuilder("\r\n"); int i = 0; foreach (var lod in lods) { int levelId = Convert.ToInt32(lod.Level); tilingScheme.LODs[i] = new LODInfo() { LevelID = levelId, Resolution = Convert.ToDouble(lod.Resolution), Scale = Convert.ToDouble(lod.Scale) }; sb.Append(@" {""level"":" + lod.Level + "," + @"""resolution"":" + lod.Resolution + "," + @"""scale"":" + lod.Scale + @"}," + "\r\n"); i++; } tilingScheme.LODsJson = sb.ToString().Remove(sb.ToString().Length - 3);//remove last "," and "\r\n" //two extent tilingScheme.InitialExtent = new PBS.Util.Envelope(Convert.ToDouble(se.Element("InitialExtent").Attribute("xmin").Value), Convert.ToDouble(se.Element("InitialExtent").Attribute("ymin").Value) , Convert.ToDouble(se.Element("InitialExtent").Attribute("xmax").Value), Convert.ToDouble(se.Element("InitialExtent").Attribute("ymax").Value)); tilingScheme.FullExtent = new PBS.Util.Envelope(Convert.ToDouble(se.Element("FullExtent").Attribute("xmin").Value), Convert.ToDouble(se.Element("FullExtent").Attribute("ymin").Value) , Convert.ToDouble(se.Element("FullExtent").Attribute("xmax").Value), Convert.ToDouble(se.Element("FullExtent").Attribute("ymax").Value)); tilingScheme.PacketSize = 128; tilingScheme.StorageFormat = StorageFormat.esriMapCacheStorageModeExploded; tilingScheme.TileRows = Convert.ToInt32(se.Element("Rows").Attribute("value").Value); tilingScheme.TileCols = Convert.ToInt32(se.Element("Cols").Attribute("value").Value); tilingScheme.TileOrigin = new PBS.Util.Point(Convert.ToDouble(se.Element("Origin").Attribute("x").Value), Convert.ToDouble(se.Element("Origin").Attribute("y").Value)); tilingScheme.WKID = Convert.ToInt32(se.Element("SpatialReference").Attribute("wkid").Value); tilingScheme.WKT = @"PROJCS[""WGS_1984_Web_Mercator_Auxiliary_Sphere"",GEOGCS[""GCS_WGS_1984"",DATUM[""D_WGS_1984"",SPHEROID[""WGS_1984"",6378137.0,298.257223563]],PRIMEM[""Greenwich"",0.0],UNIT[""Degree"",0.0174532925199433]],PROJECTION[""Mercator_Auxiliary_Sphere""],PARAMETER[""False_Easting"",0.0],PARAMETER[""False_Northing"",0.0],PARAMETER[""Central_Meridian"",0.0],PARAMETER[""Standard_Parallel_1"",0.0],PARAMETER[""Auxiliary_Sphere_Type"",0.0],UNIT[""Meter"",1.0],AUTHORITY[""ESRI"",""3857""]]"; addSchema(type, subType, name, tilingScheme); string configPath = se.Element("MainTypeUrlConfig").Attribute("path").Value; setConfigPath(type, configPath); string downloadUrl = se.Element("MapUrl").Attribute("value").Value; SetDownloadUrl(type, subType, name, downloadUrl); PBS.Util.Envelope downLoadExtent = new PBS.Util.Envelope(Convert.ToDouble(se.Element("DownLoadExtent").Attribute("xmin").Value), Convert.ToDouble(se.Element("DownLoadExtent").Attribute("ymin").Value), Convert.ToDouble(se.Element("DownLoadExtent").Attribute("xmax").Value), Convert.ToDouble(se.Element("DownLoadExtent").Attribute("ymax").Value)); setDownloadExtend(type, downLoadExtent); } }
public void setDownloadExtend(PBS.Util.Envelope e) { DownloadExtend = e; }