How to extract vertices from IPolyline or IPolygon

560
1
06-27-2012 12:43 PM
InsuHong1
New Contributor
Hi,


How can I extract vertices from IPolygon or IPolyline or IGeometry object and insert those vertices to existing feature?

I extracted vertices from IPolygon to IPointCollection, but IPointCollection object failed at below codes

using (ComReleaser comReleaser = new ComReleaser())
                {
                    IFeatureBuffer fcBuffer = fcTotalVertices.CreateFeatureBuffer();
                    comReleaser.ManageLifetime(fcBuffer);
                    fcBuffer.Shape = (IGeometry)pcVertices;
                    curTotalVertices = fcTotalVertices.Insert(true);
                    comReleaser.ManageLifetime(curTotalVertices);
                    curTotalVertices.InsertFeature(fcBuffer);
                    curTotalVertices.Flush();
                }


pcVertices is IPointCollection object.


How can I do this?




Thank you.
0 Kudos
1 Reply
WeifengHe
Esri Contributor
Is your pcVertices a polygon or a polyline?  You cannot insert a polygon into a polyline feature class.  You need to create a new polyline type IPointCollection object, add the points extracted from polygon into the new point collection.
0 Kudos