stdr_gui_rfid_tag.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  STDR Simulator - Simple Two DImensional Robot Simulator
3  Copyright (C) 2013 STDR Simulator
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 3 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 
16  Authors :
17  * Manos Tsardoulias, etsardou@gmail.com
18  * Aris Thallas, aris.thallas@gmail.com
19  * Chris Zalidis, zalidis@gmail.com
20 ******************************************************************************/
21 
23 
24 namespace stdr_gui{
25 
33  CGuiRfidTag::CGuiRfidTag(QPoint p,std::string name, float resolution):
34  CGuiSource(p,name,resolution),
35  message_("")
36  {
37 
38  }
39 
45  {
46 
47  }
48 
54  void CGuiRfidTag::draw(QImage *img)
55  {
56  QPainter painter(img);
57  int step = 3;
58  painter.setPen(QColor(0,200,0,200));
59  for(unsigned int i = 0 ; i < 4 ; i++)
60  {
61  painter.drawEllipse(
62  position_.x() - i * step,
63  img->height() - position_.y() - i * step,
64  2 * i * step,
65  2 * i * step);
66  }
67 
69 
70  int text_size = name_.size();
71 
72  //~ painter.setPen(QColor(0,0,0,100 * (2 - visualization_status_)));
73  painter.setPen(QColor(0,0,0,100 * (2)));
74 
75  painter.drawRect(
76  position_.x() + 10,
77  img->height() - position_.y() - 30,
78  3 + text_size * 9,
79  20);
80 
81  //~ painter.setPen(QColor(255,255,255,100 * (2 - visualization_status_)));
82  painter.setPen(QColor(255,255,255,100 * (2)));
83 
84  painter.fillRect(
85  position_.x() + 10,
86  img->height() - position_.y() - 30,
87  3 + text_size * 9,
88  20,
89  QBrush(QColor(0,0,0,100 * (2))));
90  //~ QBrush(QColor(0,0,0,100 * (2 - visualization_status_))));
91 
92  painter.setFont(QFont("Courier New"));
93  painter.drawText(
94  position_.x() + 12,
95  img->height() - position_.y() - 15,
96  QString(name_.c_str()));
97  }
98 
104  void CGuiRfidTag::setMessage(QString msg)
105  {
106  message_ = msg;
107  }
108 
114  {
115  return message_;
116  }
117 }
QPoint position_
< The position of the source in the map
QString message_
< The message of the rfid tag
std::string name_
The OGM resolution.
QString getMessage(void)
Returns the tag message.
~CGuiRfidTag(void)
Default destructor.
CGuiRfidTag(QPoint p, std::string name, float resolution)
Default contructor.
void setMessage(QString msg)
Sets the tag message.
virtual void draw(QImage *img)
Draws the tag in the map.
The main namespace for STDR GUI.
unsigned int step
Implements the functionalities of a source, to be derived by specific source types.


stdr_gui
Author(s): Manos Tsardoulias
autogenerated on Mon Jun 10 2019 15:15:16