source: flair-src/branches/sanscv/lib/FlairSensorActuator/src/UsRangeFinder.cpp@ 342

Last change on this file since 342 was 324, checked in by Sanahuja Guillaume, 5 years ago

removing opencv dependency

File size: 2.4 KB
Line 
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 <Matrix.h>
26
27using std::string;
28using namespace flair::core;
29using namespace flair::gui;
30
31namespace flair {
32namespace sensor {
33
34UsRangeFinder::UsRangeFinder(string name)
35 : IODevice(getFrameworkManager(), name) {
36 plot_tab = NULL;
37
38 MatrixDescriptor *desc = new MatrixDescriptor(1, 1);
39 desc->SetElementName(0, 0, name);
40 output = new Matrix(this, desc, floatType);
41 delete desc;
42 AddDataToLog(output);
43
44 // station sol
45 main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
46 tab = new TabWidget(main_tab->NewRow(), name);
47 sensor_tab = new Tab(tab, "Reglages");
48 setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
49}
50
51UsRangeFinder::UsRangeFinder(const IODevice *parent, std::string name)
52 : IODevice(parent, name) {
53 plot_tab = NULL;
54 main_tab = NULL;
55 tab = NULL;
56 sensor_tab = NULL;
57 setup_groupbox = NULL;
58
59 output = NULL;
60}
61
62UsRangeFinder::~UsRangeFinder() {
63 if (main_tab != NULL)
64 delete main_tab;
65}
66
67GroupBox *UsRangeFinder::GetGroupBox(void) const { return setup_groupbox; }
68
69Layout *UsRangeFinder::GetLayout(void) const { return sensor_tab; }
70
71DataPlot1D *UsRangeFinder::GetPlot(void) const { return plot; }
72
73Tab *UsRangeFinder::GetPlotTab(void) const { return plot_tab; }
74
75TabWidget *UsRangeFinder::GetTabWidget(void) const { return tab; }
76
77void UsRangeFinder::UseDefaultPlot(void) {
78 if (tab == NULL) {
79 Err("not applicable for simulation part.\n");
80 return;
81 }
82
83 plot_tab = new Tab(tab, "Mesures");
84 plot = new DataPlot1D(plot_tab->NewRow(), ObjectName(), 0, 2);
85 plot->AddCurve(output->Element(0));
86}
87
88void UsRangeFinder::LockUserInterface(void) const {
89 setup_groupbox->setEnabled(false);
90}
91
92void UsRangeFinder::UnlockUserInterface(void) const {
93 setup_groupbox->setEnabled(true);
94}
95
96float UsRangeFinder::Value(void) const { return output->Value(0, 0); }
97
98} // end namespace sensor
99} // end namespace flair
Note: See TracBrowser for help on using the repository browser.