ArcGIS Engine 10 开发手册(8-27)拉伸

本文目录
  • 正文

本文通过代码演示如何进行拉伸。

示例代码

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)

  {

  }

}

ArcGIS Engine 10 开发手册全集

ArcGIS Engine 10 开发手册全集: ArcGIS Engine 10 开发手册

如果本文对你有所帮助,欢迎对我们团队进行打赏捐助,让我们在传播3S的路上可以走得更远。
赞赏支持
微信捐助麻辣GIS 支付宝捐助麻辣GIS

麻辣GIS-Sailor
作者:
GIS爱好者,学GIS,更爱玩GIS。

如您有疑问,可在文末留言,或到QQ群提问。

本站QQ群(一):291616564 麻辣GIS

本站QQ群(二):166408035 麻辣GIS(二)

微信公众号:malagis,扫描右边二维码直接关注。

发表评论