IGeometryBag vs. IGeometryCollection

IGeometryBag and IGeometryCollection are two interfaces that serve different purposes. IGeometryBag’s main functions are in regard to the Spatial Reference of the geometry or geometries that are referenced as elements of the GeometryBag. IGeometryCollection functions involve the creation of new geometries from collections of more simple geometries. IGeometryCollection can insert and rearrange elements within the composite object as well as create the composite objects from constituent parts.
 
IGeometryBag gives the user access to methods that affect the spatial reference of a GeometryBag and the geometry references it contains.  Setting the GeometryBag’s spatial reference before adding references to geometries to the GeometryBag is important. Without this step the geometry’s spatial reference will automatically be set to whatever the GeometryBag’s spatial reference is even if it is not yet defined. Geometries added to the GeometryBag will inherit the GeometryBag's spatial reference. Make sure that the geometries you plan to reference are already in the same coordinate system. However, if the resolution and spatial domain values differ, you can use the SnapToSpatialReference method to ensure that all the elements have the same resolution value and coordinate grid.   Resolution and coordinate grid values are important if the user wishes to do any analysis on the data particularly using ITopologicalOperator or IRelationalOperator. Through the Project method the user can change the spatial reference of the GeometryBag and all of its elements.  If the input and output spatial references use different geographic coordinate systems, it is important to remember that Project will not work properly if the GeotransformationOperationSet does not contain an appropriate Geotransformation. You can not call Project on a GeometryBag that does not have its spatial reference property already defined. Also, the Project/ProjectEx methods should not be applied on GeometryBag if it contains segments this is not supported and will result in an error. These methods and properties are powerful and allow properties to be changed in all the elements of the GeometryBag.
 
IGeometryCollection is implemented by several collection objects including GeometryBag. IGeometryCollection allows for the addition, removal, insertion, and manipulation of elements from these collection objects. Also, setting specific parts of a composite geometry is available with this interface.  Only two properties are accessible in read only format from IGeometryCollection: a reference to the ith geometry through IGeometryCollection::Geometry and the total number of geometries in the collection through IGeometryCollection::GeometryCount.  Several of the methods on IGeometryCollection that involve adding arrays of geometries must be performed using IGeometryBridge or IGeometryBridge2 when programming in Java or any of the .NET languages.  After changing the properties of the elements referenced in a collection object it is important to call IGeometryCollection::GeometriesChanged so that it can delete any cached properties that it might be maintaining, such as envelope, length, or area.
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值