Building a Polygon Using Points in Arcobjects and C#

4418
1
08-01-2012 07:16 AM
BernardoG_
New Contributor II
I have seen this code in Arcpy which is used to create a Polygon from a string of Points(X , Y).Can you please let me know how I can us something like this which can generate polygon from an array of X,y values in C# and Arcobjects?
I already take alook at Arcobjects 10 .net framework sample code sample of Building a Polygon Using Points . but it was too confusing for me.
I really appreciate your time if you can point me to a tutorial  or a sample which contains a process of polygon creation same as what was in arcpy code.

Regards,
0 Kudos
1 Reply
ModyBuchbinder
Esri Regular Contributor
Hi

Somthing like this should do it:

           IPointCollection pPoly = new PolygonClass();
            object Missing = Type.Missing;
            pPoly.AddPoint(P1, ref Missing, ref Missing);
            pPoly.AddPoint(P2, ref Missing, ref Missing);
            pPoly.AddPoint(P3, ref Missing, ref Missing);
            ((IPolygon)pPoly).Close();

Have Fun
Mody
0 Kudos