ArcGIS Engine DEM拉伸渲染

从符号库中取出渲染使用的色带对象IColorRamp(也可以自己定义色带内容)

<pre name="code" class="csharp">IStyleGallery pSG = new ServerStyleGalleryClass();
IStyleGalleryStorage pSGS = pSG as IStyleGalleryStorage;
try
{
    pSGS.AddFile(Application.StartupPath + "\\ESRI.ServerStyle");
}
catch (Exception err)
{
    MessageBox.Show(err.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

IEnumStyleGalleryItem pMarkerSymbolEnum = pSG.get_Items("Color Ramps", Application.StartupPath+"\\ESRI.ServerStyle", "");
pMarkerSymbolEnum.Reset();
IStyleGalleryItem pItem = pMarkerSymbolEnum.Next();
while (pItem != null)
{
    if (pItem.Name == "Elevation #1")
    {
        pColorRamp = pItem.Item as IColorRamp;
        break;
    }
    pItem = pMarkerSymbolEnum.Next();
}


 

使用取得的ColorRamp对象渲染DEM

IRasterLayer pRasterLayr = axMapControl1.get_Layer(0) as IRasterLayer;

IRasterStretchColorRampRenderer pStretchRenderer = new RasterStretchColorRampRendererClass();
IRasterRenderer pRasterRenderer = (IRasterRenderer)pStretchRenderer;
IRaster pRaster = pRasterLayr.Raster;
pRasterRenderer.Raster = pRaster;
pRasterRenderer.Update();
pStretchRenderer.BandIndex = 0;
pStretchRenderer.ColorRamp = pColorRamp;
IRasterStretch pStretchType = (IRasterStretch)pRasterRenderer;
pStretchType.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_StandardDeviations;
pStretchType.StandardDeviationsParam = 2.5;

pRasterLayr.Renderer = pRasterRenderer;
axMapControl1.Refresh();
axTOCControl1.SetBuddyControl(axMapControl1);
axTOCControl1.Update();
axTOCControl1.Refresh();

效果如下图所示



 



评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值