source: trunk/FACT++/gui/TempViewer.cc@ 17853

Last change on this file since 17853 was 12016, checked in by lyard, 13 years ago
added the temperature viewer
File size: 1.5 KB
Line 
1/*
2 * TempViewer.cc
3 *
4 * Created on: Aug 26, 2011
5 * Author: lyard
6 */
7#include "Q3DCameraWidget.h"
8#include <qapplication.h>
9#include <qlayout.h>
10
11#include "dic.hxx"
12
13class TemperatureSub : public DimClient
14{
15 DimStampedInfo info;
16 Q3DCameraWidget* view;
17 int numC;
18
19public:
20 TemperatureSub() : info("FSC_CONTROL/TEMPERATURE", (void*)NULL, 0, this), view(NULL)
21 {numC = 0;}
22 void setViewer(Q3DCameraWidget* v) { view = v;}
23 void infoHandler()
24 {
25 DimInfo* I = getInfo();
26 if (!(I==&info))
27 {
28 cout << "Hum, I'm getting info from subsciptions to which I didn\'t subscribe... weird" << endl;
29 return;
30 }
31 float* values = (float*)(I->getData());
32 if (I->getSize() != 60*sizeof(float))
33 {
34 cout << "wrong size: " << I->getSize() << endl;
35 return;
36 }
37 if (view)// && numC > 2)
38 view->updateData(values);
39 numC++;
40 }
41};
42void do3DView(int argc, char** argv)
43{
44 QApplication a(argc, argv);
45
46 Q3DCameraWidget* view = new Q3DCameraWidget();
47 TemperatureSub sub;
48
49 QWidget window;
50 QHBoxLayout* layout = new QHBoxLayout(&window);
51 layout->setContentsMargins(0,0,0,0);
52 layout->addWidget(view);
53// layout->setMouseTracking(true);
54// window.setMouseTracking(true);
55// view->setMouseTracking(true);
56 window.resize(600,600);
57 window.show();
58
59 sub.setViewer(view);
60
61 a.exec();
62
63}
64
65int main(int argc, char** argv)
66{
67 do3DView(argc, argv);
68
69}
Note: See TracBrowser for help on using the repository browser.