source: ntrip/trunk/BNC/src/PPP/pppWidgets.cpp@ 5955

Last change on this file since 5955 was 5955, checked in by mervart, 10 years ago
File size: 14.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 "PPP/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 _staTable = new QTableWidget(); _staTable ->setObjectName("PPP/staTable"); _widgets << _staTable;
65 _lcGPS = new QComboBox(); _lcGPS ->setObjectName("PPP/lcGPS"); _widgets << _lcGPS;
66 _lcGLONASS = new QComboBox(); _lcGLONASS ->setObjectName("PPP/lcGLONASS"); _widgets << _lcGLONASS;
67 _lcGalileo = new QComboBox(); _lcGalileo ->setObjectName("PPP/lcGalileo"); _widgets << _lcGalileo;
68 _sigmaC1 = new QLineEdit(); _sigmaC1 ->setObjectName("PPP/sigmaC1"); _widgets << _sigmaC1;
69 _sigmaL1 = new QLineEdit(); _sigmaL1 ->setObjectName("PPP/sigmaL1"); _widgets << _sigmaL1;
70 _corrWaitTime = new QSpinBox(); _corrWaitTime->setObjectName("PPP/corrWaitTime"); _widgets << _corrWaitTime;
71 _addStaButton = new QPushButton("Add Station"); _widgets << _addStaButton;
72 _delStaButton = new QPushButton("Delete Station"); _widgets << _delStaButton;
73 _plotCoordinates = new QLineEdit; _plotCoordinates ->setObjectName("PPP/plotCoordinates"); _widgets << _plotCoordinates;
74 _mapWinButton = new QPushButton; _mapWinButton ->setObjectName("PPP/mapWinButton"); _widgets << _mapWinButton;
75 _useGoogleMap = new QRadioButton; _useGoogleMap ->setObjectName("PPP/useGoogleMap"); _widgets << _useGoogleMap;
76 _useOpenStreetMap = new QRadioButton; _useOpenStreetMap->setObjectName("PPP/useOpenStreetMap"); _widgets << _useOpenStreetMap;
77 _mapWinDotSize = new QLineEdit; _mapWinDotSize ->setObjectName("PPP/mapWinDotSize"); _widgets << _mapWinDotSize;
78 _mapWinDotColor = new QComboBox; _mapWinDotColor ->setObjectName("PPP/mapWinDotColor"); _widgets << _mapWinDotColor;
79 _mapSpeedSlider = new QSlider; _mapSpeedSlider ->setObjectName("PPP/mapSpeedSlider"); _widgets << _mapSpeedSlider;
80
81 _dataSource->setEditable(false);
82 _dataSource->addItems(QString("no,Real-Time Streams,RINEX Files").split(","));
83 connect(_dataSource, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets()));
84
85 _lcGPS->setEditable(false);
86 _lcGPS->addItems(QString("no,P3,L3,P3&L3").split(","));
87
88 _lcGLONASS->setEditable(false);
89 _lcGLONASS->addItems(QString("no,P3,L3,P3&L3").split(","));
90
91 _lcGalileo->setEditable(false);
92 _lcGalileo->addItems(QString("no,P3,L3,P3&L3").split(","));
93
94 _corrWaitTime->setMinimum(0);
95 _corrWaitTime->setMaximum(20);
96 _corrWaitTime->setSingleStep(1);
97 _corrWaitTime->setSuffix(" sec");
98 _corrWaitTime->setSpecialValueText("no");
99
100 _staTable->setColumnCount(9);
101 _staTable->setRowCount(0);
102 _staTable->setHorizontalHeaderLabels(
103 QString("Station,Sigma N,Sigma E,Sigma H,Noise N,Noise E,Noise H,Tropo Sigma,Tropo Noise").split(","));
104 _staTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
105 _staTable->setSelectionBehavior(QAbstractItemView::SelectRows);
106 _staTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
107 /// _staTable->horizontalHeader()->setStretchLastSection(true);
108 _staTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
109
110 connect(_addStaButton, SIGNAL(clicked()), this, SLOT(slotAddStation()));
111 connect(_delStaButton, SIGNAL(clicked()), this, SLOT(slotDelStation()));
112
113 _mapWinButton->setText("Open Map");
114
115 _mapWinDotColor->setEditable(false);
116 _mapWinDotColor->addItems(QString("red,yellow").split(","));
117
118 _mapSpeedSlider->setOrientation(Qt::Horizontal);
119 _mapSpeedSlider->setRange(1, 100);
120 _mapSpeedSlider->setTickPosition(QSlider::TicksBelow);
121 _mapSpeedSlider->setTickInterval(10);
122 connect(_mapSpeedSlider, SIGNAL(valueChanged(int)), BNC_CORE, SIGNAL(mapSpeedSliderChanged(int)));
123
124
125 _mapWinButton->setWhatsThis(tr("<p>You make like to track your rover position using Google Maps or Open Street Map as a background map. Track plots 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>When in 'Post-Processing' mode you should not forget to specify a proxy under the 'Network' tab if that is operated in front of BNC."));
126 _useGoogleMap->setWhatsThis(tr("<p>Specify Google Maps as the background for your rover positions."));
127 _useOpenStreetMap->setWhatsThis(tr("<p>Specify Open Street Map as the background for your rover positions."));
128 _mapWinDotSize->setWhatsThis(tr("<p>Specify the size of dots showing the rover positions.</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>"));
129 _mapWinDotColor->setWhatsThis(tr("<p>Specify the color of dots showing the rover track.</p>"));
130 _mapSpeedSlider->setWhatsThis(tr("<p>With BNC in PPP post-processing mode you can specify the speed of computations as appropriate for visualization. Note that you can adjust 'Speed' on-the-fly while BNC is already processing your observations."));
131
132 readOptions();
133}
134
135//
136////////////////////////////////////////////////////////////////////////////
137void t_pppWidgets::readOptions() {
138
139 bncSettings settings;
140
141 // ComboBoxes
142 // ----------
143 int ii = _dataSource->findText(settings.value(_dataSource->objectName()).toString());
144 if (ii != -1) {
145 _dataSource->setCurrentIndex(ii);
146 }
147 ii = _lcGPS->findText(settings.value(_lcGPS->objectName()).toString());
148 if (ii != -1) {
149 _lcGPS->setCurrentIndex(ii);
150 }
151 ii = _lcGLONASS->findText(settings.value(_lcGLONASS->objectName()).toString());
152 if (ii != -1) {
153 _lcGLONASS->setCurrentIndex(ii);
154 }
155 ii = _lcGalileo->findText(settings.value(_lcGalileo->objectName()).toString());
156 if (ii != -1) {
157 _lcGalileo->setCurrentIndex(ii);
158 }
159
160 // FileChoosers
161 // ------------
162 _rinexObs ->setFileName(settings.value(_rinexObs ->objectName()).toString());
163 _rinexNav ->setFileName(settings.value(_rinexNav ->objectName()).toString());
164 _corrFile ->setFileName(settings.value(_corrFile ->objectName()).toString());
165 _crdFile ->setFileName(settings.value(_crdFile ->objectName()).toString());
166 _antexFile->setFileName(settings.value(_antexFile->objectName()).toString());
167
168 // LineEdits
169 // ---------
170 _corrMount->setText(settings.value(_corrMount->objectName()).toString());
171 _logFile ->setText(settings.value(_logFile ->objectName()).toString());
172 _nmeaFile ->setText(settings.value(_nmeaFile ->objectName()).toString());
173 _nmeaPort ->setText(settings.value(_nmeaPort ->objectName()).toString());
174 _sigmaC1 ->setText(settings.value(_sigmaC1 ->objectName()).toString());
175 _sigmaL1 ->setText(settings.value(_sigmaL1 ->objectName()).toString());
176
177 // SpinBox
178 // -------
179 _corrWaitTime->setValue(settings.value(_corrWaitTime->objectName()).toInt());
180
181 // Table with stations
182 // -------------------
183 for (int iRow = _staTable->rowCount()-1; iRow >=0; iRow--) {
184 _staTable->removeRow(iRow);
185 }
186 int iRow = -1;
187 QListIterator<QString> it(settings.value(_staTable->objectName()).toStringList());
188 while (it.hasNext()) {
189 QStringList hlp = it.next().split(",");
190 ++iRow;
191 _staTable->insertRow(iRow);
192 for (int iCol = 0; iCol < hlp.size(); iCol++) {
193 _staTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
194 }
195 }
196
197 // Plots and Maps
198 // --------------
199 _plotCoordinates ->setText(settings.value(_plotCoordinates->objectName()).toString());
200 _useGoogleMap ->setChecked(!settings.value(_useGoogleMap->objectName()).toBool());
201 _useOpenStreetMap->setChecked(settings.value(_useOpenStreetMap->objectName()).toBool());
202 _mapWinDotSize ->setText(settings.value(_mapWinDotSize->objectName()).toString());
203
204 ii = _mapWinDotColor->findText(settings.value(_mapWinDotColor->objectName()).toString());
205 if (ii != -1) {
206 _mapWinDotColor->setCurrentIndex(ii);
207 }
208
209 int speed = settings.value(_mapSpeedSlider->objectName()).toInt();
210 if (speed == 0) speed = _mapSpeedSlider->maximum();
211 _mapSpeedSlider->setSliderPosition(speed);
212}
213
214//
215////////////////////////////////////////////////////////////////////////////
216void t_pppWidgets::saveOptions() {
217
218 bncSettings settings;
219
220 settings.setValue(_dataSource ->objectName(), _dataSource ->currentText());
221 settings.setValue(_rinexObs ->objectName(), _rinexObs ->fileName());
222 settings.setValue(_rinexNav ->objectName(), _rinexNav ->fileName());
223 settings.setValue(_corrMount ->objectName(), _corrMount ->text());
224 settings.setValue(_corrFile ->objectName(), _corrFile ->fileName());
225 settings.setValue(_crdFile ->objectName(), _crdFile ->fileName());
226 settings.setValue(_antexFile ->objectName(), _antexFile ->fileName());
227 settings.setValue(_logFile ->objectName(), _logFile ->text());
228 settings.setValue(_nmeaFile ->objectName(), _nmeaFile ->text());
229 settings.setValue(_nmeaPort ->objectName(), _nmeaPort ->text());
230 settings.setValue(_lcGPS ->objectName(), _lcGPS ->currentText());
231 settings.setValue(_lcGLONASS ->objectName(), _lcGLONASS ->currentText());
232 settings.setValue(_lcGalileo ->objectName(), _lcGalileo ->currentText());
233 settings.setValue(_sigmaC1 ->objectName(), _sigmaC1 ->text());
234 settings.setValue(_sigmaL1 ->objectName(), _sigmaL1 ->text());
235 settings.setValue(_corrWaitTime->objectName(), _corrWaitTime->value());
236
237 QStringList staList;
238 for (int iRow = 0; iRow < _staTable->rowCount(); iRow++) {
239 QString hlp;
240 for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
241 if (_staTable->item(iRow, iCol)) {
242 hlp += _staTable->item(iRow, iCol)->text() + ",";
243 }
244 }
245 if (!hlp.isEmpty()) {
246 staList << hlp;
247 }
248 }
249 settings.setValue(_staTable->objectName(), staList);
250
251 settings.setValue(_plotCoordinates ->objectName(), _plotCoordinates ->text());
252 settings.setValue(_useGoogleMap ->objectName(), _useGoogleMap ->isChecked());
253 settings.setValue(_useOpenStreetMap->objectName(), _useOpenStreetMap->isChecked());
254 settings.setValue(_mapWinDotSize ->objectName(), _mapWinDotSize ->text());
255 settings.setValue(_mapWinDotColor ->objectName(), _mapWinDotColor ->currentText());
256 settings.setValue(_mapSpeedSlider ->objectName(), _mapSpeedSlider ->value());
257}
258
259//
260////////////////////////////////////////////////////////////////////////////
261void t_pppWidgets::slotEnableWidgets() {
262
263 const static QPalette paletteWhite(QColor(255, 255, 255));
264 const static QPalette paletteGray(QColor(230, 230, 230));
265
266 bool allDisabled = _dataSource->currentText() == "no";
267 bool realTime = _dataSource->currentText() == "Real-Time Streams";
268 bool rinexFiles = _dataSource->currentText() == "RINEX Files";
269
270 QListIterator<QWidget*> it(_widgets);
271 while (it.hasNext()) {
272 QWidget* widget = it.next();
273 widget->setEnabled(!allDisabled);
274 }
275
276 if (realTime) {
277 _rinexObs->setEnabled(false);
278 _rinexNav->setEnabled(false);
279 _corrFile->setEnabled(false);
280 }
281 else if (rinexFiles) {
282 _corrMount->setEnabled(false);
283 }
284
285 _dataSource->setEnabled(true);
286
287 it.toFront();
288 while (it.hasNext()) {
289 QWidget* widget = it.next();
290 if (widget->isEnabled()) {
291 widget->setPalette(paletteWhite);
292 }
293 else {
294 widget->setPalette(paletteGray);
295 }
296 }
297}
298
299//
300////////////////////////////////////////////////////////////////////////////
301void t_pppWidgets::slotAddStation() {
302 int iRow = _staTable->rowCount();
303 _staTable->insertRow(iRow);
304 for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
305 _staTable->setItem(iRow, iCol, new QTableWidgetItem(""));
306 }
307}
308
309//
310////////////////////////////////////////////////////////////////////////////
311void t_pppWidgets::slotDelStation() {
312 int nRows = _staTable->rowCount();
313 bool flg[nRows];
314 for (int iRow = 0; iRow < nRows; iRow++) {
315 if (_staTable->isItemSelected(_staTable->item(iRow,1))) {
316 flg[iRow] = true;
317 }
318 else {
319 flg[iRow] = false;
320 }
321 }
322 for (int iRow = nRows-1; iRow >= 0; iRow--) {
323 if (flg[iRow]) {
324 _staTable->removeRow(iRow);
325 }
326 }
327}
328
Note: See TracBrowser for help on using the repository browser.