Vishful thinking…

Using IEnumGeomteryBind

Posted in ArcGIS, ESRI by viswaug on August 27, 2007

The IEnumGeometryBind interface gives us an easy way of packaging all the shapes in a FeatureClass or an SelectionSet into a GeometryBag object. I am not sure if using it is more effecient than looping through the data source yourself and adding them to the GeometryBag class. But it sure does save us some lines of code. Here is how you use it.

IEnumGeometry eGeom = new EnumFeatureGeometryClass();
IEnumGeometryBind bind = eGeom as IEnumGeometryBind;
null, FeatureClass);
IGeometryFactory gFactory = new GeometryEnvironmentClass();
IGeometry geom = gFactory.CreateGeometryFromEnumerator(eGeom);

The first argument to the ‘BindGeometrySource’ function is a IQueryFilter object which can be set to null if all the features in the FeatureClass are required. The second argument for the ‘BindGeometrySource’ function could be either a FeatureClass or a SelectionSet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: