Changeset 1932 in ntrip
- Timestamp:
- Nov 12, 2009, 7:42:21 AM (15 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bnc.pro
r1890 r1932 37 37 bncipport.h bncnetqueryv0.h bncnetqueryudp.h \ 38 38 bncnetqueryudp0.h bncudpport.h \ 39 bncserialport.h bncnetquerys.h 39 bncserialport.h bncnetquerys.h bncfigure.h \ 40 40 RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h \ 41 41 RTCM/RTCM2_2021.h RTCM/rtcm_utils.h \ … … 59 59 bncipport.cpp bncnetqueryv0.cpp bncnetqueryudp.cpp \ 60 60 bncnetqueryudp0.cpp bncudpport.cpp \ 61 bncserialport.cpp bncnetquerys.cpp 61 bncserialport.cpp bncnetquerys.cpp bncfigure.cpp \ 62 62 RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp \ 63 63 RTCM/RTCM2_2021.cpp RTCM/rtcm_utils.cpp \ -
trunk/BNC/bncwindow.cpp
r1931 r1932 53 53 #include "bnctableitem.h" 54 54 #include "bncsettings.h" 55 #include "bncfigure.h" 55 56 56 57 using namespace std; … … 58 59 // Constructor 59 60 //////////////////////////////////////////////////////////////////////////// 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 // Destructor74 ////////////////////////////////////////////////////////////////////////////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 // Constructor143 ////////////////////////////////////////////////////////////////////////////144 61 bncWindow::bncWindow() { 145 62 146 63 _caster = 0; 147 64 148 _ Figure1 = new FWidget(this);65 _bncFigure = new bncFigure(this); 149 66 150 67 int ww = QFontMetrics(this->font()).width('w'); … … 491 408 // ---------- 492 409 QGridLayout* log2Layout = new QGridLayout; 493 log2Layout->addWidget(_ Figure1, 0,0);410 log2Layout->addWidget(_bncFigure, 0,0); 494 411 log2group->setLayout(log2Layout); 495 412 … … 1323 1240 ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread); 1324 1241 connect(thread, SIGNAL(newBytes(QByteArray, double)), 1325 _ Figure1, SLOT(slotNewData(QByteArray, double)));1242 _bncFigure, SLOT(slotNewData(QByteArray, double))); 1326 1243 1327 1244 break; -
trunk/BNC/bncwindow.h
r1931 r1932 32 32 #include "bnccaster.h" 33 33 34 class FWidget : public QWidget {35 Q_OBJECT36 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 58 34 class bncAboutDlg : public QDialog { 59 35 Q_OBJECT … … 63 39 }; 64 40 65 41 class bncFlowchartDlg : public QDialog { 66 42 Q_OBJECT 67 43 … … 71 47 }; 72 48 73 class bncWindow : public QMainWindow { 49 class bncFigure; 50 51 class bncWindow : public QMainWindow { 74 52 Q_OBJECT 75 53 … … 177 155 178 156 QTabWidget* _loggroup; 179 FWidget* _Figure1;157 bncFigure* _bncFigure; 180 158 181 159 bncCaster* _caster;
Note:
See TracChangeset
for help on using the changeset viewer.