classified by Definedinterval. No interval changes.

Discussion created by stil on Nov 19, 2012
I have a grid. I need to display it is classified by DefinedInterval. Method is set to normal, and the interval is calculated by itself.
  In the description of the method is said that you first need to set the interval and then assign method (?), But how is not clear.

Public Function ClassifyRenderer1(ByVal rasterDataset As ESRI.ArcGIS.Geodatabase.IRasterDataset, nummeclass As Integer) As IRasterRenderer
            'Create the classify renderer.
            Dim classifyRenderer As IRasterClassifyColorRampRenderer = New RasterClassifyColorRampRendererClass()
              classifyRenderer.ClassCount = nummeclass
            Dim rasterRenderer As IRasterRenderer = CType(classifyRenderer, IRasterRenderer)

            'Set up the renderer properties.
            Dim raster As IRaster = rasterDataset.CreateDefaultRaster()
            rasterRenderer.Raster = raster
            Dim pRasterBC As IRasterBandCollection = CType(rasterRenderer.Raster, IRasterBandCollection)
              Dim pRasterBand As IRasterBand = pRasterBC.Item(0)
            classifyRenderer.ClassCount = nummeclass

            'set classfication method
            Dim pClassProp As IRasterClassifyUIProperties
            pClassProp = classifyRenderer
            Dim pUID As UID
            Dim ClassBreak As Object
            Dim pClassify As IClassifyGEN
            pClassify = New DefinedInterval
            Dim pInterval As IIntervalRange2 = pClassify
            pInterval.IntervalRange = 25
            ClassBreak = pClassify.ClassBreaks
            pUID = pClassify.ClassID
            pClassProp.ClassificationMethod = pUID
            rasterRenderer = classifyRenderer

            'Set the color ramp for the symbology.
            Dim colorRamp As IAlgorithmicColorRamp = New AlgorithmicColorRampClass
              Dim startColor As IRgbColor
            Dim endColor As IRgbColor
            startColor = New RgbColor
            endColor = New RgbColor
            startColor.Red = 209
            startColor.Green = 144
            startColor.Blue = 21
            endColor.Red = 7
            endColor.Green = 218
            endColor.Blue = 7
            'Set the Start and End
            colorRamp.ToColor = startColor
            colorRamp.FromColor = endColor
            'Set the ramping Alglorithm alg
            colorRamp.Algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm
            'Set the size of the ramp (the number of colors to be derived)alg
            colorRamp.Size = nummeclass
            'Create the rampalg
            ' Dim createColorRamp As Boolean

            'Create the symbol for the classes.
            Dim fillSymbol As IFillSymbol = New SimpleFillSymbolClass()
            Dim pFSymbol As IFillSymbol
            pFSymbol = New SimpleFillSymbol

            Dim i As Integer
            For i = 0 To classifyRenderer.ClassCount - 1 Step i + 1
               pFSymbol.Color = colorRamp.Color(i)
               classifyRenderer.Symbol(i) = CType(pFSymbol, ISymbol)
               ' classifyRenderer.Label(i) = Convert.ToString(i)
            Return rasterRenderer
        Catch ex As Exception
            Return Nothing
        End Try
    End Function