stdr_gui_co2_source.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002    STDR Simulator - Simple Two DImensional Robot Simulator
00003    Copyright (C) 2013 STDR Simulator
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 3 of the License, or
00007    (at your option) any later version.
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software Foundation,
00014    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015    
00016    Authors : 
00017    * Manos Tsardoulias, etsardou@gmail.com
00018    * Aris Thallas, aris.thallas@gmail.com
00019    * Chris Zalidis, zalidis@gmail.com 
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     //~ painter.setPen(QColor(0,0,0,100 * (2 - visualization_status_)));
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     //~ painter.setPen(QColor(255,255,255,100 * (2 - visualization_status_)));
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       //~ QBrush(QColor(0,0,0,100 * (2 - visualization_status_))));
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 


stdr_gui
Author(s): Manos Tsardoulias
autogenerated on Thu Jun 6 2019 18:57:38