ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / PredefinedShape Enumeration
Example Example

In This Topic
    PredefinedShape Enumeration
    In This Topic
    Specifies the available predefined shape types
    Syntax
    Members
    MemberDescription
    Circle Circle - a type of polygon
    Cloud Cloud shaped polygon
    Cross Cross shaped polygon
    Ellipse Ellipse - a type of polygon
    HalfCircle Half or "Semi" circle shaped polygon
    None None- default
    Rectangle Rectangle - i.e. an Envelope, also a type of Polygon
    RightTriangle RightTriangle shaped polygon
    RoundedRectangle RoundedRectangle shaped polygon
    Triangle Triangle shaped polygon
    X X shaped polygon
    Remarks
    Example
    Create rectangle graphic with simple symbology
    //Create a simple 2D rectangle graphic and apply simple fill and
    //outline symbols.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build 2D envelope geometry
      Coordinate2D rec_ll = new Coordinate2D(1.0, 4.75);
      Coordinate2D rec_ur = new Coordinate2D(3.0, 5.75);
      //At 2.x - Envelope rec_env = EnvelopeBuilder.CreateEnvelope(rec_ll, rec_ur);
      Envelope rec_env = EnvelopeBuilderEx.CreateEnvelope(rec_ll, rec_ur);
    
      //Set symbology, create and add element to layout
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
        ColorFactory.Instance.BlackRGB, 5.0, SimpleLineStyle.Solid);
      CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol(
        ColorFactory.Instance.GreenRGB, SimpleFillStyle.DiagonalCross, outline);
    
      //At 2.x - GraphicElement recElm =
      //           LayoutElementFactory.Instance.CreateRectangleGraphicElement(
      //                                                  layout, rec_env, polySym);
      //         recElm.SetName("New Rectangle");
      //
      GraphicElement recElm = ElementFactory.Instance.CreateGraphicElement(
        container, rec_env, polySym, "New Rectangle");
      //Or use Predefined shape
      GraphicElement recElm2 = ElementFactory.Instance.CreatePredefinedShapeGraphicElement(
                                container, PredefinedShape.Rectangle, rec_env, polySym, 
                                "New Rectangle2");
    });
    Create Predefined Shape Graphic Element
    //Must be on QueuedTask.Run(() => { ...
    
    //PredefinedShape shapeType =
    //              PredefinedShape.Circle | Cloud | Cross |Circle | Triangle | ... ;
    
    //Build geometry
    Coordinate2D ll = new Coordinate2D(4, 2.5);
    Coordinate2D ur = new Coordinate2D(6, 4.5);
    Envelope env = EnvelopeBuilderEx.CreateEnvelope(ll, ur);
    
    var outline = SymbolFactory.Instance.ConstructStroke(
                    ColorFactory.Instance.BlueRGB, 2);
    var poly_sym = SymbolFactory.Instance.ConstructPolygonSymbol(
                     null, outline);
    
    var ge = ElementFactory.Instance.CreatePredefinedShapeGraphicElement(
                           container, shapeType, env.Center, env.Width, env.Height, 
                            poly_sym, shapeType.ToString(), true);
    
    Create Predefined Shape Graphic Element
    //Must be on QueuedTask.Run(() => { ...
    
    //PredefinedShape shapeType =
    //              PredefinedShape.Circle | Cloud | Cross |Circle | Triangle | ... ;
    
    //Build geometry
    Coordinate2D ll = new Coordinate2D(4, 2.5);
    Coordinate2D ur = new Coordinate2D(6, 4.5);
    Envelope env = EnvelopeBuilderEx.CreateEnvelope(ll, ur);
    
    var outline = SymbolFactory.Instance.ConstructStroke(
                    ColorFactory.Instance.BlueRGB, 2);
    var poly_sym = SymbolFactory.Instance.ConstructPolygonSymbol(
                     null, outline);
    
    var ge = ElementFactory.Instance.CreatePredefinedShapeGraphicElement(
                           container, shapeType, env.Center, env.Width, env.Height, 
                            poly_sym, shapeType.ToString(), true);
    
    Create Predefined Shape Graphic Element
    //Must be on QueuedTask.Run(() => { ...
    
    //PredefinedShape shapeType =
    //              PredefinedShape.Circle | Cloud | Cross |Circle | Triangle | ... ;
    
    //Build geometry
    Coordinate2D ll = new Coordinate2D(4, 2.5);
    Coordinate2D ur = new Coordinate2D(6, 4.5);
    Envelope env = EnvelopeBuilderEx.CreateEnvelope(ll, ur);
    
    var outline = SymbolFactory.Instance.ConstructStroke(
                    ColorFactory.Instance.BlueRGB, 2);
    var poly_sym = SymbolFactory.Instance.ConstructPolygonSymbol(
                     null, outline);
    
    var ge = ElementFactory.Instance.CreatePredefinedShapeGraphicElement(
                           container, shapeType, env.Center, env.Width, env.Height, 
                            poly_sym, shapeType.ToString(), true);
    
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Desktop.Layouts.PredefinedShape

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also