X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.cpp;h=3060ff1b930c8682409f10993b73622562fbb098;hb=baf67656b97e3d61e9223e66ebe4f554e364cd4a;hp=4ccd48e52352e97ad69938f3873b0090221fc11e;hpb=bd9b40058a376c946318a444dd6c77737ec6ac98;p=architektonas diff --git a/src/dimension.cpp b/src/dimension.cpp index 4ccd48e..3060ff1 100644 --- a/src/dimension.cpp +++ b/src/dimension.cpp @@ -4,7 +4,7 @@ // (C) 2011 Underground Software // See the README and GPLv3 files for licensing and warranty information // -// JLH = James L. Hammons +// JLH = James Hammons // // WHO WHEN WHAT // --- ---------- ------------------------------------------------------------ @@ -18,16 +18,18 @@ #include "painter.h" -Dimension::Dimension(Vector p1, Vector p2, Object * p/*= NULL*/): Object(p1, p), endpoint(p2), +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()), point1(NULL), point2(NULL) + length(p2.Magnitude()), type(dt), point1(NULL), point2(NULL) { } // This is bad, p1 & p2 could be NULL, causing much consternation... -Dimension::Dimension(Vector * p1, Vector * p2, Object * p/*= NULL*/): Object(*p1, p), endpoint(*p2), +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()), point1(p1), point2(p2) + length(p2->Magnitude()), type(dt), point1(p1), point2(p2) { } @@ -56,24 +58,30 @@ Dimension::~Dimension() Vector orthogonal = Vector(cos(orthoAngle), sin(orthoAngle)); Vector unit = Vector(endpoint - position).Unit(); +//NOTE: SCREEN_ZOOM is our kludge factor... We need to figure out a better +// way of doing this... // Get our line parallel to our points - Point p1 = position + (orthogonal * 10.0); - Point p2 = endpoint + (orthogonal * 10.0); + Point p1 = position + (orthogonal * 10.0 * SCREEN_ZOOM); + Point p2 = endpoint + (orthogonal * 10.0 * SCREEN_ZOOM); // Draw main dimension line painter->DrawLine(p1, p2); - Point p3 = position + (orthogonal * 16.0); - Point p4 = endpoint + (orthogonal * 16.0); - Point p5 = position + (orthogonal * 4.0); - Point p6 = endpoint + (orthogonal * 4.0); + Point p3 = position + (orthogonal * 16.0 * SCREEN_ZOOM); + Point p4 = endpoint + (orthogonal * 16.0 * SCREEN_ZOOM); + Point p5 = position + (orthogonal * 4.0 * SCREEN_ZOOM); + Point p6 = endpoint + (orthogonal * 4.0 * SCREEN_ZOOM); // Draw extension lines painter->DrawLine(p3, p5); painter->DrawLine(p4, p6); + painter->SetBrush(QBrush(QColor(Qt::blue))); + painter->DrawArrowhead(p1, p2); + painter->DrawArrowhead(p2, p1); + // Draw length of dimension line... - painter->SetFont(QFont("Arial", 10)); + painter->SetFont(QFont("Arial", 10.0 * Painter::zoom * SCREEN_ZOOM)); Vector v1((p1.x - p2.x) / 2.0, (p1.y - p2.y) / 2.0); Point ctr = p2 + v1; // This is in pixels, which isn't even remotely correct... !!! FIX !!! @@ -323,6 +331,16 @@ void Dimension::SetPoint2(Vector * v) needUpdate = true; } +Vector Dimension::GetPoint1(void) +{ + return position; +} + +Vector Dimension::GetPoint2(void) +{ + return endpoint; +} + void Dimension::FlipSides(void) { #if 0 @@ -336,3 +354,4 @@ void Dimension::FlipSides(void) #endif needUpdate = true; } +