IPointCollection Interface

Provides access to members that manipulate the points of a Multipoint, Path, Ring, Polyline, Polygon, TriangleFan, TriangleStrip, or MultiPatch.

Description

Used to access and manipulate the Points in Multipoints, Paths, Rings, Polylines, Polygons, Triangles, TriangleFans, TriangleStrips, and MultiPatches. IPointCollection can be used to create Multipoints, Triangles, TriangleFans, TriangleStrips, Line-based Paths, Line-based Rings, single-path Line-based Polylines, and single-ring Line-based Polygons. Multipoints, Triangles, TriangleFans, and TriangleStrips return references to the points in the collection. All other geometries return copies of points instead of direct references. PointCollections can be used to get, count, add, insert, query, remove, replace, set, and update the Points in a geometry. Depending on the method, Points can be manipulated as a single Point, an array of Points, or a collection of Points.

If you are using Java or a .NET enabled language, such as VB.NET, you may want to use the alternative versions of IPointCollection methods exposed by the IGeometryBridge and IGeometryBridge2 interfaces.

Members

Name Description
Method AddPoint Adds a vertex to a Path, Ring, Polyline, or Polygon; or adds a reference to the input point to a Multipoint, TriangleFan, or TriangleStrip.
Method AddPointCollection Adds copies of points in the input point collection to this Path, Ring, Polyline, or Polygon; or adds references to the points in the collection to this Multipoint, TriangleFan, or TriangleStrip.
Method AddPoints Adds copies of the input points as vertices to this Path, Ring, Polyline, or Polygon; or references to the input points to this Multipoint, TriangleFan, or TriangleStrip. This method is intended for internal use only.
Method AddWKSPoints Adds vertices to this Path, Ring, Polyline, or Polygon, or adds new points to this Multipoint, TriangleFan, or TriangleStrip.
Read-only property EnumVertices A new enumerator for this point collection.
Method InsertPointCollection Inserts copies of points, from the input point collection, as vertices into this Path, Ring, Polyline, or Polygon; or references to points in the input point collection into this Multipoint, TriangleFan, or TriangleStrip.
Method InsertPoints Inserts copies of the input points as vertices into a Path, Ring, Polyline, or Polygon; or references to the input points into a Multipoint, TriangleFan, or TriangleStrip. This method is intended for internal use only.
Method InsertWKSPoints Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, TriangleFan, TriangleStrip, or MultiPatch.
Read-only property Point A copy of the ith vertex of a Path, Ring, Polyline, or Polygon; or a reference to the ith point of a Multipoint, TriangleFan, or TriangleStrip.
Read-only property PointCount The number of points in the collection.
Method QueryPoint Queries for a point in the PointCollection at given index.
Method QueryPoints Copies some points to an existing array of points. This method is intended for internal use only.
Method QueryWKSPoints Copies vertices'/points' coordinates to the array of point structures.
Method RemovePoints Removes vertices from a Path, Ring, Polyline, or Polygon, or references to points from a Multipoint, TriangleFan, or TriangleStrip.
Method ReplacePointCollection Replaces vertices/points within a PointCollection.
Method ReplacePoints Replaces vertices/points within a PointCollection.
Method SetPointCollection Replaces all vertices of this Path, Ring, Polyline, or Polygon with copies of the points in the input collection; or all points of this Multipoint, TriangleFan, or TriangleStrip with references to points from the input collection.
Method SetPoints Replaces all existing vertices of this Path, Ring, Polyline, or Polygon with copies of the input points; or all existing points of this Multipoint, TriangleFan, or TriangleStrip with references to the input points (for C++ and VB users only).
Method SetWKSPoints Replaces all vertices of this Path, Ring, Polyline, or Polygon with new ones, or replaces all points of this Multipoint, TriangleFan, or TriangleStrip with new ones.
Method UpdatePoint Changes the ith vertex or point to be a copy of the input point.

IPointCollection.AddPoint Method

Adds a vertex to a Path, Ring, Polyline, or Polygon; or adds a reference to the input point to a Multipoint, TriangleFan, or TriangleStrip.

Public Sub AddPoint ( _
    ByVal inPoint As IPoint, _
    [ByRef before As Object], _
    [ByRef after As Object] _
)
public void AddPoint (
    IPoint inPoint,
    ref object before,
    ref object after
);

Description

Adds a Point to a PointCollection. If before and after are omitted, the Point is added to the end of the PointCollection. Additionally, by specifying either the before or after index, the Point can be added at a specific location in the PointCollection.

