src/linetypes/circularprimitive.cpp

Fri, 21 Dec 2018 21:43:06 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 21 Dec 2018 21:43:06 +0200
changeset 1431
2e0e2c696605
parent 1425
5354313b9958
permissions
-rw-r--r--

things

1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #include "../algorithms/geometry.h"
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "../glShared.h"
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include "../model.h"
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 #include "../algorithms/invert.h"
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
5 #include "circularprimitive.h"
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 #include "quadrilateral.h"
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 #include "primitives.h"
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
9 QString LDCircularPrimitive::buildFilename() const
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
11 int numerator = segments();
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
12 int denominator = divisions();
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 QString prefix;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
15 if (divisions() != MediumResolution)
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
16 prefix = QString::number(divisions()) + '\\';
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 simplify(numerator, denominator);
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
19
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
20 // Ensure that the denominator is at least 4, expand if necessary
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
21 if (denominator < 4)
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
22 {
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
23 numerator = static_cast<int>(round(numerator * 4.0 / denominator));
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
24 denominator = 4;
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
25 }
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
26
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
27 return format("%1%2-%3%4.dat", prefix, numerator, denominator, stem());
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
30 LDCircularPrimitive::LDCircularPrimitive(PrimitiveModel::Type type,
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 int segments,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 int divisions,
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
33 const QMatrix4x4& matrix) :
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
34 LDMatrixObject {matrix},
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
35 m_type {type},
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
36 m_section {segments, divisions} {}
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
38 LDObjectType LDCircularPrimitive::type() const
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
39 {
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
40 return SubclassType;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
41 }
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
42
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
43 QString LDCircularPrimitive::asText() const
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 {
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
45 return LDSubfileReference(buildFilename(), transformationMatrix()).asText();
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
48 void LDCircularPrimitive::getVertices(DocumentManager* /* context */, QSet<Vertex>& vertices) const
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
50 int endSegment = (segments() == divisions()) ? segments() : segments() + 1;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
51
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
52 for (int i = 0; i < endSegment; i += 1)
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
53 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
54 QPointF point2d = pointOnLDrawCircumference(i, divisions());
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
55
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
56 for (double y_value : {0.0, 1.0})
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
57 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
58 Vertex vertex {point2d.x(), y_value, point2d.y()};
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
59 vertex.transform(transformationMatrix());
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
60 vertices.insert(vertex);
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
61 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
62 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
63 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
64
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
65 bool LDCircularPrimitive::isRasterizable() const
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
66 {
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
67 return true;
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
68 }
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
69
1412
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
70 bool LDCircularPrimitive::isFlat() const
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
71 {
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
72 switch (m_type)
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
73 {
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
74 case PrimitiveModel::Cylinder:
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
75 case PrimitiveModel::CylinderClosed:
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
76 case PrimitiveModel::CylinderOpen:
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
77 return false;
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
78
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
79 default:
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
80 return true;
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
81 }
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
82 }
f5eb947a2e7f added support for inverting circular primitives
Teemu Piippo <teemu@hecknology.net>
parents: 1410
diff changeset
83
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
84 void LDCircularPrimitive::rasterize(
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
85 DocumentManager* context,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
86 Winding /* parentWinding */,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
87 Model& model,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
88 bool /* deep */,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
89 bool /* render */
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
90 ) {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
91 Model cylinderBody {context};
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
92 buildPrimitiveBody(cylinderBody, false);
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
93
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
94 for (LDObject* object : cylinderBody.objects())
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
95 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
96 for (int i = 0; i < object->numVertices(); i += 1)
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
97 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
98 Vertex vertex = object->vertex(i);
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
99 vertex.transform(transformationMatrix());
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
100 object->setVertex(i, vertex);
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
101 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
102 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
103
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
104 model.merge(cylinderBody);
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
105 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
106
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
107 QVector<LDPolygon> LDCircularPrimitive::rasterizePolygons(DocumentManager* context, Winding winding)
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
108 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
109 Model cylinderBody {context};
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
110 buildPrimitiveBody(cylinderBody, true);
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
111 QVector<LDPolygon> result;
1394
8d9d0532b3df fixed cylinder rendering
Teemu Piippo <teemu@hecknology.net>
parents: 1391
diff changeset
112 bool cachedShouldInvert = shouldInvert(winding, context);
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
113
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
114 for (LDObject* object : cylinderBody.objects())
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
115 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
116 for (int i = 0; i < object->numVertices(); i += 1)
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
117 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
118 Vertex vertex = object->vertex(i);
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
119 vertex.transform(transformationMatrix());
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
120 object->setVertex(i, vertex);
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
121 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
122
1400
ae83213bdd63 refactored LDPolygon
Teemu Piippo <teemu@hecknology.net>
parents: 1399
diff changeset
123 LDPolygon polygon = object->getPolygon();
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
124
1400
ae83213bdd63 refactored LDPolygon
Teemu Piippo <teemu@hecknology.net>
parents: 1399
diff changeset
125 if (polygon.isValid())
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
126 {
1394
8d9d0532b3df fixed cylinder rendering
Teemu Piippo <teemu@hecknology.net>
parents: 1391
diff changeset
127 if (cachedShouldInvert)
1400
ae83213bdd63 refactored LDPolygon
Teemu Piippo <teemu@hecknology.net>
parents: 1399
diff changeset
128 invertPolygon(polygon);
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
129
1400
ae83213bdd63 refactored LDPolygon
Teemu Piippo <teemu@hecknology.net>
parents: 1399
diff changeset
130 result.append(polygon);
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
131 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
132 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
133
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
134 return result;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
135 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
136
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
137 void LDCircularPrimitive::buildPrimitiveBody(Model& model, bool deep) const
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
138 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
139 PrimitiveModel primitive;
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
140 primitive.type = m_type;
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
141 primitive.segments = segments();
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
142 primitive.divisions = divisions();
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
143 primitive.ringNumber = 0;
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
144 primitive.generateBody(model, deep);
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
145 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
146
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
147 QString LDCircularPrimitive::stem() const
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
148 {
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
149 switch (m_type)
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
150 {
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
151 case PrimitiveModel::Cylinder:
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
152 return "cyli";
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
153
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
154 case PrimitiveModel::Circle:
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
155 return "edge";
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
156
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
157 case PrimitiveModel::Disc:
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
158 return "disc";
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
159
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
160 case PrimitiveModel::DiscNegative:
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
161 return "ndis";
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
162
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
163 case PrimitiveModel::CylinderClosed:
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
164 return "cylc";
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
165
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
166 case PrimitiveModel::CylinderOpen:
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
167 return "cylo";
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
168
1408
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
169 case PrimitiveModel::Chord:
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
170 return "chrd";
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
171
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
172 case PrimitiveModel::Ring:
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
173 case PrimitiveModel::Cone:
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
174 break;
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
175 }
1408
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
176
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
177 throw std::logic_error("Bad primitive type to LDCircularPrimitive");
1399
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
178 }
f52ea4078f5d added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents: 1398
diff changeset
179
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
180 QString LDCircularPrimitive::objectListText() const
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
181 {
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
182 QString prefix;
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
183
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
184 if (divisions() == HighResolution)
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
185 prefix = "Hi-Res";
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
186 else if (divisions() == LowResolution)
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
187 prefix = "Lo-Res";
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
188 else if (divisions() != MediumResolution)
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
189 prefix = format("%1-resolution", divisions());
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
190
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
191 QString result = format(
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
192 "%1 %2 %3 %4, (",
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
193 prefix,
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
194 PrimitiveModel::typeName(m_type),
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
195 double(segments()) / double(divisions()),
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
196 position().toString(true)
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
197 ).simplified();
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
198
1403
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
199 for (int i = 0; i < 3; ++i)
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
200 for (int j = 0; j < 3; ++j)
7a2d84112983 replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents: 1402
diff changeset
201 result += format("%1%2", transformationMatrix()(i, j), (i != 2 or j != 2) ? " " : "");
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
202
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
203 result += ')';
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
204 return result;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
205 }
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
206
1406
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
207 PrimitiveModel::Type LDCircularPrimitive::primitiveType() const
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
208 {
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
209 return m_type;
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
210 }
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
211
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
212 void LDCircularPrimitive::setPrimitiveType(PrimitiveModel::Type newType)
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
213 {
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
214 changeProperty(&m_type, newType);
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
215 }
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
216
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
217 int LDCircularPrimitive::segments() const
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
218 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
219 return m_section.segments;
1406
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
220 }
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
221
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
222 void LDCircularPrimitive::setSegments(int newSegments)
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
223 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
224 changeProperty(&m_section.segments, newSegments);
1406
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
225 }
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
226
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
227 int LDCircularPrimitive::divisions() const
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
228 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
229 return m_section.divisions;
1406
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
230 }
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
231
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
232 void LDCircularPrimitive::setDivisions(int newDivisions)
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
233 {
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
234 changeProperty(&m_section.divisions, newDivisions);
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
235 }
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
236
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
237 const CircularSection&LDCircularPrimitive::section() const
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
238 {
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
239 return m_section;
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
240 }
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
241
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
242 void LDCircularPrimitive::setSection(const CircularSection& newSection)
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
243 {
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
244 changeProperty(&m_section, newSection);
1406
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
245 }
37fffb682d2f Circular primitive editor complete
Teemu Piippo <teemu@hecknology.net>
parents: 1403
diff changeset
246
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
247 int LDCircularPrimitive::triangleCount(DocumentManager*) const
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
248 {
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
249 switch (m_type)
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
250 {
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
251 case PrimitiveModel::Ring:
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
252 case PrimitiveModel::Cone:
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
253 throw std::logic_error("Bad primitive type to LDCircularPrimitive");
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
254
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
255 case PrimitiveModel::Cylinder:
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
256 case PrimitiveModel::CylinderOpen:
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
257 return 2 * segments();
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
258
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
259 case PrimitiveModel::CylinderClosed:
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
260 return 3 * segments();
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
261
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
262 case PrimitiveModel::Disc:
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
263 case PrimitiveModel::DiscNegative:
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
264 return segments();
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
265
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
266 case PrimitiveModel::Circle:
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
267 return 0;
1408
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
268
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
269 case PrimitiveModel::Chord:
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
270 return qBound(0, segments() - 1, divisions() - 2);
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
271 }
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
272
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
273 return 0;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
274 }
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
275
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
276 QString LDCircularPrimitive::iconName() const
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
277 {
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
278 switch (m_type)
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
279 {
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
280 case PrimitiveModel::Ring:
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
281 case PrimitiveModel::Cone:
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
282 break;
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
283
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
284 case PrimitiveModel::Cylinder:
1425
5354313b9958 added icons for circular primitives and enhanced some existing ones
Teemu Piippo <teemu@hecknology.net>
parents: 1418
diff changeset
285 case PrimitiveModel::CylinderOpen:
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
286 return "cylinder";
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
287
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
288 case PrimitiveModel::Disc:
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
289 return "disc";
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
290
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
291 case PrimitiveModel::DiscNegative:
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
292 return "disc-negative";
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
293
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
294 case PrimitiveModel::Circle:
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
295 return "circle";
1407
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
296
22bc5862cb56 added support for open/closed cylinders in LDCircularPrimitive
Teemu Piippo <teemu@hecknology.net>
parents: 1406
diff changeset
297 case PrimitiveModel::CylinderClosed:
1425
5354313b9958 added icons for circular primitives and enhanced some existing ones
Teemu Piippo <teemu@hecknology.net>
parents: 1418
diff changeset
298 return "closed-cylinder";
1408
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
299
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
300 case PrimitiveModel::Chord:
0d6162662040 fixed bugs regarding primitives, added chord substitution
Teemu Piippo <teemu@hecknology.net>
parents: 1407
diff changeset
301 return "chord";
1402
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
302 }
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
303
8bbf2af8c3f5 some rework in description
Teemu Piippo <teemu@hecknology.net>
parents: 1401
diff changeset
304 return "";
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
305 }
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
306
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
307 void LDCircularPrimitive::serialize(class Serializer& serializer)
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
308 {
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
309 LDMatrixObject::serialize(serializer);
1418
503d4e7e27c9 used the new CircularSectionEditor in CircularPrimitiveEditor
Teemu Piippo <teemu@hecknology.net>
parents: 1412
diff changeset
310 serializer << m_section << m_type;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
311 }

mercurial