source: ntrip/trunk/BNC/src/upload/bnccustomtrafo.cpp@ 9868

Last change on this file since 9868 was 8252, checked in by stoecker, 7 years ago

see #105 - reenable Qt4 build options, drop generic version dependend includes, replace by direct requirements, remaining QtCore lines should also be replaced

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