Ejemplo n.º 1
0
        public Bus13RouteDataService(string endpoint, string location, string infoParam)
        {
            if (string.IsNullOrWhiteSpace(endpoint))
            {
                throw new ArgumentException("Endpoint must not be null or empty.", nameof(endpoint));
            }

            if (string.IsNullOrWhiteSpace(location))
            {
                throw new ArgumentException("Location must not be null or empty.", nameof(location));
            }

            if (string.IsNullOrWhiteSpace(infoParam))
            {
                throw new ArgumentException("Info param value must not be null or empty.", nameof(infoParam));
            }

            _infoParamValue = infoParam;
            _endpoint       = endpoint;
            _location       = location;

            var context = new DataServiceContext(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);
            var postProcessorsFactory = new PostProcessorFactory();

            _routeStopPostProcessors = postProcessorsFactory.CreateRouteStopsDataPostProcessors(context);
        }
Ejemplo n.º 2
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);
        }