ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / AnnotationFeatureClassDescription Class / LabelClasses Property
Example

In This Topic
    LabelClasses Property (AnnotationFeatureClassDescription)
    In This Topic
    Syntax
    public IReadOnlyList<CIMLabelClass> LabelClasses {get;}
    Public ReadOnly Property LabelClasses As IReadOnlyList(Of CIMLabelClass)
    Example
    Modifying annotation labels and symbols
    {
      Task ModifyAnnotationLabelAndSymbolsAsync(SchemaBuilder schemaBuilder, AnnotationFeatureClassDefinition annotationFeatureClassDefinition) => QueuedTask.Run(() =>
      {
        AnnotationFeatureClassDescription annotationFeatureClassDescription = new AnnotationFeatureClassDescription(annotationFeatureClassDefinition);
        IReadOnlyList<CIMLabelClass> labelClasses = annotationFeatureClassDescription.LabelClasses;
    
        // Adding a new annotation label class
        List<CIMLabelClass> modifiedLabelClasses = new List<CIMLabelClass>(labelClasses);
        modifiedLabelClasses.Add(new CIMLabelClass()
        {
          Name = "RedSymbol",
          TextSymbol = new CIMSymbolReference
          {
            Symbol = new CIMTextSymbol()
            {
              Angle = 45,
              FontType = FontType.Type1,
              FontFamilyName = "Arial",
              FontEffects = FontEffects.Normal,
              HaloSize = 2.0,
    
              Symbol = new CIMPolygonSymbol
              {
                SymbolLayers = new CIMSymbolLayer[]
                  { new CIMSolidFill { Color = CIMColor.CreateRGBColor(255, 0, 0) } },
                UseRealWorldSymbolSizes = true
              }
            },
            MaxScale = 0,
            MinScale = 0,
            SymbolName = "TextSymbol-RED"
          }
        });
    
        // Adding a  new symbol
        annotationFeatureClassDescription.Symbols.Add(new CIMSymbolIdentifier()
        {
          ID = 1001,
          Name = "ID_10001",
          Symbol = new CIMTextSymbol()
          {
            Angle = 43,
            FontEffects = FontEffects.Subscript,
            FontType = FontType.TTOpenType,
            FontStyleName = "Regular",
            FontFamilyName = "Tahoma",
            TextCase = TextCase.Allcaps
          }
        });
    
        // Modify annotation feature class
        AnnotationFeatureClassDescription modifiedAnnotationFeatureClassDescription = new AnnotationFeatureClassDescription(annotationFeatureClassDescription.Name,
            annotationFeatureClassDescription.FieldDescriptions, annotationFeatureClassDescription.ShapeDescription,
            annotationFeatureClassDescription.GeneralPlacementProperties, modifiedLabelClasses);
    
        // Enqueue modify
        schemaBuilder.Modify(modifiedAnnotationFeatureClassDescription);
    
        // DDL execute
        schemaBuilder.Build();
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also