source: flair-src/trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp @ 3

Last change on this file since 3 was 3, checked in by Sanahuja Guillaume, 6 years ago

sensoractuator

File size: 2.4 KB
RevLine 
[3]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
27using std::string;
28using namespace flair::core;
29using namespace flair::gui;
30
31namespace flair
32{
33namespace sensor
34{
35
36UsRangeFinder::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
52UsRangeFinder::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
63UsRangeFinder::~UsRangeFinder()
64{
65    if(main_tab!=NULL) delete main_tab;
66}
67
68GroupBox* UsRangeFinder::GetGroupBox(void) const
69{
70    return setup_groupbox;
71}
72
73Layout* UsRangeFinder::GetLayout(void) const
74{
75    return sensor_tab;
76}
77
78DataPlot1D* UsRangeFinder::GetPlot(void) const
79{
80    return plot;
81}
82
83Tab* UsRangeFinder::GetPlotTab(void) const
84{
85    return plot_tab;
86}
87
88void 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
101void UsRangeFinder::LockUserInterface(void) const
102{
103    setup_groupbox->setEnabled(false);
104}
105
106void UsRangeFinder::UnlockUserInterface(void) const
107{
108    setup_groupbox->setEnabled(true);
109}
110
111float UsRangeFinder::Value(void) const
112{
113    return output->Value(0,0);
114}
115
116} // end namespace sensor
117} // end namespace flair
Note: See TracBrowser for help on using the repository browser.