[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 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 | //
|
---|
[15] | 13 | // purpose: Class displaying a 2D plot on the ground station for laser range
|
---|
| 14 | // finder like Hokuyo
|
---|
[2] | 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 |
|
---|
| 25 | using std::string;
|
---|
| 26 | using namespace flair::core;
|
---|
| 27 |
|
---|
[15] | 28 | namespace flair {
|
---|
| 29 | namespace gui {
|
---|
[2] | 30 |
|
---|
[15] | 31 | RangeFinderPlot::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;
|
---|
[2] | 38 |
|
---|
[15] | 39 | SetSendSize(datas->GetDataType().GetSize());
|
---|
[2] | 40 |
|
---|
[15] | 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();
|
---|
[2] | 53 |
|
---|
[15] | 54 | if (datas->Cols() != 1 || datas->Rows() != nb_samples)
|
---|
| 55 | Err("Wrong input matrix size\n");
|
---|
[2] | 56 | }
|
---|
| 57 |
|
---|
| 58 | RangeFinderPlot::~RangeFinderPlot() {}
|
---|
| 59 |
|
---|
[15] | 60 | void RangeFinderPlot::CopyDatas(char *buf) const {
|
---|
| 61 | datas->GetMutex();
|
---|
| 62 | memcpy(buf, datas->getCvMat()->data.ptr, datas->GetDataType().GetSize());
|
---|
| 63 | datas->ReleaseMutex();
|
---|
[2] | 64 | }
|
---|
| 65 |
|
---|
| 66 | } // end namespace gui
|
---|
| 67 | } // end namespace flair
|
---|