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

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

singleton manager

File size: 1.7 KB
RevLine 
[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 "IODataElement.h"
22
23using std::string;
24
[15]25namespace flair {
26namespace gui {
[2]27
28using namespace core;
29
[15]30void RGBFromColor(DataPlot::Color_t color, uint8_t &r, uint8_t &g, uint8_t &b) {
31 switch (color) {
32 case DataPlot::Red:
33 r = 255;
34 g = 0;
35 b = 0;
36 break;
37 case DataPlot::Blue:
38 r = 0;
39 g = 0;
40 b = 255;
41 break;
42 case DataPlot::Green:
43 r = 0;
44 g = 255;
45 b = 0;
46 break;
47 case DataPlot::Yellow:
48 r = 255;
49 g = 255;
50 b = 0;
51 break;
52 case DataPlot::Black:
53 r = 0;
54 g = 0;
55 b = 0;
56 break;
57 case DataPlot::White:
58 r = 255;
59 g = 255;
60 b = 255;
61 break;
62 }
[2]63}
64
[15]65DataPlot::DataPlot(const LayoutPosition *position, string name, string type)
66 : SendData(position, name, type) {
67 pimpl_ = new DataPlot_impl();
[2]68}
69
[15]70DataPlot::~DataPlot() { delete pimpl_; }
[2]71
[15]72void DataPlot::AddDataToSend(const IODataElement *element) {
73 pimpl_->tosend.push_back(element);
[2]74
[15]75 SetSendSize(SendSize() + element->Size());
[2]76}
77
[15]78void DataPlot::CopyDatas(char *buf) const {
79 int buf_size = 0;
[2]80
[15]81 for (size_t i = 0; i < pimpl_->tosend.size(); i++) {
82 pimpl_->tosend[i]->CopyData(buf + buf_size);
83 buf_size += pimpl_->tosend[i]->Size();
84 }
[2]85}
86
87} // end namespace gui
88} // end namespace flair
Note: See TracBrowser for help on using the repository browser.