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

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

    Parameters

    json
    The JSON string containing the CIMGraphicElement state.
    settings
    The JSON deserialization settings.
    Example
    Create Graphic Element using CIMGraphic
    {
      //Note: on the QueuedTask
      //Place symbol on the layout
      MapPoint location = MapPointBuilderEx.CreateMapPoint(new Coordinate2D(9, 1));
    
      //specify a symbol
      var pt_symbol = SymbolFactory.Instance.ConstructPointSymbol(
                            ColorFactory.Instance.GreenRGB);
    
      //create a CIMGraphic 
      var graphic = new CIMPointGraphic()
      {
        Symbol = pt_symbol.MakeSymbolReference(),
        Location = location //center of map
      };
      //Or use GraphicFactory
      var graphicFactory = GraphicFactory.Instance.CreateSimpleGraphic(location, pt_symbol);
    
      ElementFactory.Instance.CreateGraphicElement(layout, graphic);
      ElementFactory.Instance.CreateGraphicElement(layout, graphicFactory);
    }
    Create Element using a CIMGraphicElement
    {
      //Note: Must be on QueuedTask.Run
    
      //Place symbol on the layout
      MapPoint point = MapPointBuilderEx.CreateMapPoint(new Coordinate2D(9, 1));
    
      //specify a symbol
      var pt_symbol = SymbolFactory.Instance.ConstructPointSymbol(
                            ColorFactory.Instance.GreenRGB);
    
      //create a CIMGraphic 
      var graphic = new CIMGraphicElement()
      {
        Graphic = new CIMPointGraphic()
        {
          Symbol = pt_symbol.MakeSymbolReference(),
          Location = point //A point in the layout
        }
      };
      ElementFactory.Instance.CreateElement(layout, graphic);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also