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

Last change on this file since 122 was 15, checked in by Bayard Gildas, 6 years ago

sources reformatted with flair-format-dir script

File size: 2.4 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]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
[15]31namespace flair {
32namespace sensor {
[3]33
[15]34UsRangeFinder::UsRangeFinder(const FrameworkManager *parent, string name)
35 : IODevice(parent, name) {
36 plot_tab = NULL;
[3]37
[15]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);
[3]42
[15]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);
[3]48}
49
[15]50UsRangeFinder::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;
[3]57
[15]58 output = NULL;
[3]59}
60
[15]61UsRangeFinder::~UsRangeFinder() {
62 if (main_tab != NULL)
63 delete main_tab;
[3]64}
65
[15]66GroupBox *UsRangeFinder::GetGroupBox(void) const { return setup_groupbox; }
[3]67
[15]68Layout *UsRangeFinder::GetLayout(void) const { return sensor_tab; }
[3]69
[15]70DataPlot1D *UsRangeFinder::GetPlot(void) const { return plot; }
[3]71
[15]72Tab *UsRangeFinder::GetPlotTab(void) const { return plot_tab; }
[3]73
[15]74void UsRangeFinder::UseDefaultPlot(void) {
75 if (tab == NULL) {
76 Err("not applicable for simulation part.\n");
77 return;
78 }
[3]79
[15]80 plot_tab = new Tab(tab, "Mesures");
81 plot = new DataPlot1D(plot_tab->NewRow(), ObjectName(), 0, 2);
82 plot->AddCurve(output->Element(0));
[3]83}
84
[15]85void UsRangeFinder::LockUserInterface(void) const {
86 setup_groupbox->setEnabled(false);
[3]87}
88
[15]89void UsRangeFinder::UnlockUserInterface(void) const {
90 setup_groupbox->setEnabled(true);
[3]91}
92
[15]93float UsRangeFinder::Value(void) const { return output->Value(0, 0); }
[3]94
95} // end namespace sensor
96} // end namespace flair
Note: See TracBrowser for help on using the repository browser.