+ hitPoint1 = hitPoint2 = false;
+// Vector lineSegment(position, endpoint);
+ Vector v1(position, point);
+ Vector v2(endpoint, point);
+// double t = Geometry::ParameterOfLineAndPoint(position, endpoint, point);
+// double distance;
+
+// if (t < 0.0)
+// distance = v1.Magnitude();
+// else if (t > 1.0)
+// distance = v2.Magnitude();
+// else
+ // distance = ?Det?(ls, v1) / |ls|
+// distance = fabs((lineSegment.x * v1.y - v1.x * lineSegment.y)
+// / lineSegment.Magnitude());
+
+ if ((v1.Magnitude() * Painter::zoom) < 8.0)
+ hitPoint1 = true;
+ else if ((v2.Magnitude() * Painter::zoom) < 8.0)
+ hitPoint2 = true;
+
+ return (hitPoint1 || hitPoint2 ? true : false);
+}
+
+
+void Dimension::SaveHitState(void)
+{
+ 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;