Bézier curves are now parsed correctly

Sun, 04 Oct 2015 06:43:02 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 04 Oct 2015 06:43:02 +0300
changeset 1003
31873c3cbdbc
parent 1002
a3ee23db8393
child 1004
ba4200437179

Bézier curves are now parsed correctly

src/editmodes/curvemode.cpp file | annotate | diff | comparison | revisions
src/ldDocument.cpp file | annotate | diff | comparison | revisions
src/ldObject.cpp file | annotate | diff | comparison | revisions
--- a/src/editmodes/curvemode.cpp	Sun Oct 04 06:31:36 2015 +0300
+++ b/src/editmodes/curvemode.cpp	Sun Oct 04 06:43:02 2015 +0300
@@ -80,7 +80,7 @@
 	if (m_drawedVerts.size() == 4)
 	{
 		LDObjectList objs;
-		objs << new LDBezierCurve (m_drawedVerts[0], m_drawedVerts[1], m_drawedVerts[2], m_drawedVerts[3]);
+		objs << LDSpawn<LDBezierCurve> (m_drawedVerts[0], m_drawedVerts[1], m_drawedVerts[2], m_drawedVerts[3]);
 		finishDraw (objs);
 	}
 }
--- a/src/ldDocument.cpp	Sun Oct 04 06:31:36 2015 +0300
+++ b/src/ldDocument.cpp	Sun Oct 04 06:43:02 2015 +0300
@@ -442,6 +442,18 @@
 						obj->setHeight (tokens[8].toLong());
 						return obj;
 					}
+					else if (tokens[2] == "BEZIER_CURVE")
+					{
+						CheckTokenCount (tokens, 16);
+						CheckTokenNumbers (tokens, 3, 15);
+						LDBezierCurve* obj = LDSpawn<LDBezierCurve>();
+						obj->setColor (StringToNumber (tokens[3]));
+
+						for (int i = 0; i < 4; ++i)
+							obj->setVertex (i, ParseVertex (tokens, 4 + (i * 3)));
+
+						return obj;
+					}
 				}
 
 				// Just a regular comment:
--- a/src/ldObject.cpp	Sun Oct 04 06:31:36 2015 +0300
+++ b/src/ldObject.cpp	Sun Oct 04 06:43:02 2015 +0300
@@ -1097,7 +1097,11 @@
 	parms.append (pointAt (1.0));
 
 	for (int i = 0; i < segments; ++i)
-		result << new LDLine (parms[i], parms[i + 1]);
+	{
+		LDLine* line = LDSpawn<LDLine> (parms[i], parms[i + 1]);
+		line->setColor (color());
+		result << line;
+	}
 
 	return result;
 }

mercurial