guna82

IGeometryCollection.AddGeometry - reusing Point reference

Discussion created by guna82 on May 28, 2013
Latest reply on May 31, 2013 by whe-esristaff
I am trying to create a large number (>10k) of convex hulls using ITopoOp.convexhull and each ConvexHull has more than 2000 points. I am using a Multipoint Geometry collection and adding 2000+ points using AddGeometry(). However, I have to create a new Point() every time I add a geometry to the geometriccollection. This is causing a major performance lag in the application. However, if I do not call new Point(), the resulting convexHull is incorrect as all the geometries in the collection have the same Point. Is there a way I can get around this or is there an alternate solution, to speed up the creation of convex hulls. 

{

                  P = new ESRI.ArcGIS.Geometry.Point();
                  P.SpatialReference = sr;
                  P.PutCoords( inmemory_features[rs].x, inmemory_features[rs].y );
                  geomcoll.AddGeometry( P as IGeometry, ref missing, ref missing );
}

Outcomes