本文整理汇总了C#中IRaster.PaintColorSchemeToBitmap方法的典型用法代码示例。如果您正苦于以下问题:C# IRaster.PaintColorSchemeToBitmap方法的具体用法?C# IRaster.PaintColorSchemeToBitmap怎么用?C# IRaster.PaintColorSchemeToBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRaster
的用法示例。
在下文中一共展示了IRaster.PaintColorSchemeToBitmap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapRasterLayer
/// <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);
}
示例2: MapRasterLayer
/// <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);
if ((long)raster.NumRows * raster.NumColumns > MaxCellsInMemory)
{
// 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.
Bitmap bmp = new Bitmap(raster.NumColumns, raster.NumRows);
raster.PaintColorSchemeToBitmap(Symbolizer, bmp, raster.ProgressHandler);
var id = new InRamImage(bmp) { Bounds = { AffineCoefficients = raster.Bounds.AffineCoefficients } };
BitmapGetter = id;
}
}