コード例 #1
0
 public HttpTileSource(ITileSchema tileSchema, IRequest request, string name = null, 
     IPersistentCache<byte[]> persistentCache = null, Func<Uri, byte[]> tileFetcher = null)
 {
     _provider = new HttpTileProvider(request, persistentCache, tileFetcher);
     _tileSchema = tileSchema;
     Name = name ?? string.Empty;
 }
コード例 #2
0
 public HttpTileSource(ITileSchema tileSchema, IRequest request, string name = null,
                       IPersistentCache <byte[]> persistentCache             = null, Func <Uri, byte[]> tileFetcher = null)
 {
     _provider = new HttpTileProvider(request, persistentCache, tileFetcher);
     Schema    = tileSchema;
     Name      = name ?? string.Empty;
 }
コード例 #3
0
 public HttpTileSourceTDT(ITileSchema tileSchema, IRequest request, string name = null,
                          IPersistentCache <byte[]> persistentCache             = null, Func <Uri, byte[]> tileFetcher = null, Attribution attibution = null)
 {
     _provider   = new HttpTileProvider(request, persistentCache, tileFetcher);
     Schema      = tileSchema;
     Name        = name ?? string.Empty;
     Attribution = attibution ?? new Attribution();
 }
コード例 #4
0
 public GoogleTileSource(GoogleRequest request, IPersistentCache <byte[]> persistentCache = null)
 {
     _tileSchema = new SphericalMercatorInvertedWorldSchema();
     _provider   = new HttpTileProvider(request, persistentCache,
                                        // The Google requests needs to fake the UserAgent en Referer.
                                        uri =>
     {
         var httpWebRequest       = (HttpWebRequest)WebRequest.Create(uri);
         httpWebRequest.UserAgent = UserAgent;
         httpWebRequest.Referer   = Referer;
         return(RequestHelper.FetchImage(httpWebRequest));
     });
 }
コード例 #5
0
ファイル: GoogleTileSource.cs プロジェクト: bertt/BruTile
 public GoogleTileSource(GoogleRequest request, IPersistentCache<byte[]> persistentCache = null)
 {
     _tileSchema = new SphericalMercatorInvertedWorldSchema();
     _provider = new HttpTileProvider(request, persistentCache,
         // The Google requests needs to fake the UserAgent en Referer.
         uri =>
             {
                 var httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);
                 httpWebRequest.UserAgent = UserAgent;
                 httpWebRequest.Referer = Referer;
                 return RequestHelper.FetchImage(httpWebRequest);
             });
 }
コード例 #6
0
ファイル: TileMapParser.cs プロジェクト: bertt/BruTile
        public static TileSource CreateTileSource(Stream tileMapResource, string overrideUrl = null,
            Dictionary<string, string> customParameters = null, IPersistentCache<byte[]> persistentCache = null,
            Func<Uri, byte[]> fetchTile = null)
        {
            var reader = new StreamReader(tileMapResource);
            var serializer = new XmlSerializer(typeof(TileMap));
            var tileMap = (TileMap)serializer.Deserialize(reader);
            var tileSchema = CreateSchema(tileMap);

            var tileUrls = new Dictionary<string, Uri>();
            foreach (TileMapTileSetsTileSet ts in tileMap.TileSets.TileSet)
            {
                tileUrls[ts.order] = new Uri(ts.href);
            }
            var tileProvider = new HttpTileProvider(CreateRequest(tileUrls, tileSchema.Format, overrideUrl, customParameters),
                persistentCache, fetchTile);

            return new TileSource(tileProvider, tileSchema);
        }
コード例 #7
0
        /// <summary>
        /// Method called prior to any tile access
        /// </summary>
        public void Initialize()
        {
            if (_initialized) return;
            _initialized = true;

            var schema = RestoreSchema();
            var request = new WmscRequest(new Uri(_url), schema, _layers, _styles, _customParameters, _version);
            
            ITileProvider provider = new HttpTileProvider(request);
            TileSource = (WmscTileSource)Activator.CreateInstance(typeof(WmscTileSource), BindingFlags.NonPublic, schema, provider);
            TileCache = CreateTileCache();
            _tileFetcher = new TileFetcher(provider,
                                           BruTileLayerPlugin.Settings.MemoryCacheMinimum,
                                           BruTileLayerPlugin.Settings.MemoryCacheMaximum,
                                           TileCache);

        }
コード例 #8
0
ファイル: TiledWmsSample.cs プロジェクト: pauldendulk/Mapsui
 public GeodanWorldWmsTileSource()
 {
     var schema = new GlobalSphericalMercator(YAxis.TMS) {Srs = "EPSG:900913"};
     Provider = new HttpTileProvider(CreateWmsRequest(schema));
     Schema = schema;
 }