Fri, 04 Mar 2022 11:37:50 +0200
Major refactoring
- Model now just stores objects
- Document contains business logic
- Model::EditContext is now ModelEditor, no longer a nested class
3 | 1 | #include "edge.h" |
2 | ||
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
3 | QString ldraw::Edge::textRepresentation() const |
6 | 4 | { |
87
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
5 | return utility::format( |
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
6 | "%1 %2", |
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
7 | utility::vertexToStringParens(this->points[0]), |
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
8 | utility::vertexToStringParens(this->points[1])); |
6 | 9 | } |
21 | 10 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
33
diff
changeset
|
11 | void ldraw::Edge::getPolygons( |
21 | 12 | std::vector<gl::Polygon>& polygons, |
13 | GetPolygonsContext* context) const | |
14 | { | |
15 | Q_UNUSED(context) | |
87
93ec4d630346
added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents:
86
diff
changeset
|
16 | polygons.push_back(gl::edgeLine(this->points[0], this->points[1], this->colorIndex, this->id)); |
81
62373840e33a
object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents:
77
diff
changeset
|
17 | } |
132
488d0ba6070b
Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents:
87
diff
changeset
|
18 | |
488d0ba6070b
Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents:
87
diff
changeset
|
19 | ldraw::Object::Type ldraw::Edge::typeIdentifier() const |
488d0ba6070b
Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents:
87
diff
changeset
|
20 | { |
488d0ba6070b
Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents:
87
diff
changeset
|
21 | return Type::EdgeLine; |
488d0ba6070b
Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents:
87
diff
changeset
|
22 | } |
141 | 23 | |
24 | QString ldraw::Edge::toLDrawCode() const | |
25 | { | |
26 | return utility::format( | |
27 | "2 %1 %2 %3", | |
28 | this->colorIndex.index, | |
29 | utility::vertexToString(this->points[0]), | |
30 | utility::vertexToString(this->points[1])); | |
31 | } |