src/primitives.h

changeset 1053
2a48c0fff107
parent 1021
f40c792c9334
child 1054
1f4c8a369e7c
--- a/src/primitives.h	Wed Nov 16 00:52:22 2016 +0200
+++ b/src/primitives.h	Wed Nov 16 01:28:42 2016 +0200
@@ -35,22 +35,25 @@
 	PrimitiveCategory* category;
 };
 
-enum PrimitiveType
+struct PrimitiveModel
 {
-	Circle,
-	Cylinder,
-	Disc,
-	DiscNegative,
-	Ring,
-	Cone,
-};
-
-struct PrimitiveSpec
-{
-	PrimitiveType type;
+	enum Type
+	{
+		Circle,
+		Cylinder,
+		Disc,
+		DiscNegative,
+		Ring,
+		Cone,
+	} type;
 	int segments;
 	int divisions;
 	int ringNumber;
+
+	QString typeName() const;
+	LDObjectList generateBody() const;
+	static QString typeName(Type type);
+	QString makeFileName() const;
 };
 
 class PrimitiveCategory : public QObject
@@ -89,24 +92,22 @@
 	PrimitiveManager(QObject* parent);
 
 	PrimitiveScanner* activeScanner();
-	LDDocument* generatePrimitive(const PrimitiveSpec &spec);
-	LDDocument* getPrimitive(const PrimitiveSpec &spec);
+	LDDocument* generatePrimitive(const PrimitiveModel &spec);
+	LDDocument* getPrimitive(const PrimitiveModel &spec);
 	QString getPrimitivesCfgPath() const;
 	void loadPrimitives();
-	void makeCircle(int segs, int divs, double radius, QList<QLineF>& lines);
-	QString makeRadialFileName(const PrimitiveSpec &spec);
-	void populateTreeWidget(QTreeWidget* tree, const QString& selectByDefault = QString());
-	QString primitiveTypeName(PrimitiveType type);
-	Q_SLOT void scanDone();
+	void populateTreeWidget(QTreeWidget* tree, const QString& selectByDefault = {});
 	void startScan();
 
+public slots:
+	void scanDone();
+
 private:
 	QList<PrimitiveCategory*> m_categories;
 	PrimitiveScanner* m_activeScanner;
 	QList<Primitive> m_primitives;
 	PrimitiveCategory* m_unmatched;
 
-	LDObjectList makePrimitiveBody(const PrimitiveSpec &spec);
 	void loadCategories();
 	void populateCategories();
 	void clearCategories();

mercurial