I have a problem when inserting features with polygon feature class in FGDB. This is my code:
... initialising some fields (does not affect performance)
m_featureBuffer.Shape = CreateShape(feature);
m_insertCursor.InsertFeature(m_featureBuffer);
CreateShape:
protected override ESRI.ArcGIS.Geometry.IGeometry CreateShape(IAbstractFeature feature)
{
IArea area = (IArea)feature;
ESRI.ArcGIS.Geometry.IPointCollection polygon = new ESRI.ArcGIS.Geometry.PolygonClass();
foreach (Point2D point2d in area.Polygon.OuterBoundaryIs.Coordinates)
{
ESRI.ArcGIS.Geometry.IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
point.PutCoords(point2d.X, point2d.Y);
polygon.AddPoint(point);
}
return (ESRI.ArcGIS.Geometry.IGeometry)polygon;
}
In this case inserting ~1500 polygons takes about ~110 seconds. If I comment this line
m_featureBuffer.Shape = CreateShape(feature);
the insert takes ~10 seconds! If I create empty polygons and pass them in the Shape property of the feature buffer, it takes ~10 seconds too.
I tried to use the IFeatureClassLoad according to the ESRI example, but it doesn't help with the performance.
Please, help me, because the difference of more than 10 times is awful. Thanks.
Solved.