ArcGIS Engine 10 开发手册(8-25)分级渲染
发布时间: 2018-02-02
所属分类: ArcGIS Engine 10 开发手册
本文通过代码演示如何进行分级渲染。
示例代码
public IRasterRenderer ClassifyRenderer (ESRI.ArcGIS.Geodatabase.IRasterDataset pRasterDataset)
{
try
{
//Create the classify renderer.
IRasterClassifyColorRampRenderer pClassifyRenderer = new RasterClassifyColorRampRendererClass ();
IRasterRenderer pRasterRenderer = (IRasterRenderer) pClassifyRenderer;
//Set up the renderer properties.
IRaster pRaster = pRasterDataset.CreateDefaultRaster ();
pRasterRenderer.Raster = pRaster;
pClassifyRenderer.ClassCount = 9;
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 = 9;
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 (Exception ex)
{
System.Diagnostics.Debug.WriteLine (ex.Message);
return null;
}
}
ArcGIS Engine 10 开发手册全集
ArcGIS Engine 10 开发手册全集: ArcGIS Engine 10 开发手册
相关阅读
声明
1.本文所分享的所有需要用户下载使用的内容(包括但不限于软件、数据、图片)来自于网络或者麻辣GIS粉丝自行分享,版权归该下载资源的合法拥有者所有,如有侵权请第一时间联系本站删除。
2.下载内容仅限个人学习使用,请切勿用作商用等其他用途,否则后果自负。
手机阅读
公众号关注
知识星球
手机阅读
最新GIS干货
私享圈子