Beispiel #1
0
        public MapLayer(LevelMap map, MiMapLevelLayerConfig config)
        {
            Map       = map;
            LayerId   = config.LayerId ?? "base";
            Directory = Path.Combine(map.TilesDirectory, LayerId);
            Renderer  = RendererFactory.CreateLayerRenderer(config.Renderer);

            var postProcessors = new List <IPostProcessor>();

            foreach (var pp in config.Renderer.PostProcessors)
            {
                var p = PostProcessorFactory.CreatePostProcessor(pp);
                if (p != null)
                {
                    postProcessors.Add(p);
                }
            }
            PostProcessors = postProcessors.ToArray();

            Scaler = new TileScaler(Directory, Renderer.RenderScale, map.Meta.TileSize, map.Meta.MinZoom, map.Meta.MaxZoom, map.Config.LevelId, LayerId);
            Scaler.OnTileUpdated += (s, e) => OnTileUpdated?.Invoke(s, e);
            //CleanupTimer = new Timer(CleanupCallback, null, 5000, 5000);
        }