]> Shamusworld >> Repos - architektonas/blobdiff - src/dimension.cpp
Added 1st stab at grouping capability.
[architektonas] / src / dimension.cpp
index 2107d67865e34c12fa0fa7feb8bde2f089e24b25..29eaf6965ca9d1a4dcc2046078eda44805ba2e62 100644 (file)
 Dimension::Dimension(Vector p1, Vector p2, DimensionType dt/*= DTLinear*/ ,Object * p/*= NULL*/):
        Object(p1, p), endpoint(p2),
        dragging(false), draggingHandle1(false), draggingHandle2(false),
-       length(p2.Magnitude()), type(dt), point1(NULL), point2(NULL)
+       length(p2.Magnitude()), dimensionType(dt), point1(NULL), point2(NULL)
 {
+       type = OTDimension;
 }
 
 
 // This is bad, p1 & p2 could be NULL, causing much consternation...
 Dimension::Dimension(Connection p1, Connection p2, DimensionType dt/*= DTLinear*/ , Object * p/*= NULL*/):
        dragging(false), draggingHandle1(false), draggingHandle2(false),
-       length(0), type(dt), point1(p1), point2(p2)
+       length(0), dimensionType(dt), point1(p1), point2(p2)
 {
+       type = OTDimension;
 }
 
 
@@ -360,6 +362,29 @@ about keeping track of old states...
 }
 
 
+/*virtual*/ QRectF Dimension::Extents(void)
+{
+       Point p1 = position;
+       Point p2 = endpoint;
+
+       if (point1.object)
+               p1 = point1.object->GetPointAtParameter(point1.t);
+
+       if (point2.object)
+               p2 = point2.object->GetPointAtParameter(point2.t);
+
+       return QRectF(QPointF(p1.x, p1.y), QPointF(p2.x, p2.y));
+}
+
+
+#if 0
+/*virtual*/ ObjectType Dimension::Type(void)
+{
+       return OTDimension;
+}
+#endif
+
+
 void Dimension::FlipSides(void)
 {
 #if 0