public IPolyline GetSubpart(int startSegmentIndex, double startFraction, int endSegmentIndex, double endFraction) { IPointCollection4 subpart = new PolylineClass(); ((IZAware)subpart).ZAware = true; var add = 2; if (endFraction == 0) { add = 1; } int pointCount = endSegmentIndex - startSegmentIndex + add; var points = new WKSPointZ[pointCount]; SegmentProxy seg0 = GetSegment(startSegmentIndex); IPnt p = seg0.GetPointAt(startFraction, true); points[0] = QaGeometryUtils.GetWksPoint(p); for (int i = startSegmentIndex + 1; i <= endSegmentIndex; i++) { points[i - startSegmentIndex] = GetPlanePoint(i); } if (endFraction > 0) { SegmentProxy seg1 = GetSegment(endSegmentIndex); IPnt end = seg1.GetPointAt(endFraction, true); points[pointCount - 1] = QaGeometryUtils.GetWksPoint(end); } GeometryUtils.SetWKSPointZs(subpart, points); return((IPolyline)subpart); }
private IPolyline GetLinearSubpart(int startSegmentIndex, double startFraction, int endSegmentIndex, double endFraction) { IPointCollection4 subpart = new PolylineClass(); int add = 2; if (endFraction == 0) { add = 1; } int pointCount = endSegmentIndex - startSegmentIndex + add; var points = new WKSPointZ[pointCount]; SegmentProxy seg0 = GetSegment(startSegmentIndex); IPnt p = seg0.GetPointAt(startFraction, as3D: true); points[0] = QaGeometryUtils.GetWksPoint(p); for (int i = startSegmentIndex + 1; i <= endSegmentIndex; i++) { points[i - startSegmentIndex] = _points[i]; } if (endFraction > 0) { SegmentProxy seg1 = GetSegment(endSegmentIndex); IPnt end = seg1.GetPointAt(endFraction, as3D: true); points[pointCount - 1] = QaGeometryUtils.GetWksPoint(end); } GeometryUtils.SetWKSPointZs(subpart, points); ((IPolyline)subpart).SpatialReference = SpatialReference; return((IPolyline)subpart); }