src/linetypes/circularprimitive.cpp

changeset 1407
22bc5862cb56
parent 1406
37fffb682d2f
child 1408
0d6162662040
--- a/src/linetypes/circularprimitive.cpp	Sun Jun 17 16:13:24 2018 +0300
+++ b/src/linetypes/circularprimitive.cpp	Sun Jun 17 17:07:29 2018 +0300
@@ -76,7 +76,7 @@
 	bool /* render */
 ) {
 	Model cylinderBody {context};
-	buildPrimitiveBody(cylinderBody);
+	buildPrimitiveBody(cylinderBody, false);
 
 	for (LDObject* object : cylinderBody.objects())
 	{
@@ -94,7 +94,7 @@
 QVector<LDPolygon> LDCircularPrimitive::rasterizePolygons(DocumentManager* context, Winding winding)
 {
 	Model cylinderBody {context};
-	buildPrimitiveBody(cylinderBody);
+	buildPrimitiveBody(cylinderBody, true);
 	QVector<LDPolygon> result;
 	bool cachedShouldInvert = shouldInvert(winding, context);
 
@@ -121,14 +121,14 @@
 	return result;
 }
 
-void LDCircularPrimitive::buildPrimitiveBody(Model& model) const
+void LDCircularPrimitive::buildPrimitiveBody(Model& model, bool deep) const
 {
 	PrimitiveModel primitive;
 	primitive.type = m_type;
 	primitive.segments = m_segments;
 	primitive.divisions = m_divisions;
 	primitive.ringNumber = 0;
-	primitive.generateBody(model);
+	primitive.generateBody(model, deep);
 }
 
 QString LDCircularPrimitive::stem() const
@@ -147,6 +147,12 @@
 	case PrimitiveModel::DiscNegative:
 		return "ndis";
 
+	case PrimitiveModel::CylinderClosed:
+		return "cylc";
+
+	case PrimitiveModel::CylinderOpen:
+		return "cylo";
+
 	default:
 		throw std::logic_error("Bad primitive type to LDCircularPrimitive");
 	}
@@ -218,6 +224,8 @@
 		throw std::logic_error("Bad primitive type to LDCircularPrimitive");
 
 	case PrimitiveModel::Cylinder:
+	case PrimitiveModel::CylinderClosed:
+	case PrimitiveModel::CylinderOpen:
 		return 2 * m_segments;
 
 	case PrimitiveModel::Disc:
@@ -250,6 +258,12 @@
 
 	case PrimitiveModel::Circle:
 		return "circle";
+
+	case PrimitiveModel::CylinderClosed:
+		return "cylinder-closed";
+
+	case PrimitiveModel::CylinderOpen:
+		return "cylinder-open";
 	}
 
 	return "";

mercurial