AnsweredAssumed Answered

Construct a Circular Polygon Feature

Question asked by cdebruin on Jul 26, 2018
Latest reply on Jul 31, 2018 by cdebruin

Hi all,

 

I'm looking to create a circular polygon feature using the ArcObjects .NET API. I basically want to read a list of points and diameters from a text file, then draw the circles and save them to a polygon feature class. I've been pouring through the documentation on ICircularArc and plenty of other Interfaces, but I can't seem to find what I'm looking for. The closest thing I've done is draw a circular line using the following code sample.

 

private void drawCircle(IActiveView activeView, IPoint centerPoint, double Radius)
{
    IGraphicsContainer graphicsContainer = activeView.GraphicsContainer;
    // set up the color
    IRgbColor rgbColor = new RgbColor();
    rgbColor.Red = 0;
    rgbColor.Green = 255;
    rgbColor.Blue = 0;
    IColor color = rgbColor;
    // make the line and define its color, style and width
    ISimpleLineSymbol LineSymbol = new SimpleLineSymbol();
    LineSymbol.Color = color;
    LineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
    LineSymbol.Style = 2;
    ISymbol symbol = (ISymbol)LineSymbol;
    // create circle element
    ILineElement pCircleLineElement = new LineElement();
    pCircleLineElement.Symbol = LineSymbol;
    IElement pCircleElement = (IElement)pCircleLineElement;
    IConstructCircularArc pCircularArc = new CircularArc();
    pCircularArc.ConstructCircle(centerPoint, Radius, true);
    ISegment Seg = (ISegment)pCircularArc;
    ISegmentCollection SegCollection = new Polygon();
    SegCollection.AddSegment(Seg);
    pCircleElement.Geometry = (IGeometry)SegCollection;
    // add the element to the map and draw it.
    graphicsContainer.AddElement(pCircleElement, 0);
    activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null/* TODO Change to default(_) if this is not a reference type */, null/* TODO Change to default(_) if this is not a reference type */);
}

Outcomes