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

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

add us plot

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