stdr_map_loader.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_LOADER
23 #define STDR_MAP_LOADER
24 
25 #include "ui_map.h"
26 #include "stdr_gui/stdr_tools.h"
27 
28 #define ZOOM_RATIO 1.1
29 
34 namespace stdr_gui
35 {
40  class CMapLoader :
41  public QWidget,
42  public Ui_mapWidget
43  {
44  //------------------------------------------------------------------------//
45  private:
47  int argc_;
49  char** argv_;
51  int zoom_;
52 
54  QImage* internal_img_;
55 
57  QPoint map_min_;
58 
60  QPoint map_max_;
61 
64 
70  QPoint pointUnscaled(QPoint p);
71 
78  std::pair<int,int> checkDimensions(int w,int h);
79 
80  //------------------------------------------------------------------------//
81  public:
82 
89  CMapLoader(int argc, char **argv);
90 
96  void setInitialImageSize(QSize s);
97 
103  void resizeEvent(QResizeEvent *e);
104 
110  void updateImage(QImage *img);
111 
118  void drawGrid(QImage *img,float resolution);
119 
126  void updateZoom(QPoint p,bool zoomIn);
127 
133  void updateCenter(QPoint p);
134 
140  void moveDirectionally(int key);
141 
146  void resetZoom(void);
147 
153  QPoint getGlobalPoint(QPoint p);
154 
155  };
156 }
157 
158 #endif
void updateCenter(QPoint p)
Updates the image center.
QPoint map_max_
The original image size.
QPoint map_min_
The lower right point of map visualization.
Implements the low level Qt functionalities of the map widget. Inherits from Ui_mapWidget (generated ...
void drawGrid(QImage *img, float resolution)
Draws a grid in an image.
QPoint getGlobalPoint(QPoint p)
Calculates the "real" point in the image.
int argc_
< Number of input arguments
char ** argv_
Current zoom. Calculated as pow(2,zoom_) * initial image size.
CMapLoader(int argc, char **argv)
Default contructor.
void setInitialImageSize(QSize s)
Sets the initial image size.
void updateImage(QImage *img)
Updates the image.
int zoom_
Internal image used before a map is loaded.
void updateZoom(QPoint p, bool zoomIn)
Updates the zoom of the image.
void resizeEvent(QResizeEvent *e)
Captures the resize event.
QImage * internal_img_
The upper left point of map visualization.
The main namespace for STDR GUI.
std::pair< int, int > checkDimensions(int w, int h)
Return the dimensions according to the container size.
void resetZoom(void)
Resets the zoom of the image.
void moveDirectionally(int key)
Updates the image center by moving directionally.
QPoint pointUnscaled(QPoint p)
Unscales the input point.


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