Determine if a feature class is an Annotation feature class.

526
1
12-09-2010 01:54 PM
RiverTaig1
Occasional Contributor
Seems like a simple question but it has me stumped...How can I test to determine if a given IFeatureClass is annotation?

IRelationshipClass rc = relClass.Next();
while (rc != null)
{
  if (rc.DestinationClass is ESRI.ArcGIS.Carto.IAnnoClass) //This doesn't work
  {
    //More code here...
  }
  rc = relClass.Next();
}
0 Kudos
1 Reply
KristofVydt
New Contributor
Hi Steve,

The IFeatureClass.FeatureType property returns an esriFeatureType constant esriFTAnnotation (11) in case of Annotation Feature.

In VBA you can do a simple test like this ...
Sub AnnoFeatureTest()

    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument
    
    Dim pLayer As IFeatureLayer
    Set pLayer = pMxDoc.FocusMap.Layer(0)
    
    Dim featureType As esriFeatureType
    featureType = pLayer.FeatureClass.featureType
    
    If (featureType = esriFTAnnotation) Then
        Debug.Print "It's a feature annotation !"
    Else
        Debug.Print "It's some other feature type."
    End If
    
End Sub


Kristof Vydt
Esri Certified Desktop Associate
Esri BeLux
0 Kudos