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; }
77 Dimension(): type(OTDimension), id(Global::objectID++) {}
78 Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
79 type(OTDimension), id(Global::objectID++), layer(0), color(c), thickness(th),
80 style(l), selected(false), hovered(false), hitObject(false), subtype(dt) { p[0] = pt1; p[1] = pt2; }
87 Text(): type(OTText), id(Global::objectID++) {}
88 Text(Vector pt1, char * str, float th = 10.0, uint32_t c = 0):
89 type(OTText), id(Global::objectID++), layer(0), color(c), thickness(th),
90 style(LSSolid), selected(false), hovered(false), hitObject(false), s(str) { p[0] = pt1; }
96 Polygon(): type(OTPolygon), id(Global::objectID++) {}
102 Spline(): type(OTSpline), id(Global::objectID++) {}
107 std::vector<void *> objects;
111 Container(bool tl = false): type(OTContainer), id(Global::objectID++), selected(false), hovered(false), hitObject(false), topLevel(tl) {}
112 // void DeleteContents(void) {}
113 /* void DeleteContents(Container * c)
115 std::vector<void *>::iterator i;
117 for(i=c->objects.begin(); i!=c->objects.end(); i++)
119 Object * obj = (Object *)(*i);
121 if (obj->type == OTContainer)
122 DeleteContainer((Container *)obj);
133 #endif // __STRUCTS_H__