]> Shamusworld >> Repos - architektonas/blob - src/forms/dlgdimlinear.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / forms / dlgdimlinear.cpp
1 // dlgdimlinear.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  06/11/2010  Created this file. :-)
15 //
16
17 #include "dlgdimlinear.h"
18
19 #include "dimlinear.h"
20 #include "drawing.h"
21 #include "math.h"
22
23 DlgDimLinear::DlgDimLinear(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
24         QDialog(parent, flags)
25 {
26         ui.setupUi(this);
27 }
28
29 DlgDimLinear::~DlgDimLinear()
30 {
31 }
32
33 void DlgDimLinear::setDim(DimLinear & d)
34 {
35         dim = &d;
36         ui.wPen->setPen(dim->getPen(false), true, false, "Pen");
37         Drawing * graphic = dim->getGraphic();
38
39         if (graphic)
40                 ui.cbLayer->init(*(graphic->getLayerList()), false, false);
41
42         Layer * lay = dim->getLayer(false);
43
44         if (lay)
45                 ui.cbLayer->setLayer(*lay);
46
47         ui.wLabel->setLabel(dim->getLabel(false));
48         ui.leAngle->setText(QString("%1").arg(Math::rad2deg(dim->getAngle())));
49 }
50
51 void DlgDimLinear::updateDim()
52 {
53         dim->setLabel(ui.wLabel->getLabel());
54         dim->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text(), 0.0)));
55 }