10 enum ObjectType { OTNone = 0, OTLine, OTCircle, OTEllipse, OTArc, OTPolygon, OTDimension, OTSpline, OTText, OTContainer, OTCount };
12 enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader };
14 enum ToolType { TTNone, TTLine, TTCircle, TTEllipse, TTArc, TTDimension, TTText, TTPolygon, TTSpline, TTRotate, TTMirror, TTTrim, TTTriangulate, TTDelete };
16 enum ToolState { TSNone, TSPoint1, TSPoint2, TSPoint3, TSPoint4, TSDone };
18 #define OBJECT_COMMON \
36 Line(): type(OTLine), id(Global::objectID++) {}
37 Line(Vector pt1, Vector pt2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
38 type(OTLine), id(Global::objectID++), layer(0), color(c), thickness(th),
39 style(l), selected(false), hovered(false), hitObject(false) { p[0] = pt1; p[1] = pt2; }
45 Circle(): type(OTCircle), id(Global::objectID++) {}
46 Circle(Vector pt1, double r, float th = 1.0, uint32_t c = 0, int l = LSSolid):
47 type(OTCircle), id(Global::objectID++), layer(0), color(c), thickness(th),
48 style(l), selected(false), hovered(false), hitObject(false)
49 { p[0] = pt1; radius[0] = r; }
55 Ellipse(): type(OTEllipse), id(Global::objectID++) {}
56 Ellipse(Vector pt1, Vector pt2, double r1, double r2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
57 type(OTEllipse), id(Global::objectID++), layer(0), color(c), thickness(th),
58 style(l), selected(false), hovered(false), hitObject(false)
59 { p[0] = pt1; p[1] = pt2; radius[0] = r1; radius[1] = r2; }
65 Arc(): type(OTArc), id(Global::objectID++) {}
66 Arc(Vector pt1, double r, double a1, double a2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
67 type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th),
68 style(l), selected(false), hovered(false), hitObject(false)
69 { p[0] = pt1; radius[0] = r; angle[0] = a1, angle[1] = a2; }
76 Point lp[2]; // Line point, the actual dimension line
78 Dimension(): type(OTDimension), id(Global::objectID++) {}
79 Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
80 type(OTDimension), id(Global::objectID++), layer(0), color(c),
81 thickness(th), style(l), selected(false), hovered(false),
82 hitObject(false), subtype(dt), offset(0) { p[0] = pt1; p[1] = pt2; }
89 Text(): type(OTText), id(Global::objectID++) {}
90 Text(Vector pt1, char * str, float th = 10.0, uint32_t c = 0):
91 type(OTText), id(Global::objectID++), layer(0), color(c), thickness(th),
92 style(LSSolid), selected(false), hovered(false), hitObject(false), s(str) { p[0] = pt1; }
98 Polygon(): type(OTPolygon), id(Global::objectID++) {}
104 Spline(): type(OTSpline), id(Global::objectID++) {}
109 std::vector<void *> objects;
113 Container(bool tl = false): type(OTContainer), id(Global::objectID++), selected(false), hovered(false), hitObject(false), topLevel(tl) {}
114 // void DeleteContents(void) {}
115 /* void DeleteContents(Container * c)
117 std::vector<void *>::iterator i;
119 for(i=c->objects.begin(); i!=c->objects.end(); i++)
121 Object * obj = (Object *)(*i);
123 if (obj->type == OTContainer)
124 DeleteContainer((Container *)obj);
135 #endif // __STRUCTS_H__