com.esri.arcgis.geometry
Interface IGeometryCollection

All Superinterfaces:
Serializable
All Known Implementing Classes:
GeometryBag, MultiPatch, Multipoint, Polygon, Polyline, TriangleFan, Triangles, TriangleStrip

public interface IGeometryCollection
extends Serializable

Provides access to members that can be used for accessing, adding and removing individual geometries of a multi-part geometry (Multipoint, Polyline, Polygon, MultiPatch, and GeometryBag).

Description

A Collection of Geometry parts. For Multipoints, Triangles, TriangleFans, and TriangleStrips, the Geometry parts are Points. For Polylines, the Geometry parts are Paths. For Polygons, the Geometry parts are Rings. For MultiPatches, the Geometry parts are Triangles, TriangleFans, TriangleStrips, or Rings. For GeometryBags, the Geometry parts are any IGeometry object.

The GeometryCollection can be used to access, manipulate, add, insert, remove, and set specific parts of a composite geometry.

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.

When To Use

If you are using a development language that does not support C style arrays, use IGeometryBridge instead. The IGeometryBridge interface solves that problem allowing you to pass safe arrays instead.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

See Also:
IPointCollection, IGeometry, ISegmentCollection, IGeometryCollection

Method Summary
 void addGeometries(int count, IGeometry newGeometries)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.addGeometries(com.esri.arcgis.geometry.IGeometryCollection, com.esri.arcgis.geometry.IGeometry[]).
 void addGeometry(IGeometry inGeometry, Object before, Object after)
          Adds a reference to the input geometry either at the end, or before, or after the specified index.
 void addGeometryCollection(IGeometryCollection newGeometries)
          Adds references to geometries in the input collection.
 void geometriesChanged()
          Tells this geometry collection that some of its geometries have been altered.
 IGeometry getGeometry(int index)
          A reference to the ith geometry.
 int getGeometryCount()
          The number of geometries in this collection.
 void insertGeometries(int index, int count, IGeometry newGeometries)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.insertGeometries(com.esri.arcgis.geometry.IGeometryCollection, int, com.esri.arcgis.geometry.IGeometry[]).
 void insertGeometryCollection(int index, IGeometryCollection newGeometries)
          Inserts at the specified index references to all if the geometries in the input collection.
 void queryGeometries(int index, int count, IGeometry[] geometries)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.queryGeometries(com.esri.arcgis.geometry.IGeometryCollection, int, com.esri.arcgis.geometry.IGeometry[][]).
 void removeGeometries(int index, int count)
          Removes references to some geometries from this collection.
 void setGeometries(int count, IGeometry newGeometries)
          Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.setGeometries(com.esri.arcgis.geometry.IGeometryCollection, com.esri.arcgis.geometry.IGeometry[]).
 void setGeometryCollection(IGeometryCollection newParts)
          Replaces all geometries in the collection with references to geometries from the input collection.
 

Method Detail

getGeometryCount

int getGeometryCount()
                     throws IOException,
                            AutomationException
The number of geometries in this collection.

Description

Returns the number of Geometries in the GeometryCollection. The last Geometry in the GeometryCollection has an index equal to GeometryCount - 1.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Returns:
The cParts
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getGeometry

IGeometry getGeometry(int index)
                      throws IOException,
                             AutomationException
A reference to the ith geometry.

Product Availability

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

Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.geometry.IGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addGeometry

void addGeometry(IGeometry inGeometry,
                 Object before,
                 Object after)
                 throws IOException,
                        AutomationException
Adds a reference to the input geometry either at the end, or before, or after the specified index.

Remarks

When applying the AddGeometry method give either the before or after index and not both. Adding a Geometry to the collection as the first one is done by setting the before index as 0.

The spatial reference of the GeometryCollection is transferred (objects projected if necessary) to any objects added to it. However the spatial reference of the added geometry is not transferred to the GeometryCollection. Always make sure to set the spatial reference on the object GeometryCollection prior to add other geometries to it to avoid creating invalid geometry. For example, adding geometry objects to a GeometryBag that doesn't have a well-defined spatial reference will set an undefined spatial reference to all the objects added to the bag. Using this GeometryBag may cause unexpected behavior with the ITopologicalOperator::ConstructUnion method.

 

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
inGeometry - A reference to a com.esri.arcgis.geometry.IGeometry (in)
before - A Variant (in, optional, pass null if not required)
after - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

queryGeometries

void queryGeometries(int index,
                     int count,
                     IGeometry[] geometries)
                     throws IOException,
                            AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.queryGeometries(com.esri.arcgis.geometry.IGeometryCollection, int, com.esri.arcgis.geometry.IGeometry[][]).

