ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / PointCloudSceneLayer Class / GetAvailablePointCloudRendererFields Method
Input renderer type
Example

In This Topic
    GetAvailablePointCloudRendererFields Method
    In This Topic
    Gets the available fields for the specified renderer type. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public IReadOnlyList<string> GetAvailablePointCloudRendererFields( 
       PointCloudRendererType rendererType
    )
    Public Function GetAvailablePointCloudRendererFields( _
       ByVal rendererType As PointCloudRendererType _
    ) As IReadOnlyList(Of String)

    Parameters

    rendererType
    Input renderer type

    Return Value

    IReadOnlyList{ System.String}
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Each renderer type requires different fields be present on the point cloud layer. If an empty list is returned from GetAvailablePointCloudRendererFields for a given renderer type then it means that that particular renderer type is not supported for the given PointCloudSceneLayer.
    If the renderer type is supported then one of the field names returned in the list must be set as the PointCloudRendererDefinition.Field value when defining the new renderer to be used.
    Setting an invalid renderer on the layer will disable rendering of the layer until it is removed
    Example
    Query PointCloudSceneLayer Renderer fields
    //Must be called on the MCT
    //var pcsl = ...;
    //At 2.x - IReadOnlyList<string> flds = pcsl.QueryAvailablePointCloudRendererFields(
    //                                     PointCloudRendererType.UniqueValueRenderer);
    IReadOnlyList<string> flds = pcsl.GetAvailablePointCloudRendererFields(
                                 PointCloudRendererType.UniqueValueRenderer);
    var fldCount = flds.Count;
    
    Create and Set a Stretch Renderer
    //Must be called on the MCT
    //var pcsl = ...;
    
    //At 2.x - var fields = pcsl.QueryAvailablePointCloudRendererFields(
    //                           PointCloudRendererType.StretchRenderer);
    
    var fields = pcsl.GetAvailablePointCloudRendererFields(
                             PointCloudRendererType.StretchRenderer);
    var stretchDef = new PointCloudRendererDefinition(
                              PointCloudRendererType.StretchRenderer)
    {
      //Will be either ELEVATION or INTENSITY
      Field = fields[0]
    };
    //Create the CIM Renderer
    var stretchRenderer = pcsl.CreateRenderer(stretchDef) 
                                       as CIMPointCloudStretchRenderer;
    //Apply a color ramp
    var style = Project.Current.GetItems<StyleProjectItem>()
                                    .First(s => s.Name == "ArcGIS Colors");
    var colorRamp = style.SearchColorRamps("").First();
    stretchRenderer.ColorRamp = colorRamp.ColorRamp;
    //Apply modulation
    stretchRenderer.ColorModulation = new CIMColorModulationInfo()
    {
      MinValue = 0,
      MaxValue = 100
    };
    //apply the renderer
    pcsl.SetRenderer(stretchRenderer);
    
    Create and Set a ClassBreaks Renderer
    //Must be called on the MCT
    //var pcsl = ...;
    
    //At 2.x - var fields = pcsl.QueryAvailablePointCloudRendererFields(
    //                          PointCloudRendererType.ClassBreaksRenderer);
    
    var fields = pcsl.GetAvailablePointCloudRendererFields(
                         PointCloudRendererType.ClassBreaksRenderer);
    var classBreakDef = new PointCloudRendererDefinition(
                              PointCloudRendererType.ClassBreaksRenderer)
    {
      //ELEVATION or INTENSITY
      Field = fields[0]
    };
    //create the renderer
    var cbr = pcsl.CreateRenderer(classBreakDef) 
                              as CIMPointCloudClassBreaksRenderer;
    //Set up a color scheme to use
    var style = Project.Current.GetItems<StyleProjectItem>()
                               .First(s => s.Name == "ArcGIS Colors");
    var rampStyle = style.LookupItem(
      StyleItemType.ColorRamp, "Spectrum By Wavelength-Full Bright_Multi-hue_2")
                                                                as ColorRampStyleItem;
    var colorScheme = rampStyle.ColorRamp;
    //Set up 6 manual class breaks
    var breaks = 6;
    var colors = ColorFactory.Instance.GenerateColorsFromColorRamp(
                                                colorScheme, breaks);
    var classBreaks = new List<CIMColorClassBreak>();
    var min = cbr.Breaks[0].UpperBound;
    var max = cbr.Breaks[cbr.Breaks.Count() - 1].UpperBound;
    var step = (max - min) / (double)breaks;
    
    //add in the class breaks
    double upper = min;
    for (int b = 1; b <= breaks; b++)
    {
      double lower = upper;
      upper = b == breaks ? max : min + (b * step);
      var cb = new CIMColorClassBreak()
      {
        UpperBound = upper,
        Label = string.Format("{0:#0.0#} - {1:#0.0#}", lower, upper),
        Color = colors[b - 1]
      };
      classBreaks.Add(cb);
    }
    cbr.Breaks = classBreaks.ToArray();
    pcsl.SetRenderer(cbr);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also