This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometryBag Interface (ArcObjects .NET 10.5 SDK) |
Provides access to members that identify a geometry bag.
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.
Description | ||
---|---|---|
Dimension | The topological dimension of this geometry. | |
Envelope | Creates a copy of this geometry's envelope and returns it. | |
GeometryType | The type of this geometry. | |
GeoNormalize | Shifts longitudes, if need be, into a continuous range of 360 degrees. | |
GeoNormalizeFromLongitude | Normalizes longitudes into a continuous range containing the longitude. This method is obsolete. | |
IsEmpty | Indicates whether this geometry contains any points. | |
LosslessExport | Indicates if this geometry bag exported itself to a shapefile buffer with no loss of information. Currently always returns false. | |
Project | Projects this geometry into a new spatial reference. | |
QueryEnvelope | Copies this geometry's envelope properties into the specified envelope. | |
SetEmpty | Removes all points from this geometry. | |
SnapToSpatialReference | Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system. | |
SpatialReference | The spatial reference associated with this geometry. |
Interfaces | Description |
---|---|
IGeometry | Provides access to members that describe properties and behavior of all geometric objects. |
CoClasses and Classes | Description |
---|---|
GeometryBag | An ordered collection of objects that support the IGeometry interface. |
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.
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);
IConstructGeometryCollection Interface | IGeometryCollection Interface