/// <summary> /// Konvertiert alles zu Polylinien /// </summary> /// <returns> Erzeugte Polylinien</returns> private List <Ent.LwPolyline> All_To_Polyline() { List <Ent.LwPolyline> list_all_Path = new List <Ent.LwPolyline>(); foreach (List <object> Element in ListElement_Image) { List <Ent.LwPolylineVertex> list_all_vertex = new List <Ent.LwPolylineVertex>(); foreach (object element in Element) { Type type = element.GetType(); if (type == typeof(Beziercurve)) { Beziercurve newCurve = element as Beziercurve; foreach (Potrace.DoublePoint pt in newCurve.List_Of_All_Points) { list_all_vertex.Add(new Ent.LwPolylineVertex((double)pt.X, (double)pt.Y)); } } else { LineF newLine = element as LineF; list_all_vertex.Add(new Ent.LwPolylineVertex((double)newLine.Point1.x, (double)newLine.Point1.Y)); list_all_vertex.Add(new Ent.LwPolylineVertex((double)newLine.Point2.x, (double)newLine.Point2.Y)); } } Ent.LwPolyline newPolyline = new Ent.LwPolyline(list_all_vertex); list_all_Path.Add(newPolyline); } Set_Max_und_Min(list_all_Path); RahmenPassend(ref list_all_Path); return(allePolylinien = list_all_Path); }
/// <summary> /// Erzeugt alle Punkte, die zum Nachmalen des Bildes wichtig sind /// </summary> /// <param name="anzahl">Anzahl der der Segmente pro Bezier-Kurve</param> private void TakeAllPoints(double anzahl) { if (ListOfCurveArray == null) { return; } Image tt = loaded_Image; for (int i = 0; i < ListOfCurveArray.Count; i++) { ArrayList CurveArray = (ArrayList)ListOfCurveArray[i]; for (int j = 0; j < CurveArray.Count; j++) { List <object> listElement_Image = new List <object>(); Potrace.Curve[] Curves = (Potrace.Curve[])CurveArray[j]; for (int k = 0; k < Curves.Length; k++) { if (Curves[k].Kind == Potrace.CurveKind.Bezier) { PointF A = new PointF(Curves[k].A.X, Curves[k].A.Y, new ControlPoint(Curves[k].ControlPointA.X, Curves[k].ControlPointA.Y)); PointF B = new PointF(Curves[k].B.X, Curves[k].B.Y, new ControlPoint(Curves[k].ControlPointB.X, Curves[k].ControlPointB.Y)); Beziercurve newCurve = new Beziercurve(A, A.ControlPt, B, B.ControlPt); newCurve.List_Of_All_Points = newCurve.BezierToDoublePoint(anzahl); listElement_Image.Add(newCurve); } else { PointF Point1 = new PointF(Curves[k].A.X, Curves[k].A.Y, null); PointF Point2 = new PointF(Curves[k].B.X, Curves[k].B.Y, null); LineF newLine = new LineF(Point1, Point2); listElement_Image.Add(newLine); } } ListElement_Image.Add(listElement_Image); } } }