src/linetypes/compoundobject.h

Tue, 15 Mar 2022 18:56:02 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 15 Mar 2022 18:56:02 +0200
changeset 184
35bbfad4d0f4
parent 183
97b591813c8b
child 186
922662adb72a
permissions
-rw-r--r--

Add missing svg icon

183
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "object.h"
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 class Model;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 namespace ldraw
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 {
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 class CompoundObject;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 }
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 /**
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * @brief An abstract object that has a transformation mmatrix and can be inverted.
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * It can be inlined into multiple objects.
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 */
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 class ldraw::CompoundObject : public ColoredObject
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 {
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 public:
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 CompoundObject() = default;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 CompoundObject(
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 const glm::mat4& transformation,
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 const Color color = ldraw::MAIN_COLOR);
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 QVariant getProperty(Property property) const override;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 glm::vec3 position() const;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 void invert(GetPolygonsContext*context) override;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 Model* resolve(const ModelId callingModelId, DocumentManager* documents) const;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 QDataStream& serialize(QDataStream& stream) const override;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 QDataStream& deserialize(QDataStream& stream) override;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 std::optional<Axis> flatDimension(GetPolygonsContext *context) const;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 glm::mat4 transformation;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 bool isInverted = false;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 protected:
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 void setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) override;
97b591813c8b - Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 };

mercurial