[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: 2013/04/10
|
---|
| 6 | // filename: DataPlot.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Abstract class to display plots on ground station
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "DataPlot.h"
|
---|
| 19 | #include "DataPlot_impl.h"
|
---|
| 20 | #include "LayoutPosition.h"
|
---|
| 21 | #include "FrameworkManager.h"
|
---|
| 22 | #include "IODataElement.h"
|
---|
| 23 |
|
---|
| 24 | using std::string;
|
---|
| 25 |
|
---|
[15] | 26 | namespace flair {
|
---|
| 27 | namespace gui {
|
---|
[2] | 28 |
|
---|
| 29 | using namespace core;
|
---|
| 30 |
|
---|
[15] | 31 | void RGBFromColor(DataPlot::Color_t color, uint8_t &r, uint8_t &g, uint8_t &b) {
|
---|
| 32 | switch (color) {
|
---|
| 33 | case DataPlot::Red:
|
---|
| 34 | r = 255;
|
---|
| 35 | g = 0;
|
---|
| 36 | b = 0;
|
---|
| 37 | break;
|
---|
| 38 | case DataPlot::Blue:
|
---|
| 39 | r = 0;
|
---|
| 40 | g = 0;
|
---|
| 41 | b = 255;
|
---|
| 42 | break;
|
---|
| 43 | case DataPlot::Green:
|
---|
| 44 | r = 0;
|
---|
| 45 | g = 255;
|
---|
| 46 | b = 0;
|
---|
| 47 | break;
|
---|
| 48 | case DataPlot::Yellow:
|
---|
| 49 | r = 255;
|
---|
| 50 | g = 255;
|
---|
| 51 | b = 0;
|
---|
| 52 | break;
|
---|
| 53 | case DataPlot::Black:
|
---|
| 54 | r = 0;
|
---|
| 55 | g = 0;
|
---|
| 56 | b = 0;
|
---|
| 57 | break;
|
---|
| 58 | case DataPlot::White:
|
---|
| 59 | r = 255;
|
---|
| 60 | g = 255;
|
---|
| 61 | b = 255;
|
---|
| 62 | break;
|
---|
| 63 | }
|
---|
[2] | 64 | }
|
---|
| 65 |
|
---|
[15] | 66 | DataPlot::DataPlot(const LayoutPosition *position, string name, string type)
|
---|
| 67 | : SendData(position, name, type) {
|
---|
| 68 | pimpl_ = new DataPlot_impl();
|
---|
[2] | 69 | }
|
---|
| 70 |
|
---|
[15] | 71 | DataPlot::~DataPlot() { delete pimpl_; }
|
---|
[2] | 72 |
|
---|
[15] | 73 | void DataPlot::AddDataToSend(const IODataElement *element) {
|
---|
| 74 | pimpl_->tosend.push_back(element);
|
---|
[2] | 75 |
|
---|
[15] | 76 | SetSendSize(SendSize() + element->Size());
|
---|
[2] | 77 | }
|
---|
| 78 |
|
---|
[15] | 79 | void DataPlot::CopyDatas(char *buf) const {
|
---|
| 80 | int buf_size = 0;
|
---|
[2] | 81 |
|
---|
[15] | 82 | for (size_t i = 0; i < pimpl_->tosend.size(); i++) {
|
---|
| 83 | pimpl_->tosend[i]->CopyData(buf + buf_size);
|
---|
| 84 | buf_size += pimpl_->tosend[i]->Size();
|
---|
| 85 | }
|
---|
[2] | 86 | }
|
---|
| 87 |
|
---|
| 88 | } // end namespace gui
|
---|
| 89 | } // end namespace flair
|
---|