stdr_gui_thermal_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_thermal_source.h"
00023 
00024 namespace stdr_gui{
00025    
00032   CGuiThermalSource::CGuiThermalSource(QPoint p,std::string name, float resolution):
00033           CGuiSource(p,name,resolution),
00034           degrees_(0.0)
00035   {
00036   
00037   }
00038   
00043   CGuiThermalSource::~CGuiThermalSource(void)
00044   {
00045 
00046   }
00047 
00053   void CGuiThermalSource::draw(QImage *img)
00054   {
00055     QPainter painter(img);
00056     int step = 3;
00057     painter.setPen(QColor(200, 0, 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)));
00072     
00073     painter.drawRect(
00074       position_.x() + 10,
00075       img->height() - position_.y() - 30,
00076       3 + text_size * 9,
00077       20);
00078     
00079     painter.setPen(QColor(255,255,255,100 * (2)));
00080     
00081     painter.fillRect(
00082       position_.x() + 10,
00083       img->height() - position_.y() - 30,
00084       3 + text_size * 9,
00085       20,
00086       QBrush(QColor(0,0,0,100 * (2))));
00087     
00088     painter.setFont(QFont("Courier New"));
00089     painter.drawText(
00090       position_.x() + 12,
00091       img->height() - position_.y() - 15,
00092       QString(name_.c_str()));
00093   }
00094   
00100   void CGuiThermalSource::setDegrees(float degrees)
00101   {
00102     degrees_ = degrees;
00103   }
00104   
00109   float CGuiThermalSource::getDegrees(void)
00110   {
00111     return degrees_;
00112   }
00113 }
00114 


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