[5692] | 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 |
|
---|
[5810] | 43 | #include "PPP/pppWidgets.h"
|
---|
[5692] | 44 | #include "qtfilechooser.h"
|
---|
[5694] | 45 | #include "bncsettings.h"
|
---|
[5692] | 46 |
|
---|
| 47 | using namespace std;
|
---|
| 48 |
|
---|
| 49 | // Constructor
|
---|
| 50 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 51 | t_pppWidgets::t_pppWidgets() {
|
---|
[5699] | 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;
|
---|
[5701] | 56 | _corrMount = new QLineEdit(); _corrMount ->setObjectName("PPP/corrMount"); _widgets << _corrMount;
|
---|
[5699] | 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;
|
---|
[5703] | 70 | _addStaButton = new QPushButton("Add Station"); _widgets << _addStaButton;
|
---|
| 71 | _delStaButton = new QPushButton("Delete Station"); _widgets << _delStaButton;
|
---|
[5893] | 72 | _plotCoordinates = new QLineEdit; _plotCoordinates ->setObjectName("PPP/plotCoordinates"); _widgets << _plotCoordinates;
|
---|
| 73 | _mapWinButton = new QPushButton; _mapWinButton ->setObjectName("PPP/mapWinButton"); _widgets << _mapWinButton;
|
---|
| 74 | _gmRadioButton = new QRadioButton; _gmRadioButton ->setObjectName("PPP/gmRadioButton"); _widgets << _gmRadioButton;
|
---|
| 75 | _osmRadioButton = new QRadioButton; _osmRadioButton ->setObjectName("PPP/osmRadioButton"); _widgets << _osmRadioButton;
|
---|
| 76 | _mapWinDotSizeLineEdit = new QLineEdit; _mapWinDotSizeLineEdit ->setObjectName("PPP/mapWinDotSizeLineEdit"); _widgets << _mapWinDotSizeLineEdit;
|
---|
| 77 | _mapWinDotColorComboBox = new QComboBox; _mapWinDotColorComboBox->setObjectName("PPP/mapWinDotColorComboBox"); _widgets << _mapWinDotColorComboBox;
|
---|
| 78 | _mapSpeedSlider = new QSlider; _mapSpeedSlider ->setObjectName("PPP/mapSpeedSlider"); _widgets << _mapSpeedSlider;
|
---|
| 79 |
|
---|
[5697] | 80 | _dataSource->setEditable(false);
|
---|
[5699] | 81 | _dataSource->addItems(QString("no,Real-Time Streams,RINEX Files").split(","));
|
---|
| 82 | connect(_dataSource, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets()));
|
---|
[5697] | 83 |
|
---|
| 84 | _lcGPS->setEditable(false);
|
---|
[5699] | 85 | _lcGPS->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
[5697] | 86 |
|
---|
| 87 | _lcGLONASS->setEditable(false);
|
---|
[5699] | 88 | _lcGLONASS->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
[5697] | 89 |
|
---|
| 90 | _lcGalileo->setEditable(false);
|
---|
[5699] | 91 | _lcGalileo->addItems(QString("no,P3,L3,P3&L3").split(","));
|
---|
[5697] | 92 |
|
---|
[5698] | 93 | _corrWaitTime->setMinimum(0);
|
---|
| 94 | _corrWaitTime->setMaximum(20);
|
---|
| 95 | _corrWaitTime->setSingleStep(1);
|
---|
| 96 | _corrWaitTime->setSuffix(" sec");
|
---|
| 97 | _corrWaitTime->setSpecialValueText("no");
|
---|
| 98 |
|
---|
[5702] | 99 | _staTable->setColumnCount(9);
|
---|
[5703] | 100 | _staTable->setRowCount(0);
|
---|
[5702] | 101 | _staTable->setHorizontalHeaderLabels(
|
---|
| 102 | QString("Station,Sigma N,Sigma E,Sigma H,Noise N,Noise E,Noise H,Tropo Sigma,Tropo Noise").split(","));
|
---|
[5703] | 103 | _staTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
---|
| 104 | _staTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
---|
| 105 | _staTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
|
---|
| 106 | /// _staTable->horizontalHeader()->setStretchLastSection(true);
|
---|
| 107 | _staTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
---|
| 108 |
|
---|
| 109 | connect(_addStaButton, SIGNAL(clicked()), this, SLOT(slotAddStation()));
|
---|
| 110 | connect(_delStaButton, SIGNAL(clicked()), this, SLOT(slotDelStation()));
|
---|
[5702] | 111 |
|
---|
[5893] | 112 | _mapWinButton->setText("Open Map");
|
---|
| 113 |
|
---|
| 114 | _mapWinDotColorComboBox->setEditable(false);
|
---|
| 115 | _mapWinDotColorComboBox->addItems(QString("red,yellow").split(","));
|
---|
| 116 |
|
---|
| 117 | _mapSpeedSlider->setOrientation(Qt::Horizontal);
|
---|
| 118 | _mapSpeedSlider->setRange(1, 100);
|
---|
| 119 | _mapSpeedSlider->setTickPosition(QSlider::TicksBelow);
|
---|
| 120 | _mapSpeedSlider->setTickInterval(10);
|
---|
| 121 |
|
---|
[5895] | 122 | _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."));
|
---|
| 123 | _gmRadioButton->setWhatsThis(tr("<p>Specify Google Maps as the background for your rover positions."));
|
---|
| 124 | _osmRadioButton->setWhatsThis(tr("<p>Specify Open Street Map as the background for your rover positions."));
|
---|
| 125 | _mapWinDotSizeLineEdit->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>"));
|
---|
| 126 | _mapWinDotColorComboBox->setWhatsThis(tr("<p>Specify the color of dots showing the rover track.</p>"));
|
---|
| 127 | _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."));
|
---|
| 128 |
|
---|
[5696] | 129 | readOptions();
|
---|
[5692] | 130 | }
|
---|
| 131 |
|
---|
[5694] | 132 | //
|
---|
| 133 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5696] | 134 | void t_pppWidgets::readOptions() {
|
---|
| 135 |
|
---|
| 136 | bncSettings settings;
|
---|
| 137 |
|
---|
[5707] | 138 | // ComboBoxes
|
---|
| 139 | // ----------
|
---|
[5696] | 140 | int ii = _dataSource->findText(settings.value(_dataSource->objectName()).toString());
|
---|
| 141 | if (ii != -1) {
|
---|
| 142 | _dataSource->setCurrentIndex(ii);
|
---|
| 143 | }
|
---|
| 144 | ii = _lcGPS->findText(settings.value(_lcGPS->objectName()).toString());
|
---|
| 145 | if (ii != -1) {
|
---|
| 146 | _lcGPS->setCurrentIndex(ii);
|
---|
| 147 | }
|
---|
| 148 | ii = _lcGLONASS->findText(settings.value(_lcGLONASS->objectName()).toString());
|
---|
| 149 | if (ii != -1) {
|
---|
| 150 | _lcGLONASS->setCurrentIndex(ii);
|
---|
| 151 | }
|
---|
| 152 | ii = _lcGalileo->findText(settings.value(_lcGalileo->objectName()).toString());
|
---|
| 153 | if (ii != -1) {
|
---|
| 154 | _lcGalileo->setCurrentIndex(ii);
|
---|
| 155 | }
|
---|
| 156 |
|
---|
[5707] | 157 | // FileChoosers
|
---|
| 158 | // ------------
|
---|
[5696] | 159 | _rinexObs ->setFileName(settings.value(_rinexObs ->objectName()).toString());
|
---|
| 160 | _rinexNav ->setFileName(settings.value(_rinexNav ->objectName()).toString());
|
---|
| 161 | _corrFile ->setFileName(settings.value(_corrFile ->objectName()).toString());
|
---|
| 162 | _crdFile ->setFileName(settings.value(_crdFile ->objectName()).toString());
|
---|
| 163 | _antexFile->setFileName(settings.value(_antexFile->objectName()).toString());
|
---|
| 164 |
|
---|
[5707] | 165 | // LineEdits
|
---|
| 166 | // ---------
|
---|
[5701] | 167 | _corrMount->setText(settings.value(_corrMount->objectName()).toString());
|
---|
| 168 | _logFile ->setText(settings.value(_logFile ->objectName()).toString());
|
---|
| 169 | _nmeaFile ->setText(settings.value(_nmeaFile ->objectName()).toString());
|
---|
| 170 | _nmeaPort ->setText(settings.value(_nmeaPort ->objectName()).toString());
|
---|
| 171 | _sigmaC1 ->setText(settings.value(_sigmaC1 ->objectName()).toString());
|
---|
| 172 | _sigmaL1 ->setText(settings.value(_sigmaL1 ->objectName()).toString());
|
---|
[5696] | 173 |
|
---|
[5707] | 174 | // SpinBox
|
---|
| 175 | // -------
|
---|
[5696] | 176 | _corrWaitTime->setValue(settings.value(_corrWaitTime->objectName()).toInt());
|
---|
[5707] | 177 |
|
---|
| 178 | // Table with stations
|
---|
| 179 | // -------------------
|
---|
| 180 | for (int iRow = _staTable->rowCount()-1; iRow >=0; iRow--) {
|
---|
| 181 | _staTable->removeRow(iRow);
|
---|
| 182 | }
|
---|
| 183 | int iRow = -1;
|
---|
| 184 | QListIterator<QString> it(settings.value(_staTable->objectName()).toStringList());
|
---|
| 185 | while (it.hasNext()) {
|
---|
| 186 | QStringList hlp = it.next().split(",");
|
---|
| 187 | ++iRow;
|
---|
| 188 | _staTable->insertRow(iRow);
|
---|
| 189 | for (int iCol = 0; iCol < hlp.size(); iCol++) {
|
---|
| 190 | _staTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
|
---|
| 191 | }
|
---|
| 192 | }
|
---|
[5893] | 193 |
|
---|
| 194 | // Plots and Maps
|
---|
| 195 | // --------------
|
---|
| 196 | _plotCoordinates ->setText(settings.value(_plotCoordinates->objectName()).toString());
|
---|
| 197 | _gmRadioButton ->setChecked(!settings.value(_gmRadioButton->objectName()).toBool());
|
---|
| 198 | _osmRadioButton ->setChecked(settings.value(_osmRadioButton->objectName()).toBool());
|
---|
| 199 | _mapWinDotSizeLineEdit->setText(settings.value(_mapWinDotSizeLineEdit->objectName()).toString());
|
---|
| 200 |
|
---|
| 201 | ii = _mapWinDotColorComboBox->findText(settings.value(_mapWinDotColorComboBox->objectName()).toString());
|
---|
| 202 | if (ii != -1) {
|
---|
| 203 | _mapWinDotColorComboBox->setCurrentIndex(ii);
|
---|
| 204 | }
|
---|
| 205 |
|
---|
| 206 | int speed = settings.value(_mapSpeedSlider->objectName()).toInt();
|
---|
| 207 | if (speed == 0) speed = _mapSpeedSlider->maximum();
|
---|
| 208 | _mapSpeedSlider->setSliderPosition(speed);
|
---|
[5696] | 209 | }
|
---|
| 210 |
|
---|
| 211 | //
|
---|
| 212 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5694] | 213 | void t_pppWidgets::saveOptions() {
|
---|
| 214 |
|
---|
| 215 | bncSettings settings;
|
---|
| 216 |
|
---|
[5695] | 217 | settings.setValue(_dataSource ->objectName(), _dataSource ->currentText());
|
---|
| 218 | settings.setValue(_rinexObs ->objectName(), _rinexObs ->fileName());
|
---|
| 219 | settings.setValue(_rinexNav ->objectName(), _rinexNav ->fileName());
|
---|
[5701] | 220 | settings.setValue(_corrMount ->objectName(), _corrMount ->text());
|
---|
[5695] | 221 | settings.setValue(_corrFile ->objectName(), _corrFile ->fileName());
|
---|
| 222 | settings.setValue(_crdFile ->objectName(), _crdFile ->fileName());
|
---|
| 223 | settings.setValue(_antexFile ->objectName(), _antexFile ->fileName());
|
---|
| 224 | settings.setValue(_logFile ->objectName(), _logFile ->text());
|
---|
| 225 | settings.setValue(_nmeaFile ->objectName(), _nmeaFile ->text());
|
---|
| 226 | settings.setValue(_nmeaPort ->objectName(), _nmeaPort ->text());
|
---|
| 227 | settings.setValue(_lcGPS ->objectName(), _lcGPS ->currentText());
|
---|
| 228 | settings.setValue(_lcGLONASS ->objectName(), _lcGLONASS ->currentText());
|
---|
| 229 | settings.setValue(_lcGalileo ->objectName(), _lcGalileo ->currentText());
|
---|
| 230 | settings.setValue(_sigmaC1 ->objectName(), _sigmaC1 ->text());
|
---|
| 231 | settings.setValue(_sigmaL1 ->objectName(), _sigmaL1 ->text());
|
---|
| 232 | settings.setValue(_corrWaitTime->objectName(), _corrWaitTime->value());
|
---|
[5694] | 233 |
|
---|
[5707] | 234 | QStringList staList;
|
---|
| 235 | for (int iRow = 0; iRow < _staTable->rowCount(); iRow++) {
|
---|
| 236 | QString hlp;
|
---|
| 237 | for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
|
---|
| 238 | if (_staTable->item(iRow, iCol)) {
|
---|
| 239 | hlp += _staTable->item(iRow, iCol)->text() + ",";
|
---|
| 240 | }
|
---|
| 241 | }
|
---|
| 242 | if (!hlp.isEmpty()) {
|
---|
| 243 | staList << hlp;
|
---|
| 244 | }
|
---|
| 245 | }
|
---|
| 246 | settings.setValue(_staTable->objectName(), staList);
|
---|
[5894] | 247 |
|
---|
| 248 | settings.setValue(_plotCoordinates ->objectName(), _plotCoordinates ->text());
|
---|
| 249 | settings.setValue(_gmRadioButton ->objectName(), _gmRadioButton ->isChecked());
|
---|
| 250 | settings.setValue(_osmRadioButton ->objectName(), _osmRadioButton ->isChecked());
|
---|
| 251 | settings.setValue(_mapWinDotSizeLineEdit ->objectName(), _mapWinDotSizeLineEdit ->text());
|
---|
| 252 | settings.setValue(_mapWinDotColorComboBox->objectName(), _mapWinDotColorComboBox->currentText());
|
---|
| 253 | settings.setValue(_mapSpeedSlider ->objectName(), _mapSpeedSlider ->value());
|
---|
[5694] | 254 | }
|
---|
[5699] | 255 |
|
---|
| 256 | //
|
---|
| 257 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 258 | void t_pppWidgets::slotEnableWidgets() {
|
---|
| 259 |
|
---|
| 260 | const static QPalette paletteWhite(QColor(255, 255, 255));
|
---|
| 261 | const static QPalette paletteGray(QColor(230, 230, 230));
|
---|
| 262 |
|
---|
| 263 | bool allDisabled = _dataSource->currentText() == "no";
|
---|
| 264 | bool realTime = _dataSource->currentText() == "Real-Time Streams";
|
---|
[5701] | 265 | bool rinexFiles = _dataSource->currentText() == "RINEX Files";
|
---|
[5699] | 266 |
|
---|
| 267 | QListIterator<QWidget*> it(_widgets);
|
---|
| 268 | while (it.hasNext()) {
|
---|
[5700] | 269 | QWidget* widget = it.next();
|
---|
| 270 | widget->setEnabled(!allDisabled);
|
---|
[5699] | 271 | }
|
---|
| 272 |
|
---|
[5701] | 273 | if (realTime) {
|
---|
| 274 | _rinexObs->setEnabled(false);
|
---|
| 275 | _rinexNav->setEnabled(false);
|
---|
| 276 | _corrFile->setEnabled(false);
|
---|
| 277 | }
|
---|
| 278 | else if (rinexFiles) {
|
---|
| 279 | _corrMount->setEnabled(false);
|
---|
| 280 | }
|
---|
| 281 |
|
---|
[5699] | 282 | _dataSource->setEnabled(true);
|
---|
[5700] | 283 |
|
---|
| 284 | it.toFront();
|
---|
| 285 | while (it.hasNext()) {
|
---|
| 286 | QWidget* widget = it.next();
|
---|
| 287 | if (widget->isEnabled()) {
|
---|
| 288 | widget->setPalette(paletteWhite);
|
---|
| 289 | }
|
---|
| 290 | else {
|
---|
| 291 | widget->setPalette(paletteGray);
|
---|
| 292 | }
|
---|
| 293 | }
|
---|
[5699] | 294 | }
|
---|
[5703] | 295 |
|
---|
| 296 | //
|
---|
| 297 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 298 | void t_pppWidgets::slotAddStation() {
|
---|
[5706] | 299 | int iRow = _staTable->rowCount();
|
---|
| 300 | _staTable->insertRow(iRow);
|
---|
| 301 | for (int iCol = 0; iCol < _staTable->columnCount(); iCol++) {
|
---|
| 302 | _staTable->setItem(iRow, iCol, new QTableWidgetItem(""));
|
---|
| 303 | }
|
---|
[5703] | 304 | }
|
---|
| 305 |
|
---|
| 306 | //
|
---|
| 307 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 308 | void t_pppWidgets::slotDelStation() {
|
---|
[5706] | 309 | int nRows = _staTable->rowCount();
|
---|
| 310 | bool flg[nRows];
|
---|
| 311 | for (int iRow = 0; iRow < nRows; iRow++) {
|
---|
| 312 | if (_staTable->isItemSelected(_staTable->item(iRow,1))) {
|
---|
| 313 | flg[iRow] = true;
|
---|
| 314 | }
|
---|
| 315 | else {
|
---|
| 316 | flg[iRow] = false;
|
---|
| 317 | }
|
---|
| 318 | }
|
---|
| 319 | for (int iRow = nRows-1; iRow >= 0; iRow--) {
|
---|
| 320 | if (flg[iRow]) {
|
---|
| 321 | _staTable->removeRow(iRow);
|
---|
| 322 | }
|
---|
| 323 | }
|
---|
[5703] | 324 | }
|
---|
[5707] | 325 |
|
---|