}
else
{
+ // Draw outside arrowheads
Point p7 = p1 - (unit * 9.0 * size);
Point p8 = p2 + (unit * 9.0 * size);
painter->DrawArrowhead(p1, p7, size);
painter->SetFont(QFont("Arial", 8.0 * Painter::zoom * size));
Vector v1((p1.x - p2.x) / 2.0, (p1.y - p2.y) / 2.0);
Point ctr = p2 + v1;
+
+#if 0
QString dimText = QString("%1\"").arg(Vector(endpoint - position).Magnitude());
+#else
+ QString dimText;
+ double length = Vector(endpoint - position).Magnitude();
+
+ if (length < 12.0)
+ dimText = QString("%1\"").arg(length);
+ else
+ {
+ double feet = (double)((int)length / 12);
+ double inches = length - (feet * 12.0);
+
+ if (inches == 0)
+ dimText = QString("%1'").arg(feet);
+ else
+ dimText = QString("%1' %2\"").arg(feet).arg(inches);
+ }
+#endif
+
painter->DrawAngledText(ctr, angle, dimText, size);
}
}
+/*virtual*/ Object * Dimension::Copy(void)
+{
+#warning "!!! This doesn't take care of attached Dimensions !!!"
+/*
+This is a real problem. While having a pointer in the Dimension to this line's points
+is fast & easy, it creates a huge problem when trying to replicate an object like this.
+
+Maybe a way to fix that then, is to have reference numbers instead of pointers. That
+way, if you copy them, ... you might still have problems. Because you can't be sure if
+a copy will be persistant or not, you then *definitely* do not want them to have the
+same reference number.
+*/
+
+ Dimension * d = new Dimension(position, endpoint, dimensionType, parent);
+ d->size = size;
+ return d;
+}
+
+
// Dimensions are special: they contain exactly *two* points. Here, we check
// only for zero/non-zero in returning the correct points.
/*virtual*/ Vector Dimension::GetPointAtParameter(double parameter)