ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SymbolFactory Class / ConstructPolygonSymbol Method / ConstructPolygonSymbol(CIMColor,SimpleStipplePattern) Method
Outline and stipple color
Example

In This Topic
    ConstructPolygonSymbol(CIMColor,SimpleStipplePattern) Method
    In This Topic
    Constructs a polygon symbol of specific color and stipple pattern. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Function ConstructPolygonSymbol( _
       ByVal color As CIMColor, _
       ByVal stipplePattern As SimpleStipplePattern _
    ) As CIMPolygonSymbol

    Parameters

    color
    Outline and stipple color
    stipplePattern

    Return Value

    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run
    Remarks
    The polygon symbol outline and stipple color will be the same. The background fill will be white. Note: the stipple pattern is generated with a marker not a fill.
    Example
    Create_polygon_env
    //Create a polygon graphic using an envelope with simple line and fill styles.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build 2D envelope
      Coordinate2D env_ll = new Coordinate2D(1.0, 4.75);
      Coordinate2D env_ur = new Coordinate2D(3.0, 5.75);
      //At 2.x - Envelope env = EnvelopeBuilder.CreateEnvelope(env_ll, env_ur);
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(env_ll, env_ur);
    
      //Set symbolology, create and add element to layout
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
        ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.DashDotDot);
      CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol(
        ColorFactory.Instance.RedRGB, SimpleFillStyle.ForwardDiagonal, outline);
      //At 2.x - GraphicElement polyElm =
      //            LayoutElementFactory.Instance.CreatePolygonGraphicElement(layout, env, polySym);
      //         polyElm.SetName("New Polygon");
      GraphicElement polyElm = ElementFactory.Instance.CreateGraphicElement(
        layout, env, polySym, "New Polygon");
    });
    Create_circle
    //Create a circle graphic element using a simple line and fill styles.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build geometry
      Coordinate2D center = new Coordinate2D(2, 4);
      //At 2.x - EllipticArcBuilder eabCir = new EllipticArcBuilder(center, 0.5, esriArcOrientation.esriArcClockwise);
      var eabCir = new EllipticArcBuilderEx(center, 0.5, ArcOrientation.ArcClockwise);
      EllipticArcSegment cir = eabCir.ToSegment();
    
      //Set symbolology, create and add element to layout
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Dash);
      CIMPolygonSymbol circleSym = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Solid, outline);
      //At 2.x - GraphicElement cirElm = LayoutElementFactory.Instance.CreateCircleGraphicElement(layout, cir, circleSym);
      //         cirElm.SetName("New Circle");
    
      var polyLine = PolylineBuilderEx.CreatePolyline(cir);
      GraphicElement cirElm = ElementFactory.Instance.CreateGraphicElement(layout, polyLine, circleSym, "New Circle");
    });
    Create_ellipse
    //Create an ellipse graphic with simple line and fill styles.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build geometry
      Coordinate2D center = new Coordinate2D(2, 2.75);
      //At 2.x - EllipticArcBuilder eabElp = new EllipticArcBuilder(center, 0, 1, 0.45, esriArcOrientation.esriArcClockwise);
      var eabElp = new EllipticArcBuilderEx(center, 0, 1, 0.45, ArcOrientation.ArcClockwise);
      EllipticArcSegment ellipse = eabElp.ToSegment();
    
      //Set symbolology, create and add element to layout
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.GreenRGB, 2.0, SimpleLineStyle.Dot);
      CIMPolygonSymbol ellipseSym = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB, SimpleFillStyle.Vertical, outline);
      //At 2.x - GraphicElement elpElm = LayoutElementFactory.Instance.CreateEllipseGraphicElement(layout, ellipse, ellipseSym);
      //         elpElm.SetName("New Ellipse");
    
      var polyLine = PolylineBuilderEx.CreatePolyline(ellipse);
      GraphicElement elpElm = ElementFactory.Instance.CreateGraphicElement(layout, polyLine, ellipseSym, "New Ellipse");
    });
    Snippet Procedural Symbol
    /// <summary>
    /// Create a procedural symbol that can be applied to a polygon building footprint layer
    /// ![ProceduralSymbol](http://Esri.github.io/arcgis-pro-sdk/images/Symbology/polygon-procedural.png)        
    /// </summary>    
    /// <remarks>Note: The rule package used in this method can be obtained from the Sample Data included in the arcgis-pro-sdk-community-samples repository.</remarks>
    private static readonly string _rulePkgPath = @"C:\Data\RulePackages\Venice_2014.rpk";
    public static Task<CIMPolygonSymbol> CreateProceduralPolygonSymbolAsync()
    {
      return QueuedTask.Run<CIMPolygonSymbol>(() =>
      {
        //Polygon symbol to hold the procedural layer
        var myPolygonSymbol = SymbolFactory.Instance.ConstructPolygonSymbol();
    
        //Array of layers to hold a procedural symbol layer
        CIMSymbolLayer[] proceduralSymbolLyr =
              {
                    new CIMProceduralSymbolLayer()
                    {
                        PrimitiveName = "Venice Rule package 2014",
                        RulePackage = _rulePkgPath,
                        RulePackageName = "Venice_2014",
                    }
          };
        myPolygonSymbol.SymbolLayers = proceduralSymbolLyr;
        return myPolygonSymbol;
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also