private void InitializeSegment() { Reset(); _intersections = CGAL.Intersection.Calculate(_points, _types); int len = _points.Length; int begin = Invalid; if (len < 2) { return; } for (int i = 0; i < len; i++) { if (_types[i] != 0) { continue; } //有起始点,起始点和当前点间间距为2以上才需要生成路径 if (begin != Invalid && (i - begin) >= 2) { DividePath.GenerateDividePath(_paths, _intersections, _points, _types, begin, i - begin); } begin = i; } //last point if (_types[len - 1] != 0 && begin != Invalid && (len - begin) >= 2) { DividePath.GenerateDividePath(_paths, _intersections, _points, _types, begin, len - begin); } }
/// <summary> /// 生成新路径 /// </summary> private void GenerateCombinePath() { IEnumerable <GraphicsPath> list = DividePath.ConnectPath(_paths); GraphicsPath path = new GraphicsPath(); foreach (var p in list) { path.AddPath(p, false); } _points = (PointF[])path.PathPoints.Clone(); _types = (byte[])path.PathTypes.Clone(); LoadGeneratePathEvent(); }