FACT++  1.0
TempViewer.cc
Go to the documentation of this file.
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 
13 class TemperatureSub : public DimClient
14 {
17  int numC;
18 
19 public:
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 };
42 void do3DView(int argc, char** argv)
43 {
44  QApplication a(argc, argv);
45 
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 
65 int main(int argc, char** argv)
66 {
67  do3DView(argc, argv);
68 
69 }
int main(int argc, char **argv)
Definition: TempViewer.cc:65
void do3DView(int argc, char **argv)
Definition: TempViewer.cc:42
void infoHandler()
Definition: TempViewer.cc:23
Definition: dic.hxx:31
int getSize()
Definition: dic.hxx:100
Q3DCameraWidget * view
Definition: TempViewer.cc:16
void * getData()
Definition: diccpp.cxx:213
void setViewer(Q3DCameraWidget *v)
Definition: TempViewer.cc:22
DimStampedInfo info
Definition: TempViewer.cc:15
DimInfo * getInfo()
Definition: dic.hxx:26