LDObject subclass renaming:

Tue, 14 Feb 2017 12:58:53 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 14 Feb 2017 12:58:53 +0200
changeset 1139
51303023d651
parent 1138
0dfdef50b0ee
child 1140
c5791a3aa1ba

LDObject subclass renaming:
· LDLine → LDEdgeLine
· LDCondLine → LDConditionalEdge
· LDQuad → LDQuadrilateral

src/editmodes/circleMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/drawMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/linePathMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/magicWandMode.cpp file | annotate | diff | comparison | revisions
src/editmodes/rectangleMode.cpp file | annotate | diff | comparison | revisions
src/glCompiler.cpp file | annotate | diff | comparison | revisions
src/ldObject.cpp file | annotate | diff | comparison | revisions
src/ldObject.h file | annotate | diff | comparison | revisions
src/model.cpp file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/toolsets/algorithmtoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/editmodes/circleMode.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/editmodes/circleMode.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -137,7 +137,7 @@
 			v3.setCoordinate (localx, v3[localx] + c1[i].x1());
 			v3.setCoordinate (localy, v3[localy] + c1[i].y1());
 
-			LDQuad* quad = model.emplace<LDQuad>(v0, v1, v2, v3);
+			LDQuadrilateral* quad = model.emplace<LDQuadrilateral>(v0, v1, v2, v3);
 			quad->setColor(MainColor);
 
 			// Ensure the quads always are BFC-front towards the camera
