ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Geometry Namespace / EllipticArcBuilderEx Class / CreateCircle Method
The center of the circle.
The radius of the circle.
The ellipse orientation, clockwise or counterclockwise.
(Optional) The SpatialReference of the ellipse. The default value is null.
Example

In This Topic
    CreateCircle Method
    In This Topic
    Convenience method to create a new instance of the EllipticArcSegment class. The segment will be a circle built from a center point and radius.
    Syntax

    Parameters

    centerPt
    The center of the circle.
    radius
    The radius of the circle.
    orientation
    The ellipse orientation, clockwise or counterclockwise.
    spatialReference
    (Optional) The SpatialReference of the ellipse. The default value is null.

    Return Value

    Exceptions
    Remarks
    The start and end point of the circle are equal and are located at the top of the circle.
    Example
    Construct a Circle
    // Construct a circle with center at (-1,-1), radius = 2, and oriented clockwise.
    // Use a builderEx convenience method or use a builderEx constructor.
    
    Coordinate2D centerPtCoord = new Coordinate2D(-1, -1);
    
    // Builder convenience methods don't need to run on the MCT.
    EllipticArcSegment circle = EllipticArcBuilderEx.CreateCircle(centerPtCoord, 2, ArcOrientation.ArcClockwise);
    // circle.IsCircular = true
    // circle.IsCounterClockwise = false
    // circle.IsMinor = false
    
    double startAngle, rotationAngle, centralAngle, semiMajor, semiMinor;
    Coordinate2D actualCenterPt;
    circle.QueryCoords(out actualCenterPt, out startAngle, out centralAngle, out rotationAngle, out semiMajor, out semiMinor);
    
    // semiMajor = 2.0
    // semiMinor = 2.0
    // startAngle = PI/2
    // centralAngle = -2*PI
    // rotationAngle = 0
    // endAngle = PI/2
    
    // This EllipticArcBuilderEx constructor doesn't need to run on the MCT.
    EllipticArcBuilderEx builder = new EllipticArcBuilderEx(centerPtCoord, 2, ArcOrientation.ArcClockwise);
    EllipticArcSegment otherCircle = builder.ToSegment();
    
    Create Circle Graphic
    //Must be on QueuedTask.Run(() => { ...
    
    //Build geometry
    Coordinate2D center = new Coordinate2D(2, 4);
    EllipticArcSegment circle_seg = EllipticArcBuilderEx.CreateCircle(
      new Coordinate2D(2, 4), 0.5, ArcOrientation.ArcClockwise, null);
    var circle_poly = PolygonBuilderEx.CreatePolygon(PolylineBuilderEx.CreatePolyline(circle_seg));
    
    //PolylineBuilderEx.CreatePolyline(cir, AttributeFlags.AllAttributes));
    //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);
    SymbolFactory.Instance.ConstructPolygonSymbol(null,
      SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 2));
    
    var circleGraphic = GraphicFactory.Instance.CreateSimpleGraphic(circle_poly, circleSym);
    
    //Make an element to add to GraphicsLayer or Layout
    //var elemInfo = new ElementInfo() { Anchor = Anchor.CenterPoint };
    //GraphicElement cirElm = ElementFactory.Instance.CreateGraphicElement(
    //  container, circleGraphic, "New Circle", true, elemInfo);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also