麻辣GIS微信平台

更多 GIS 干货

微信关注不错过

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 开发手册

相关阅读

麻辣GIS-Sailor

作者:

GIS爱好者,学GIS,更爱玩GIS。

声明

1.本文所分享的所有需要用户下载使用的内容(包括但不限于软件、数据、图片)来自于网络或者麻辣GIS粉丝自行分享,版权归该下载资源的合法拥有者所有,如有侵权请第一时间联系本站删除。

2.下载内容仅限个人学习使用,请切勿用作商用等其他用途,否则后果自负。

手机阅读
公众号关注
知识星球
手机阅读
麻辣GIS微信公众号关注
最新GIS干货
关注麻辣GIS知识星球
私享圈子

留言板(小编看到第一时间回复)