/// <summary> /// This should launch a frmRasterSymbolizer /// </summary> /// <param name="context">System.ComponentModel.ITypeDescriptorContext context</param> /// <param name="provider">IServiceProvider provider</param> /// <param name="value">object value</param> /// <returns>A new RasterSymbolizer</returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { IRasterSymbolizer rs = value as IRasterSymbolizer; if (rs == null) { rs = new RasterSymbolizer(); } IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); IRasterLayer parent = rs.ParentLayer; RasterLayerDialog frm = new RasterLayerDialog(parent); dialogProvider.ShowDialog(frm); return parent.Symbolizer; }
/// <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) { string imageFile = Path.ChangeExtension(raster.Filename, ".bmp"); if (File.Exists(imageFile)) File.Delete(imageFile); IRasterSymbolizer rs = new RasterSymbolizer(); rs.Raster = raster; rs.Scheme.ApplyScheme(ColorSchemes.FallLeaves, raster); Bitmap bmp = new Bitmap(raster.NumColumns, raster.NumRows); bmp.Save(imageFile); raster.PaintColorSchemeToBitmap(rs, bmp, raster.ProgressHandler); bmp.Save(imageFile); bmp.Dispose(); ImageData id = new ImageData(imageFile); id.Bounds.AffineCoefficients = raster.Bounds.AffineCoefficients; id.WorldFile.Affine = raster.Bounds.AffineCoefficients; Configure(id, raster); }