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

Last change on this file since 13 was 2, checked in by Sanahuja Guillaume, 9 years ago

flaircore

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