X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmirroraction.cpp;h=720692ed85130725ac3c2170206fa2ec251463ea;hb=4b37ccbdf263a4798e53a62e33d869a728ace283;hp=500f59d9e6cd89633c1571e85ee2fe8b0de21083;hpb=428876081ee41d40e32f5b4f2bfcfdb7a835e6e1;p=architektonas diff --git a/src/mirroraction.cpp b/src/mirroraction.cpp index 500f59d..720692e 100644 --- a/src/mirroraction.cpp +++ b/src/mirroraction.cpp @@ -12,7 +12,11 @@ // #include "mirroraction.h" +#include "applicationwindow.h" +#include "container.h" +#include "drawingview.h" #include "line.h" +#include "mathconstants.h" #include "painter.h" //#include "vector.h" @@ -23,7 +27,7 @@ enum { FIRST_POINT, NEXT_POINT }; MirrorAction::MirrorAction(): state(FIRST_POINT), line(NULL), - shiftWasPressedOnNextPoint(false) + shiftWasPressedOnNextPoint(false), mirror(new Container(Vector())) { } @@ -48,9 +52,16 @@ MirrorAction::~MirrorAction() painter->DrawLine(p1, p2); painter->DrawHandle(p2); - QString text = tr("Length: %1 in."); - text = text.arg(Vector::Magnitude(p1, p2)); + double absAngle = (Vector(p2 - p1).Angle()) * RADIANS_TO_DEGREES; +// double absLength = Vector(position - endpoint).Magnitude(); + + QString text = QChar(0x2221) + QObject::tr(": %1"); + text = text.arg(absAngle); +// QString text = tr("Length: %1 in."); +// text = text.arg(Vector::Magnitude(p1, p2)); painter->DrawInformativeText(text); + + mirror->Draw(painter); } } @@ -72,7 +83,22 @@ MirrorAction::~MirrorAction() if (state == FIRST_POINT) p1 = point; else + { p2 = point; + + mirror->Clear(); + int itemsSelected = ApplicationWindow::drawing->document.ItemsSelected(); + + if (itemsSelected == 0) + return; + + for(int i=0; idocument.SelectedItem(i); + Object * mirrored = object->Mirror(p1, p2); + mirror->Add(mirrored); + } + } }