stdr_map_connector.h
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 
22 #ifndef STDR_MAP_CONNECTOR
23 #define STDR_MAP_CONNECTOR
24 
26 
31 namespace stdr_gui
32 {
38  {
48  };
49 
50 
55  class CMapConnector :
56  public QObject
57  {
58  Q_OBJECT
59  //------------------------------------------------------------------------//
60  private:
61 
63  int argc_;
65  char** argv_;
66 
69 
71  QCursor zoom_in_cursor_;
74 
77 
80 
83 
84  //------------------------------------------------------------------------//
85  public:
86 
93  CMapConnector(int argc, char **argv);
94 
99  ~CMapConnector(void);
100 
106  void updateImage(QImage *img);
107 
113  void setInitialImageSize(QSize s);
114 
121  void updateZoom(QPoint p,bool z);
122 
128  void updateCenter(QPoint p);
129 
135  QPoint getGlobalPoint(QPoint p);
136 
143  void drawGrid(QImage *img,float resolution);
144 
150  QPoint mapToGlobal(QPoint p);
151 
156  QWidget* getLoader(void);
157 
163  void setMapInitialized(bool mi);
164 
165  //------------------------------------------------------------------------//
166  public Q_SLOTS:
167 
174  bool eventFilter( QObject* watched, QEvent* event);
175 
181  void serveImage(QImage *img);
182 
188  void setCursorZoomIn(bool state);
189 
195  void setCursorZoomOut(bool state);
196 
202  void setCursorAdjusted(bool state);
203 
208  void waitForPlace(void);
209 
214  void waitForThermalPlace(void);
215 
220  void waitForCo2Place(void);
221 
226  void waitForSoundPlace(void);
227 
232  void waitForRfidPlace(void);
233 
239  void waitForReplace(std::string robotFrameId);
240 
241  //------------------------------------------------------------------------//
242  Q_SIGNALS:
243 
249  void signalUpdateImage(QImage *img);
250 
256  void zoomInPressed(QPoint p);
257 
263  void zoomOutPressed(QPoint p);
264 
270  void robotPlaceSet(QPoint p);
271 
277  void thermalPlaceSet(QPoint p);
278 
284  void co2PlaceSet(QPoint p);
285 
291  void soundPlaceSet(QPoint p);
292 
298  void rfidPlaceSet(QPoint p);
299 
306  void itemClicked(QPoint p,Qt::MouseButton b);
307 
314  void robotReplaceSet(QPoint p,std::string robotName);
315  };
316 }
317 
318 #endif
void updateZoom(QPoint p, bool z)
Updates the map zoom. Wrapper for a loader function.
bool eventFilter(QObject *watched, QEvent *event)
General event filter. Captures all events.
void waitForSoundPlace(void)
Changes the map state. Waits for a sound source to be placed.
void waitForCo2Place(void)
Changes the map state. Waits for a CO2 source to be placed.
std::string current_robot_frame_id_
Mouse cursor for zoom in.
void rfidPlaceSet(QPoint p)
Emmited when click is captured and state is SETRFIDPLACE.
QWidget * getLoader(void)
Returns the CMapLoader object.
Implements the low level Qt functionalities of the map widget. Inherits from Ui_mapWidget (generated ...
void waitForRfidPlace(void)
Changes the map state. Waits for an RFID tag to be placed.
int argc_
< Number of input arguments
QCursor zoom_out_cursor_
Holds the map state.
void soundPlaceSet(QPoint p)
Emmited when click is captured and state is SETSOUNDPLACE.
void zoomOutPressed(QPoint p)
Emmited when click is captured and state is ZOOMOUT.
void waitForPlace(void)
Changes the map state. Waits for a robot to be placed.
void updateCenter(QPoint p)
Updates the map center when a robot is followed.
QCursor zoom_in_cursor_
Mouse cursor for zoom out.
char ** argv_
Holds the currently clicked robot frame id.
void setInitialImageSize(QSize s)
Sets map initial size to the loader.
void robotPlaceSet(QPoint p)
Emmited when click is captured and state is SETPLACE.
void setMapInitialized(bool mi)
Sets the map initialization status.
~CMapConnector(void)
Default destructor.
void drawGrid(QImage *img, float resolution)
Wrapper for the draw grid function of loader.
void co2PlaceSet(QPoint p)
Emmited when click is captured and state is SETCO2PLACE.
void robotReplaceSet(QPoint p, std::string robotName)
Emmited when click is captured and state is SETREPLACE.
QPoint getGlobalPoint(QPoint p)
Returns the point in the real map image. Wrapper for a loader function.
void updateImage(QImage *img)
Emits the signalUpdateImage signal.
void waitForReplace(std::string robotFrameId)
Changes the map state. Waits for a robot to be re-placed.
EStdrMapState
Holds the possible map states.
The main namespace for STDR GUI.
Serves the Qt events of the map-holding widget. Inherits from QObject.
EStdrMapState map_state_
Object of CMapLoader.
void waitForThermalPlace(void)
Changes the map state. Waits for a thermal source to be placed.
void itemClicked(QPoint p, Qt::MouseButton b)
Emmited when click is captured and state is NORMAL.
void serveImage(QImage *img)
Called from signalUpdateImage signal. Calls the updateImage of CMapLoader.
void signalUpdateImage(QImage *img)
Emmited in updateImage function.
void setCursorAdjusted(bool state)
Called when zoom adjusted event happens.
QPoint mapToGlobal(QPoint p)
Calls the Qt function that gets the real point that the event happened.
void setCursorZoomIn(bool state)
Called when zoom in event happens.
CMapConnector(int argc, char **argv)
Default contructor.
void thermalPlaceSet(QPoint p)
Emmited when click is captured and state is SETTHERMALPLACE.
void zoomInPressed(QPoint p)
Emmited when click is captured and state is ZOOMIN.
CMapLoader loader_
True if map is initialized.
void setCursorZoomOut(bool state)
Called when zoom out event happens.


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