src/linetypes/circularprimitive.h

Wed, 25 May 2022 17:47:06 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 25 May 2022 17:47:06 +0300
changeset 194
be056e87c8ca
parent 186
922662adb72a
permissions
-rw-r--r--

simplify further

186
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "compoundobject.h"
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include "propertygenerics.h"
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 namespace ldraw
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 {
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 class CircularPrimitive;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 }
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 class ldraw::CircularPrimitive : public CompoundObject
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 {
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 public:
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 using BaseClass = CompoundObject;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 CircularPrimitive() = default;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 CircularPrimitive(CircularPrimitiveType type, int segments, int divisions);
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 QVariant getProperty(Property property) const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 QString textRepresentation() const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 static QString circularPrimitiveTypeName(CircularPrimitiveType type);
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 Type typeIdentifier() const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 QDataStream& serialize(QDataStream& stream) const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 QDataStream& deserialize(QDataStream& stream) override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 QString toLDrawCode() const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 QString iconName() const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 QString typeName() const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 void getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext*) const override;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 float fraction() const;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 CircularPrimitiveType type = Circle;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 int segments = 16;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 int divisions = 16;
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 };
922662adb72a work on circle tool
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31

mercurial