本文整理汇总了C#中ESRI.CreateDefaultRaster方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.CreateDefaultRaster方法的具体用法?C# ESRI.CreateDefaultRaster怎么用?C# ESRI.CreateDefaultRaster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.CreateDefaultRaster方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StretchRenderer
/// <summary>
/// 根据单波段灰度渲染
/// </summary>
/// <param name="rasterDataset">栅格数据集</param>
/// <param name="graypos">第几波段</param>
/// <returns></returns>
public static IRasterRenderer StretchRenderer(ESRI.ArcGIS.Geodatabase.IRasterDataset rasterDataset, int graypos)
{
try
{
//Define the from and to colors for the color ramp.
IRgbColor fromColor = new RgbColorClass();
fromColor.Red = 255;
fromColor.Green = 0;
fromColor.Blue = 0;
IColor toColor = new RgbColorClass();
fromColor.Red = 0;
fromColor.Green = 255;
fromColor.Blue = 0;
//Create the color ramp.
IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRampClass();
colorRamp.Size = 255;
colorRamp.FromColor = fromColor;
colorRamp.ToColor = toColor;
bool createColorRamp;
colorRamp.CreateRamp(out createColorRamp);
//Create a stretch renderer.
IRasterStretchColorRampRenderer stretchRenderer = new
RasterStretchColorRampRendererClass();
//设置显示对比度和亮度
//((IRasterDisplayProps)stretchRenderer).BrightnessValue = -90;
IRasterRenderer rasterRenderer = (IRasterRenderer)stretchRenderer;
//Set the renderer properties.
IRaster raster = rasterDataset.CreateDefaultRaster();
rasterRenderer.Raster = raster;
rasterRenderer.Update();
stretchRenderer.BandIndex = graypos;
//stretchRenderer.ColorRamp = colorRamp;
//Set the stretch type.
IRasterStretch stretchType = (IRasterStretch)rasterRenderer;
stretchType.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_StandardDeviations;
stretchType.StandardDeviationsParam = 2;
return rasterRenderer;
}
catch
{
return null;
}
}
示例2: ClassifyRenderer
public static IRasterRenderer ClassifyRenderer(ESRI.ArcGIS.Geodatabase.IRasterDataset pRasterDataset)
{
try
{
//create the classify render:创建渲染器
IRasterClassifyColorRampRenderer pClassifyRenderer=new RasterClassifyColorRampRendererClass();
IRasterRenderer pRasterRenderer=(IRasterRenderer)pClassifyRenderer;
IRaster pRaster=pRasterDataset.CreateDefaultRaster();
pRasterRenderer.Raster=pRaster;
pClassifyRenderer.ClassCount=10;
pRasterRenderer.Update();
//创建颜色
IRgbColor pFromColor=new RgbColorClass();
pFromColor.Red=255;
pFromColor.Green=0;
pFromColor.Blue=0;
IRgbColor pToColor=new RgbColorClass();
pToColor.Red=0;
pToColor.Green=255;
pToColor.Blue=255;
//set the color ramp for the symbology:生成色带
IAlgorithmicColorRamp pRamp=new AlgorithmicColorRampClass();
pRamp.Size=10;
pRamp.FromColor=pFromColor;
pRamp.ToColor=pToColor;
bool pBoolColorRamp;
pRamp.CreateRamp(out pBoolColorRamp);
//create the symbol for the classes.:创建符号
IFillSymbol pFillSymbol=new SimpleFillSymbolClass();
for (int i=0;i<pClassifyRenderer.ClassCount;i++){
pFillSymbol.Color=pRamp.get_Color(i);
pClassifyRenderer.set_Symbol(i,(ISymbol)pFillSymbol);
pClassifyRenderer.set_Label(i,Convert.ToString(i));
}
return pRasterRenderer;
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}
示例3: StretchRenderer
public IRasterRenderer StretchRenderer(ESRI.ArcGIS.Geodatabase.IRasterDataset pRasterDataset)
{
try
{
//Define the from and to colors for the color ramp.
IRgbColor pFromColor = new RgbColorClass();
pFromColor.Red = 255;
pFromColor.Green = 0;
pFromColor.Blue = 0;
IRgbColor pToColor = new RgbColorClass();
pToColor.Red = 0;
pToColor.Green = 255;
pToColor.Blue = 0;
//Create the color ramp.
IAlgorithmicColorRamp pRamp = new AlgorithmicColorRampClass();
pRamp.Size = 255;
pRamp.FromColor = pFromColor;
pRamp.ToColor = pToColor;
bool createColorRamp;
pRamp.CreateRamp(out createColorRamp);
//Create a stretch renderer.
IRasterStretchColorRampRenderer pStretchRenderer = new
RasterStretchColorRampRendererClass();
IRasterRenderer pRasterRenderer = (IRasterRenderer)pStretchRenderer;
//Set the renderer properties.
IRaster pRaster = pRasterDataset.CreateDefaultRaster();
pRasterRenderer.Raster = pRaster;
pRasterRenderer.Update();
pStretchRenderer.BandIndex = 0;
pStretchRenderer.ColorRamp = pRamp;
//Set the stretch type.
IRasterStretch pStretchType = (IRasterStretch)pRasterRenderer;
pStretchType.StretchType =
esriRasterStretchTypesEnum.esriRasterStretch_StandardDeviations;
pStretchType.StandardDeviationsParam = 2;
return pRasterRenderer;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}