src/model.h

changeset 1366
69087b1e123b
parent 1326
69a90bd2dba2
--- a/src/model.h	Fri Mar 30 14:30:51 2018 +0300
+++ b/src/model.h	Sat Mar 31 18:41:24 2018 +0300
@@ -78,6 +78,20 @@
 	Q_OBJECT
 
 public:
+	enum
+	{
+		LDObjectTypeRole = Qt::UserRole,
+		Vertex0Role,
+		Vertex1Role,
+		Vertex2Role,
+		Vertex3Role,
+		ColorRole,
+		PositionRole,
+		TransformationMatrixRole,
+		ReferenceNameRole,
+		CommentTextRole,
+	};
+
 	Model(class DocumentManager* manager);
 	Model(const Model& other) = delete;
 	~Model();
@@ -109,6 +123,10 @@
 	QModelIndex objectByPickingColor(const QColor& color) const;
 	Winding winding() const;
 	void setWinding(Winding winding);
+	const GLRotationMatrix& transformationMatrix() const;
+	void setTransformationMatrix(const GLRotationMatrix& matrix);
+	Vertex map(const Vertex& global) const;
+	Vertex unmap(const Vertex& local) const;
 
 	bool moveRows(
 		const QModelIndex& sourceParent,
@@ -120,12 +138,14 @@
 
 	int rowCount(const QModelIndex& parent) const override;
 	QVariant data(const QModelIndex& index, int role) const override;
+	bool setData(const QModelIndex& index, const QVariant& value, int role);
 
 signals:
 	void objectAdded(const QModelIndex& object);
 	void aboutToRemoveObject(const QModelIndex& index);
 	void objectModified(LDObject* object);
 	void windingChanged(Winding newWinding);
+	void transformationMatrixChanged(const Matrix& newMatrix);
 
 protected:
 	template<typename T, typename... Args> T* constructObject(Args&& ...args);
@@ -137,6 +157,8 @@
 	mutable int _triangleCount = 0;
 	mutable bool _needsTriangleRecount;
 	Winding _winding = NoWinding;
+	GLRotationMatrix storedTransformationmatrix;
+	GLRotationMatrix invertedTransformationmatrix;
 
 private:
 	void installObject(int row, LDObject* object);

mercurial