[C#]public void SplitDivideLength() { //Construct Polycurve IPoint fromPoint = new PointClass(); fromPoint.PutCoords(0, 0); IPoint toPoint = new PointClass(); toPoint.PutCoords(100, 0); ILine line = new LineClass(); line.FromPoint = fromPoint; line.ToPoint = toPoint; /* offset: start, 0 -> we start from the beginning * length: the desired output length for all segments execpt the last one * asRatio: ratio */ double offset = 0; double length = 10; bool asRatio = false; int numberOfSplittedSegments; //NOTE that our array is of length 2 but we will get 10 Segments. //This means that only the first 2 Segements are copied to the array. //Nevertheless numberOfSplittedSegments will be = 10 ISegment[] splittedSegments = new ISegment[2]; for(int i = 0; i < 2; i++) { splittedSegments[i] = new PolylineClass() as ISegment; } ISegment segment = line as ISegment; IGeometryBridge2 geometryBridge = new GeometryEnvironmentClass(); geometryBridge.SplitDivideLength(segment, offset, length, asRatio, out numberOfSplittedSegments, ref splittedSegments); //print segments length for(int i = 0; i < splittedSegments.Length; i++) { System.Windows.Forms.MessageBox.Show(splittedSegments[i].Length.ToString()); } }
[Visual Basic 6.0, Visual Basic .NET, C++]
No example is available for Visual Basic 6.0, Visual Basic .NET, or C++. To view a C# example, click the Language Filter button
in the upper-left corner of the page.