AnsweredAssumed Answered

changing text symbol style?

Question asked by travis.slack on Jun 12, 2016


I have a chunk of code I managed to get working that labels a feature applies an expression and converts to annotation. I've figured out how to change the font variables but can't find any information on how to change the Text Symbol Style to something like a bullet leader with a box. how do i reference something like that? the code im using is below.

 

    Shared Sub ConvertLabelsToAnnotationSingleLayerMapAnno(ByVal pMap As IMap, ByVal layerIndex As Integer)

        Dim pConvertLabelsToAnnotation As IConvertLabelsToAnnotation = New ConvertLabelsToAnnotationClass()

        Dim pTrackCancel As ITrackCancel = New CancelTrackerClass()

        'Change global level options for the conversion by sending in different parameters to the next line.

        pConvertLabelsToAnnotation.Initialize(pMap, esriAnnotationStorageType.esriMapAnnotation, _

                                              esriLabelWhichFeatures.esriVisibleFeatures, True, _

                                              pTrackCancel, Nothing)

        Dim pLayer As ILayer = pMap.Layer(layerIndex)

        Dim pGeoFeatureLayer As IGeoFeatureLayer = pLayer

 

 

        If Not pGeoFeatureLayer Is Nothing Then

            Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection

            pAnnoLayerPropsColl = pGeoFeatureLayer.AnnotationProperties

            Dim pAnnoLayerProps As IAnnotateLayerProperties

            pAnnoLayerPropsColl.Clear()

            Dim pBOLayerProps As IBasicOverposterLayerProperties

            pBOLayerProps = New BasicOverposterLayerProperties

            pBOLayerProps.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolygon

            pBOLayerProps.NumLabelsOption = esriBasicNumLabelsOption.esriOneLabelPerShape

            pBOLayerProps.FeatureWeight = esriBasicOverposterWeight.esriNoWeight

            pBOLayerProps.LabelWeight = esriBasicOverposterWeight.esriLowWeight

            Dim tSym As ITextSymbol

            tSym = New TextSymbol

            Dim font As IFontDisp

            font = tSym.Font

            font.Bold = False

            font.Size = 13

            tSym.Font = font

            Dim pLELayerProps As ILabelEngineLayerProperties

            pLELayerProps = New LabelEngineLayerProperties

 

 

            pLELayerProps.Expression = "[TYPE]"

            pLELayerProps.Symbol = tSym

            pLELayerProps.BasicOverposterLayerProperties = pBOLayerProps

            pAnnoLayerProps = pLELayerProps

            'pAnnoLayerProps.Class = "Class"

            pAnnoLayerPropsColl.Add(pAnnoLayerProps)

            pGeoFeatureLayer.DisplayAnnotation = True

 

 

            Dim pFeatureClass As IFeatureClass = pGeoFeatureLayer.FeatureClass

            pConvertLabelsToAnnotation.AddFeatureLayer(pGeoFeatureLayer, pGeoFeatureLayer.Name + "_Anno", _

                                                       Nothing, Nothing, False, False, False, False, False, "")

            'Do the conversion.

            pConvertLabelsToAnnotation.ConvertLabels()

            'Turn off labeling for the layer converted.

            pGeoFeatureLayer.DisplayAnnotation = False

            'Refresh the map to update the display.

            Dim pActiveView As IActiveView = pMap

            pActiveView.Refresh()

        End If

    End Sub

Outcomes