stdr_gui_rfid_tag.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_rfid_tag.h"
00023 
00024 namespace stdr_gui{
00025   
00033   CGuiRfidTag::CGuiRfidTag(QPoint p,std::string name, float resolution):
00034         CGuiSource(p,name,resolution),
00035         message_("")
00036   {
00037   
00038   }
00039   
00044   CGuiRfidTag::~CGuiRfidTag(void)
00045   {
00046 
00047   }
00048 
00054   void CGuiRfidTag::draw(QImage *img)
00055   {
00056     QPainter painter(img);
00057     int step = 3;
00058     painter.setPen(QColor(0,200,0,200));
00059     for(unsigned int i = 0 ; i < 4 ; i++)
00060     {
00061       painter.drawEllipse(
00062         position_.x() - i * step, 
00063         img->height() - position_.y() - i * step, 
00064         2 * i * step, 
00065         2 * i * step);
00066     }
00067 
00069     
00070     int text_size = name_.size();
00071     
00072     //~ painter.setPen(QColor(0,0,0,100 * (2 - visualization_status_)));
00073     painter.setPen(QColor(0,0,0,100 * (2)));
00074     
00075     painter.drawRect(
00076       position_.x() + 10,
00077       img->height() - position_.y() - 30,
00078       3 + text_size * 9,
00079       20);
00080     
00081     //~ painter.setPen(QColor(255,255,255,100 * (2 - visualization_status_)));
00082     painter.setPen(QColor(255,255,255,100 * (2)));
00083     
00084     painter.fillRect(
00085       position_.x() + 10,
00086       img->height() - position_.y() - 30,
00087       3 + text_size * 9,
00088       20,
00089       QBrush(QColor(0,0,0,100 * (2))));
00090       //~ QBrush(QColor(0,0,0,100 * (2 - visualization_status_))));
00091     
00092     painter.setFont(QFont("Courier New"));
00093     painter.drawText(
00094       position_.x() + 12,
00095       img->height() - position_.y() - 15,
00096       QString(name_.c_str()));
00097   }
00098   
00104   void CGuiRfidTag::setMessage(QString msg)
00105   {
00106     message_ = msg;
00107   }
00108   
00113   QString CGuiRfidTag::getMessage(void)
00114   {
00115     return message_;
00116   }
00117 }


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