public void AddPointToPointCollection()

    {

        IPoint point = new PointClass();

        point.PutCoords(0, 0);

        object missing = Type.Missing;

        IPointCollection pointCollection = new MultipointClass();

        //We don't specify the before and after object, so we add missing.

        //This adds the point to the end of the PointCollection

        pointCollection.AddPoint(point, ref missing, ref missing);

        System.Windows.Forms.MessageBox.Show(pointCollection.PointCount.ToString());

    }

IPointCollection.AddPointCollection Method

Adds copies of points in the input point collection to this Path, Ring, Polyline, or Polygon; or adds references to the points in the collection to this Multipoint, TriangleFan, or TriangleStrip.

Public Sub AddPointCollection ( _
    ByVal newPoints As IPointCollection _
)
public void AddPointCollection (
    IPointCollection newPoints
);

Description

Adds a PointCollection of Points to the end of the PointCollection. The resulting PointCollection does not retain the division between the old PointCollection and the additional PointCollection.

public static IMultipoint CreateMPFromPolygons(IPolygon polygon1, IPolygon polygon2)

    {

        IMultipoint pSourceMultipoint = new MultipointClass();

        IPointCollection pSourceMultipointCollection = (IPointCollection)pSourceMultipoint;

        IPointCollection pointCollectionPoly1 = (IPointCollection)polygon1;

        IPointCollection pointCollectionPoly2 = (IPointCollection)polygon2;

        pSourceMultipointCollection.AddPointCollection(pointCollectionPoly1);

        pSourceMultipointCollection.AddPointCollection(pointCollectionPoly2);

        return (IMultipoint)pSourceMultipointCollection;

    }

IPointCollection.AddPoints Method

Adds copies of the input points as vertices to this Path, Ring, Polyline, or Polygon; or references to the input points to this Multipoint, TriangleFan, or TriangleStrip. This method is intended for internal use only.

Public Sub AddPoints ( _
    ByVal Count As Integer, _
    ByRef newPoints As IPoint _
)
public void AddPoints (
    int Count,
    ref IPoint newPoints
);

Description

Adds the first specified number (Count) of Points to the PointCollection from an array of Points (with at least Count points). The Points are all added to the end of the PointCollection in the same sequence as they are ordered in the array.

When using C# you must use the IGeometryBridge interface to call this method.
When using VBNET you must use the IGeometryBridge interface to call this method.

IPointCollection.AddWKSPoints Method

Adds vertices to this Path, Ring, Polyline, or Polygon, or adds new points to this Multipoint, TriangleFan, or TriangleStrip.

Public Sub AddWKSPoints ( _
    ByVal Count As Integer, _
    ByRef pointStructures As WKSPoint _
)
public void AddWKSPoints (
    int Count,
    ref WKSPoint pointStructures
);
When using C# you must use the IGeometryBridge to call this method.
When using VBNET you must use the IGeometryBridge to call this method.

IPointCollection.EnumVertices Property

A new enumerator for this point collection.

Public ReadOnly Property EnumVertices As IEnumVertex
public IEnumVertex EnumVertices {get;}

Description

Returns an EnumVertex for the vertices in the PointCollection. The EnumVertex allows the Points to be tranversed in a sequential order.

IPointCollection.InsertPointCollection Method

Inserts copies of points, from the input point collection, as vertices into this Path, Ring, Polyline, or Polygon; or references to points in the input point collection into this Multipoint, TriangleFan, or TriangleStrip.

Public Sub InsertPointCollection ( _
    ByVal Index As Integer, _
    ByVal newPoints As IPointCollection _
)
public void InsertPointCollection (
    int Index,
    IPointCollection newPoints
);

Description

Inserts a PointCollection of Points into the PointCollection at the specified index. The resulting PointCollection does not retain information about the distinction between the old and new Point Collections.

IPointCollection.InsertPoints Method

Inserts copies of the input points as vertices into a Path, Ring, Polyline, or Polygon; or references to the input points into a Multipoint, TriangleFan, or TriangleStrip. This method is intended for internal use only.

Public Sub InsertPoints ( _
    ByVal Index As Integer, _
    ByVal Count As Integer, _
    ByRef newPoints As IPoint _
)
public void InsertPoints (
    int Index,
    int Count,
    ref IPoint newPoints
);

Description

Inserts a specified number (Count) of Points into the PointCollection at the given index from an array of Points. The first Count points from the array are inserted.

