source: ntrip/trunk/BNC/src/pppWidgets.cpp@ 6715

Last change on this file since 6715 was 6715, checked in by weber, 9 years ago

Documentation completed

File size: 18.7 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: t_pppWidgets
30 *
31 * Purpose: This class stores widgets for PPP options
32 *
33 * Author: L. Mervart
34 *
35 * Created: 29-Jul-2014
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42
43#include "pppWidgets.h"
44#include "qtfilechooser.h"
45#include "bncsettings.h"
46#include "bnccore.h"
47
48using namespace std;
49
50// Constructor
51////////////////////////////////////////////////////////////////////////////
52t_pppWidgets::t_pppWidgets() {
53
54 _dataSource = new QComboBox(); _dataSource ->setObjectName("PPP/dataSource"); _widgets << _dataSource;
55 _rinexObs = new qtFileChooser(); _rinexObs ->setObjectName("PPP/rinexObs"); _widgets << _rinexObs;
56 _rinexNav = new qtFileChooser(); _rinexNav ->setObjectName("PPP/rinexNav"); _widgets << _rinexNav;
57 _corrMount = new QLineEdit(); _corrMount ->setObjectName("PPP/corrMount"); _widgets << _corrMount;
58 _corrFile = new qtFileChooser(); _corrFile ->setObjectName("PPP/corrFile"); _widgets << _corrFile;
59 _crdFile = new qtFileChooser(); _crdFile ->setObjectName("PPP/crdFile"); _widgets << _crdFile;
60 _antexFile = new qtFileChooser(); _antexFile ->setObjectName("PPP/antexFile"); _widgets << _antexFile;
61 _logFile = new QLineEdit(); _logFile ->setObjectName("PPP/logFile"); _widgets << _logFile;
62 _nmeaFile = new QLineEdit(); _nmeaFile ->setObjectName("PPP/nmeaFile"); _widgets << _nmeaFile;
63 _nmeaPort = new QLineEdit(); _nmeaPort ->setObjectName("PPP/nmeaPort"); _widgets << _nmeaPort;
64 _snxtroFile = new QLineEdit(); _snxtroFile ->setObjectName("PPP/snxtroFile"); _widgets << _snxtroFile;
65 _snxtroSampl = new QSpinBox(); _snxtroSampl ->setObjectName("PPP/snxtroSampl"); _widgets << _snxtroSampl;
66 _staTable = new QTableWidget(); _staTable ->setObjectName("PPP/staTable"); _widgets << _staTable;
67 _lcGPS = new QComboBox(); _lcGPS ->setObjectName("PPP/lcGPS"); _widgets << _lcGPS;
68 _lcGLONASS = new QComboBox(); _lcGLONASS ->setObjectName("PPP/lcGLONASS"); _widgets << _lcGLONASS;
69 _lcGalileo = new QComboBox(); _lcGalileo ->setObjectName("PPP/lcGalileo"); _widgets << _lcGalileo;
70 _sigmaC1 = new QLineEdit(); _sigmaC1 ->setObjectName("PPP/sigmaC1"); _widgets << _sigmaC1;
71 _sigmaL1 = new QLineEdit(); _sigmaL1 ->setObjectName("PPP/sigmaL1"); _widgets << _sigmaL1;
72 _maxResC1 = new QLineEdit(); _maxResC1 ->setObjectName("PPP/maxResC1"); _widgets << _maxResC1;
73 _maxResL1 = new QLineEdit(); _maxResL1 ->setObjectName("PPP/maxResL1"); _widgets << _maxResL1;
74 _minObs = new QSpinBox(); _minObs ->setObjectName("PPP/minObs"); _widgets << _minObs;
75 _minEle = new QSpinBox(); _minEle ->setObjectName("PPP/minEle"); _widgets << _minEle;
76 _eleWgtCode = new QCheckBox(); _eleWgtCode ->setObjectName("PPP/eleWgtCode"); _widgets << _eleWgtCode;
77 _eleWgtPhase = new QCheckBox(); _eleWgtPhase ->setObjectName("PPP/eleWgtPhase"); _widgets << _eleWgtPhase;
78 _seedingTime = new QLineEdit(); _seedingTime ->setObjectName("PPP/seedingTime"); _widgets << _seedingTime;
79 _corrWaitTime = new QSpinBox(); _corrWaitTime->setObjectName("PPP/corrWaitTime"); _widgets << _corrWaitTime;
80
81 _addStaButton = new QPushButton("Add Station"); _widgets << _addStaButton;
82 _delStaButton = new QPushButton("Delete Station"); _widgets << _delStaButton;
83
84 _plotCoordinates = new QLineEdit; _plotCoordinates ->setObjectName("PPP/plotCoordinates"); _widgets << _plotCoordinates;
85 _mapWinButton = new QPushButton; _mapWinButton ->setObjectName("PPP/mapWinButton"); _widgets << _mapWinButton;
86 _useGoogleMap = new QRadioButton; _useGoogleMap ->setObjectName("PPP/useGoogleMap"); _widgets << _useGoogleMap;
87 _useOpenStreetMap = new QRadioButton; _useOpenStreetMap->setObjectName("PPP/useOpenStreetMap"); _widgets << _useOpenStreetMap;
88 _mapWinDotSize = new QLineEdit; _mapWinDotSize ->setObjectName("PPP/mapWinDotSize"); _widgets << _mapWinDotSize;
89 _mapWinDotColor = new QComboBox; _mapWinDotColor ->setObjectName("PPP/mapWinDotColor"); _widgets << _mapWinDotColor;
90 _mapSpeedSlider = new QSlider; _mapSpeedSlider ->setObjectName("PPP/mapSpeedSlider"); _widgets << _mapSpeedSlider;
91
92 _dataSource->setEditable(false);
93 _dataSource->addItems(QString(",Real-Time Streams,RINEX Files").split(","));
94 connect(_dataSource, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets()));
95
96 slotEnableWidgets();
97
98 _lcGPS->setEditable(false);
99 _lcGPS->addItems(QString("no,P3,L3,P3&L3").split(","));
100
101 _lcGLONASS->setEditable(false);
102 _lcGLONASS->addItems(QString("no,P3,L3,P3&L3").split(","));
103
104 _lcGalileo->setEditable(false);
105 _lcGalileo->addItems(QString("no,P3,L3,P3&L3").split(","));
106
107 _snxtroSampl->setMinimum(0);
108 _snxtroSampl->setMaximum(300);
109 _snxtroSampl->setSingleStep(30);
110 _snxtroSampl->setSuffix(" sec");
111
112 _minObs->setMinimum(4);
113 _minObs->setMaximum(6);
114 _minObs->setSingleStep(1);
115
116 _minEle->setMinimum(0);
117 _minEle->setMaximum(20);
118 _minEle->setSingleStep(1);
119 _minEle->setSuffix(" deg");
120
121 _corrWaitTime->setMinimum(0);
122 _corrWaitTime->setMaximum(20);
123 _corrWaitTime->setSingleStep(1);
124 _corrWaitTime->setSuffix(" sec");
125 _corrWaitTime->setSpecialValueText("no");
126
127 _staTable->setColumnCount(9);
128 _staTable->setRowCount(0);
129 _staTable->setHorizontalHeaderLabels(
130 QString("Station,Sigma N,Sigma E,Sigma H,Noise N,Noise E,Noise H,Tropo Sigma,Tropo Noise").split(","));
131 _staTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
132 _staTable->setSelectionBehavior(QAbstractItemView::SelectRows);
133 _staTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
134 _staTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
135
136 connect(_addStaButton, SIGNAL(clicked()), this, SLOT(slotAddStation()));
137 connect(_delStaButton, SIGNAL(clicked()), this, SLOT(slotDelStation()));
138
139 _mapWinButton->setText("Open Map");
140
141 _mapWinDotColor->setEditable(false);
142 _mapWinDotColor->addItems(QString("red,yellow").split(","));
143
144 _mapSpeedSlider->setOrientation(Qt::Horizontal);
145 _mapSpeedSlider->setRange(1, 100);
146 _mapSpeedSlider->setTickPosition(QSlider::TicksBelow);
147 _mapSpeedSlider->setTickInterval(10);
148 connect(_mapSpeedSlider, SIGNAL(valueChanged(int)), BNC_CORE, SIGNAL(mapSpeedSliderChanged(int)));
149
150// weber
151 _staTable->setWhatsThis(tr("<p>Specify values for Sigma and Noise of the Station's North, East and Height coordinates in meters. Specify also a Sigma for a-priory model based Tropospheric delays and their expected variation (Noise).</p><p><ul><li>A Sigma of 100.0 meters may be an appropriate choice for the initial N/E/H coordinates. However, this value may be significantly smaller (i.e. 0.01) for stations with well known a-priory coordinates.</li><li>A white Noise of 100.0 meters for the estimated N/E/H coordinates may be appropriate considering the potential movement of a rover position.</li><li>A value of 0.1 meters may be an appropriate Sigma for the a-priory model based Tropospheric delay estimation.</li><li>Enter a Noise in meters per second to describe the expected variation of the tropospheric effect. Supposing 1Hz observation data, a value of 3e-6 would mean that the tropospheric effect may vary for 3600 * 3e-6 = 0.01 meters per hour.</li></ul></p>"));
152
153 _plotCoordinates->setWhatsThis(tr("<p>BNC allows to produce a time series plot of coordinates for one Real-time PPP solution in the 'PPP Plot' section below. Specify the 'Mountpoint' of the stream whose coordinate displacements you would like to see plotted.</p><p>Default is an empty option field, meaning that BNC shall not produce a time series plot of PPP coordinate displacements.</p>"));
154 _mapWinButton->setWhatsThis(tr("<p>You make like to track your rover position using Google Maps or Open Street Map as a background map. Track maps can be produced with BNC in 'Realtime-PPP', 'Realtime-SPP' and 'Post-Processing' mode.</p><p>The 'Open Map' button opens a windows showing a map according to specified options.</p><p>Even in 'Post-Processing' mode you should not forget to specify a proxy under the 'Network' tab if that is operated in front of BNC."));
155 _useGoogleMap->setWhatsThis(tr("<p>Specify Google Maps as the background for your rover positions."));
156 _useOpenStreetMap->setWhatsThis(tr("<p>Specify Open Street Map as the background for your rover positions."));
157 _mapWinDotSize->setWhatsThis(tr("<p>Specify the size of dots showing the rover positions on the track map.</p><p>A dot size of '3' may be appropriate. The maximum possible dot size is '10'. An empty option field or a size of '0' would mean that you don't want BNC to show the rover's track on the map.</p>"));
158 _mapWinDotColor->setWhatsThis(tr("<p>Specify the color of dots showing the rover track on the map.</p>"));
159 _mapSpeedSlider->setWhatsThis(tr("<p>With BNC in PPP post-processing mode you can specify the speed of computations as appropriate for 'Track map' visualization. Note that you can adjust 'speed' on-the-fly while BNC is already processing your observations."));
160
161 readOptions();
162}
163
164//
165////////////////////////////////////////////////////////////////////////////
166void t_pppWidgets::readOptions() {
167
168 bncSettings settings;
169
170 // ComboBoxes
171 // ----------
172 int ii = _dataSource->findText(settings.value(_dataSource->objectName()).toString());
173 if (ii != -1) {
174 _dataSource->setCurrentIndex(ii);
175 }
176 ii = _lcGPS->findText(settings.value(_lcGPS->objectName()).toString());
177 if (ii != -1) {
178 _lcGPS->setCurrentIndex(ii);
179 }
180 ii = _lcGLONASS->findText(settings.value(_lcGLONASS->objectName()).toString());
181 if (ii != -1) {
182 _lcGLONASS->setCurrentIndex(ii);
183 }
184 ii = _lcGalileo->findText(settings.value(_lcGalileo->objectName()).toString());
185 if (ii != -1) {
186 _lcGalileo->setCurrentIndex(ii);
187 }
188
189 // FileChoosers
190 // ------------
191 _rinexObs ->setFileName(settings.value(_rinexObs ->objectName()).toString());
192 _rinexNav ->setFileName(settings.value(_rinexNav ->objectName()).toString());
193 _corrFile ->setFileName(settings.value(_corrFile ->objectName()).toString());
194 _crdFile ->setFileName(settings.value(_crdFile ->objectName()).toString());
195 _antexFile->setFileName(settings.value(_antexFile->objectName()).toString());
196
197 // LineEdits
198 // ---------
199 _corrMount ->setText(settings.value(_corrMount ->objectName()).toString());
200 _logFile ->setText(settings.value(_logFile ->objectName()).toString());
201 _nmeaFile ->setText(settings.value(_nmeaFile ->objectName()).toString());
202 _nmeaPort ->setText(settings.value(_nmeaPort ->objectName()).toString());
203 _snxtroFile ->setText(settings.value(_snxtroFile ->objectName()).toString());
204 _sigmaC1 ->setText(settings.value(_sigmaC1 ->objectName()).toString());
205 _sigmaL1 ->setText(settings.value(_sigmaL1 ->objectName()).toString());
206 _maxResC1 ->setText(settings.value(_maxResC1 ->objectName()).toString());
207 _maxResL1 ->setText(settings.value(_maxResL1 ->objectName()).toString());
208 _seedingTime->setText(settings.value(_seedingTime->objectName()).toString());
209
210 // CheckBoxes
211 // ----------
212 _eleWgtCode ->setCheckState(Qt::CheckState(settings.value(_eleWgtCode ->objectName()).toInt()));
213 _eleWgtPhase->setCheckState(Qt::CheckState(settings.value(_eleWgtPhase->objectName()).toInt()));
214
215 // SpinBoxex
216 // ---------
217 _minObs->setValue(settings.value(_minObs->objectName()).toInt());
218 _minEle->setValue(settings.value(_minEle->objectName()).toInt());
219 _corrWaitTime->setValue(settings.value(_corrWaitTime->objectName()).toInt());
220 _snxtroSampl->setValue(settings.value(_snxtroSampl->objectName()).toInt());
221
222 // Table with stations
223 // -------------------
224 for (int iRow = _staTable->rowCount()-1; iRow >=0; iRow--) {
225 _staTable->removeRow(iRow);
226 }
227 int iRow = -1;
228 QListIterator<QString> it(settings.value(_staTable->objectName()).toStringList());
229 while (it.hasNext()) {
230 QStringList hlp = it.next().split(",");
231 ++iRow;
232 _staTable->insertRow(iRow);
233 for (int iCol = 0; iCol < hlp.size(); iCol++) {
234 _staTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
235 }
236 }
237
238 // Plots and Maps
239 // --------------
240 _plotCoordinates ->setText(settings.value(_plotCoordinates->objectName()).toString());
241 _useGoogleMap ->setChecked(settings.value(_useGoogleMap->objectName()).toBool());
242 _useOpenStreetMap->setChecked(settings.value(_useOpenStreetMap->objectName()).toBool());
243 _mapWinDotSize ->setText(settings.value(_mapWinDotSize->objectName()).toString());
244
245 ii = _mapWinDotColor->findText(settings.value(_mapWinDotColor->objectName()).toString());
246 if (ii != -1) {
247 _mapWinDotColor->setCurrentIndex(ii);
248 }
249
250 int speed = settings.value(_mapSpeedSlider->objectName()).toInt();
251 if (speed == 0) speed = _mapSpeedSlider->maximum();
252 _mapSpeedSlider->setSliderPosition(speed);
253}
254
255//
256////////////////////////////////////////////////////////////////////////////
257void t_pppWidgets::saveOptions() {
258
259 bncSettings settings;
260
261 settings.setValue(_dataSource ->objectName(), _dataSource ->currentText());
262 settings.setValue(_rinexObs ->objectName(), _rinexObs ->fileName());
263 settings.setValue(_rinexNav ->objectName(), _rinexNav ->fileName());
264 settings.setValue(_corrMount ->objectName(), _corrMount ->text());
265 settings.setValue(_corrFile ->objectName(), _corrFile ->fileName());
266 settings.setValue(_crdFile ->objectName(), _crdFile ->fileName());
267 settings.setValue(_antexFile ->objectName(), _antexFile ->fileName());
268 settings.setValue(_logFile ->objectName(), _logFile ->text());
269 settings.setValue(_nmeaFile ->objectName(), _nmeaFile ->text());
270 settings.setValue(_nmeaPort ->objectName(), _nmeaPort ->text());
271 settings.setValue(_snxtroFile ->objectName(), _snxtroFile ->text());
272 settings.setValue(_snxtroSampl ->objectName(), _snxtroSampl ->value());
273 settings.setValue(_lcGPS ->objectName(), _lcGPS ->currentText());
274 settings.setValue(_lcGLONASS ->objectName(), _lcGLONASS ->currentText());
275 settings.setValue(_lcGalileo ->objectName(), _lcGalileo ->currentText());
276 settings.setValue(_sigmaC1 ->objectName(), _sigmaC1 ->text());
277 settings.setValue(_sigmaL1 ->objectName(), _sigmaL1 ->text());
278 settings.setValue(_corrWaitTime->objectName(), _corrWaitTime->value());
279 settings.setValue(_maxResC1 ->objectName(), _maxResC1 ->text());
280 settings.setValue(_maxResL1 ->objectName(), _maxResL1 ->text());
281 settings.setValue(_seedingTime ->objectName(), _seedingTime ->text());
282 settings.setValue(_minObs ->objectName(), _minObs ->value());
283 settings.setValue(_minEle ->objectName(), _minEle ->value());
284 settings.setValue(_eleWgtCode ->objectName(), _eleWgtCode ->checkState());
285 settings.setValue(_eleWgtPhase ->objectName(), _eleWgtPhase ->checkState());
286
287 QStringList staList;
288 for (int iRow = 0; iRow < _staTable->rowCount(); iRow++) {
289 QString hlp;
290 for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
291 if (_staTable->item(iRow, iCol)) {
292 hlp += _staTable->item(iRow, iCol)->text() + ",";
293 }
294 }
295 if (!hlp.isEmpty()) {
296 staList << hlp;
297 }
298 }
299 settings.setValue(_staTable->objectName(), staList);
300
301 settings.setValue(_plotCoordinates ->objectName(), _plotCoordinates ->text());
302 settings.setValue(_useGoogleMap ->objectName(), _useGoogleMap ->isChecked());
303 settings.setValue(_useOpenStreetMap->objectName(), _useOpenStreetMap->isChecked());
304 settings.setValue(_mapWinDotSize ->objectName(), _mapWinDotSize ->text());
305 settings.setValue(_mapWinDotColor ->objectName(), _mapWinDotColor ->currentText());
306 settings.setValue(_mapSpeedSlider ->objectName(), _mapSpeedSlider ->value());
307}
308
309//
310////////////////////////////////////////////////////////////////////////////
311void t_pppWidgets::slotEnableWidgets() {
312
313 const static QPalette paletteWhite(QColor(255, 255, 255));
314 const static QPalette paletteGray(QColor(230, 230, 230));
315
316 bool allDisabled = _dataSource->currentText() == "";
317 bool realTime = _dataSource->currentText() == "Real-Time Streams";
318 bool rinexFiles = _dataSource->currentText() == "RINEX Files";
319
320 QListIterator<QWidget*> it(_widgets);
321 while (it.hasNext()) {
322 QWidget* widget = it.next();
323 widget->setEnabled(!allDisabled);
324 }
325
326 if (realTime) {
327 _rinexObs->setEnabled(false);
328 _rinexNav->setEnabled(false);
329 _corrFile->setEnabled(false);
330 }
331 else if (rinexFiles) {
332 _corrMount->setEnabled(false);
333 }
334
335 _dataSource->setEnabled(true);
336
337 it.toFront();
338 while (it.hasNext()) {
339 QWidget* widget = it.next();
340 if (widget->isEnabled()) {
341 widget->setPalette(paletteWhite);
342 }
343 else {
344 widget->setPalette(paletteGray);
345 }
346 }
347}
348
349//
350////////////////////////////////////////////////////////////////////////////
351void t_pppWidgets::slotAddStation() {
352 int iRow = _staTable->rowCount();
353 _staTable->insertRow(iRow);
354 for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
355 _staTable->setItem(iRow, iCol, new QTableWidgetItem(""));
356 }
357}
358
359//
360////////////////////////////////////////////////////////////////////////////
361void t_pppWidgets::slotDelStation() {
362 int nRows = _staTable->rowCount();
363 bool flg[nRows];
364 for (int iRow = 0; iRow < nRows; iRow++) {
365 if (_staTable->isItemSelected(_staTable->item(iRow,1))) {
366 flg[iRow] = true;
367 }
368 else {
369 flg[iRow] = false;
370 }
371 }
372 for (int iRow = nRows-1; iRow >= 0; iRow--) {
373 if (flg[iRow]) {
374 _staTable->removeRow(iRow);
375 }
376 }
377}
378
Note: See TracBrowser for help on using the repository browser.