source: flair-src/trunk/lib/FlairCore/src/DataPlot1D.cpp @ 42

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

sources reformatted with flair-format-dir script

File size: 1.7 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:    2011/10/07
6//  filename:   DataPlot1D.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Class displaying a 1D plot on the ground station
14//
15//
16/*********************************************************************/
17
18#include "DataPlot1D.h"
19#include "LayoutPosition.h"
20#include "IODataElement.h"
21#include "FrameworkManager.h"
22
23using std::string;
24
25namespace flair {
26namespace gui {
27
28using namespace core;
29
30DataPlot1D::DataPlot1D(const LayoutPosition *position, string name, float ymin,
31                       float ymax)
32    : DataPlot(position, name, "DataPlot1D") {
33  SetVolatileXmlProp("min", ymin);
34  SetVolatileXmlProp("max", ymax);
35  SendXml();
36}
37
38DataPlot1D::~DataPlot1D() {}
39
40void DataPlot1D::AddCurve(const core::IODataElement *element, uint8_t r,
41                          uint8_t g, uint8_t b, string curve_name) {
42  if (curve_name != "") {
43    SetVolatileXmlProp("curve", curve_name);
44  } else {
45    SetVolatileXmlProp("curve", element->Parent()->ObjectName() + "\\" +
46                                    element->ObjectName());
47  }
48  SetVolatileXmlProp("type", element->GetDataType().GetDescription());
49  SetVolatileXmlProp("r", r);
50  SetVolatileXmlProp("g", g);
51  SetVolatileXmlProp("b", b);
52
53  SendXml();
54
55  // save data information
56  AddDataToSend(element);
57}
58
59void DataPlot1D::AddCurve(const core::IODataElement *element, Color_t color,
60                          string curve_name) {
61  uint8_t r, g, b;
62  RGBFromColor(color, r, g, b);
63  AddCurve(element, r, g, b, curve_name);
64}
65
66} // end namespace gui
67} // end namespace flair
Note: See TracBrowser for help on using the repository browser.