]> Shamusworld >> Repos - architektonas/blobdiff - src/structs.h
Miscellaneous fixes/updates:
[architektonas] / src / structs.h
index c1b33fb2958ee3133aae136199c345df547a0039..0d16ff8d30f5c81772766997d20ebae3b652b434 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 };
 
@@ -37,7 +37,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;
 
@@ -94,10 +94,10 @@ struct Dimension {
        Dimension(): type(OTDimension), id(Global::objectID++), selected(false),
                hovered(false), hitObject(false)
                { hitPoint[0] = hitPoint[1] = hitPoint[2] = hitPoint[3] = hitPoint[4] = false; }
-       Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
+       Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, double offs = 0, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
                type(OTDimension), id(Global::objectID++), layer(0), color(c),
                thickness(th), style(l), selected(false), hovered(false),
-               hitObject(false), subtype(dt), offset(0)
+               hitObject(false), subtype(dt), offset(offs)
                { p[0] = pt1; p[1] = pt2; hitPoint[0] = hitPoint[1] = hitPoint[2] = hitPoint[3] = hitPoint[4] = false; }
 };
 
@@ -116,10 +116,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 +140,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 +166,3 @@ struct Container {
 };
 
 #endif // __STRUCTS_H__
-