Changeset 2753 in ntrip for trunk/BNC/bnctabledlg.cpp


Ignore:
Timestamp:
Dec 1, 2010, 2:02:27 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnctabledlg.cpp

    r1848 r2753  
    4545#include "bncnetqueryv1.h"
    4646#include "bncsettings.h"
     47#include "bncmap.h"
    4748
    4849using namespace std;
     
    140141  connect(_buttonGet, SIGNAL(clicked()), this, SLOT(slotGetTable()));
    141142 
     143  _buttonMap = new QPushButton(tr("Map"), this);
     144  _buttonMap->setEnabled(false);
     145  connect(_buttonMap, SIGNAL(clicked()), this, SLOT(slotShowMap()));
     146 
    142147  _buttonCancel = new QPushButton(tr("Cancel"), this);
    143148  connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
     
    149154  buttonLayout->addWidget(_buttonWhatsThis);
    150155  buttonLayout->addStretch(1);
     156  buttonLayout->addWidget(_buttonMap);
    151157  buttonLayout->addWidget(_buttonGet);
    152158  buttonLayout->addWidget(_buttonCancel);
     
    219225
    220226  _buttonGet->setEnabled(false);
     227  _buttonMap->setEnabled(true);
    221228  _buttonCasterTable->setEnabled(false);
    222229
     
    228235    return;
    229236  }
    230 
     237 
    231238  static const QStringList labels = QString("mountpoint,identifier,format,"
    232239    "format-details,carrier,system,network,country,lat,long,"
     
    291298}
    292299
     300// Show world map
     301////////////////////////////////////////////////////////////////////////////
     302void bncTableDlg::slotShowMap() {
     303
     304  bncMap* winMap = new bncMap(this);
     305  winMap->setGeometry( x(), y()+height()*1.2, 860, 400 );
     306
     307  connect(this, SIGNAL(newPoint(QPointF, QString, QPen)),
     308          winMap, SLOT(slotNewPoint(QPointF, QString, QPen)));
     309  connect(this, SIGNAL(resetMap()), winMap, SLOT(slotResetMap()));
     310     
     311  _buttonMap->setEnabled(false);
     312  showSourceTable();
     313  winMap->exec();
     314  _buttonMap->setEnabled(true);
     315
     316  disconnect(this, SIGNAL(newPoint(QPointF, QString, QPen)),
     317             winMap, SLOT(slotNewPoint(QPointF, QString, QPen)));
     318  disconnect(this, SIGNAL(resetMap()), winMap, SLOT(slotResetMap()));
     319   
     320  delete winMap;
     321}
     322
     323// Show world map
     324////////////////////////////////////////////////////////////////////////////
     325void bncTableDlg::showSourceTable() {
     326
     327  for( int i = 0; i < _allLines.size(); i++ ){
     328       
     329    if( _allLines.at(i).startsWith("STR") == true ){
     330             
     331       QStringList tmp = _allLines.at(i).split(';');
     332       if( tmp.size() > 0 ){
     333                 
     334         QPointF point;
     335                 point.setY( tmp.at(9).toDouble() );
     336                 point.setX( tmp.at(10).toDouble() );
     337         QString site = tmp.at(1);
     338                 site.resize(4);
     339
     340         emit newPoint(point, site, QPen(QBrush(QColor(0,0,255,180)), 5) );
     341       }             
     342     }
     343   }
     344}
     345
     346
    293347// Accept slot
    294348////////////////////////////////////////////////////////////////////////////
     
    306360
    307361  QStringList* mountPoints = new QStringList;
    308 
    309362  if (_table) {
     363//  emit resetMap();
    310364    for (int ir = 0; ir < _table->rowCount(); ir++) {
    311365      QTableWidgetItem* item   = _table->item(ir,0);
     366      QString             site = _table->item(ir,0)->text();
    312367      QString           format = _table->item(ir,2)->text();
    313368      QString         latitude = _table->item(ir,8)->text();
     
    320375        mountPoints->push_back(url.toString() + " " + format + " " + latitude
    321376                        + " " + longitude + " " + nmea + " " + ntripVersion);
     377         
     378        emit newPoint(QPointF(longitude.toDouble(),latitude.toDouble()), site,
     379                      QPen(QBrush(QColor(255,0,0,180)), 13) );
     380
    322381      }
    323382    }
     
    564623  QDialog::accept();
    565624}
    566 
Note: See TracChangeset for help on using the changeset viewer.