ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMPictureGraphic Class
Members Example

In This Topic
    CIMPictureGraphic Class
    In This Topic
    Represents a picture graphic.
    Object Model
    CIMPictureGraphic ClassEnvelope ClassCIMPictureGraphic ClassCIMGraphicFrame ClassCIMPictureGraphic ClassCIMSymbolReference Class
    Syntax
    Example
    Create a new picture element with advanced symbol settings
    //Create a picture element and also set background and border symbology.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build 2D envelope geometry
      Coordinate2D pic_ll = new Coordinate2D(6, 1);
      Coordinate2D pic_ur = new Coordinate2D(8, 2);
      //At 2.x - Envelope env = EnvelopeBuilder.CreateEnvelope(pic_ll, pic_ur);
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(pic_ll, pic_ur);
    
      //Create and add element to layout
      string picPath = @"C:\Temp\WhitePass.jpg";
      //At 2.x - GraphicElement picElm =
      //    LayoutElementFactory.Instance.CreatePictureGraphicElement(
      //                                             layout, env, picPath);
      //         picElm.SetName("New Picture");
      //
      GraphicElement picElm = ElementFactory.Instance.CreatePictureGraphicElement(
                                           layout, env, picPath, "New Picture");
    
      //(Optionally) Modify the border and shadow 
      CIMGraphic picGra = picElm.GetGraphic();
      CIMPictureGraphic cimPicGra = picGra as CIMPictureGraphic;
      cimPicGra.Frame.BorderSymbol = new CIMSymbolReference();
      cimPicGra.Frame.BorderSymbol.Symbol =
            SymbolFactory.Instance.ConstructLineSymbol(
                   ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Solid);
    
      cimPicGra.Frame.ShadowSymbol = new CIMSymbolReference();
      cimPicGra.Frame.ShadowSymbol.Symbol =
                  SymbolFactory.Instance.ConstructPolygonSymbol(
                        ColorFactory.Instance.BlackRGB, SimpleFillStyle.Solid);
    
      //Update the element
      picElm.SetGraphic(picGra);
    });
    Graphic Overlay with CIMPictureGraphic
    // get the current mapview
    var mapView = MapView.Active;
    if (mapView == null)
      return;
    
    //Valid formats for PictureURL are:
    // e.g. local file URL:
    // file:///<path>
    // file:///c:/images/symbol.png
    //
    // e.g. network file URL:
    // file://<host>/<path>
    // file://server/share/symbol.png
    //
    // e.g. data URL:
    // data:<mediatype>;base64,<data>
    // data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAU ...
    //
    // image/bmp
    // image/gif
    // image/jpeg
    // image/png
    // image/tiff
    // image/x-esri-bglf
    
    var pictureGraphic = new CIMPictureGraphic
    {
      PictureURL = @"file:///C:/Images/MyImage.png",
      Box = envelope
    };
    
    IDisposable _graphic = mapView.AddOverlay(pictureGraphic);
    Graphic Overlay with CIMPictureGraphic
    // get the current mapview
    var mapView = MapView.Active;
    if (mapView == null)
      return;
    
    //Valid formats for PictureURL are:
    // e.g. local file URL:
    // file:///<path>
    // file:///c:/images/symbol.png
    //
    // e.g. network file URL:
    // file://<host>/<path>
    // file://server/share/symbol.png
    //
    // e.g. data URL:
    // data:<mediatype>;base64,<data>
    // data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAU ...
    //
    // image/bmp
    // image/gif
    // image/jpeg
    // image/png
    // image/tiff
    // image/x-esri-bglf
    
    var pictureGraphic = new CIMPictureGraphic
    {
      PictureURL = @"file:///C:/Images/MyImage.png",
      Box = envelope
    };
    
    IDisposable _graphic = mapView.AddOverlay(pictureGraphic);
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMGraphic
             ArcGIS.Core.CIM.CIMPictureGraphic

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also