Creating a raster classify renderer
[Java]
public IRasterRenderer classifyRenderer(IRasterDataset rasterDataset)throws
Exception{
//create the classify renderer
IRasterClassifyColorRampRenderer classifyRenderer = new
RasterClassifyColorRampRenderer();
IRasterRenderer rasterRenderer = (IRasterRenderer)classifyRenderer;
//setup renderer properties
IRaster raster = rasterDataset.createDefaultRaster();
rasterRenderer.setRasterByRef(raster);
classifyRenderer.setClassCount(3);
rasterRenderer.update();
//set color ramp for the symbology
IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRamp();
colorRamp.setSize(3);
boolean[] createColorRamp = {
false
};
colorRamp.createRamp(createColorRamp);
//create symbol for the classes
IFillSymbol fillSymbol = new SimpleFillSymbol();
for (int i = 0; i < classifyRenderer.getClassCount(); i++){
fillSymbol.setColor(colorRamp.getColor(i));
classifyRenderer.setSymbol(i, (ISymbol)fillSymbol);
classifyRenderer.setLabel(i, i + "");
}
return rasterRenderer;
}
See Also:
How to add a raster layer to a map
Development licensing |
Deployment licensing |
ArcInfo |
ArcInfo |
ArcEditor |
ArcEditor |
ArcView |
ArcInfo |
Engine Developer Kit |
Engine Runtime |