Changeset 15 in flair-src for trunk/lib/FlairCore/src/DataPlot.cpp
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/DataPlot.cpp
r2 r15 24 24 using std::string; 25 25 26 namespace flair 27 { 28 namespace gui 29 { 26 namespace flair { 27 namespace gui { 30 28 31 29 using namespace core; 32 30 33 void 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 } 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 } 68 64 } 69 65 70 DataPlot::DataPlot(const LayoutPosition * position,string name,string type):SendData(position,name,type)71 {72 pimpl_=new DataPlot_impl();66 DataPlot::DataPlot(const LayoutPosition *position, string name, string type) 67 : SendData(position, name, type) { 68 pimpl_ = new DataPlot_impl(); 73 69 } 74 70 75 DataPlot::~DataPlot() 76 { 77 delete pimpl_; 71 DataPlot::~DataPlot() { delete pimpl_; } 72 73 void DataPlot::AddDataToSend(const IODataElement *element) { 74 pimpl_->tosend.push_back(element); 75 76 SetSendSize(SendSize() + element->Size()); 78 77 } 79 78 80 void DataPlot::AddDataToSend(const IODataElement *element) 81 { 82 pimpl_->tosend.push_back(element); 79 void DataPlot::CopyDatas(char *buf) const { 80 int buf_size = 0; 83 81 84 SetSendSize(SendSize()+element->Size()); 85 } 86 87 void 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 } 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 } 94 86 } 95 87
Note:
See TracChangeset
for help on using the changeset viewer.