Changeset 15 in flair-src for trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp
r3 r15 29 29 using namespace flair::gui; 30 30 31 namespace flair 32 { 33 namespace sensor 34 { 31 namespace flair { 32 namespace sensor { 35 33 36 UsRangeFinder::UsRangeFinder(const FrameworkManager * parent,string name) : IODevice(parent,name)37 {38 plot_tab=NULL;34 UsRangeFinder::UsRangeFinder(const FrameworkManager *parent, string name) 35 : IODevice(parent, name) { 36 plot_tab = NULL; 39 37 40 cvmatrix_descriptor* desc=new cvmatrix_descriptor(1,1);41 desc->SetElementName(0,0,name);42 output=new cvmatrix(this,desc,floatType);43 38 cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1); 39 desc->SetElementName(0, 0, name); 40 output = new cvmatrix(this, desc, floatType); 41 AddDataToLog(output); 44 42 45 //station sol46 main_tab=new Tab(parent->GetTabWidget(),name);47 tab=new TabWidget(main_tab->NewRow(),name);48 sensor_tab=new Tab(tab,"Reglages");49 setup_groupbox=new GroupBox(sensor_tab->NewRow(),name);43 // station sol 44 main_tab = new Tab(parent->GetTabWidget(), name); 45 tab = new TabWidget(main_tab->NewRow(), name); 46 sensor_tab = new Tab(tab, "Reglages"); 47 setup_groupbox = new GroupBox(sensor_tab->NewRow(), name); 50 48 } 51 49 52 UsRangeFinder::UsRangeFinder(const IODevice * parent,std::string name) : IODevice(parent,name)53 {54 plot_tab=NULL;55 main_tab=NULL;56 tab=NULL;57 sensor_tab=NULL;58 setup_groupbox=NULL;50 UsRangeFinder::UsRangeFinder(const IODevice *parent, std::string name) 51 : IODevice(parent, name) { 52 plot_tab = NULL; 53 main_tab = NULL; 54 tab = NULL; 55 sensor_tab = NULL; 56 setup_groupbox = NULL; 59 57 60 output=NULL;58 output = NULL; 61 59 } 62 60 63 UsRangeFinder::~UsRangeFinder() 64 { 65 if(main_tab!=NULL)delete main_tab;61 UsRangeFinder::~UsRangeFinder() { 62 if (main_tab != NULL) 63 delete main_tab; 66 64 } 67 65 68 GroupBox* UsRangeFinder::GetGroupBox(void) const 69 { 70 return setup_groupbox; 66 GroupBox *UsRangeFinder::GetGroupBox(void) const { return setup_groupbox; } 67 68 Layout *UsRangeFinder::GetLayout(void) const { return sensor_tab; } 69 70 DataPlot1D *UsRangeFinder::GetPlot(void) const { return plot; } 71 72 Tab *UsRangeFinder::GetPlotTab(void) const { return plot_tab; } 73 74 void UsRangeFinder::UseDefaultPlot(void) { 75 if (tab == NULL) { 76 Err("not applicable for simulation part.\n"); 77 return; 78 } 79 80 plot_tab = new Tab(tab, "Mesures"); 81 plot = new DataPlot1D(plot_tab->NewRow(), ObjectName(), 0, 2); 82 plot->AddCurve(output->Element(0)); 71 83 } 72 84 73 Layout* UsRangeFinder::GetLayout(void) const 74 { 75 return sensor_tab; 85 void UsRangeFinder::LockUserInterface(void) const { 86 setup_groupbox->setEnabled(false); 76 87 } 77 88 78 DataPlot1D* UsRangeFinder::GetPlot(void) const 79 { 80 return plot; 89 void UsRangeFinder::UnlockUserInterface(void) const { 90 setup_groupbox->setEnabled(true); 81 91 } 82 92 83 Tab* UsRangeFinder::GetPlotTab(void) const 84 { 85 return plot_tab; 86 } 87 88 void UsRangeFinder::UseDefaultPlot(void) 89 { 90 if(tab==NULL) 91 { 92 Err("not applicable for simulation part.\n"); 93 return; 94 } 95 96 plot_tab=new Tab(tab,"Mesures"); 97 plot=new DataPlot1D(plot_tab->NewRow(),ObjectName(),0,2); 98 plot->AddCurve(output->Element(0)); 99 } 100 101 void UsRangeFinder::LockUserInterface(void) const 102 { 103 setup_groupbox->setEnabled(false); 104 } 105 106 void UsRangeFinder::UnlockUserInterface(void) const 107 { 108 setup_groupbox->setEnabled(true); 109 } 110 111 float UsRangeFinder::Value(void) const 112 { 113 return output->Value(0,0); 114 } 93 float UsRangeFinder::Value(void) const { return output->Value(0, 0); } 115 94 116 95 } // end namespace sensor
Note:
See TracChangeset
for help on using the changeset viewer.