--- a/src/editmodes/drawMode.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/editmodes/drawMode.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -71,7 +71,7 @@
 	{
 	    case 2:
 			// 2 verts - make a line
-		    model.emplace<LDLine>(verts[0], verts[1]);
+		    model.emplace<LDEdgeLine>(verts[0], verts[1]);
 		    break;
 
 		case 3:
@@ -79,7 +79,7 @@
 		{
 		    LDObject* obj = (countof(verts) == 3) ?
 			            static_cast<LDObject*>(model.emplace<LDTriangle>()) :
-			            static_cast<LDObject*>(model.emplace<LDQuad>());
+			            static_cast<LDObject*>(model.emplace<LDQuadrilateral>());
 
 			for (int i = 0; i < countof(verts); ++i)
 				obj->setVertex (i, verts[i]);
--- a/src/editmodes/linePathMode.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/editmodes/linePathMode.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -83,7 +83,7 @@
 	Model model {m_documents};
 
 	for (int i = 0; i < countof(m_drawedVerts) - 1; ++i)
-		model.emplace<LDLine>(m_drawedVerts[i], m_drawedVerts[i + 1]);
+		model.emplace<LDEdgeLine>(m_drawedVerts[i], m_drawedVerts[i + 1]);
 
 	finishDraw(model);
 }
--- a/src/editmodes/magicWandMode.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/editmodes/magicWandMode.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -46,8 +46,11 @@
 	// of candidates.
 	for (LDObject* candidate : candidates)
 	{
-		if (not isOneOf (candidate->type(), LDObjectType::Line, LDObjectType::CondLine) or candidate->vertex (0) == candidate->vertex (1))
+		if (not isOneOf(candidate->type(), LDObjectType::EdgeLine, LDObjectType::ConditionalEdge)
+			or candidate->vertex (0) == candidate->vertex (1))
+		{
 			continue;
+		}
 
 		int matches = 0;
 
@@ -60,7 +63,7 @@
 			{
 				// Boundary found. If it's an edgeline, add it to the boundaries list, if a
 				// conditional line, select it.
-				if (candidate->type() == LDObjectType::CondLine)
+				if (candidate->type() == LDObjectType::ConditionalEdge)
 					m_selection << candidate;
 				else
 					boundaries.append (std::make_tuple (candidate->vertex (0), candidate->vertex (1)));
@@ -96,13 +99,13 @@
 
 	switch (obj->type())
 	{
-		case LDObjectType::Line:
-		case LDObjectType::CondLine:
+		case LDObjectType::EdgeLine:
+		case LDObjectType::ConditionalEdge:
 			matchesneeded = 1;
 			break;
 
 		case LDObjectType::Triangle:
-		case LDObjectType::Quad:
+		case LDObjectType::Quadrilateral:
 			matchesneeded = 2;
 			break;
 
--- a/src/editmodes/rectangleMode.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/editmodes/rectangleMode.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -42,7 +42,7 @@
 	if (countof(m_drawedVerts) == 2)
 	{
 		Model model {m_documents};
-		LDQuad* quad = model.emplace<LDQuad>();
+		LDQuadrilateral* quad = model.emplace<LDQuadrilateral>();
 		updateRectVerts();
 
 		for (int i = 0; i < quad->numVertices(); ++i)
--- a/src/glCompiler.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/glCompiler.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -298,9 +298,9 @@
 	// Note: We cannot split quads into triangles here, it would mess up the wireframe view.
 	// Quads must go into separate vbos.
 	case LDObjectType::Triangle:
-	case LDObjectType::Quad:
-	case LDObjectType::Line:
-	case LDObjectType::CondLine:
+	case LDObjectType::Quadrilateral:
+	case LDObjectType::EdgeLine:
+	case LDObjectType::ConditionalEdge:
 		{
 			LDPolygon* poly = obj->getPolygon();
 			poly->id = obj->id();
--- a/src/ldObject.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/ldObject.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -64,10 +64,10 @@
     LDMatrixObject (model) {}
 
 LDOBJ_DEFAULT_CTOR (LDError, LDObject)
-LDOBJ_DEFAULT_CTOR (LDLine, LDObject)
+LDOBJ_DEFAULT_CTOR (LDEdgeLine, LDObject)
 LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject)
-LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine)
-LDOBJ_DEFAULT_CTOR (LDQuad, LDObject)
+LDOBJ_DEFAULT_CTOR (LDConditionalEdge, LDEdgeLine)
+LDOBJ_DEFAULT_CTOR (LDQuadrilateral, LDObject)
 LDOBJ_DEFAULT_CTOR (LDBfc, LDObject)
 LDOBJ_DEFAULT_CTOR (LDBezierCurve, LDObject)
 
@@ -94,7 +94,7 @@
 
 // =============================================================================
 //
-QString LDLine::asText() const
+QString LDEdgeLine::asText() const
 {
 	QString val = format ("2 %1", color());
 
@@ -118,7 +118,7 @@
 
 // =============================================================================
 //
-QString LDQuad::asText() const
+QString LDQuadrilateral::asText() const
 {
 	QString val = format ("4 %1", color());
 
@@ -130,7 +130,7 @@
 
 // =============================================================================
 //
-QString LDCondLine::asText() const
+QString LDConditionalEdge::asText() const
 {
 	QString val = format ("5 %1", color());
 	
@@ -191,7 +191,7 @@
 	return 1;
 }
 
-int LDQuad::triangleCount() const
+int LDQuadrilateral::triangleCount() const
 {
 	return 2;
 }
@@ -203,7 +203,7 @@
 
 // =============================================================================
 //
-LDLine::LDLine (Vertex v1, Vertex v2, Model* model) :
+LDEdgeLine::LDEdgeLine (Vertex v1, Vertex v2, Model* model) :
     LDObject {model}
 {
 	setVertex (0, v1);
@@ -222,7 +222,7 @@
 
 // =============================================================================
 //
-LDQuad::LDQuad (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, Model* model) :
+LDQuadrilateral::LDQuadrilateral (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, Model* model) :
     LDObject {model}
 {
 	setVertex (0, v1);
@@ -233,8 +233,8 @@
 
 // =============================================================================
 //
-LDCondLine::LDCondLine (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model) :
-    LDLine {model}
+LDConditionalEdge::LDConditionalEdge (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model) :
+	LDEdgeLine {model}
 {
 	setVertex (0, v0);
 	setVertex (1, v1);
@@ -266,10 +266,10 @@
 {
 	switch (obj->type())
 	{
-	case LDObjectType::Line:
-	case LDObjectType::CondLine:
+	case LDObjectType::EdgeLine:
+	case LDObjectType::ConditionalEdge:
 	case LDObjectType::Triangle:
-	case LDObjectType::Quad:
+	case LDObjectType::Quadrilateral:
 		for (int i = 0; i < obj->numVertices(); ++i)
 		{
 			Vertex v = obj->vertex (i);
@@ -316,10 +316,10 @@
 LDPolygon* LDObject::getPolygon()
 {
 	LDObjectType ot = type();
-	int num = (ot == LDObjectType::Line)		? 2
+	int num = (ot == LDObjectType::EdgeLine)		? 2
 			: (ot == LDObjectType::Triangle)	? 3
-			: (ot == LDObjectType::Quad)		? 4
-			: (ot == LDObjectType::CondLine)	? 5
+			: (ot == LDObjectType::Quadrilateral)		? 4
+			: (ot == LDObjectType::ConditionalEdge)	? 5
 			: 0;
 
 	if (num == 0)
@@ -498,7 +498,7 @@
 
 // =============================================================================
 //
-void LDQuad::invert()
+void LDQuadrilateral::invert()
 {
 	// Quad:     0 -> 1 -> 2 -> 3
 	// reversed: 0 -> 3 -> 2 -> 1
@@ -580,7 +580,7 @@
 
 // =============================================================================
 //
-void LDLine::invert()
+void LDEdgeLine::invert()
 {
 	// For lines, we swap the vertices.
 	Vertex tmp = vertex (0);
@@ -590,7 +590,7 @@
 
 // =============================================================================
 //
-void LDCondLine::invert()
+void LDConditionalEdge::invert()
 {
 	// I don't think that a conditional line's control points need to be swapped, do they?
 	Vertex tmp = vertex (0);
@@ -613,9 +613,9 @@
 
 // =============================================================================
 //
-LDLine* LDCondLine::becomeEdgeLine()
+LDEdgeLine* LDConditionalEdge::becomeEdgeLine()
 {
-	LDLine* replacement = model()->emplaceReplacement<LDLine>(this);
+	LDEdgeLine* replacement = model()->emplaceReplacement<LDEdgeLine>(this);
 
 	for (int i = 0; i < replacement->numVertices(); ++i)
 		replacement->setVertex (i, vertex (i));
@@ -790,7 +790,7 @@
 
 	for (LDPolygon& poly : polygons)
 	{
-		LDLine* line = model.emplace<LDLine>(poly.vertices[0], poly.vertices[1]);
+		LDEdgeLine* line = model.emplace<LDEdgeLine>(poly.vertices[0], poly.vertices[1]);
 		line->setColor (poly.color);
 	}
 }
--- a/src/ldObject.h	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/ldObject.h	Tue Feb 14 12:58:53 2017 +0200
@@ -24,9 +24,7 @@
 #include "colors.h"
 
 class Model;
-class LDSubfileReference;
 class LDDocument;
-class LDBfc;
 
 /*
  * Object type codes.
@@ -34,10 +32,10 @@
 enum LDObjectType
 {
 	SubfileReference,	//	Object represents a	sub-file reference
-	Quad,				//	Object represents a	quadrilateral
+	Quadrilateral,		//	Object represents a	quadrilateral
 	Triangle,			//	Object represents a	triangle
-	Line,				//	Object represents a	line
-	CondLine,			//	Object represents a	conditional line
+	EdgeLine,			//	Object represents a	line
+	ConditionalEdge,	//	Object represents a	conditional line
 	Bfc,				//	Object represents a	BFC statement
 	Comment,			//	Object represents a	comment
 	Error,				//	Object is the result of failed parsing
@@ -75,7 +73,7 @@
 	virtual int numVertices() const;
 	virtual QString objectListText() const;
 	LDObject* previous() const;
-	bool previousIsInvertnext (LDBfc*& ptr);
+	bool previousIsInvertnext(class LDBfc*& ptr);
 	QColor randomColor() const;
 	void setColor (LDColor color);
 	void setHidden (bool value);
@@ -257,10 +255,10 @@
 /*
  * Represents a single code-2 line in the LDraw code file.
  */
-class LDLine : public LDObject
+class LDEdgeLine : public LDObject
 {
 public:
-	static constexpr LDObjectType SubclassType = LDObjectType::Line;
+	static constexpr LDObjectType SubclassType = LDObjectType::EdgeLine;
 
 	virtual LDObjectType type() const override
 	{
@@ -275,17 +273,17 @@
 
 protected:
 	friend class Model;
-	LDLine (Model* model);
-	LDLine (Vertex v1, Vertex v2, Model* model = nullptr);
+	LDEdgeLine (Model* model);
+	LDEdgeLine (Vertex v1, Vertex v2, Model* model = nullptr);
 };
 
 /*
  * Represents a single code-5 conditional line.
  */
-class LDCondLine : public LDLine
+class LDConditionalEdge : public LDEdgeLine
 {
 public:
-	static constexpr LDObjectType SubclassType = LDObjectType::CondLine;
+	static constexpr LDObjectType SubclassType = LDObjectType::ConditionalEdge;
 
 	virtual LDObjectType type() const override
 	{
@@ -296,13 +294,13 @@
 	virtual void invert() override;
 	int numVertices() const override { return 4; }
 	LDColor defaultColor() const override { return EdgeColor; }
-	LDLine* becomeEdgeLine();
+	LDEdgeLine* becomeEdgeLine();
 	QString typeName() const override { return "condline"; }
 
 protected:
 	friend class Model;
-	LDCondLine (Model* model);
-	LDCondLine (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model = nullptr);
+	LDConditionalEdge (Model* model);
+	LDConditionalEdge (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, Model* model = nullptr);
 };
 
 /*
@@ -333,10 +331,10 @@
 /*
  * Represents a single code-4 quadrilateral.
  */
-class LDQuad : public LDObject
+class LDQuadrilateral : public LDObject
 {
 public:
-	static constexpr LDObjectType SubclassType = LDObjectType::Quad;
+	static constexpr LDObjectType SubclassType = LDObjectType::Quadrilateral;
 
 	virtual LDObjectType type() const override
 	{
@@ -351,8 +349,8 @@
 
 protected:
 	friend class Model;
-	LDQuad (Model* model);
-	LDQuad (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, Model* model = nullptr);
+	LDQuadrilateral (Model* model);
+	LDQuadrilateral (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, Model* model = nullptr);
 };
 
 /*
--- a/src/model.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/model.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -440,7 +440,7 @@
 				CheckTokenNumbers (tokens, 1, 7);
 
 				// Line
-				LDLine* obj = emplaceAt<LDLine>(position);
+				LDEdgeLine* obj = emplaceAt<LDEdgeLine>(position);
 				obj->setColor (StringToNumber (tokens[1]));
 
 				for (int i = 0; i < 2; ++i)
@@ -474,9 +474,9 @@
 				LDObject* obj;
 
 				if (num == 4)
-					obj = emplaceAt<LDQuad>(position);
+					obj = emplaceAt<LDQuadrilateral>(position);
 				else
-					obj = emplaceAt<LDCondLine>(position);
+					obj = emplaceAt<LDConditionalEdge>(position);
 
 				obj->setColor (StringToNumber (tokens[1]));
 
--- a/src/primitives.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/primitives.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -262,7 +262,7 @@
 		{
 		case Circle:
 		    {
-			    LDLine* line = model.emplace<LDLine>();
+			    LDEdgeLine* line = model.emplace<LDEdgeLine>();
 				line->setVertex(0, Vertex {x0, 0.0f, z0});
 				line->setVertex(1, Vertex {x1, 0.0f, z1});
 				line->setColor(EdgeColor);
@@ -311,7 +311,7 @@
 				Vertex v1 = {x1, y1, z1};
 				Vertex v2 = {x2, y2, z2};
 				Vertex v3 = {x3, y3, z3};
-				LDQuad* quad = model.emplace<LDQuad>(v0, v1, v2, v3);
+				LDQuadrilateral* quad = model.emplace<LDQuadrilateral>(v0, v1, v2, v3);
 				quad->setColor(MainColor);
 
 				if (type == Cylinder)
@@ -375,7 +375,7 @@
 			v0 = {v0[X] * ringNumber, 1.0, v0[Z] * ringNumber};
 		}
 
-		LDCondLine* line = model.emplace<LDCondLine>();
+		LDConditionalEdge* line = model.emplace<LDConditionalEdge>();
 		line->setColor(EdgeColor);
 		line->setVertex(0, v0);
 		line->setVertex(1, v1);
--- a/src/toolsets/algorithmtoolset.cpp	Tue Feb 14 12:48:21 2017 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Tue Feb 14 12:58:53 2017 +0200
@@ -118,25 +118,25 @@
 	{
 		const LDObjectType type = object->type();
 
-		if (type != LDObjectType::Quad and type != LDObjectType::Triangle)
+		if (type != LDObjectType::Quadrilateral and type != LDObjectType::Triangle)
 			continue;
 
 		Model lines {m_documents};
 
-		if (type == LDObjectType::Quad)
+		if (type == LDObjectType::Quadrilateral)
 		{
-			LDQuad* quad = static_cast<LDQuad*>(object);
-			lines.emplace<LDLine>(quad->vertex (0), quad->vertex (1));
-			lines.emplace<LDLine>(quad->vertex (1), quad->vertex (2));
-			lines.emplace<LDLine>(quad->vertex (2), quad->vertex (3));
-			lines.emplace<LDLine>(quad->vertex (3), quad->vertex (0));
+			LDQuadrilateral* quad = static_cast<LDQuadrilateral*>(object);
+			lines.emplace<LDEdgeLine>(quad->vertex (0), quad->vertex (1));
+			lines.emplace<LDEdgeLine>(quad->vertex (1), quad->vertex (2));
+			lines.emplace<LDEdgeLine>(quad->vertex (2), quad->vertex (3));
+			lines.emplace<LDEdgeLine>(quad->vertex (3), quad->vertex (0));
 		}
 		else
 		{
 			LDTriangle* triangle = static_cast<LDTriangle*>(object);
-			lines.emplace<LDLine>(triangle->vertex (0), triangle->vertex (1));
-			lines.emplace<LDLine>(triangle->vertex (1), triangle->vertex (2));
-			lines.emplace<LDLine>(triangle->vertex (2), triangle->vertex (0));
+			lines.emplace<LDEdgeLine>(triangle->vertex (0), triangle->vertex (1));
+			lines.emplace<LDEdgeLine>(triangle->vertex (1), triangle->vertex (2));
+			lines.emplace<LDEdgeLine>(triangle->vertex (2), triangle->vertex (0));
 		}
 
 		count += countof(lines.objects());
@@ -278,7 +278,7 @@
 {
 	int num = 0;
 
-	for (LDCondLine* line : filterByType<LDCondLine>(selectedObjects()))
+	for (LDConditionalEdge* line : filterByType<LDConditionalEdge>(selectedObjects()))
 	{
 		line->becomeEdgeLine();
 		++num;
@@ -386,7 +386,7 @@
 
 	for (LDObject* obj : selectedObjects())
 	{
-		if (not isOneOf (obj->type(), LDObjectType::Line, LDObjectType::CondLine))
+		if (not isOneOf (obj->type(), LDObjectType::EdgeLine, LDObjectType::ConditionalEdge))
 			continue;
 
 		Model segments {m_documents};
@@ -408,10 +408,10 @@
 				a = (obj->vertex (0)[ax] + ((len * (i + 1)) / numSegments));
 			});
 
-			if (obj->type() == LDObjectType::Line)
-				segments.emplace<LDLine>(v0, v1);
+			if (obj->type() == LDObjectType::EdgeLine)
+				segments.emplace<LDEdgeLine>(v0, v1);
 			else
-				segments.emplace<LDCondLine>(v0, v1, obj->vertex (2), obj->vertex (3));
+				segments.emplace<LDConditionalEdge>(v0, v1, obj->vertex (2), obj->vertex (3));
 		}
 
 		currentDocument()->replace(obj, segments);

mercurial