Implements the low level Qt functionalities of the map widget. Inherits from Ui_mapWidget (generated from an ui file) and QWidget. More...
#include <stdr_map_loader.h>
Public Member Functions | |
CMapLoader (int argc, char **argv) | |
Default contructor. | |
void | drawGrid (QImage *img, float resolution) |
Draws a grid in an image. | |
QPoint | getGlobalPoint (QPoint p) |
Calculates the "real" point in the image. | |
void | moveDirectionally (int key) |
Updates the image center by moving directionally. | |
void | resetZoom (void) |
Resets the zoom of the image. | |
void | resizeEvent (QResizeEvent *e) |
Captures the resize event. | |
void | setInitialImageSize (QSize s) |
Sets the initial image size. | |
void | updateCenter (QPoint p) |
Updates the image center. | |
void | updateImage (QImage *img) |
Updates the image. | |
void | updateZoom (QPoint p, bool zoomIn) |
Updates the zoom of the image. | |
Private Member Functions | |
std::pair< int, int > | checkDimensions (int w, int h) |
Return the dimensions according to the container size. | |
QPoint | pointUnscaled (QPoint p) |
Unscales the input point. | |
Private Attributes | |
int | argc_ |
< Number of input arguments | |
char ** | argv_ |
Current zoom. Calculated as pow(2,zoom_) * initial image size. | |
QSize | initial_image_size_ |
QImage * | internal_img_ |
The upper left point of map visualization. | |
QPoint | map_max_ |
The original image size. | |
QPoint | map_min_ |
The lower right point of map visualization. | |
int | zoom_ |
Internal image used before a map is loaded. |
Implements the low level Qt functionalities of the map widget. Inherits from Ui_mapWidget (generated from an ui file) and QWidget.
Definition at line 40 of file stdr_map_loader.h.
stdr_gui::CMapLoader::CMapLoader | ( | int | argc, |
char ** | argv | ||
) |
Default contructor.
argc | [int] Number of input arguments |
argv | [char **] Input arguments |
Definition at line 32 of file stdr_map_loader.cpp.
std::pair< int, int > stdr_gui::CMapLoader::checkDimensions | ( | int | w, |
int | h | ||
) | [private] |
Return the dimensions according to the container size.
w | [int] Image width |
h | [int] Image height |
Definition at line 59 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::drawGrid | ( | QImage * | img, |
float | resolution | ||
) |
Draws a grid in an image.
img | [QImage*] The image for the grid to be drawn on |
resolution | [float] The map resolution |
Definition at line 108 of file stdr_map_loader.cpp.
QPoint stdr_gui::CMapLoader::getGlobalPoint | ( | QPoint | p | ) |
Calculates the "real" point in the image.
p | [QPoint] The point to be translated |
Definition at line 304 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::moveDirectionally | ( | int | key | ) |
Updates the image center by moving directionally.
key | [int] The key pressed |
Definition at line 196 of file stdr_map_loader.cpp.
QPoint stdr_gui::CMapLoader::pointUnscaled | ( | QPoint | p | ) | [private] |
Unscales the input point.
p | [QPoint] Point of an event in the adjusted map |
Definition at line 274 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::resetZoom | ( | void | ) |
void stdr_gui::CMapLoader::resizeEvent | ( | QResizeEvent * | e | ) |
Captures the resize event.
e | [QResizeEvent*] The resize event |
Definition at line 48 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::setInitialImageSize | ( | QSize | s | ) |
Sets the initial image size.
s | [QSize] The initial image size |
Definition at line 319 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::updateCenter | ( | QPoint | p | ) |
Updates the image center.
p | [QPoint] The new center |
Definition at line 230 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::updateImage | ( | QImage * | img | ) |
Updates the image.
img | [QImage*] The image to be updated |
Definition at line 83 of file stdr_map_loader.cpp.
void stdr_gui::CMapLoader::updateZoom | ( | QPoint | p, |
bool | zoomIn | ||
) |
Updates the zoom of the image.
p | [QPoint] The point of the zoom event |
zoomIn | [bool] True if zoom in, false if zoom out |
Definition at line 129 of file stdr_map_loader.cpp.
int stdr_gui::CMapLoader::argc_ [private] |
char** stdr_gui::CMapLoader::argv_ [private] |
Current zoom. Calculated as pow(2,zoom_) * initial image size.
Definition at line 50 of file stdr_map_loader.h.
QSize stdr_gui::CMapLoader::initial_image_size_ [private] |
Definition at line 63 of file stdr_map_loader.h.
QImage* stdr_gui::CMapLoader::internal_img_ [private] |
The upper left point of map visualization.
Definition at line 56 of file stdr_map_loader.h.
QPoint stdr_gui::CMapLoader::map_max_ [private] |
The original image size.
Definition at line 62 of file stdr_map_loader.h.
QPoint stdr_gui::CMapLoader::map_min_ [private] |
The lower right point of map visualization.
Definition at line 59 of file stdr_map_loader.h.
int stdr_gui::CMapLoader::zoom_ [private] |
Internal image used before a map is loaded.
Definition at line 53 of file stdr_map_loader.h.