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, TTParallel };
17 enum ToolState { TSNone, TSPoint1, TSPoint2, TSPoint3, TSPoint4, TSDone };
19 const char objName[OTCount][16] = {
20 "None", "Line", "Circle", "Ellipse", "Arc", "Polygon", "Dimension",
21 "Spline", "Text", "Container"
23 const char dimName[DTCount][32] = {
24 "Linear", "Vertical", "Horizontal", "Radial", "Diametric",
25 "Circumferential", "Angular", "Leader"
28 #define OBJECT_COMMON \
51 Line(): type(OTLine), id(Global::objectID++), selected(false), hovered(false), hitObject(false) { hitPoint[0] = hitPoint[1] = false; }
52 Line(Vector pt1, Vector pt2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
53 type(OTLine), id(Global::objectID++), layer(0), color(c), thickness(th),
54 style(l), selected(false), hovered(false), hitObject(false) { p[0] = pt1; p[1] = pt2; hitPoint[0] = hitPoint[1] = false; }
60 Circle(): type(OTCircle), id(Global::objectID++) {}
61 Circle(Vector pt1, double r, float th = 1.0, uint32_t c = 0, int l = LSSolid):
62 type(OTCircle), id(Global::objectID++), layer(0), color(c), thickness(th),
63 style(l), selected(false), hovered(false), hitObject(false)
64 { p[0] = pt1; radius[0] = r; hitPoint[0] = hitPoint[1] = false; }
70 Ellipse(): type(OTEllipse), id(Global::objectID++) {}
71 Ellipse(Vector pt1, Vector pt2, double r1, double r2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
72 type(OTEllipse), id(Global::objectID++), layer(0), color(c), thickness(th),
73 style(l), selected(false), hovered(false), hitObject(false)
74 { p[0] = pt1; p[1] = pt2; radius[0] = r1; radius[1] = r2; hitPoint[0] = hitPoint[1] = false; }
80 Arc(): type(OTArc), id(Global::objectID++) {}
81 Arc(Vector pt1, double r, double a1, double a2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
82 type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th),
83 style(l), selected(false), hovered(false), hitObject(false)
84 { p[0] = pt1; radius[0] = r; angle[0] = a1, angle[1] = a2; hitPoint[0] = hitPoint[1] = hitPoint[2] = false; }
91 Point lp[2]; // Line point, the actual dimension line
92 Object * obj[2]; // Pointer to attached objects (circle, lines for angle)
94 Dimension(): type(OTDimension), id(Global::objectID++), selected(false),
95 hovered(false), hitObject(false)
96 { hitPoint[0] = hitPoint[1] = hitPoint[2] = hitPoint[3] = hitPoint[4] = false; }
97 Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, double offs = 0, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
98 type(OTDimension), id(Global::objectID++), layer(0), color(c),
99 thickness(th), style(l), selected(false), hovered(false),
100 hitObject(false), subtype(dt), offset(offs)
101 { p[0] = pt1; p[1] = pt2; hitPoint[0] = hitPoint[1] = hitPoint[2] = hitPoint[3] = hitPoint[4] = false; }
110 Text(): type(OTText), id(Global::objectID++) {}
111 Text(Vector pt1, char * str, float th = 10.0, uint32_t c = 0):
112 type(OTText), id(Global::objectID++), layer(0), color(c), thickness(th),
113 style(LSSolid), selected(false), hovered(false), hitObject(false),
114 measured(false), s(str) { p[0] = pt1; angle[0] = 0; }
120 Polygon(): type(OTPolygon), id(Global::objectID++) {}
126 Spline(): type(OTSpline), id(Global::objectID++) {}
136 Container(bool tl = false): type(OTContainer), id(Global::objectID++), selected(false), hovered(false), hitObject(false), topLevel(tl), clicked(NULL) {}
137 void Add(void * obj) { objects.push_back(obj); }
138 void Add(VPVector objs) { objects.insert(objects.end(), objs.begin(), objs.end()); }
139 // void DeleteContents(void) {}
140 /* void DeleteContents(Container * c)
142 std::vector<void *>::iterator i;
144 for(i=c->objects.begin(); i!=c->objects.end(); i++)
146 Object * obj = (Object *)(*i);
148 if (obj->type == OTContainer)
149 DeleteContainer((Container *)obj);
156 #endif // __STRUCTS_H__