src/linetypes/circularprimitive.h

Thu, 21 Jun 2018 19:21:49 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 21 Jun 2018 19:21:49 +0300
changeset 1418
503d4e7e27c9
parent 1412
f5eb947a2e7f
permissions
-rw-r--r--

used the new CircularSectionEditor in CircularPrimitiveEditor

#pragma once
#include "../primitives.h"
#include "modelobject.h"

class LDCircularPrimitive : public LDMatrixObject
{
public:
	static const LDObjectType SubclassType = LDObjectType::CircularPrimitive;

	LDCircularPrimitive() = default;
	LDCircularPrimitive(
		PrimitiveModel::Type type,
		int segments,
		int divisions,
		const QMatrix4x4& matrix
	);

	LDObjectType type() const override;
	QString asText() const override;
	void getVertices(DocumentManager *context, QSet<Vertex>& verts) const override;
	bool isRasterizable() const override;
	bool isFlat() const;
	void rasterize(
		DocumentManager* context,
		Winding parentWinding,
		Model& model,
		bool deep,
		bool render
	) override;
	QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override;
	QString objectListText() const override;
	PrimitiveModel::Type primitiveType() const;
	void setPrimitiveType(PrimitiveModel::Type newType);
	int segments() const;
	void setSegments(int newSegments);
	int divisions() const;
	void setDivisions(int newDivisions);
	const CircularSection& section() const;
	void setSection(const CircularSection& newSection);
	int triangleCount(DocumentManager*) const override;
	QString iconName() const override;
	void serialize(class Serializer& serializer) override;

private:
	QString buildFilename() const;
	void buildPrimitiveBody(Model& model, bool newParameter = false) const;
	QString stem() const;

	PrimitiveModel::Type m_type = PrimitiveModel::Circle;
	CircularSection m_section;
};

mercurial