source: flair-src/trunk/lib/FlairCore/src/RangeFinderPlot.cpp@ 27

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

sources reformatted with flair-format-dir script

File size: 2.0 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/07/23
6// filename: RangeFinderPlot.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class displaying a 2D plot on the ground station for laser range
14// finder like Hokuyo
15//
16//
17/*********************************************************************/
18
19#include "RangeFinderPlot.h"
20#include "cvmatrix.h"
21#include "Layout.h"
22#include "LayoutPosition.h"
23#include "FrameworkManager.h"
24#include <cxcore.h>
25
26using std::string;
27using namespace flair::core;
28
29namespace flair {
30namespace gui {
31
32RangeFinderPlot::RangeFinderPlot(const LayoutPosition *position, string name,
33 string x_name, float xmin, float xmax,
34 string y_name, float ymin, float ymax,
35 const cvmatrix *datas, float start_angle,
36 float end_angle, uint32_t nb_samples)
37 : SendData(position, name, "RangeFinderPlot", 200) {
38 this->datas = datas;
39
40 SetSendSize(datas->GetDataType().GetSize());
41
42 SetVolatileXmlProp("xmin", xmin);
43 SetVolatileXmlProp("xmax", xmax);
44 SetVolatileXmlProp("ymin", ymin);
45 SetVolatileXmlProp("ymax", ymax);
46 SetVolatileXmlProp("x_name", x_name);
47 SetVolatileXmlProp("y_name", y_name);
48 SetVolatileXmlProp("start_angle", start_angle);
49 SetVolatileXmlProp("end_angle", end_angle);
50 SetVolatileXmlProp("nb_samples", nb_samples);
51 SetVolatileXmlProp(
52 "type", datas->GetDataType().GetElementDataType().GetDescription());
53 SendXml();
54
55 if (datas->Cols() != 1 || datas->Rows() != nb_samples)
56 Err("Wrong input matrix size\n");
57}
58
59RangeFinderPlot::~RangeFinderPlot() {}
60
61void RangeFinderPlot::CopyDatas(char *buf) const {
62 datas->GetMutex();
63 memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize());
64 datas->ReleaseMutex();
65}
66
67} // end namespace gui
68} // end namespace flair
Note: See TracBrowser for help on using the repository browser.