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


IGeometryBridge2.SplitAtDistances Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IGeometryBridge2.SplitAtDistances Method

Introduces new vertices into this polyline at specified distances from the beginning of the polyline.

[Visual Basic .NET]
Public Function SplitAtDistances ( _
    ByVal polyCurve As IPolycurve2, _
    ByRef distances As Double[]&, _
    ByVal asRatios As Boolean, _
    ByVal createParts As Boolean _
) As IEnumSplitPoint
[C#]
public IEnumSplitPoint SplitAtDistances (
    IPolycurve2 polyCurve,
    ref Double[]& distances,
    ref bool asRatios,
    ref bool createParts
);
[C++]
HRESULT SplitAtDistances(
  IPolycurve2* polyCurve,
  distances* distances,
  VARIANT_BOOL asRatios,
  VARIANT_BOOL createParts,
  IEnumSplitPoint** splitInfo
);
[C++]

Parameters polyCurve [in]
polyCurve is a parameter of type IPolycurve2 distances [in] distances is a parameter of type asRatios [in] asRatios is a parameter of type VARIANT_BOOL createParts [in] createParts is a parameter of type VARIANT_BOOL splitInfo [out, retval]
splitInfo is a parameter of type IEnumSplitPoint

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
[C#]

    public void SplitAtDistances()
    {
        //Construct Polycurve
        IPoint fromPoint=new PointClass();
        fromPoint.PutCoords(0, 0);
        IPoint toPoint=new PointClass();
        toPoint.PutCoords(100, 0);
        IPolycurve2 polyCurve=new PolylineClass();
        polyCurve.FromPoint=fromPoint;
        polyCurve.ToPoint=toPoint;

        //split in 10 parts using absolute length, therefore asRatio=false
        bool asRatio=false;
        double[] distances=new double[10];
        for (int i=0; i < 10; i++)
        {
            distances[i]=(polyCurve.Length / 100) * (i + 1) * 10;
        }
        IGeometryBridge2 geometryBridge=new GeometryEnvironmentClass();
        IEnumSplitPoint splitPoints=geometryBridge.SplitAtDistances(polyCurve, ref distances, asRatio, true);
        //print splitPoints
        splitPoints.Reset();
        IPoint currentPoint;
        int partIndex;
        int vertexIndex;
        splitPoints.Next(out currentPoint, out partIndex, out vertexIndex);
        while (currentPoint != null)
        {
            System.Windows.Forms.MessageBox.Show("X=" + currentPoint.X + " ,Y=" + currentPoint.Y);
            splitPoints.Next(out currentPoint, out partIndex, out vertexIndex);
        }
    }

See Also

IGeometryBridge2 Interface