11 enum ObjectType { OTNone = 0, OTLine, OTCircle, OTEllipse, OTArc, OTPolygon, OTDimension, OTSpline, OTText, OTContainer, OTCount };
13 enum DimensionType { DTLinear = 0, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader, DTCount };
15 enum ToolType { TTNone, TTLine, TTCircle, TTEllipse, TTArc, TTDimension, TTText, TTPolygon, TTSpline, TTRotate, TTMirror, TTTrim, TTTriangulate, TTDelete };
17 enum ToolState { TSNone, TSPoint1, TSPoint2, TSPoint3, TSPoint4, TSDone };
19 #define OBJECT_COMMON \
41 Line(): type(OTLine), id(Global::objectID++) {}
42 Line(Vector pt1, Vector pt2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
43 type(OTLine), id(Global::objectID++), layer(0), color(c), thickness(th),
44 style(l), selected(false), hovered(false), hitObject(false) { p[0] = pt1; p[1] = pt2; }
50 Circle(): type(OTCircle), id(Global::objectID++) {}
51 Circle(Vector pt1, double r, float th = 1.0, uint32_t c = 0, int l = LSSolid):
52 type(OTCircle), id(Global::objectID++), layer(0), color(c), thickness(th),
53 style(l), selected(false), hovered(false), hitObject(false)
54 { p[0] = pt1; radius[0] = r; }
60 Ellipse(): type(OTEllipse), id(Global::objectID++) {}
61 Ellipse(Vector pt1, Vector pt2, double r1, double r2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
62 type(OTEllipse), id(Global::objectID++), layer(0), color(c), thickness(th),
63 style(l), selected(false), hovered(false), hitObject(false)
64 { p[0] = pt1; p[1] = pt2; radius[0] = r1; radius[1] = r2; }
70 Arc(): type(OTArc), id(Global::objectID++) {}
71 Arc(Vector pt1, double r, double a1, double a2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
72 type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th),
73 style(l), selected(false), hovered(false), hitObject(false)
74 { p[0] = pt1; radius[0] = r; angle[0] = a1, angle[1] = a2; }
81 Point lp[2]; // Line point, the actual dimension line
82 Object * obj[2]; // Pointer to attached objects (circle, lines for angle)
84 Dimension(): type(OTDimension), id(Global::objectID++) {}
85 Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
86 type(OTDimension), id(Global::objectID++), layer(0), color(c),
87 thickness(th), style(l), selected(false), hovered(false),
88 hitObject(false), subtype(dt), offset(0) { p[0] = pt1; p[1] = pt2; }
97 Text(): type(OTText), id(Global::objectID++) {}
98 Text(Vector pt1, char * str, float th = 10.0, uint32_t c = 0):
99 type(OTText), id(Global::objectID++), layer(0), color(c), thickness(th),
100 style(LSSolid), selected(false), hovered(false), hitObject(false),
101 measured(false), s(str) { p[0] = pt1; angle[0] = 0; }
107 Polygon(): type(OTPolygon), id(Global::objectID++) {}
113 Spline(): type(OTSpline), id(Global::objectID++) {}
118 std::vector<void *> objects;
122 Container(bool tl = false): type(OTContainer), id(Global::objectID++), selected(false), hovered(false), hitObject(false), topLevel(tl) {}
123 // void DeleteContents(void) {}
124 /* void DeleteContents(Container * c)
126 std::vector<void *>::iterator i;
128 for(i=c->objects.begin(); i!=c->objects.end(); i++)
130 Object * obj = (Object *)(*i);
132 if (obj->type == OTContainer)
133 DeleteContainer((Container *)obj);
140 #endif // __STRUCTS_H__