ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMPolygonGraphic Class / FromJson Method
The JSON string containing the CIMPolygonGraphic state.
The JSON deserialization settings.
Example

In This Topic
    FromJson Method (CIMPolygonGraphic)
    In This Topic
    Reconstructs the CIMPolygonGraphic with a specified state from a JSON encoding.
    Syntax
    Public Shared Shadows Function FromJson( _
       ByVal json As String, _
       Optional ByVal settings As JsonDeserializationSettings _
    ) As CIMPolygonGraphic

    Parameters

    json
    The JSON string containing the CIMPolygonGraphic state.
    settings
    The JSON deserialization settings.
    Example
    Polygon Graphic Element using CIMGraphic
    {
      // Note: must be called on the QueuedTask
      {
        //On the QueuedTask
        //Place a polygon symbol using the mapview extent geometry
        var extent = MapView.Active.Extent;
        //Contract the extent
        var polygonEnv = extent.Expand(-100000, -90000, false);
        //create a polygon using the envelope
        var polygon = PolygonBuilderEx.CreatePolygon(polygonEnv);
    
        //specify a symbol
        var poly_symbol = SymbolFactory.Instance.ConstructPolygonSymbol(
                              ColorFactory.Instance.GreenRGB);
    
        //create a CIMGraphic 
        var graphic = new CIMPolygonGraphic()
        {
          Symbol = poly_symbol.MakeSymbolReference(),
          Polygon = polygon,
        };
        graphicsLayer.AddElement(graphic);
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also