When using C# you must use the IGeometryBridge interface to call this method.
When using VBNET you must use the IGeometryBridge interface to call this method.

IPointCollection.InsertWKSPoints Method

Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, TriangleFan, TriangleStrip, or MultiPatch.

Public Sub InsertWKSPoints ( _
    ByVal Index As Integer, _
    ByVal Count As Integer, _
    ByRef newPoints As WKSPoint _
)
public void InsertWKSPoints (
    int Index,
    int Count,
    ref WKSPoint newPoints
);
When using C# you must use the IGeometryBridgeInterface to call this method.
When using VBNET you must use the IGeometryBridgeInterface to call this method.

IPointCollection.Point Property

A copy of the ith vertex of a Path, Ring, Polyline, or Polygon; or a reference to the ith point of a Multipoint, TriangleFan, or TriangleStrip.

Public Function get_Point ( _
    ByVal i As Integer _
) As IPoint
public IPoint get_Point (
    int i
);

Description

Gets the ith Point from the PointCollection. The first Point in the PointCollection has index 0, and the last Point has index equal to PointCount - 1. (Alternatively, the last Point in the PointCollection can be referenced using index -1.).

Remarks

Note: Since a copy of the point is returned by Point (get_Point) for path, ring, polyline and polygon the IPointCollection::UpdatePoint method must be used to update points on those geometry types.

IPointCollection.PointCount Property

The number of points in the collection.

Public ReadOnly Property PointCount As Integer
public int PointCount {get;}

Description

Returns the number of Points in the PointCollection. The last Point in the PointCollection has an index equal to PointCount - 1.

IPointCollection.QueryPoint Method

Queries for a point in the PointCollection at given index.

Public Sub QueryPoint ( _
    ByVal Index As Integer, _
    ByVal Point As IPoint _
)
public void QueryPoint (
    int Index,
    IPoint Point
);

Description

Queries the ith Point from the PointCollection. The first Point in the PointCollection has index 0, and the last Point has index equal to PointCount - 1. (Alternatively, the last Point in the PointCollection can be referenced using index -1.).

Remarks

Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

IPointCollection.QueryPoints Method

Copies some points to an existing array of points. This method is intended for internal use only.

Public Sub QueryPoints ( _
    ByVal Index As Integer, _
    ByVal Count As Integer, _
    ByRef Points As IPoint _
)
public void QueryPoints (
    int Index,
    int Count,
    ref IPoint Points
);

Description

Queries a specified number (Count) of Points starting at the given index into an array of Points.

When using C# you must use the IGeometryBridge interface to call this method.
When using VBNET you must use the IGeometryBridge interface to call this method.

IPointCollection.QueryWKSPoints Method

Copies vertices'/points' coordinates to the array of point structures.

Public Sub QueryWKSPoints ( _
    ByVal Index As Integer, _
    ByVal Count As Integer, _
    ByRef pointStructures As WKSPoint _
)
public void QueryWKSPoints (
    int Index,
    int Count,
    ref WKSPoint pointStructures
);
When using C# you must use the IGeometryBridge to call this method.
When using VBNET you must use the IGeometryBridge interface to call this method.

IPointCollection.RemovePoints Method

Removes vertices from a Path, Ring, Polyline, or Polygon, or references to points from a Multipoint, TriangleFan, or TriangleStrip.

Public Sub RemovePoints ( _
    ByVal Index As Integer, _
    ByVal Count As Integer _
)
public void RemovePoints (
    int Index,
    int Count
);

Description

Removes a specified number (Count) of Points from a PointCollection starting at a given index.

IPointCollection.ReplacePointCollection Method

Replaces vertices/points within a PointCollection.

Public Sub ReplacePointCollection ( _
    ByVal Index As Integer, _
    ByVal goingAway As Integer, _
    ByVal newPoints As IPointCollection _
)
public void ReplacePointCollection (
    int Index,
    int goingAway,
    IPointCollection newPoints
);

Description

Replaces a specified number (goingAway) of Points in the PointCollection begining at a given index with a PointCollection of Points (inserted at the given index).

IPointCollection.ReplacePoints Method

Replaces vertices/points within a PointCollection.

Public Sub ReplacePoints ( _
    ByVal Index As Integer, _
    ByVal comingIn As Integer, _
    ByVal goingAway As Integer, _
    ByRef newPoints As IPoint _
)
public void ReplacePoints (
    int Index,
    int comingIn,
    int goingAway,
    ref IPoint newPoints
);

Description

