This document is archived and information here might be outdated.  Recommended version.


IGeometryBag Interface (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IGeometryBag Interface

Provides access to members that identify a geometry bag.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

A GeometryBag is a heterogeneous collection of references to objects that support the IGeometry interface.  Operations on GeometryBags that depend upon a specific interface require that all geometries within the Bag support that interface.  Otherwise, an error will be returned.  (ex. To Buffer the elements of a GeometryBag using the ITopologicalOperator, only geometries that support ITopologicalOperator can be collected in the Bag.) 

 

When adding elements to a GeometryBag, keep in mind that the elements acquire the spatial reference of the bag. If the spatial reference of the bag is nil, for example, and the element references a well-defined spatial reference, then the element will lose that reference when it is added to the bag.

Members

Description
Read-only property Dimension The topological dimension of this geometry.
Read-only property Envelope Creates a copy of this geometry's envelope and returns it.
Read-only property GeometryType The type of this geometry.
Method GeoNormalize Shifts longitudes, if need be, into a continuous range of 360 degrees.
Method GeoNormalizeFromLongitude Normalizes longitudes into a continuous range containing the longitude. This method is obsolete.
Read-only property IsEmpty Indicates whether this geometry contains any points.
Read-only property LosslessExport Indicates if this geometry bag exported itself to a shapefile buffer with no loss of information. Currently always returns false.
Method Project Projects this geometry into a new spatial reference.
Method QueryEnvelope Copies this geometry's envelope properties into the specified envelope.
Method SetEmpty Removes all points from this geometry.
Method SnapToSpatialReference Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system.
Read/write property SpatialReference The spatial reference associated with this geometry.

Inherited Interfaces

Interfaces Description
IGeometry Provides access to members that describe properties and behavior of all geometric objects.

CoClasses that implement IGeometryBag

CoClasses and Classes Description
GeometryBag An ordered collection of objects that support the IGeometry interface.

Remarks

Every Geometry created within ArcGIS should be assigned a spatial reference. Always attach well-defined spatial references to new geometries. This improves processing efficiency, in particular, when using ITopologicalOperator on geometries that contain curved segments (circular arcs, bezier curves, elliptical arcs). New geometries include any geometry that is created in memory. It does not matter whether it will be stored in a feature class or not. Well-defined as applied to a spatial reference means that it not only has its coordinate system (projection) defined, but also its coordinate grid. The coordinate grid consists of the xy domain, xy resolution, and xy cluster tolerance properties of a spatial reference. If the Geometry includes z or m values, the z or m domains, z or m resolutions, and z or m cluster tolerance properties must also be defined. The cluster tolerance and resolutions can be quickly and easily set using SetDefault methods on ISpatialReferenceResolution and ISpatialReferenceTolerance interfaces.

[C#]

For example, a line should be converted to a polyline before adding it to the geometry bag as shown in the following code:

ISegmentCollection segColl=new PathClass() as ISegmentCollection;

ISegment seg=myLine as ISegment;

object obj=Type.Missing;

segColl.AddSegment(seg, ref obj, ref obj);

 

IGeometryCollection geomColl=new PolylineClass() as IGeometryCollection;

geomColl.AddGeometry((IGeometry)segColl, ref obj, ref obj);

 

IGeometryCollection bag=new GeometryBagClass() as IGeometryCollection;

bag.AddGeometry((IGeometry)geomColl, ref obj, ref obj);

See Also

IConstructGeometryCollection Interface | IGeometryCollection Interface

.NET Related Topics

Executing spatial queries