]> Shamusworld >> Repos - architektonas/blobdiff - src/structs.h
Added Parallel tool + command processing.
[architektonas] / src / structs.h
index 5f694886d5b079843c05ce5db191f8bd8a9c8525..62366adaca188179d705dfe97e6c76f4819b1ab6 100644 (file)
@@ -8,7 +8,7 @@
 #include "rect.h"
 #include "vector.h"
 
-enum ObjectType { OTNone = 0, OTLine, OTCircle, OTEllipse, OTArc, OTPolygon, OTDimension, OTSpline, OTText, OTContainer, OTCount };
+enum ObjectType { OTNone = 0, OTLine, OTCircle, OTEllipse, OTArc, OTPolygon, OTDimension, OTSpline, OTText, OTContainer, OTPolyline, OTCount };
 
 enum DimensionType { DTLinear = 0, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader, DTCount };
 
@@ -16,6 +16,8 @@ enum ToolType { TTNone, TTLine, TTCircle, TTEllipse, TTArc, TTDimension, TTText,
 
 enum ToolState { TSNone, TSPoint1, TSPoint2, TSPoint3, TSPoint4, TSDone };
 
+enum BasicUnit { BUInch = 0, BUFoot, BUYard, BUMile, BUMM, BUCM, BUM, BUKM, BUCount };
+
 const char objName[OTCount][16] = {
        "None", "Line", "Circle", "Ellipse", "Arc", "Polygon", "Dimension",
        "Spline", "Text", "Container"
@@ -25,6 +27,12 @@ const char dimName[DTCount][32] = {
        "Circumferential", "Angular", "Leader"
 };
 
+const char buShortName[BUCount][8] = {
+       "in", "ft", "yd", "mi", "mm", "cm", "m", "km"
+};
+
+const double buInInches[BUCount] = { 1.0, 12.0, 36.0, 1.0/25.4, 1.0/2.54, 1.0/0.0254, 1.0/0.0000254 };
+
 #define OBJECT_COMMON \
        int type;         \
        uint32_t id;      \
@@ -37,7 +45,7 @@ const char dimName[DTCount][32] = {
        bool hitPoint[5]; \
        bool hitObject;   \
        Point p[5];       \
-       double angle[2];  \
+       double angle[3];  \
        double radius[2]; \
        double length;
 
@@ -116,10 +124,22 @@ struct Text {
 
 struct Polygon {
        OBJECT_COMMON;
+       int sides;
 
        Polygon(): type(OTPolygon), id(Global::objectID++) {}
 };
 
+struct Polyline {
+       OBJECT_COMMON;
+       VPVector objects;
+       bool closed;
+       Object * clicked;
+
+       Polyline(): type(OTPolyline), id(Global::objectID++), selected(false), hovered(false), hitObject(false), clicked(NULL) {}
+       void Add(void * obj) { objects.push_back(obj); }
+       void Add(VPVector objs) { objects.insert(objects.end(), objs.begin(), objs.end()); }
+};
+
 struct Spline {
        OBJECT_COMMON;
 
@@ -128,13 +148,14 @@ struct Spline {
 
 struct Container {
        OBJECT_COMMON;
-       std::vector<void *> objects;
+       VPVector objects;
        double scale;
        bool topLevel;
        Object * clicked;
 
        Container(bool tl = false): type(OTContainer), id(Global::objectID++), selected(false), hovered(false), hitObject(false), topLevel(tl), clicked(NULL) {}
        void Add(void * obj) { objects.push_back(obj); }
+       void Add(VPVector objs) { objects.insert(objects.end(), objs.begin(), objs.end()); }
 //     void DeleteContents(void) {}
 /*     void DeleteContents(Container * c)
        {
@@ -153,4 +174,3 @@ struct Container {
 };
 
 #endif // __STRUCTS_H__
-