Removes a specified number (goingAway) of Points from a PointCollection starting at a given index and replaces them (starting at the same index) with a specified number (comingIn) of Points from an array of Points.

If you are using attempting to use this method from a .NET enabled language, such as VB.NET, you may need to use the ReplacePoints method provided by the IGeometryBridge interface exposed on the GeometryEnvironment object.

When using C# you must use the IGeometryBridge interface to call this method.
When using VBNET you must use the IGeometryBridge interface to call this method.

IPointCollection.SetPointCollection Method

Replaces all vertices of this Path, Ring, Polyline, or Polygon with copies of the points in the input collection; or all points of this Multipoint, TriangleFan, or TriangleStrip with references to points from the input collection.

Public Sub SetPointCollection ( _
    ByVal newPoints As IPointCollection _
)
public void SetPointCollection (
    IPointCollection newPoints
);

Description

Sets the contents of the PointCollection equal to the contents of the input PointCollection. After SetPointCollection is called, the PointCollection contains only the Points from the input PointCollection (regardless of what it may have contained previously).

IPointCollection.SetPoints Method

Replaces all existing vertices of this Path, Ring, Polyline, or Polygon with copies of the input points; or all existing points of this Multipoint, TriangleFan, or TriangleStrip with references to the input points (for C++ and VB users only).

Public Sub SetPoints ( _
    ByVal Count As Integer, _
    ByRef newPoints As IPoint _
)
public void SetPoints (
    int Count,
    ref IPoint newPoints
);

Description

Sets the contents of the PointCollection equal to the first Count Points from the input array of Points. After SetPoints is called, the PointCollection contains only count Points from the input Point array (regardless of what it may have contained previously).

When using C# you must use the IGeometryBridge interface to call this method.
When using VBNET you must use the IGeometryBridge interface to call this method.

IPointCollection.SetWKSPoints Method

Replaces all vertices of this Path, Ring, Polyline, or Polygon with new ones, or replaces all points of this Multipoint, TriangleFan, or TriangleStrip with new ones.

Public Sub SetWKSPoints ( _
    ByVal Count As Integer, _
    ByRef pointStructures As WKSPoint _
)
public void SetWKSPoints (
    int Count,
    ref WKSPoint pointStructures
);
When using C# you must use the IGeometryBridge to call this method.
When using VBNET you must use the IGeometryBridge to call this method.

IPointCollection.UpdatePoint Method

Changes the ith vertex or point to be a copy of the input point.

Public Sub UpdatePoint ( _
    ByVal i As Integer, _
    ByVal p As IPoint _
)
public void UpdatePoint (
    int i,
    IPoint p
);

Description

Updates the ith Point with a copy of the input Point. Update replaces the reference to the indexed point with a reference to the input Point.

Remarks

For efficiency UpdatePoint does not check if the spatial reference of the input point is equal to the spatial reference of the PointCollection. Please make sure that the spatial reference of the input point is equal to the spatial reference of the PointCollection before you pass the point in.

Note : You can also explicitly check the spatial reference by using IClone::IsEqual

//Point to use in the UpdatePoint call

 IPoint point = new PointClass() as IPoint;

 

 //Point Collection to UpdatePoint

 IPointCollection ptCollection = new MultipointClass() as IPointCollection;

 

 //Set the spatial reference of the Point Collection usually it has already been set

 ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass() as ISpatialReferenceFactory;

 IGeometry geom = ptCollection as IGeometry;

 geom.SpatialReference = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983N_AmericaLambert);

 ISpatialReference sr = geom.SpatialReference;

 

 //This line does nothing if the two spatial references are already equal

  point.Project(sr);

 

 //The integer is the number of point in the point collection you are updating

  ptCollection.UpdatePoint(1, point);

Classes that implement IPointCollection

Classes Description
MultiPatch A collection of surface patches.
Multipoint An ordered collection of points; optionally has measure, height and ID attributes.
Path A sequence of connected segments.
Polygon A collection of rings ordered by their containment relationship; optionally has measure, height and ID attributes.
Polyline An ordered collection of paths; optionally has measure, height and ID attributes.
Ring An area bounded by one, closed sequence of connected segments; optionally has measure, height and ID attributes at each vertex.
TriangleFan A continuous 3D fan of triangles, where each triangle after the first shares an edge with the preceding triangle, and all triangles share a common pivot point.
Triangles A collection of 3D triangles, where each consecutive triplet of vertices defines a new triangle
TriangleStrip A continuous 3D strip of triangles, where each triangle after the first shares an edge with the preceding triangle.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.