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;
 }
Beispiel #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;
 }
Beispiel #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();
 }
Beispiel #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));
     });
 }
Beispiel #5
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);
             });
 }
Beispiel #6
0
        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);
        }
        /// <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);

        }
Beispiel #8
0
 public GeodanWorldWmsTileSource()
 {
     var schema = new GlobalSphericalMercator(YAxis.TMS) {Srs = "EPSG:900913"};
     Provider = new HttpTileProvider(CreateWmsRequest(schema));
     Schema = schema;
 }