| 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
| 5 | // created: 2014/01/22
|
---|
| 6 | // filename: UsRangeFinder.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Base class for UsRangeFinder
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "UsRangeFinder.h"
|
---|
| 19 | #include <FrameworkManager.h>
|
---|
| 20 | #include <Tab.h>
|
---|
| 21 | #include <TabWidget.h>
|
---|
| 22 | #include <GroupBox.h>
|
---|
| 23 | #include <Layout.h>
|
---|
| 24 | #include <DataPlot1D.h>
|
---|
| 25 | #include <cvmatrix.h>
|
---|
| 26 |
|
---|
| 27 | using std::string;
|
---|
| 28 | using namespace flair::core;
|
---|
| 29 | using namespace flair::gui;
|
---|
| 30 |
|
---|
| 31 | namespace flair
|
---|
| 32 | {
|
---|
| 33 | namespace sensor
|
---|
| 34 | {
|
---|
| 35 |
|
---|
| 36 | UsRangeFinder::UsRangeFinder(const FrameworkManager* parent,string name) : IODevice(parent,name)
|
---|
| 37 | {
|
---|
| 38 | plot_tab=NULL;
|
---|
| 39 |
|
---|
| 40 | cvmatrix_descriptor* desc=new cvmatrix_descriptor(1,1);
|
---|
| 41 | desc->SetElementName(0,0,name);
|
---|
| 42 | output=new cvmatrix(this,desc,floatType);
|
---|
| 43 | AddDataToLog(output);
|
---|
| 44 |
|
---|
| 45 | //station sol
|
---|
| 46 | 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);
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 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;
|
---|
| 59 |
|
---|
| 60 | output=NULL;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | UsRangeFinder::~UsRangeFinder()
|
---|
| 64 | {
|
---|
| 65 | if(main_tab!=NULL) delete main_tab;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | GroupBox* UsRangeFinder::GetGroupBox(void) const
|
---|
| 69 | {
|
---|
| 70 | return setup_groupbox;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | Layout* UsRangeFinder::GetLayout(void) const
|
---|
| 74 | {
|
---|
| 75 | return sensor_tab;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | DataPlot1D* UsRangeFinder::GetPlot(void) const
|
---|
| 79 | {
|
---|
| 80 | return plot;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 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 | }
|
---|
| 115 |
|
---|
| 116 | } // end namespace sensor
|
---|
| 117 | } // end namespace flair
|
---|