Changeset 1932 in ntrip


Ignore:
Timestamp:
Nov 12, 2009, 7:42:21 AM (15 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnc.pro

    r1890 r1932  
    3737          bncipport.h bncnetqueryv0.h bncnetqueryudp.h                \
    3838          bncnetqueryudp0.h bncudpport.h                              \
    39           bncserialport.h bncnetquerys.h                              \
     39          bncserialport.h bncnetquerys.h bncfigure.h                  \
    4040          RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h          \
    4141          RTCM/RTCM2_2021.h RTCM/rtcm_utils.h                         \
     
    5959          bncipport.cpp bncnetqueryv0.cpp bncnetqueryudp.cpp          \
    6060          bncnetqueryudp0.cpp bncudpport.cpp                          \
    61           bncserialport.cpp bncnetquerys.cpp                          \
     61          bncserialport.cpp bncnetquerys.cpp bncfigure.cpp            \
    6262          RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp                        \
    6363          RTCM/RTCM2_2021.cpp RTCM/rtcm_utils.cpp                     \
  • trunk/BNC/bncwindow.cpp

    r1931 r1932  
    5353#include "bnctableitem.h"
    5454#include "bncsettings.h"
     55#include "bncfigure.h"
    5556
    5657using namespace std;
     
    5859// Constructor
    5960////////////////////////////////////////////////////////////////////////////
    60 FWidget::FWidget(QWidget *parent) : QWidget(parent) {
    61   bncSettings settings;
    62   QListIterator<QString> it(settings.value("mountPoints").toStringList());
    63   while (it.hasNext()) {
    64     QStringList hlp   = it.next().split(" ");
    65     QUrl        url(hlp[0]);
    66     QByteArray  staID = url.path().mid(1).toAscii();
    67     _bytes[staID] = new sumAndMean();
    68   }
    69   _counter = 0;
    70   slotNextAnimationFrame();
    71 }
    72 
    73 // Destructor
    74 ////////////////////////////////////////////////////////////////////////////
    75 FWidget::~FWidget() {
    76 }
    77 
    78 //
    79 ////////////////////////////////////////////////////////////////////////////
    80 void FWidget::slotNewData(const QByteArray staID, double nbyte) {
    81   QMutexLocker locker(&_mutex);
    82   QMap<QByteArray, sumAndMean*>::const_iterator it = _bytes.find(staID);
    83   if (it != _bytes.end()) {
    84     it.value()->_sum += nbyte;
    85   }
    86 }
    87 
    88 //
    89 ////////////////////////////////////////////////////////////////////////////
    90 void FWidget::slotNextAnimationFrame() {
    91   QMutexLocker locker(&_mutex);
    92   if (++_counter == 10) {
    93     QMapIterator<QByteArray, sumAndMean*> it(_bytes);
    94     while (it.hasNext()) {
    95       it.next();
    96       it.value()->_mean = it.value()->_sum / _counter;
    97       it.value()->_sum  = 0.0;
    98     }
    99     _counter = 0;
    100   }
    101   update();
    102   QTimer::singleShot(1000, this, SLOT(slotNextAnimationFrame()));
    103 }
    104 
    105 //
    106 ////////////////////////////////////////////////////////////////////////////
    107 void FWidget::paintEvent(QPaintEvent *) {
    108   QRectF rectangle(0, 0, 640, 180);
    109   QBrush rBrush(Qt::white,Qt::SolidPattern);
    110   QPainter painter(this);
    111   painter.fillRect(rectangle,rBrush);
    112   painter.drawRect(rectangle);
    113   QLine line(50, 140, 630, 140);
    114   painter.drawLine(line);
    115   line.setLine(50, 140, 50, 10);
    116   painter.drawLine(line);
    117   QPoint textP(40, 140);
    118   painter.drawText(textP, tr("0"));
    119   textP.setX(20);
    120   textP.setY(25);
    121   painter.drawText(textP, tr("3000"));
    122   int anker=0;
    123   textP.setY(160);
    124   painter.drawText(textP, tr(QTime::currentTime().toString().toAscii()));
    125   textP.setX(300);
    126 
    127   QMapIterator<QByteArray, sumAndMean*> it(_bytes);
    128   while (it.hasNext()) {
    129     it.next();
    130     QByteArray staID = it.key();
    131     double     vv    = it.value()->_mean;
    132     QRectF vrect((100+anker*40), (140-vv), (30), (vv));
    133     QBrush xBrush(Qt::green,Qt::SolidPattern);
    134     textP.setX(100+anker*40);
    135     painter.fillRect(vrect,xBrush);
    136     painter.drawRect(vrect);
    137     painter.drawText(textP, staID);
    138     anker++;
    139   }
    140 }
    141 
    142 // Constructor
    143 ////////////////////////////////////////////////////////////////////////////
    14461bncWindow::bncWindow() {
    14562
    14663  _caster = 0;
    14764
    148   _Figure1 = new FWidget(this);
     65  _bncFigure = new bncFigure(this);
    14966
    15067  int ww = QFontMetrics(this->font()).width('w');
     
    491408  // ----------
    492409  QGridLayout* log2Layout = new QGridLayout;
    493   log2Layout->addWidget(_Figure1,            0,0);
     410  log2Layout->addWidget(_bncFigure,            0,0);
    494411  log2group->setLayout(log2Layout);
    495412
     
    13231240        ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread);
    13241241        connect(thread, SIGNAL(newBytes(QByteArray, double)),
    1325                 _Figure1, SLOT(slotNewData(QByteArray, double)));
     1242                _bncFigure, SLOT(slotNewData(QByteArray, double)));
    13261243
    13271244        break;
  • trunk/BNC/bncwindow.h

    r1931 r1932  
    3232#include "bnccaster.h"
    3333
    34 class FWidget : public QWidget {
    35   Q_OBJECT
    36  public:
    37   FWidget(QWidget *parent);
    38   ~FWidget();
    39  public slots:
    40   void slotNewData(const QByteArray staID, double nbyte);
    41  protected:
    42   void paintEvent(QPaintEvent *event);
    43  private slots:
    44   void slotNextAnimationFrame();
    45  private:
    46   class sumAndMean {
    47    public:
    48     sumAndMean() {_mean = 0.0; _sum = 0.0;}
    49     ~sumAndMean() {}
    50     double _mean;
    51     double _sum;
    52   };
    53   QMap<QByteArray, sumAndMean*> _bytes;
    54   QMutex                        _mutex;
    55   int                           _counter;
    56 };
    57 
    5834class bncAboutDlg : public QDialog {
    5935  Q_OBJECT
     
    6339};
    6440
    65   class bncFlowchartDlg : public QDialog {
     41class bncFlowchartDlg : public QDialog {
    6642  Q_OBJECT
    6743
     
    7147};
    7248
    73   class bncWindow : public QMainWindow {
     49class bncFigure;
     50
     51class bncWindow : public QMainWindow {
    7452  Q_OBJECT
    7553
     
    177155
    178156    QTabWidget* _loggroup;
    179     FWidget*    _Figure1;
     157    bncFigure*  _bncFigure;
    180158
    181159    bncCaster* _caster;
Note: See TracChangeset for help on using the changeset viewer.