Select to view content in your preferred language

Please Expret of ClassBreaksRenderer /ArcGis9.2/VB.NET/ - legendItems are NOTHING

672
1
11-07-2010 12:19 AM
by Anonymous User
Not applicable
Original User: JMJ98

Hello

Hello

Please, we need an example of classBreaksRender, that worked well for VB.NET.
All we are trying to prove, not visualize the legend of the TOC. The link is an example of how the legend is running the following code (image 1 in attachment)

The second image represents the configuration of the renderer made by the code in VB. NET
The third image, so there is no way to get 

(If we click the OK button in ArcMap (image 2), we get the image 3, but using the code is impossible)

Thanks for the help

Code for define ClassBreaksRenderer object:

'------------------------------
        Dim pMxDoc As IMxDocument
        Dim pLayer As ILayer
        Dim pGeoLayer As IGeoFeatureLayer
        Dim pFLayer As IFeatureLayer
        Dim pFClass As IFeatureClass
        Dim pRender As IClassBreaksRenderer
        Dim pColor1 As IRgbColor
        Dim pColor2 As IRgbColor
        Dim pColor3 As IRgbColor
        Dim i As Integer
        Dim pSFSym1 As ISimpleMarkerSymbol, pSFSym2 As ISimpleMarkerSymbol
        Dim pRendererPropPage As IRendererPropertyPage
        Dim pTable As ITable
        Dim pUIProp As IClassBreaksUIProperties


        pMxDoc = m_pDoc
        pLayer = pMxDoc.ActiveView.FocusMap.Layer(0)
        pFLayer = pLayer
       
        pFClass = pFLayer.FeatureClass
        pTable = pFLayer

        pRender = New ClassBreaksRenderer
        pRender.Field = "Valor"
        pRender.BreakCount = 2
        pRender.MinimumBreak = 0
        pRender.Break(0) = 249.9999
        pRender.Break(1) = 5000

        pUIProp = pRender
        pUIProp.LowBreak(0) = 0
        pUIProp.LowBreak(1) = 250

        pRender.Label(0) = " < 250"
        pRender.Label(1) = " >= 250"

        pColor1 = New RgbColorClass
        pColor1.RGB = System.Drawing.ColorTranslator.ToWin32(Color.GreenYellow)
        pColor2 = New RgbColorClass
        pColor2.RGB = System.Drawing.ColorTranslator.ToWin32(Color.Red)
        pColor3 = New RgbColorClass
        pColor3.RGB = System.Drawing.ColorTranslator.ToWin32(Color.Black)

        pSFSym1 = New SimpleMarkerSymbol
        pSFSym1.Color = pColor1
        pSFSym1.Outline = True
        pSFSym1.OutlineSize = 0.4
        pSFSym1.OutlineColor = pColor3
        pSFSym1.Size = 5
        pSFSym1.Style = esriSimpleMarkerStyle.esriSMSCircle
        pRender.Symbol(0) = pSFSym1

        pSFSym2 = New SimpleMarkerSymbol
        pSFSym2.Color = pColor2
        pSFSym2.Outline = True
        pSFSym2.OutlineSize = 0.4
        pSFSym2.OutlineColor = pColor3
        pSFSym2.Size = 5
        pSFSym2.Style = esriSimpleMarkerStyle.esriSMSCircle
        pRender.Symbol(1) = pSFSym2

        pRendererPropPage = New GraduatedColorPropertyPage
        pGeoLayer = pFLayer

        pGeoLayer.RendererPropertyPageClassID = pRendererPropPage.ClassID
        pGeoLayer.Renderer = pRender

        '(Limite=50mg/l, RD 1514/2009

        pMxDoc.UpdateContents()
        pMxDoc.ActiveView.Refresh()
'------------------------------
0 Kudos
1 Reply
by Anonymous User
Not applicable
Original User: JMJ98

At last we have seen ClassBreaksRenderer correct the error.
How are you things we have wasted much time. ArcObjects is the worst thing that many behaviors are not understood the code.

The solution has been not to create a new symbol with SimpleMarkerSymbol but:

        pMxDoc = m_pDoc
        player = pMxDoc.ActiveView.FocusMap.Layer (0)
        pFLayer = Play
        pGeoLayer = pFLayer
        pSimpleRend = pGeoLayer.Renderer
        Good -> pSFSym1 = pSimpleRend.Symbol
        Bad -> pSFSym1 = New SimpleMarkerSymbol

Thanks to those who have tried to help
0 Kudos