source: ntrip/trunk/BNS/bnscustomtrafo.cpp@ 7481

Last change on this file since 7481 was 1772, checked in by weber, 16 years ago

* empty log message *

File size: 8.8 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Server
3 * -------------------------------------------------------------------------
4 *
5 * Class: bnscustomtrafo
6 *
7 * Purpose: This class sets Helmert Transformation Parameters
8 *
9 * Author: G. Weber
10 *
11 * Created: 22-Mar-2009
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include "bnscustomtrafo.h"
18#include "bnssettings.h"
19
20using namespace std;
21
22// Constructor
23////////////////////////////////////////////////////////////////////////////
24bnsCustomTrafo::bnsCustomTrafo(QWidget* parent) : QDialog(parent) {
25
26 setMinimumSize(400,150);
27 QVBoxLayout* mainLayout = new QVBoxLayout(this);
28 QGridLayout* editLayout = new QGridLayout;
29
30 setWindowTitle(tr("Custom Transformation Parameters"));
31
32 bnsSettings settings;
33
34 _dxLineEdit = new QLineEdit(settings.value("trafo_dx").toString());
35 _dyLineEdit = new QLineEdit(settings.value("trafo_dy").toString());
36 _dzLineEdit = new QLineEdit(settings.value("trafo_dz").toString());
37 _dxrLineEdit = new QLineEdit(settings.value("trafo_dxr").toString());
38 _dyrLineEdit = new QLineEdit(settings.value("trafo_dyr").toString());
39 _dzrLineEdit = new QLineEdit(settings.value("trafo_dzr").toString());
40 _oxLineEdit = new QLineEdit(settings.value("trafo_ox").toString());
41 _oyLineEdit = new QLineEdit(settings.value("trafo_oy").toString());
42 _ozLineEdit = new QLineEdit(settings.value("trafo_oz").toString());
43 _oxrLineEdit = new QLineEdit(settings.value("trafo_oxr").toString());
44 _oyrLineEdit = new QLineEdit(settings.value("trafo_oyr").toString());
45 _ozrLineEdit = new QLineEdit(settings.value("trafo_ozr").toString());
46 _scLineEdit = new QLineEdit(settings.value("trafo_sc").toString());
47 _scrLineEdit = new QLineEdit(settings.value("trafo_scr").toString());
48 _t0LineEdit = new QLineEdit(settings.value("trafo_t0").toString());
49
50 // WhatsThis
51 // ---------
52 _dxLineEdit->setWhatsThis(tr("<p>Set translation in X at epoch t0.</p>"));
53 _dyLineEdit->setWhatsThis(tr("<p>Set translation in Y at epoch t0.</p>"));
54 _dzLineEdit->setWhatsThis(tr("<p>Set translation in Z at epoch t0.</p>"));
55 _dxrLineEdit->setWhatsThis(tr("<p>Set translation rate in X.</p>"));
56 _dyrLineEdit->setWhatsThis(tr("<p>Set translation rate in Y.</p>"));
57 _dzrLineEdit->setWhatsThis(tr("<p>Set translation rate in Z.</p>"));
58 _oxLineEdit->setWhatsThis(tr("<p>Set rotation in X at epoch t0.</p>"));
59 _oyLineEdit->setWhatsThis(tr("<p>Set rotation in Y at epoch t0.</p>"));
60 _ozLineEdit->setWhatsThis(tr("<p>Set rotation in Z at epoch t0.</p>"));
61 _oxrLineEdit->setWhatsThis(tr("<p>Set rotation rate in X.</p>"));
62 _oyrLineEdit->setWhatsThis(tr("<p>Set rotation rate in Y.</p>"));
63 _ozrLineEdit->setWhatsThis(tr("<p>Set rotation rate in Z.</p>"));
64 _scLineEdit->setWhatsThis(tr("<p>Set scale at epoch t0.</p>"));
65 _scrLineEdit->setWhatsThis(tr("<p>Set scale rate.</p>"));
66 _t0LineEdit->setWhatsThis(tr("<p>Set reference epoch e.g. 2000.0</p>"));
67
68 int ww = QFontMetrics(font()).width('w');
69 _dxLineEdit->setMaximumWidth(9*ww);
70 _dyLineEdit->setMaximumWidth(9*ww);
71 _dzLineEdit->setMaximumWidth(9*ww);
72 _dxrLineEdit->setMaximumWidth(9*ww);
73 _dyrLineEdit->setMaximumWidth(9*ww);
74 _dzrLineEdit->setMaximumWidth(9*ww);
75 _oxLineEdit->setMaximumWidth(9*ww);
76 _oyLineEdit->setMaximumWidth(9*ww);
77 _ozLineEdit->setMaximumWidth(9*ww);
78 _oxrLineEdit->setMaximumWidth(9*ww);
79 _oyrLineEdit->setMaximumWidth(9*ww);
80 _ozrLineEdit->setMaximumWidth(9*ww);
81 _scLineEdit->setMaximumWidth(9*ww);
82 _scrLineEdit->setMaximumWidth(9*ww);
83 _t0LineEdit->setMaximumWidth(9*ww);
84
85 editLayout->addWidget(new QLabel(tr("dX(t0) [m]")), 0, 0, Qt::AlignRight);
86 editLayout->addWidget(_dxLineEdit, 0, 1);
87 editLayout->addWidget(new QLabel(tr("dY(t0) [m]")), 0, 2, Qt::AlignRight);
88 editLayout->addWidget(_dyLineEdit, 0, 3);
89 editLayout->addWidget(new QLabel(tr("dZ(t0) [m]")), 0, 4, Qt::AlignRight);
90 editLayout->addWidget(_dzLineEdit, 0, 5);
91 editLayout->addWidget(new QLabel(tr("dXr [m/y]")), 1, 0, Qt::AlignRight);
92 editLayout->addWidget(_dxrLineEdit, 1, 1);
93 editLayout->addWidget(new QLabel(tr("dYr [m/y]")), 1, 2, Qt::AlignRight);
94 editLayout->addWidget(_dyrLineEdit, 1, 3);
95 editLayout->addWidget(new QLabel(tr("dZr [m/y]")), 1, 4, Qt::AlignRight);
96 editLayout->addWidget(_dzrLineEdit, 1, 5);
97 editLayout->addWidget(new QLabel(tr(" oX(t0) [as]")), 2, 0, Qt::AlignRight);
98 editLayout->addWidget(_oxLineEdit, 2, 1);
99 editLayout->addWidget(new QLabel(tr(" oY(t0) [as]")), 2, 2, Qt::AlignRight);
100 editLayout->addWidget(_oyLineEdit, 2, 3);
101 editLayout->addWidget(new QLabel(tr(" oZ(t0) [as]")), 2, 4, Qt::AlignRight);
102 editLayout->addWidget(_ozLineEdit, 2, 5);
103 editLayout->addWidget(new QLabel(tr("oXr [as/y]")), 3, 0, Qt::AlignRight);
104 editLayout->addWidget(_oxrLineEdit, 3, 1);
105 editLayout->addWidget(new QLabel(tr("oYr [as/y]")), 3, 2, Qt::AlignRight);
106 editLayout->addWidget(_oyrLineEdit, 3, 3);
107 editLayout->addWidget(new QLabel(tr("oZr [as/y]")), 3, 4, Qt::AlignRight);
108 editLayout->addWidget(_ozrLineEdit, 3, 5);
109 editLayout->addWidget(new QLabel(tr("S(t0) [10^-9]")), 4, 0, Qt::AlignRight);
110 editLayout->addWidget(_scLineEdit, 4, 1);
111 editLayout->addWidget(new QLabel(tr("Sr [10^-9/y]")), 4, 2, Qt::AlignRight);
112 editLayout->addWidget(_scrLineEdit, 4, 3);
113 editLayout->addWidget(new QLabel(tr("t0 [y]")), 4, 4, Qt::AlignRight);
114 editLayout->addWidget(_t0LineEdit, 4, 5);
115 editLayout->addWidget(new QLabel("Specify up to 14 Helmert Transformation Parameters for transformation from IGS05"), 5, 0, 1, 6, Qt::AlignCenter);
116 editLayout->addWidget(new QLabel("into target reference system."), 6, 0, 1, 6, Qt::AlignCenter);
117
118 mainLayout->addLayout(editLayout);
119
120 _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
121 connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
122
123 _buttonCancel = new QPushButton(tr("Cancel"), this);
124 connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
125
126 _buttonOK = new QPushButton(tr("OK"), this);
127 connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
128
129 _buttonOK->setDefault(true);
130
131 QHBoxLayout* buttonLayout = new QHBoxLayout;
132
133 buttonLayout->addWidget(_buttonWhatsThis);
134 buttonLayout->addStretch(1);
135 buttonLayout->addWidget(_buttonCancel);
136 buttonLayout->addWidget(_buttonOK);
137
138 mainLayout->addLayout(buttonLayout);
139}
140
141// Destructor
142////////////////////////////////////////////////////////////////////////////
143bnsCustomTrafo::~bnsCustomTrafo() {
144 delete _buttonCancel;
145 delete _buttonOK;
146 delete _buttonWhatsThis;
147}
148
149// Accept slot
150////////////////////////////////////////////////////////////////////////////
151void bnsCustomTrafo::accept() {
152
153 QStringList* mountPoints = new QStringList;
154
155 if ( !_dxLineEdit->text().isEmpty() &&
156 !_dyLineEdit->text().isEmpty() &&
157 !_dzLineEdit->text().isEmpty() &&
158 !_dxrLineEdit->text().isEmpty() &&
159 !_dyrLineEdit->text().isEmpty() &&
160 !_dzrLineEdit->text().isEmpty() &&
161 !_oxLineEdit->text().isEmpty() &&
162 !_oyLineEdit->text().isEmpty() &&
163 !_ozLineEdit->text().isEmpty() &&
164 !_oxrLineEdit->text().isEmpty() &&
165 !_oyrLineEdit->text().isEmpty() &&
166 !_ozrLineEdit->text().isEmpty() &&
167 !_scLineEdit->text().isEmpty() &&
168 !_scrLineEdit->text().isEmpty() &&
169 !_t0LineEdit->text().isEmpty() ) {
170
171 bnsSettings settings;
172 settings.setValue("trafo_dx", _dxLineEdit->text());
173 settings.setValue("trafo_dy", _dyLineEdit->text());
174 settings.setValue("trafo_dz", _dzLineEdit->text());
175 settings.setValue("trafo_dxr", _dxrLineEdit->text());
176 settings.setValue("trafo_dyr", _dyrLineEdit->text());
177 settings.setValue("trafo_dzr", _dzrLineEdit->text());
178 settings.setValue("trafo_ox", _oxLineEdit->text());
179 settings.setValue("trafo_oy", _oyLineEdit->text());
180 settings.setValue("trafo_oz", _ozLineEdit->text());
181 settings.setValue("trafo_oxr", _oxrLineEdit->text());
182 settings.setValue("trafo_oyr", _oyrLineEdit->text());
183 settings.setValue("trafo_ozr", _ozrLineEdit->text());
184 settings.setValue("trafo_sc", _scLineEdit->text());
185 settings.setValue("trafo_scr", _scrLineEdit->text());
186 settings.setValue("trafo_t0", _t0LineEdit->text());
187
188 } else {
189 QMessageBox::warning(this, tr("Warning"),
190 tr("Incomplete settings"),
191 QMessageBox::Ok);
192 }
193
194 emit newMountPoints(mountPoints);
195
196 QDialog::accept();
197}
198
199// Whats This Help
200void bnsCustomTrafo::slotWhatsThis() {
201QWhatsThis::enterWhatsThisMode();
202}
203
Note: See TracBrowser for help on using the repository browser.