How to get the label class in the Annotation

1673
2
04-14-2010 05:50 AM
jessieleo
New Contributor
Hi All,

I am using arcobjects for VBA on Annotation, and I would like to get values in ANNOTATIONCLASSID instead of numbers. for example, I used ICursor to query the ANNOTATIONCLASSID , while I only got 0,1,2, etc. instead of the values showing on the fly like "Local Road", "Highway".

any idea how to get the charactors insted of numbers?

Thanks.



Public Sub ShowUniqueValues(PTABLE As ITable, sFieldName As String)

If OptionButton_POI_Index.Value = True Then

Set pdataset = PTABLE
Set pFeatureWorkspace = pdataset.Workspace
Set pQueryDef = pFeatureWorkspace.CreateQueryDef
With pQueryDef

.Tables = pdataset.Name ' Fully qualified table name
.WhereClause = "Status=0" '& "''" & "Placed" & "''"
.SubFields = "DISTINCT(" & sFieldName & ")"
Set pCursor = .Evaluate
End With


Set pRow = pCursor.NextRow
Do Until pRow Is Nothing
' Debug.Print pRow.Value(0) ' Note only one field in the cursor

ListBox_LayerName.AddItem pRow.Value(0)
Set pRow = pCursor.NextRow

Loop

ElseIf OptionButton_Street_Index.Value = True Then


End If




End Sub



jessie@mapmobility.com
0 Kudos
2 Replies
jessieleo
New Contributor
anybody can help???
0 Kudos
jessemaps
Occasional Contributor
This demonstrates how to get the anno class names based on an input annotationclassid value. I'd be interested to see any other ways folks are getting at the anno class names.

Private Sub testAnnoClasses()

'sample input
Dim intAnnoClassID As Integer
intAnnoClassID = 0
'------------

    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument

    Dim pMap As IMap
    Set pMap = pMxDoc.FocusMap
    
    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pMap.Layer(0)
    
    Dim pAnnoClass As IAnnoClass
    Set pAnnoClass = pFeatureLayer.FeatureClass.Extension
    
    Dim pSymbolColl As ISymbolCollection2
    Set pSymbolColl = pAnnoClass.SymbolCollection
    
    Dim pSymbolIdentifier As ISymbolIdentifier2
    pSymbolColl.Reset
    Set pSymbolIdentifier = pSymbolColl.Next

    MsgBox pSymbolColl.Count
    For i = 0 To pSymbolColl.Count - 1
        If pSymbolIdentifier.ID = intAnnoClassID Then
            MsgBox "i=" & i & " symbolID=" & pSymbolIdentifier.ID & "," & pSymbolIdentifier.Name
            Exit For
        End If
        Set pSymbolIdentifier = pSymbolColl.Next
    Next i
    
End Sub



Jesse Wickizer
Maps.com
0 Kudos