private static Layer GetGridLayer(dynamic layer)
 {
     var symbolizer = new RasterSymbolizer();
     Layer mapLayer = new MapRasterLayer(layer["Path"], symbolizer);
     // DeserializeLayer not implemented.
     return mapLayer;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RasterLayer"/> class.
 /// </summary>
 /// <param name="raster">The raster to create this layer for.</param>
 /// <param name="inProgressHandler">The Progress handler for any status updates.</param>
 public RasterLayer(IRaster raster, IProgressHandler inProgressHandler)
     : base(inProgressHandler)
 {
     DataSet = raster;
     Symbolizer = new RasterSymbolizer(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RasterLayer"/> class using the progress handler defined on the DefaultLayerManager.
 /// </summary>
 /// <param name="raster">The raster to create this layer for.</param>
 public RasterLayer(IRaster raster)
 {
     DataSet = raster;
     Symbolizer = new RasterSymbolizer(this);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RasterLayer"/> class.
 /// Opens the specified fileName and automatically creates a raster that can be used by this raster layer.
 /// </summary>
 /// <param name="fileName">The string fileName to use in order to open the file.</param>
 /// <param name="inProgressHandler">The progress handler to show progress messages.</param>
 public RasterLayer(string fileName, IProgressHandler inProgressHandler)
     : base(inProgressHandler)
 {
     DataSet = DataManager.DefaultDataManager.OpenRaster(fileName, true, inProgressHandler);
     Symbolizer = new RasterSymbolizer(this);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new instance of RasterLayer
 /// </summary>
 /// <param name="raster">The Raster</param>
 /// <param name="inProgressHandler">The Progress handler for any status updates</param>
 public RasterLayer(IRaster raster, IProgressHandler inProgressHandler)
     : base(inProgressHandler)
 {
     DataSet = raster;
     Symbolizer = new RasterSymbolizer(this);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new raster layer using the progress handler defined on the DefaultLayerManager
 /// </summary>
 /// <param name="raster">The raster to create this layer for</param>
 public RasterLayer(IRaster raster)
 {
     DataSet = raster;
     Symbolizer = new RasterSymbolizer(this);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Opens the specified fileName and automatically creates a raster that can be used by this raster layer.
 /// </summary>
 /// <param name="fileName">The string fileName to use in order to open the file</param>
 /// <param name="inProgressHandler">The progress handler to show progress messages</param>
 public RasterLayer(string fileName, IProgressHandler inProgressHandler)
     : base(inProgressHandler)
 {
     DataSet = DataManager.DefaultDataManager.OpenRaster(fileName, true, inProgressHandler);
     Symbolizer = new RasterSymbolizer(this);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a new instance of a Raster layer, and will create a "FallLeaves" image based on the
        /// raster values.
        /// </summary>
        /// <param name="raster">The raster to use</param>
        public MapRasterLayer(IRaster raster)
            : base(raster)
        {
            base.LegendText = Path.GetFileNameWithoutExtension(raster.Filename);
            // string imageFile = Path.ChangeExtension(raster.Filename, ".png");
            // if (File.Exists(imageFile)) File.Delete(imageFile);

            IRasterSymbolizer rs = new RasterSymbolizer { Raster = raster };
            if (raster.NumRows * raster.NumColumns > 8000 * 8000)
            {
                // For huge images, assume that GDAL or something was needed anyway,
                // and we would rather avoid having to re-create the pyramids if there is any chance
                // that the old values will work ok.
                string pyrFile = Path.ChangeExtension(raster.Filename, ".mwi");
                if (File.Exists(pyrFile) && File.Exists(Path.ChangeExtension(pyrFile, ".mwh")))
                {
                    BitmapGetter = new PyramidImage(pyrFile);
                    base.LegendText = Path.GetFileNameWithoutExtension(raster.Filename);
                }
                else
                {
                    BitmapGetter = CreatePyramidImage(pyrFile, DataManager.DefaultDataManager.ProgressHandler);
                }
            }
            else
            {
                // Ensure smaller images match the scheme.
                rs.Scheme.ApplyScheme(ColorSchemeType.FallLeaves, raster);
                Bitmap bmp = new Bitmap(raster.NumColumns, raster.NumRows);
                raster.PaintColorSchemeToBitmap(rs, bmp, raster.ProgressHandler);

                InRamImage id = new InRamImage(bmp);
                id.Bounds.AffineCoefficients = raster.Bounds.AffineCoefficients;
                BitmapGetter = id;
            }
        }