Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "stdr_gui/stdr_map_metainformation/stdr_gui_co2_source.h"
00023
00024 namespace stdr_gui{
00025
00032 CGuiCo2Source::CGuiCo2Source(QPoint p,std::string name, float resolution):
00033 CGuiSource(p,name,resolution),
00034 ppm_(0.0)
00035 {
00036
00037 }
00038
00043 CGuiCo2Source::~CGuiCo2Source(void)
00044 {
00045
00046 }
00047
00053 void CGuiCo2Source::draw(QImage *img)
00054 {
00055 QPainter painter(img);
00056 int step = 3;
00057 painter.setPen(QColor(0,200,0,200));
00058 for(unsigned int i = 0 ; i < 4 ; i++)
00059 {
00060 painter.drawEllipse(
00061 position_.x() - i * step,
00062 img->height() - position_.y() - i * step,
00063 2 * i * step,
00064 2 * i * step);
00065 }
00066
00068
00069 int text_size = name_.size();
00070
00071
00072 painter.setPen(QColor(0,0,0,100 * (2)));
00073
00074 painter.drawRect(
00075 position_.x() + 10,
00076 img->height() - position_.y() - 30,
00077 3 + text_size * 9,
00078 20);
00079
00080
00081 painter.setPen(QColor(255,255,255,100 * (2)));
00082
00083 painter.fillRect(
00084 position_.x() + 10,
00085 img->height() - position_.y() - 30,
00086 3 + text_size * 9,
00087 20,
00088 QBrush(QColor(0,0,0,100 * (2))));
00089
00090
00091 painter.setFont(QFont("Courier New"));
00092 painter.drawText(
00093 position_.x() + 12,
00094 img->height() - position_.y() - 15,
00095 QString(name_.c_str()));
00096
00097 }
00098
00104 void CGuiCo2Source::setPpm(float ppm)
00105 {
00106 ppm_ = ppm;
00107 }
00108
00113 float CGuiCo2Source::getPpm(void)
00114 {
00115 return ppm_;
00116 }
00117 }
00118