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: 2018/02/21
|
---|
6 | // filename: UsSensorPlot.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class displaying a plot for raw us sensor
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #include "UsSensorPlot.h"
|
---|
19 | #include "LayoutPosition.h"
|
---|
20 | #include "Matrix.h"
|
---|
21 |
|
---|
22 | using std::string;
|
---|
23 | using namespace flair::core;
|
---|
24 |
|
---|
25 | namespace flair {
|
---|
26 | namespace gui {
|
---|
27 |
|
---|
28 | UsSensorPlot::UsSensorPlot(const LayoutPosition *position, string name,
|
---|
29 | string y_name,float ymin, float ymax,const Matrix *datas,const Matrix *peakInfos)
|
---|
30 | : DataPlot(position, name, "UsSensorPlot") {
|
---|
31 | int nbSamples;
|
---|
32 | if(datas->Cols()==1) {
|
---|
33 | nbSamples=datas->Rows();
|
---|
34 | } else if(datas->Rows()==1) {
|
---|
35 | nbSamples=datas->Cols();
|
---|
36 | } else {
|
---|
37 | nbSamples=0;
|
---|
38 | Err("matrix must be 1D\n");
|
---|
39 | }
|
---|
40 |
|
---|
41 | if(peakInfos->Cols()!=4 || peakInfos->Rows()!=1) {
|
---|
42 | Err("peakInfos matrix must be 1*4 (first start,first end, second start,second end)\n");
|
---|
43 | }
|
---|
44 |
|
---|
45 | if(peakInfos->GetDataType().GetElementDataType().GetDescription()!="uint16_t") {
|
---|
46 | Err("peakInfos matrix must be 1of type uint16_t\n");
|
---|
47 | }
|
---|
48 |
|
---|
49 | this->datas = datas;
|
---|
50 | this->peakInfos = peakInfos;
|
---|
51 |
|
---|
52 | SetVolatileXmlProp("ymin", ymin);
|
---|
53 | SetVolatileXmlProp("ymax", ymax);
|
---|
54 | SetVolatileXmlProp("y_name", y_name);
|
---|
55 | SetVolatileXmlProp("samples", nbSamples);
|
---|
56 | SetVolatileXmlProp("type", datas->GetDataType().GetElementDataType().GetDescription());
|
---|
57 | SendXml();
|
---|
58 |
|
---|
59 | SetSendSize(datas->GetDataType().GetSize()+peakInfos->GetDataType().GetSize());
|
---|
60 | }
|
---|
61 |
|
---|
62 | UsSensorPlot::~UsSensorPlot() {}
|
---|
63 |
|
---|
64 | void UsSensorPlot::CopyDatas(char *buf) const {
|
---|
65 | datas->RawRead(buf);
|
---|
66 | peakInfos->RawRead(buf+datas->GetDataType().GetSize());
|
---|
67 | }
|
---|
68 |
|
---|
69 | } // end namespace gui
|
---|
70 | } // end namespace flair
|
---|