fabpuddu2

GlobeControl Layer Annotation

Discussion created by fabpuddu2 on May 30, 2013
Latest reply on May 31, 2013 by fabpuddu2
hi,

I'm using globecontrol with bilboard layer, i'm trying to add an annotation to a layer, but does not appear, I see only a filled rectangle (the result in attach)

this is my code:

    Private Sub CreateLabel(ByVal pFLy As IFeatureLayer)

        Dim pGeoFLy As IGeoFeatureLayer
        Dim pAnnoLyrPropColl As IAnnotateLayerPropertiesCollection
        Dim pLblEngLyrProps As ILabelEngineLayerProperties
        Dim pAnnoLyrProps As IAnnotateLayerProperties

        Try

            pGeoFLy = pFLy

            pAnnoLyrPropColl = pGeoFLy.AnnotationProperties
            pAnnoLyrPropColl.Clear()

            Dim pPointPlacement As IPointPlacementPriorities = New PointPlacementPrioritiesClass
            pPointPlacement.AboveCenter = 0
            pPointPlacement.AboveLeft = 0
            pPointPlacement.AboveRight = 0
            pPointPlacement.BelowCenter = 1
            pPointPlacement.BelowLeft = 0
            pPointPlacement.BelowRight = 0
            pPointPlacement.CenterLeft = 0
            pPointPlacement.CenterRight = 0

            Dim pBasicOverposeterLayerProp As IBasicOverposterLayerProperties = New BasicOverposterLayerPropertiesClass
            pBasicOverposeterLayerProp.FeatureType = esriBasicOverposterFeatureType.esriOverposterPoint
            pBasicOverposeterLayerProp.FeatureWeight = esriBasicOverposterWeight.esriNoWeight
            pBasicOverposeterLayerProp.LabelWeight = esriBasicOverposterWeight.esriHighWeight
            pBasicOverposeterLayerProp.BufferRatio = 0
            pBasicOverposeterLayerProp.PointPlacementMethod = esriOverposterPointPlacementMethod.esriOnTopPoint 
            pBasicOverposeterLayerProp.PointPlacementPriorities = pPointPlacement

            pLblEngLyrProps = New LabelEngineLayerProperties

            With pLblEngLyrProps
                .Expression = "[Label]"
                .IsExpressionSimple = True
                .Symbol = CreateFontLabel()
                .BasicOverposterLayerProperties = pBasicOverposeterLayerProp
            End With

            pAnnoLyrProps = TryCast(pLblEngLyrProps, IAnnotateLayerProperties)

            With pAnnoLyrProps
                .AnnotationMinimumScale = m_SymbolProperties.Label_MinScale
                .AnnotationMaximumScale = m_SymbolProperties.Label_MaxScale
            End With

            pAnnoLyrPropColl.Add(pAnnoLyrProps)

            pGeoFLy.DisplayAnnotation = True

        Catch ex As Exception


        Finally
            pGeoFLy = Nothing
            pAnnoLyrPropColl = Nothing
            pLblEngLyrProps = Nothing
            pAnnoLyrProps = Nothing
        End Try

    End Sub

    Private Function CreateFontLabel() As ITextSymbol

        Dim pRGBColor As IRgbColor
        Dim pFont As IFont
        Dim pTextSymbol As ITextSymbol

        Try

            pRGBColor = New RgbColor

            With pRGBColor
                .Red = m_SymbolProperties.Label_Color.R
                .Green = m_SymbolProperties.Label_Color.G
                .Blue = m_SymbolProperties.Label_Color.B
            End With

            pFont = New SystemFont

            With pFont
                .Name = m_SymbolProperties.Label_Font.Name
                .Size = m_SymbolProperties.Label_Font.Size
                .Bold = m_SymbolProperties.Label_Font.Bold
                .Underline = m_SymbolProperties.Label_Font.Underline
                .Italic = m_SymbolProperties.Label_Font.Italic
            End With

            pTextSymbol = New TextSymbol

            With pTextSymbol
                .Color = pRGBColor
                .Font = pFont
                .HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft
            End With
            CreateFontLabel = pTextSymbol
        Catch ex As Exception
            CreateFontLabel = Nothing
        Finally
            pRGBColor = Nothing
            pFont = Nothing
            pTextSymbol = Nothing
        End Try
    End Function


thanks

fabrizio

Attachments

Outcomes