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 |
|
---|
47 | using namespace std;
|
---|
48 |
|
---|
49 | // Constructor
|
---|
50 | ////////////////////////////////////////////////////////////////////////////
|
---|
51 | t_pppWidgets::t_pppWidgets() {
|
---|
52 |
|
---|
53 | _dataSource = new QComboBox(); _dataSource ->setObjectName("PPP/dataSource"); _widgets << _dataSource;
|
---|
54 | _rinexObs = new qtFileChooser(); _rinexObs ->setObjectName("PPP/rinexObs"); _widgets << _rinexObs;
|
---|
55 | _rinexNav = new qtFileChooser(); _rinexNav ->setObjectName("PPP/rinexNav"); _widgets << _rinexNav;
|
---|
56 | _corrMount = new QLineEdit(); _corrMount ->setObjectName("PPP/corrMount"); _widgets << _corrMount;
|
---|
57 | _corrFile = new qtFileChooser(); _corrFile ->setObjectName("PPP/corrFile"); _widgets << _corrFile;
|
---|
58 | _crdFile = new qtFileChooser(); _crdFile ->setObjectName("PPP/crdFile"); _widgets << _crdFile;
|
---|
59 | _antexFile = new qtFileChooser(); _antexFile ->setObjectName("PPP/antexFile"); _widgets << _antexFile;
|
---|
60 | _logFile = new QLineEdit(); _logFile ->setObjectName("PPP/logFile"); _widgets << _logFile;
|
---|
61 | _nmeaFile = new QLineEdit(); _nmeaFile ->setObjectName("PPP/nmeaFile"); _widgets << _nmeaFile;
|
---|
62 | _nmeaPort = new QLineEdit(); _nmeaPort ->setObjectName("PPP/nmeaPort"); _widgets << _nmeaPort;
|
---|
63 | _staTable = new QTableWidget(); _staTable ->setObjectName("PPP/staTable"); _widgets << _staTable;
|
---|
64 | _lcGPS = new QComboBox(); _lcGPS ->setObjectName("PPP/lcGPS"); _widgets << _lcGPS;
|
---|
65 | _lcGLONASS = new QComboBox(); _lcGLONASS ->setObjectName("PPP/lcGLONASS"); _widgets << _lcGLONASS;
|
---|
66 | _lcGalileo = new QComboBox(); _lcGalileo ->setObjectName("PPP/lcGalileo"); _widgets << _lcGalileo;
|
---|
67 | _sigmaC1 = new QLineEdit(); _sigmaC1 ->setObjectName("PPP/sigmaC1"); _widgets << _sigmaC1;
|
---|
68 | _sigmaL1 = new QLineEdit(); _sigmaL1 ->setObjectName("PPP/sigmaL1"); _widgets << _sigmaL1;
|
---|
69 | _corrWaitTime = new QSpinBox(); _corrWaitTime->setObjectName("PPP/corrWaitTime"); _widgets << _corrWaitTime;
|
---|
70 | _addStaButton = new QPushButton("Add Station"); _widgets << _addStaButton;
|
---|
71 | _delStaButton = new QPushButton("Delete Station"); _widgets << _delStaButton;
|
---|
72 |
|
---|
73 | _dataSource->setEditable(false);
|
---|
74 | _dataSource->addItems(QString("no,Real-Time Streams,RINEX Files").split(","));
|
---|
75 | connect(_dataSource, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets()));
|
---|
76 |
|
---|
77 | _lcGPS->setEditable(false);
|
---|
78 | _lcGPS->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
79 |
|
---|
80 | _lcGLONASS->setEditable(false);
|
---|
81 | _lcGLONASS->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
82 |
|
---|
83 | _lcGalileo->setEditable(false);
|
---|
84 | _lcGalileo->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
85 |
|
---|
86 | _corrWaitTime->setMinimum(0);
|
---|
87 | _corrWaitTime->setMaximum(20);
|
---|
88 | _corrWaitTime->setSingleStep(1);
|
---|
89 | _corrWaitTime->setSuffix(" sec");
|
---|
90 | _corrWaitTime->setSpecialValueText("no");
|
---|
91 |
|
---|
92 | _staTable->setColumnCount(9);
|
---|
93 | _staTable->setRowCount(0);
|
---|
94 | _staTable->setHorizontalHeaderLabels(
|
---|
95 | QString("Station,Sigma N,Sigma E,Sigma H,Noise N,Noise E,Noise H,Tropo Sigma,Tropo Noise").split(","));
|
---|
96 | _staTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
---|
97 | _staTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
---|
98 | _staTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
|
---|
99 | /// _staTable->horizontalHeader()->setStretchLastSection(true);
|
---|
100 | _staTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
---|
101 |
|
---|
102 | connect(_addStaButton, SIGNAL(clicked()), this, SLOT(slotAddStation()));
|
---|
103 | connect(_delStaButton, SIGNAL(clicked()), this, SLOT(slotDelStation()));
|
---|
104 |
|
---|
105 | readOptions();
|
---|
106 | }
|
---|
107 |
|
---|
108 | //
|
---|
109 | ////////////////////////////////////////////////////////////////////////////
|
---|
110 | void t_pppWidgets::readOptions() {
|
---|
111 |
|
---|
112 | bncSettings settings;
|
---|
113 |
|
---|
114 | // ComboBoxes
|
---|
115 | // ----------
|
---|
116 | int ii = _dataSource->findText(settings.value(_dataSource->objectName()).toString());
|
---|
117 | if (ii != -1) {
|
---|
118 | _dataSource->setCurrentIndex(ii);
|
---|
119 | }
|
---|
120 | ii = _lcGPS->findText(settings.value(_lcGPS->objectName()).toString());
|
---|
121 | if (ii != -1) {
|
---|
122 | _lcGPS->setCurrentIndex(ii);
|
---|
123 | }
|
---|
124 | ii = _lcGLONASS->findText(settings.value(_lcGLONASS->objectName()).toString());
|
---|
125 | if (ii != -1) {
|
---|
126 | _lcGLONASS->setCurrentIndex(ii);
|
---|
127 | }
|
---|
128 | ii = _lcGalileo->findText(settings.value(_lcGalileo->objectName()).toString());
|
---|
129 | if (ii != -1) {
|
---|
130 | _lcGalileo->setCurrentIndex(ii);
|
---|
131 | }
|
---|
132 |
|
---|
133 | // FileChoosers
|
---|
134 | // ------------
|
---|
135 | _rinexObs ->setFileName(settings.value(_rinexObs ->objectName()).toString());
|
---|
136 | _rinexNav ->setFileName(settings.value(_rinexNav ->objectName()).toString());
|
---|
137 | _corrFile ->setFileName(settings.value(_corrFile ->objectName()).toString());
|
---|
138 | _crdFile ->setFileName(settings.value(_crdFile ->objectName()).toString());
|
---|
139 | _antexFile->setFileName(settings.value(_antexFile->objectName()).toString());
|
---|
140 |
|
---|
141 | // LineEdits
|
---|
142 | // ---------
|
---|
143 | _corrMount->setText(settings.value(_corrMount->objectName()).toString());
|
---|
144 | _logFile ->setText(settings.value(_logFile ->objectName()).toString());
|
---|
145 | _nmeaFile ->setText(settings.value(_nmeaFile ->objectName()).toString());
|
---|
146 | _nmeaPort ->setText(settings.value(_nmeaPort ->objectName()).toString());
|
---|
147 | _sigmaC1 ->setText(settings.value(_sigmaC1 ->objectName()).toString());
|
---|
148 | _sigmaL1 ->setText(settings.value(_sigmaL1 ->objectName()).toString());
|
---|
149 |
|
---|
150 | // SpinBox
|
---|
151 | // -------
|
---|
152 | _corrWaitTime->setValue(settings.value(_corrWaitTime->objectName()).toInt());
|
---|
153 |
|
---|
154 | // Table with stations
|
---|
155 | // -------------------
|
---|
156 | for (int iRow = _staTable->rowCount()-1; iRow >=0; iRow--) {
|
---|
157 | _staTable->removeRow(iRow);
|
---|
158 | }
|
---|
159 | int iRow = -1;
|
---|
160 | QListIterator<QString> it(settings.value(_staTable->objectName()).toStringList());
|
---|
161 | while (it.hasNext()) {
|
---|
162 | QStringList hlp = it.next().split(",");
|
---|
163 | ++iRow;
|
---|
164 | _staTable->insertRow(iRow);
|
---|
165 | for (int iCol = 0; iCol < hlp.size(); iCol++) {
|
---|
166 | _staTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
|
---|
167 | }
|
---|
168 | }
|
---|
169 | }
|
---|
170 |
|
---|
171 | //
|
---|
172 | ////////////////////////////////////////////////////////////////////////////
|
---|
173 | void t_pppWidgets::saveOptions() {
|
---|
174 |
|
---|
175 | bncSettings settings;
|
---|
176 |
|
---|
177 | settings.setValue(_dataSource ->objectName(), _dataSource ->currentText());
|
---|
178 | settings.setValue(_rinexObs ->objectName(), _rinexObs ->fileName());
|
---|
179 | settings.setValue(_rinexNav ->objectName(), _rinexNav ->fileName());
|
---|
180 | settings.setValue(_corrMount ->objectName(), _corrMount ->text());
|
---|
181 | settings.setValue(_corrFile ->objectName(), _corrFile ->fileName());
|
---|
182 | settings.setValue(_crdFile ->objectName(), _crdFile ->fileName());
|
---|
183 | settings.setValue(_antexFile ->objectName(), _antexFile ->fileName());
|
---|
184 | settings.setValue(_logFile ->objectName(), _logFile ->text());
|
---|
185 | settings.setValue(_nmeaFile ->objectName(), _nmeaFile ->text());
|
---|
186 | settings.setValue(_nmeaPort ->objectName(), _nmeaPort ->text());
|
---|
187 | settings.setValue(_lcGPS ->objectName(), _lcGPS ->currentText());
|
---|
188 | settings.setValue(_lcGLONASS ->objectName(), _lcGLONASS ->currentText());
|
---|
189 | settings.setValue(_lcGalileo ->objectName(), _lcGalileo ->currentText());
|
---|
190 | settings.setValue(_sigmaC1 ->objectName(), _sigmaC1 ->text());
|
---|
191 | settings.setValue(_sigmaL1 ->objectName(), _sigmaL1 ->text());
|
---|
192 | settings.setValue(_corrWaitTime->objectName(), _corrWaitTime->value());
|
---|
193 |
|
---|
194 | QStringList staList;
|
---|
195 | for (int iRow = 0; iRow < _staTable->rowCount(); iRow++) {
|
---|
196 | QString hlp;
|
---|
197 | for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
|
---|
198 | if (_staTable->item(iRow, iCol)) {
|
---|
199 | hlp += _staTable->item(iRow, iCol)->text() + ",";
|
---|
200 | }
|
---|
201 | }
|
---|
202 | if (!hlp.isEmpty()) {
|
---|
203 | staList << hlp;
|
---|
204 | }
|
---|
205 | }
|
---|
206 | settings.setValue(_staTable->objectName(), staList);
|
---|
207 | }
|
---|
208 |
|
---|
209 | //
|
---|
210 | ////////////////////////////////////////////////////////////////////////////
|
---|
211 | void t_pppWidgets::slotEnableWidgets() {
|
---|
212 |
|
---|
213 | const static QPalette paletteWhite(QColor(255, 255, 255));
|
---|
214 | const static QPalette paletteGray(QColor(230, 230, 230));
|
---|
215 |
|
---|
216 | bool allDisabled = _dataSource->currentText() == "no";
|
---|
217 | bool realTime = _dataSource->currentText() == "Real-Time Streams";
|
---|
218 | bool rinexFiles = _dataSource->currentText() == "RINEX Files";
|
---|
219 |
|
---|
220 | QListIterator<QWidget*> it(_widgets);
|
---|
221 | while (it.hasNext()) {
|
---|
222 | QWidget* widget = it.next();
|
---|
223 | widget->setEnabled(!allDisabled);
|
---|
224 | }
|
---|
225 |
|
---|
226 | if (realTime) {
|
---|
227 | _rinexObs->setEnabled(false);
|
---|
228 | _rinexNav->setEnabled(false);
|
---|
229 | _corrFile->setEnabled(false);
|
---|
230 | }
|
---|
231 | else if (rinexFiles) {
|
---|
232 | _corrMount->setEnabled(false);
|
---|
233 | }
|
---|
234 |
|
---|
235 | _dataSource->setEnabled(true);
|
---|
236 |
|
---|
237 | it.toFront();
|
---|
238 | while (it.hasNext()) {
|
---|
239 | QWidget* widget = it.next();
|
---|
240 | if (widget->isEnabled()) {
|
---|
241 | widget->setPalette(paletteWhite);
|
---|
242 | }
|
---|
243 | else {
|
---|
244 | widget->setPalette(paletteGray);
|
---|
245 | }
|
---|
246 | }
|
---|
247 | }
|
---|
248 |
|
---|
249 | //
|
---|
250 | ////////////////////////////////////////////////////////////////////////////
|
---|
251 | void t_pppWidgets::slotAddStation() {
|
---|
252 | int iRow = _staTable->rowCount();
|
---|
253 | _staTable->insertRow(iRow);
|
---|
254 | for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
|
---|
255 | _staTable->setItem(iRow, iCol, new QTableWidgetItem(""));
|
---|
256 | }
|
---|
257 | }
|
---|
258 |
|
---|
259 | //
|
---|
260 | ////////////////////////////////////////////////////////////////////////////
|
---|
261 | void t_pppWidgets::slotDelStation() {
|
---|
262 | int nRows = _staTable->rowCount();
|
---|
263 | bool flg[nRows];
|
---|
264 | for (int iRow = 0; iRow < nRows; iRow++) {
|
---|
265 | if (_staTable->isItemSelected(_staTable->item(iRow,1))) {
|
---|
266 | flg[iRow] = true;
|
---|
267 | }
|
---|
268 | else {
|
---|
269 | flg[iRow] = false;
|
---|
270 | }
|
---|
271 | }
|
---|
272 | for (int iRow = nRows-1; iRow >= 0; iRow--) {
|
---|
273 | if (flg[iRow]) {
|
---|
274 | _staTable->removeRow(iRow);
|
---|
275 | }
|
---|
276 | }
|
---|
277 | }
|
---|
278 |
|
---|