]> Shamusworld >> Repos - architektonas/blobdiff - src/structs.h
Rendering for Line, Circle, and Arc work.
[architektonas] / src / structs.h
index b9f6e9b9bcf78a32c10ddbb269f854c759b14d75..a6b52ccb69a5fa3f4b70d3b58e65bba10e10eaf7 100644 (file)
@@ -4,25 +4,39 @@
 #include <stdint.h>
 #include <vector>
 #include <string>
+#include "global.h"
 #include "vector.h"
 
+enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer, OTSpline };
+
 #define OBJECT_COMMON \
-       int type;       \
-       uint32_t id;    \
-       int layer;      \
-       uint32_t color; \
-       float thickness;
+       int type;         \
+       uint32_t id;      \
+       int layer;        \
+       uint32_t color;   \
+       float thickness;  \
+       int style;        \
+       bool selected;
 
 struct Line {
        OBJECT_COMMON;
        Point p1;
        Point p2;
+
+       Line(): type(OTLine), id(Global::objectID++) {}
+       Line(Vector pt1, Vector pt2, float th = 1.0, uint32_t c = 0, int l = 0):
+               type(OTLine), id(Global::objectID++), layer(l), color(c), thickness(th),
+               style(0), selected(false), p1(pt1), p2(pt2) {}
 };
 
 struct Circle {
        OBJECT_COMMON;
        Point p1;
        double radius;
+
+       Circle(Vector pt1, double r, float th = 1.0, uint32_t c = 0, int l = 0):
+               type(OTCircle), id(Global::objectID++), layer(l), color(c), thickness(th),
+               style(0), selected(false), p1(pt1), radius(r) {}
 };
 
 struct Arc {
@@ -31,6 +45,10 @@ struct Arc {
        double radius;
        double angle1;
        double angle2;
+
+       Arc(Vector pt1, double r, double a1, double a2, float th = 1.0, uint32_t c = 0, int l = 0):
+               type(OTArc), id(Global::objectID++), layer(l), color(c), thickness(th),
+               style(0), selected(false), p1(pt1), radius(r), angle1(a1), angle2(a2) {}
 };
 
 struct Text {