+ oldHitPoint1 = hitPoint1;
+ oldHitPoint2 = hitPoint2;
+// oldHitLine = hitLine;
+}
+
+
+bool Dimension::HitStateChanged(void)
+{
+ if ((hitPoint1 != oldHitPoint1) || (hitPoint2 != oldHitPoint2))
+ return true;
+
+ return false;
+}
+
+
+/*virtual*/ void Dimension::Enumerate(FILE * file)
+{
+ fprintf(file, "DIMENSION %i (%lf,%lf) (%lf,%lf) %i\n", layer, position.x, position.y, endpoint.x, endpoint.y, type);
+}
+
+
+/*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)
+{
+ if (parameter == 0)
+ return position;
+
+ return endpoint;
+}
+
+
+/*virtual*/ void Dimension::Connect(Object * obj, double param)
+{
+ // There are four possibilities here...
+ // The param is only looking for 0 or 1 here.
+ if (point1.object == NULL && point2.object == NULL)
+ {
+ point1.object = obj;
+ point1.t = param;
+ }
+ else if (point1.object == NULL && point2.object != NULL)
+ {
+ if (point2.t == param)
+ point2.object = obj;
+ else
+ {
+ point1.object = obj;
+ point1.t = param;
+ }
+ }
+ else if (point1.object != NULL && point2.object == NULL)
+ {
+ if (point1.t == param)
+ point1.object = obj;
+ else
+ {
+ point2.object = obj;
+ point2.t = param;
+ }
+ }
+ else if (point1.object != NULL && point2.object != NULL)
+ {
+ if (point1.t == param)
+ point1.object = obj;
+ else
+ point2.object = obj;
+ }