ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipointBuilderEx Class / SetPoint Method / SetPoint(Int32,MapPoint) Method
The index of the point to modify. Must be in the range [0, Coordinate2Ds.Count - 1] inclusive.
The MapPoint to set. It cannot be null.
Example

In This Topic
    SetPoint(Int32,MapPoint) Method
    In This Topic
    Update the point at the specified index.
    Syntax
    public void SetPoint( 
       int index,
       MapPoint point
    )
    Public Overloads Sub SetPoint( _
       ByVal index As Integer, _
       ByVal point As MapPoint _
    ) 

    Parameters

    index
    The index of the point to modify. Must be in the range [0, Coordinate2Ds.Count - 1] inclusive.
    point
    The MapPoint to set. It cannot be null.
    Exceptions
    ExceptionDescription
    The input point is null.
    The point index is < 0 or the point index is >= Coordinate2Ds.Count.
    Remarks
    The XY-values of the point are set in the Coordinate2Ds list. If the point property HasZ is true, and this builder property HasZ is true, then the Z-value of the point is set in the Zs list. The same is true for Ms and IDs. If the point is missing any of the attributes (Z, M, or ID) that are present in this builder, a default value is used. The default value for Z is zero, M is NaN, and ID is zero. If a point has an attribute that is missing in the builder, the attribute is ignored.
    Example
    Construct a Multipoint - using MultipointBuilderEx
    Coordinate2D[] coordinate2Ds = new Coordinate2D[] { new Coordinate2D(1, 2), new Coordinate2D(-1, -2) };
    SpatialReference sr = SpatialReferences.WGS84;
    
    MultipointBuilderEx builder = new MultipointBuilderEx(coordinate2Ds, sr);
    
    // builder.PointCount = 2
    
    builder.HasZ = true;
    // builder.Zs.Count = 2
    // builder.Zs[0] = 0
    // builder.Zs[1] = 0
    
    builder.HasM = true;
    // builder.Ms.Count = 2
    // builder.Ms[0] = NaN
    // builder.Ms[1] = NaN
    
    builder.HasID = true;
    // builder.IDs.Count = 2
    // builder.IDs[0] = 0
    // builder.IDs[1] = 0
    
    // set it empty
    builder.SetEmpty();
    // builder.Coords.Count = 0
    // builder.Zs.Count = 0
    // builder.Ms.Count = 0
    // builder.IDs.Count = 0
    
    
    // reset coordinates
    List<Coordinate2D> inCoords = new List<Coordinate2D>() { new Coordinate2D(1, 2), new Coordinate2D(3, 4), new Coordinate2D(5, 6) };
    builder.Coordinate2Ds = inCoords;
    // builder.Coords.Count = 3
    // builder.HasZ = true
    // builder.HasM = true
    // builder.HasID = true
    
    double[] zs = new double[] { 1, 2, 1, 2, 1, 2 };
    builder.Zs = zs;   
    // builder.Zs.Count = 6
    
    double[] ms = new double[] { 0, 1 };
    builder.Ms = ms;   
    // builder.Ms.Count = 2
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, 0), (3, 4, 2, 1, 0) (5, 6, 1, NaN, 0)
    
    MapPoint mapPoint = builder.GetPoint(2);
    // mapPoint.HasZ = true
    // mapPoint.HasM = true
    // mapPoint.HasID = true
    // mapPoint.Z  = 1
    // mapPoint.M = NaN
    // mapPoint.ID = 0
    
    // add an M to the list
    builder.Ms.Add(2);
    // builder.Ms.count = 3
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, 0), (3, 4, 2, 1, 0) (5, 6, 1, 2, 0)
    
    // now get the 2nd point again; it will now have an M value
    mapPoint = builder.GetPoint(2);
    // mapPoint.M = 2
    
    
    int[] ids = new int[] { -1, -2, -3 };
    // assign ID values
    builder.IDs = ids;
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, -1), (3, 4, 2, 1, -2) (5, 6, 1, 2, -3)
    
    
    // create a new point
    MapPoint point = MapPointBuilderEx.CreateMapPoint(-300, 400, 4);
    builder.SetPoint(2, point);
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, -1), (3, 4, 2, 1, -2) (-300, 400, 4, NaN, 0)
    
    
    builder.RemovePoints(1, 3);
    // builder.PointCount = 1
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also