src/linetypes/circularprimitive.h

Tue, 19 Jun 2018 23:18:58 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 19 Jun 2018 23:18:58 +0300
changeset 1412
f5eb947a2e7f
parent 1407
22bc5862cb56
child 1418
503d4e7e27c9
permissions
-rw-r--r--

added support for inverting circular primitives

1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
2 #include "../primitives.h"
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include "modelobject.h"
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
5 class LDCircularPrimitive : public LDMatrixObject
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 public:
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
8 static const LDObjectType SubclassType = LDObjectType::CircularPrimitive;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
10 LDCircularPrimitive() = default;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
11 LDCircularPrimitive(
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
12 PrimitiveModel::Type type,
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
13 int segments,
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
14 int divisions,
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
15 const QMatrix4x4& matrix
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
16 );
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
18 LDObjectType type() const override;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
19 QString asText() const override;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
20 void getVertices(DocumentManager *context, QSet<Vertex>& verts) const override;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
21 bool isRasterizable() const override;
1412
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
22 bool isFlat() const;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 void rasterize(
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 DocumentManager* context,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 Winding parentWinding,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 Model& model,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 bool deep,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 bool render
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 ) override;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 QString objectListText() const override;
1406
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
32 PrimitiveModel::Type primitiveType() const;
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
33 void setPrimitiveType(PrimitiveModel::Type newType);
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
34 int segments() const;
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
35 void setSegments(int newSegments);
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
36 int divisions() const;
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
37 void setDivisions(int newDivisions);
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
38 int triangleCount(DocumentManager*) const override;
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1399
diff changeset
39 QString iconName() const override;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 void serialize(class Serializer& serializer) override;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 private:
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 QString buildFilename() const;
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
44 void buildPrimitiveBody(Model& model, bool newParameter = false) const;
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
45 QString stem() const;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
47 PrimitiveModel::Type m_type = PrimitiveModel::Circle;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
48 int m_segments = MediumResolution;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
49 int m_divisions = MediumResolution;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
50 };

mercurial