X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.cpp;h=e5a747842a32b8f6baa696c70f0dbf8219cdd9d8;hb=012cc8abb57350f9e9f126ad580ae58142452015;hp=8729b1cce27862a7842b1175dee87c1ec0f92fe9;hpb=e04e3a62d9f98d0cee6a4cf1e23a3019af8a37a7;p=architektonas diff --git a/src/dimension.cpp b/src/dimension.cpp index 8729b1c..e5a7478 100644 --- a/src/dimension.cpp +++ b/src/dimension.cpp @@ -75,23 +75,18 @@ all objects move as a unified whole. if (dimensionType == DTLinearVert) { if ((angle < 0) || (angle > PI)) - // if ((angle < PI_OVER_2) || (angle > PI3_OVER_2)) { x1 = (position.x > endpoint.x ? position.x : endpoint.x); y1 = (position.y > endpoint.y ? position.y : endpoint.y); ortho = Vector(1.0, 0); - // ortho = Vector(0, 1.0); angle = PI3_OVER_2; - // angle = 0; } else { x1 = (position.x > endpoint.x ? endpoint.x : position.x); y1 = (position.y > endpoint.y ? endpoint.y : position.y); ortho = Vector(-1.0, 0); - // ortho = Vector(0, -1.0); angle = PI_OVER_2; - // angle = PI; } linePt1.x = linePt2.x = x1; @@ -226,7 +221,7 @@ I believe they are pixels. { painter->SetPen(QPen(Qt::magenta, 1.0, Qt::SolidLine)); painter->SetBrush(QBrush(QColor(Qt::magenta))); - painter->DrawArrowToLineHandle(hp2, (dimensionType == DTLinearVert ? ortho.Angle() : 0)); + painter->DrawArrowToLineHandle(hp2, (dimensionType == DTLinearVert ? v.Angle() - PI_OVER_2 : (v.Angle() < PI ? PI : 0))); painter->SetPen(QPen(Qt::magenta, 2.0, Qt::DotLine)); } @@ -237,7 +232,7 @@ I believe they are pixels. { painter->SetPen(QPen(Qt::magenta, 1.0, Qt::SolidLine)); painter->SetBrush(QBrush(QColor(Qt::magenta))); - painter->DrawArrowToLineHandle(hp3, PI_OVER_2); + painter->DrawArrowToLineHandle(hp3, (dimensionType == DTLinearHorz ? v.Angle() - PI_OVER_2 : (v.Angle() > PI_OVER_2 && v.Angle() < PI3_OVER_2 ? PI3_OVER_2 : PI_OVER_2))); painter->SetPen(QPen(Qt::magenta, 2.0, Qt::DotLine)); } @@ -481,6 +476,45 @@ bool Dimension::HitStateChanged(void) } +/*virtual*/ void Dimension::Translate(Vector amount) +{ + position += amount; + endpoint += amount; +} + + +/*virtual*/ void Dimension::Rotate(Point point, double angle) +{ + Point l1 = Geometry::RotatePointAroundPoint(position, point, angle); + Point l2 = Geometry::RotatePointAroundPoint(endpoint, point, angle); + position = l1; + endpoint = l2; +} + + +/*virtual*/ void Dimension::Mirror(Point p1, Point p2) +{ + Point l1 = Geometry::MirrorPointAroundLine(position, p1, p2); + Point l2 = Geometry::MirrorPointAroundLine(endpoint, p1, p2); + position = l1; + endpoint = l2; +} + + +/*virtual*/ void Dimension::Save(void) +{ + Object::Save(); + oldEndpoint = endpoint; +} + + +/*virtual*/ void Dimension::Restore(void) +{ + Object::Restore(); + endpoint = oldEndpoint; +} + + /*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);