public IStyle ConvertRasterLayer(float contextZoom, StyleLayer styleLayer)
        {
            // visibility
            //   Optional enum. One of visible, none. Defaults to visible.
            //   The display of this layer. none hides this layer.
            if (styleLayer.Layout?.Visibility != null && styleLayer.Layout.Visibility.Equals("none"))
            {
                return(null);
            }

            var paint = styleLayer.Paint;

            var styleRaster = new RasterStyle();

            // raster-opacity
            //   Optional number. Defaults to 1.
            //   The opacity at which the image will be drawn.
            if (paint?.RasterOpacity != null)
            {
                styleRaster.Opacity = paint.RasterOpacity.Evaluate(contextZoom);
            }

            // raster-hue-rotate
            //   Optional number. Units in degrees. Defaults to 0.
            //   Rotates hues around the color wheel.

            // raster-brightness-min
            //   Optional number.Defaults to 0.
            //   Increase or reduce the brightness of the image. The value is the minimum brightness.

            // raster-brightness-max
            //   Optional number. Defaults to 1.
            //   Increase or reduce the brightness of the image. The value is the maximum brightness.

            // raster-saturation
            //   Optional number.Defaults to 0.
            //   Increase or reduce the saturation of the image.

            // raster-contrast
            //   Optional number. Defaults to 0.
            //   Increase or reduce the contrast of the image.

            // raster-fade-duration
            //   Optional number.Units in milliseconds.Defaults to 300.
            //   Fade duration when a new tile is added.

            return(styleRaster);
        }
示例#2
0
 /// <summary>
 /// Create tile layer for given tile source
 /// </summary>
 /// <param name="tileSource">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="dataFetchStrategy">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>
 /// <param name="fetchTileAsFeature">Fetch tile as feature</param>
 // ReSharper disable once UnusedParameter.Local // Is public and won't break this now
 public TileLayer(ITileSource tileSource, int minTiles = 200, int maxTiles = 300,
                  IDataFetchStrategy?dataFetchStrategy = null, IRenderFetchStrategy?renderFetchStrategy = null,
                  int minExtraTiles = -1, int maxExtraTiles = -1, Func <TileInfo, Task <IFeature?> >?fetchTileAsFeature = null)
 {
     _tileSource      = tileSource ?? throw new ArgumentException($"{tileSource} can not null");
     MemoryCache      = new MemoryCache <IFeature?>(minTiles, maxTiles);
     Style            = new RasterStyle();
     Attribution.Text = _tileSource.Attribution?.Text;
     Attribution.Url  = _tileSource.Attribution?.Url;
     _extent          = _tileSource.Schema?.Extent.ToMRect();
     dataFetchStrategy ??= new DataFetchStrategy(3);
     _renderFetchStrategy                  = renderFetchStrategy ?? new RenderFetchStrategy();
     _minExtraTiles                        = minExtraTiles;
     _maxExtraTiles                        = maxExtraTiles;
     _tileFetchDispatcher                  = new TileFetchDispatcher(MemoryCache, _tileSource.Schema, fetchTileAsFeature ?? ToFeatureAsync, dataFetchStrategy);
     _tileFetchDispatcher.DataChanged     += TileFetchDispatcherOnDataChanged;
     _tileFetchDispatcher.PropertyChanged += TileFetchDispatcherOnPropertyChanged;
 }
示例#3
0
        private void SetUpRasterLayer()
        {
            FeatureLayer myRasterLayer = _map.Layers["florida"] as FeatureLayer;

            _rasterTable = myRasterLayer.Table;


            RasterStyle rs = new RasterStyle();

            rs.Contrast  = 33;
            rs.Grayscale = true;

            // this composite style will affect the raster as intended
            CompositeStyle csRaster           = new CompositeStyle(rs);
            FeatureOverrideStyleModifier fosm =
                new FeatureOverrideStyleModifier("Style Mod", csRaster);

            FeatureStyleModifiers modifiers = myRasterLayer.Modifiers;

            modifiers.Append(fosm);
        }
示例#4
0
        private void SetUpRasterLayer()
        {
            FeatureLayer myRasterLayer = _map.Layers["florida"] as FeatureLayer;
            _rasterTable = myRasterLayer.Table;

            RasterStyle rs = new RasterStyle();
            rs.Contrast = 33;
            rs.Grayscale = true;

            // this composite style will affect the raster as intended
            CompositeStyle csRaster = new CompositeStyle(rs);
            FeatureOverrideStyleModifier fosm =
                new FeatureOverrideStyleModifier("Style Mod", csRaster);

            FeatureStyleModifiers modifiers = myRasterLayer.Modifiers;
            modifiers.Append(fosm);
        }