示例#1
0
 public VectorTileLayer(ITileSource tileSource, RenderGetStrategy renderStrategy = null)
 {
     _tileSource                   = tileSource;
     _tileFetcher                  = new TileFetcher(_tileSource, _tileCache, 1, 4, _fetchStrategy);
     _tileFetcher.DataChanged     += TileFetcherOnDataChanged;
     _tileFetcher.PropertyChanged += TileFetcherOnPropertyChanged;
     _renderStrategy               = renderStrategy ?? new RenderGetStrategy();
 }
示例#2
0
 public TileLayer(ITileSource source = null, int minTiles = 200, int maxTiles = 300, int maxRetries = TileFetcher.DefaultMaxAttempts,
     int maxThreads = TileFetcher.DefaultMaxThreads, IFetchStrategy fetchStrategy = null,
     IRenderGetStrategy renderFetchStrategy = null, int minExtraTiles = -1, int maxExtraTiles = -1)
 {
     _memoryCache = new MemoryCache<Feature>(minTiles, maxTiles);
     Style = new VectorStyle { Outline = { Color = Color.FromArgb(0, 0, 0, 0) } }; // initialize with transparent outline
     _maxRetries = maxRetries;
     _maxThreads = maxThreads;
     _fetchStrategy = fetchStrategy ?? new FetchStrategy();
     _renderFetchStrategy = renderFetchStrategy ?? new RenderGetStrategy();
     _minExtraTiles = minExtraTiles;
     _maxExtraTiles = maxExtraTiles;
     SetTileSource(source);
 }
示例#3
0
 /// <summary>
 /// Create tile layer for given tile source
 /// </summary>
 /// <param name="source">Tile source to use for this layer</param>
 /// <param name="minTiles">Minimum number of tiles to cache</param>
 /// <param name="maxTiles">Maximum number of tiles to cache</param>
 /// <param name="maxRetries">Unused</param>
 /// <param name="fetchStrategy">Strategy to get list of tiles for given extent</param>
 /// <param name="renderFetchStrategy"></param>
 /// <param name="minExtraTiles">Number of minimum extra tiles for memory cache</param>
 /// <param name="maxExtraTiles">Number of maximum extra tiles for memory cache</param>
 // ReSharper disable once UnusedParameter.Local // Is public and won't break this now
 public TileLayer(ITileSource source = null, int minTiles = 200, int maxTiles = 300, int maxRetries = 2, IFetchStrategy fetchStrategy = null,
     IRenderGetStrategy renderFetchStrategy = null, int minExtraTiles = -1, int maxExtraTiles = -1)
 {
     MemoryCache = new MemoryCache<Feature>(minTiles, maxTiles);
     Style = new VectorStyle { Outline = { Color = Color.FromArgb(0, 0, 0, 0) } }; // initialize with transparent outline
     var fetchStrategy1 = fetchStrategy ?? new FetchStrategy(3);
     _renderStrategy = renderFetchStrategy ?? new RenderGetStrategy();
     _minExtraTiles = minExtraTiles;
     _maxExtraTiles = maxExtraTiles;
     _tileFetchDispatcher = new TileFetchDispatcher(MemoryCache, fetchStrategy1);
     _tileFetchDispatcher.DataChanged += TileFetchDispatcherOnDataChanged;
     _tileFetchDispatcher.PropertyChanged += TileFetchDispatcherOnPropertyChanged;
     _fetchMachine = new FetchMachine(_tileFetchDispatcher);
     SetTileSource(source);
 }
示例#4
0
 public TileLayer(ITileSource source = null, int minTiles = 200, int maxTiles = 300, int maxRetries = TileFetcher.DefaultMaxAttempts,
                  int maxThreads     = TileFetcher.DefaultMaxThreads, IFetchStrategy fetchStrategy = null,
                  IRenderGetStrategy renderFetchStrategy = null, int minExtraTiles                 = -1, int maxExtraTiles = -1)
 {
     _memoryCache = new MemoryCache <Feature>(minTiles, maxTiles);
     Style        = new VectorStyle {
         Outline = { Color = Color.FromArgb(0, 0, 0, 0) }
     };                                                                            // initialize with transparent outline
     _maxRetries          = maxRetries;
     _maxThreads          = maxThreads;
     _fetchStrategy       = fetchStrategy ?? new FetchStrategy();
     _renderFetchStrategy = renderFetchStrategy ?? new RenderGetStrategy();
     _minExtraTiles       = minExtraTiles;
     _maxExtraTiles       = maxExtraTiles;
     SetTileSource(source);
 }
示例#5
0
 /// <summary>
 /// Create tile layer for given tile source
 /// </summary>
 /// <param name="source">Tile source to use for this layer</param>
 /// <param name="minTiles">Minimum number of tiles to cache</param>
 /// <param name="maxTiles">Maximum number of tiles to cache</param>
 /// <param name="maxRetries">Unused</param>
 /// <param name="fetchStrategy">Strategy to get list of tiles for given extent</param>
 /// <param name="renderGetStrategy"></param>
 /// <param name="minExtraTiles">Number of minimum extra tiles for memory cache</param>
 /// <param name="maxExtraTiles">Number of maximum extra tiles for memory cache</param>
 // ReSharper disable once UnusedParameter.Local // Is public and won't break this now
 public TileLayer(ITileSource source           = null, int minTiles = 200, int maxTiles = 300,
                  IFetchStrategy fetchStrategy = null, IRenderGetStrategy renderGetStrategy = null,
                  int minExtraTiles            = -1, int maxExtraTiles = -1, Func <TileInfo, Feature> fetchTileAsFeature = null)
 {
     MemoryCache = new MemoryCache <Feature>(minTiles, maxTiles);
     Style       = new VectorStyle {
         Outline = { Color = Color.FromArgb(0, 0, 0, 0) }
     };                                                                            // initialize with transparent outline
     _tileSource                           = source;
     _envelope                             = _tileSource?.Schema?.Extent.ToBoundingBox();
     fetchStrategy                         = fetchStrategy ?? new FetchStrategy(3);
     _renderGetStrategy                    = renderGetStrategy ?? new RenderGetStrategy();
     _minExtraTiles                        = minExtraTiles;
     _maxExtraTiles                        = maxExtraTiles;
     _tileFetchDispatcher                  = new TileFetchDispatcher(MemoryCache, source.Schema, fetchTileAsFeature ?? ToFeature, fetchStrategy);
     _tileFetchDispatcher.DataChanged     += TileFetchDispatcherOnDataChanged;
     _tileFetchDispatcher.PropertyChanged += TileFetchDispatcherOnPropertyChanged;
 }