ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMSimpleRenderer Class
Members Example

In This Topic
    CIMSimpleRenderer Class
    In This Topic
    Represents a simple renderer.
    Object Model
    CIMSimpleRenderer ClassCIMSimpleRenderer ClassCIMSimpleRenderer ClassCIMSymbolReference Class
    Syntax
    Example
    How to set symbol for a feature layer symbolized with simple renderer
    public Task SetFeatureLayerSymbolAsync(FeatureLayer ftrLayer, CIMSymbol symbolToApply)
    {
      if (ftrLayer == null || symbolToApply == null)
        throw new System.ArgumentNullException();
    
      return QueuedTask.Run(() =>
      {
    
        //Get simple renderer from the feature layer
        CIMSimpleRenderer currentRenderer = ftrLayer.GetRenderer() as CIMSimpleRenderer;
        if (currentRenderer == null)
          return;
    
        //Set symbol's real world setting to be the same as that of the feature layer
        symbolToApply.SetRealWorldUnits(ftrLayer.UsesRealWorldSymbolSizes);
    
        //Update the symbol of the current simple renderer
        currentRenderer.Symbol = symbolToApply.MakeSymbolReference();
        //Update the feature layer renderer
        ftrLayer.SetRenderer(currentRenderer);
      });
    }
    
    How to apply a symbol from style to a feature layer
    public Task SetFeatureLayerSymbolFromStyleItemAsync(
               FeatureLayer ftrLayer, SymbolStyleItem symbolItem)
    {
      if (ftrLayer == null || symbolItem == null)
        throw new System.ArgumentNullException();
    
      return QueuedTask.Run(() =>
      {
        //Get simple renderer from the feature layer
        CIMSimpleRenderer currentRenderer = ftrLayer.GetRenderer() as CIMSimpleRenderer;
        if (currentRenderer == null)
          return;
        //Get symbol from the SymbolStyleItem
        CIMSymbol symbol = symbolItem.Symbol;
    
        //Set symbol's real world setting to be the same as that of the feature layer
        symbol.SetRealWorldUnits(ftrLayer.UsesRealWorldSymbolSizes);
    
        //Update the symbol of the current simple renderer
        currentRenderer.Symbol = symbol.MakeSymbolReference();
        //Update the feature layer renderer
        ftrLayer.SetRenderer(currentRenderer);
      });
    }
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMRenderer
             ArcGIS.Core.CIM.CIMSimpleRenderer

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also