Create a circular polygon

1281
4
04-22-2010 08:36 AM
ThomasWaenke
New Contributor
Hi,

I have written a C# tool that extracts the points of a given polygon and modifies some of the z-values. The result will then be used to create a new polygon feature.

        private IPolygon GetPolygonFromShape(IFeature feature, bool hasz)
        {
            IPointCollection4 pcol1 = (IPointCollection4)feature.Shape;
            for (int i = 0; i < pcol1.PointCount; i++)
            {
// do something.....
            }
            IPolygon polygon = pcol1 as IPolygon;
            return polygon;
        }

I have now the problem that the original feature is sometimes a circle and the extracted PointCollection contains only 2 points. When I try to create the new polygon I get of course an exception 'The number of points is less than required for feature'.

How can I find out that a feature in a polygon class is a circle or a cicular arc? And how do I create the new feature as a circle from the 2 points?

Thanks an regards,
Thomas Waenke
0 Kudos
4 Replies
KirkKuykendall
Occasional Contributor III
ISegmentCollection.HasNonLinearSegments should be true for polygons having any segments that are ICircularArcs.
0 Kudos
ThomasWaenke
New Contributor
Hi all,

Thanks for your hints.

My problem seems to be more complex than I thought.
I have to read features from a FeatureClass that has no Z-values and write the features - after adding Z -  to a z-aware class.
There seems to be no functionality in the API to change the geometry this way.
The only way that I found is to recreate the features from the original vertices. This workes fine for simple lines and polygons but not when there are more complex elements. Looks like a lot of programming work.

Thomas Waenke
0 Kudos
EricPaitz
Esri Contributor
There is also a Densify Method on IGeometryBridge, IGeometryService, IPolycurve and ISegment. This should convert a curve shape to an array of points.
0 Kudos
RichardFairhurst
MVP Honored Contributor
There is also a Densify Method on IGeometryBridge, IGeometryService, IPolycurve and ISegment. This should convert a curve shape to an array of points.


See the second post in the thread for a method that will modify either Z or M values of a nonlinear polyine without destrying the feature's curved segments (written for VB .NET, but similar to VBA if you add the Set keyword).  The same principles and coding concepts apply to manipulating Z and M values in nonlinear polygons.
0 Kudos