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


IPointCollection.UpdatePoint Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IP > IPointCollection Interface > IPointCollection.UpdatePoint Method
ArcGIS Developer Help

IPointCollection.UpdatePoint Method

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

[Visual Basic .NET]
Public Sub UpdatePoint ( _
    ByVal i As Integer, _
    ByVal p As IPoint _
)
[C#]
public void UpdatePoint (
    int i,
    IPoint p
);
[C++]
HRESULT UpdatePoint(
  long i,
  IPoint* p
);
[C++]
Parameters
i 

i is a parameter of type long p
p is a parameter of type IPoint*

Product Availability

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

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

[C#]

//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);

See Also

IPointCollection Interface