Populates the array with references to a sub-sequence of geometries. This method is intended for internal use only.

Remarks

Note: The GeometryType returned by the QueryGeometries method depends on which object type points the IGeometryCollection pointer.

IGeometryCollection Object GeometryType Returned Object GeometryType
Polygon
Rings
Polyline
Paths
Multipoint
Points
Multipatch
TriangleFans or TriangleStrips or Rings
TriangleFan
Points
TriangleStrip
Points
Geometry Bag
Any type of IGeometry

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
count - The count (in)
geometries - A reference to a com.esri.arcgis.geometry.IGeometry (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addGeometries

void addGeometries(int count,
                   IGeometry newGeometries)
                   throws IOException,
                          AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.addGeometries(com.esri.arcgis.geometry.IGeometryCollection, com.esri.arcgis.geometry.IGeometry[]).

Adds references to the specified geometries. This method is intended for internal use only.

Remarks


The geometries are added last in the list. Use an array of geometries (IGeometry) and the exact number (count ) of elements in the array. Exceeding the boundary of the array will cause an application error. If you don't want to place the geometries last in the collection then use the InsertGeometries method.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
count - The count (in)
newGeometries - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addGeometryCollection

void addGeometryCollection(IGeometryCollection newGeometries)
                           throws IOException,
                                  AutomationException
Adds references to geometries in the input collection.

Description

Adds references of all of the parts of the input GeometryCollection to the end of the current GeometryCollection.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
newGeometries - A reference to a com.esri.arcgis.geometry.IGeometryCollection (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertGeometries

void insertGeometries(int index,
                      int count,
                      IGeometry newGeometries)
                      throws IOException,
                             AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.insertGeometries(com.esri.arcgis.geometry.IGeometryCollection, int, com.esri.arcgis.geometry.IGeometry[]).

Inserts at the specified index references to some number of geometries in the input array. This method is intended for internal use only.

Remarks

The geometries are inserted before the ith (index) element in the list. Use an array of geometries and give the exact number (count ) of elements in the array. A too large value for the count parameter causes exceeding the boundary of the array and will cause an application error. To place the geometries last in the collection then use the addGeometries method.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
count - The count (in)
newGeometries - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertGeometryCollection

void insertGeometryCollection(int index,
                              IGeometryCollection newGeometries)
                              throws IOException,
                                     AutomationException
Inserts at the specified index references to all if the geometries in the input collection.

Remarks

InsertGeometryCollection merges one GeometryCollection within another at a specified index.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
newGeometries - A reference to a com.esri.arcgis.geometry.IGeometryCollection (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGeometries

void setGeometries(int count,
                   IGeometry newGeometries)
                   throws IOException,
                          AutomationException
Deprecated. This method uses C style arrays which are not supported in the ArcGIS API for Java. It is replaced by GeometryEnvironment.setGeometries(com.esri.arcgis.geometry.IGeometryCollection, com.esri.arcgis.geometry.IGeometry[]).

Replaces all geometries in the collection with the specified number of references to those in the input array. This method is intended for internal use only.

Remarks

SetGeometries is used to reset the references of the geometries within the GeometryCollection . The result is that all references are changed to point only at the geometries contained within the specified array. Note that the GeometryCount changes accordingly also.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
count - The count (in)
newGeometries - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGeometryCollection

void setGeometryCollection(IGeometryCollection newParts)
                           throws IOException,
                                  AutomationException
Replaces all geometries in the collection with references to geometries from the input collection.

Remarks

SetGeometryCollection copies the geometry references from one GeometryCollection to another.

VB Example: Set GeometryCollection m_pGeoColl_A as m_pGeoColl_B


  m_pGeoColl_A.SetGeometryCollection m_pGeoColl_B

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
newParts - A reference to a com.esri.arcgis.geometry.IGeometryCollection (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeGeometries

void removeGeometries(int index,
                      int count)
                      throws IOException,
                             AutomationException
Removes references to some geometries from this collection.

Remarks

RemoveGeometries deletes count number of geometries from the index location.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
count - The count (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

geometriesChanged

void geometriesChanged()
                       throws IOException,
                              AutomationException
Tells this geometry collection that some of its geometries have been altered. Use this method on polylines, polygons and multipatches after directly editing one of its parts.

Description

GeometriesChanged flags that the geometries have been changed. It also marks a top level geometry as being non-simple. Use it when manipulating the parts of a geometry directly (for example, rotating a ring). The top level geometry won't know that its cached envelope, length, centroid, etc. are invalid until this method is used.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.