ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipointBuilderEx Class / GetPoint Method
The point index. Must be in the range [0, Coordinate2Ds.Count - 1] inclusive.
Example

In This Topic
    GetPoint Method (MultipointBuilderEx)
    In This Topic
    Gets the MapPoint at the specified point index.
    Syntax
    public MapPoint GetPoint( 
       int pointIndex
    )
    Public Function GetPoint( _
       ByVal pointIndex As Integer _
    ) As MapPoint

    Parameters

    pointIndex
    The point index. Must be in the range [0, Coordinate2Ds.Count - 1] inclusive.
    Exceptions
    ExceptionDescription
    The point index is < 0 or the point index is >= Coordinate2Ds.Count.
    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
    
    Modify the points of a Multipoint
    // assume a multiPoint has been built from 4 points
    // the modified multiPoint will have the first point removed and the last point moved
    
    // use the builderEx constructors = don't need to run on the MCT.
    MultipointBuilderEx builderEx = new MultipointBuilderEx(multipoint);
    // remove the first point
    builderEx.RemovePoint(0);
    // modify the coordinates of the last point
    var ptEx = builderEx.GetPoint(builderEx.PointCount - 1);
    builderEx.RemovePoint(builderEx.PointCount - 1);
    
    var newPtEx = MapPointBuilderEx.CreateMapPoint(ptEx.X + 1.0, ptEx.Y + 2.0);
    builderEx.AddPoint(newPtEx);
    Multipoint modifiedMultiPointEx = builderEx.ToGeometry() as Multipoint;
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also