source: flair-src/trunk/lib/FlairCore/src/DataPlot.cpp@ 19

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

sources reformatted with flair-format-dir script

File size: 1.8 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: 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
24using std::string;
25
26namespace flair {
27namespace gui {
28
29using namespace core;
30
31void 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 }
64}
65
66DataPlot::DataPlot(const LayoutPosition *position, string name, string type)
67 : SendData(position, name, type) {
68 pimpl_ = new DataPlot_impl();
69}
70
71DataPlot::~DataPlot() { delete pimpl_; }
72
73void DataPlot::AddDataToSend(const IODataElement *element) {
74 pimpl_->tosend.push_back(element);
75
76 SetSendSize(SendSize() + element->Size());
77}
78
79void DataPlot::CopyDatas(char *buf) const {
80 int buf_size = 0;
81
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 }
86}
87
88} // end namespace gui
89} // end namespace flair
Note: See TracBrowser for help on using the repository browser.