public static ESRI.ArcGIS.Carto.IRasterRenderer CreateStretchColorRampRenderer() { ESRI.ArcGIS.Carto.IRasterStretchColorRampRenderer pStretchRenderer = new ESRI.ArcGIS.Carto.RasterStretchColorRampRendererClass(); return(pStretchRenderer as ESRI.ArcGIS.Carto.IRasterRenderer); }
public static ESRI.ArcGIS.Carto.IRasterRenderer LoadRasterRendererFromByte(byte[] _RendererValue, string _RendererType) { if (_RendererValue == null || _RendererValue.Length == 0) { return(null); } try { enumRasterRendererType pRendererType = (enumRasterRendererType)Enum.Parse(typeof(enumRasterRendererType), _RendererType); ESRI.ArcGIS.Carto.IRasterRenderer pRasterRenderer = null; switch (pRendererType) { case enumRasterRendererType.StretchColorRampRenderer: pRasterRenderer = new ESRI.ArcGIS.Carto.RasterStretchColorRampRendererClass(); break; case enumRasterRendererType.ClassifyColorRampRenderer: pRasterRenderer = new ESRI.ArcGIS.Carto.RasterClassifyColorRampRendererClass(); break; case enumRasterRendererType.UniqueValueRenderer: pRasterRenderer = new ESRI.ArcGIS.Carto.RasterUniqueValueRendererClass(); break; case enumRasterRendererType.RGBRenderer: pRasterRenderer = new ESRI.ArcGIS.Carto.RasterRGBRendererClass(); break; } if (pRasterRenderer == null) { return(null); } IMemoryBlobStreamVariant pMemoryBlobStreamVariant = new MemoryBlobStreamClass(); pMemoryBlobStreamVariant.ImportFromVariant((object)_RendererValue); IStream pStream = pMemoryBlobStreamVariant as IStream; IPersistStream pPersistStream = pRasterRenderer as IPersistStream; pPersistStream.Load(pStream); pRasterRenderer = pPersistStream as ESRI.ArcGIS.Carto.IRasterRenderer; return(pRasterRenderer); } catch (Exception ex) { return(null); } }