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

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

singleton manager

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 <cxcore.h>
24
25using std::string;
26using namespace flair::core;
27
28namespace flair {
29namespace gui {
30
31RangeFinderPlot::RangeFinderPlot(const LayoutPosition *position, string name,
32 string x_name, float xmin, float xmax,
33 string y_name, float ymin, float ymax,
34 const cvmatrix *datas, float start_angle,
35 float end_angle, uint32_t nb_samples)
36 : SendData(position, name, "RangeFinderPlot", 200) {
37 this->datas = datas;
38
39 SetSendSize(datas->GetDataType().GetSize());
40
41 SetVolatileXmlProp("xmin", xmin);
42 SetVolatileXmlProp("xmax", xmax);
43 SetVolatileXmlProp("ymin", ymin);
44 SetVolatileXmlProp("ymax", ymax);
45 SetVolatileXmlProp("x_name", x_name);
46 SetVolatileXmlProp("y_name", y_name);
47 SetVolatileXmlProp("start_angle", start_angle);
48 SetVolatileXmlProp("end_angle", end_angle);
49 SetVolatileXmlProp("nb_samples", nb_samples);
50 SetVolatileXmlProp(
51 "type", datas->GetDataType().GetElementDataType().GetDescription());
52 SendXml();
53
54 if (datas->Cols() != 1 || datas->Rows() != nb_samples)
55 Err("Wrong input matrix size\n");
56}
57
58RangeFinderPlot::~RangeFinderPlot() {}
59
60void RangeFinderPlot::CopyDatas(char *buf) const {
61 datas->GetMutex();
62 memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize());
63 datas->ReleaseMutex();
64}
65
66} // end namespace gui
67} // end namespace flair
Note: See TracBrowser for help on using the repository browser.