MapBox Class Reference

Widget to display the maps of various spacial aspects of the model. More...

#include <MapBox.h>

Collaboration diagram for MapBox:

Collaboration graph
[legend]
List of all members.

Public Slots

void updatePixel (QString layerName_h, int x_h, int y_h, QColor color_h)
void updateImage (QString layerName_h, const QImage &image_h)
void switchToLayer (QString layerName_h)
 Change the layer that currentLayer and currentLayerName points.
void addLayer (QString layerName_h)
void fitInWindow ()
void zoom (double zoomFactor)
void scroll (int deltaX, int deltaY)

Signals

void queryRequestOnPx (int px_ID, int currentLayerIndex, bool newRequest)

Public Member Functions

 MapBox (QWidget *parent=0)
int getLayerIndex (QString layerName_h="")
 Return the index of the specified layer (null to ask for the current one).

Private Member Functions

void updatePixmap (const QImage &image, bool reFit=false)
void paintEvent (QPaintEvent *event)
 Reimplementation of the standard paintEvent method.
void prepareQueryEvent (QPoint click)
void keyPressEvent (QKeyEvent *event)
void wheelEvent (QWheelEvent *event)
void mousePressEvent (QMouseEvent *event)
void mouseMoveEvent (QMouseEvent *event)

Private Attributes

vector< QImage > layersVector
 Vector of QImages.
vector< QString > layersNameVector
 Vector of layer names.
QImage currentLayer
QString currentLayerName
QPoint lastDragPos
double sx1
double sy1
double sx2
double sy2
 coordinates of corner pixels of source - pixmap - rectangle
double dx1
double dy1
double dx2
double dy2
 coordinates of corner pixels of destination - widget - rectangle

Detailed Description

Widget to display the maps of various spacial aspects of the model.

This class is based on QImage. It pick-ups from layersVector the choosed layer and display it.
It has methods to change the individual pixels or the whole image of a layer.

Definition at line 39 of file MapBox.h.


Constructor & Destructor Documentation

MapBox ( QWidget *  parent = 0  ) 

Definition at line 32 of file MapBox.cpp.


Member Function Documentation

int getLayerIndex ( QString  layerName_h = ""  ) 

Return the index of the specified layer (null to ask for the current one).

Definition at line 120 of file MapBox.cpp.

Referenced by prepareQueryEvent().

Here is the caller graph for this function:

void updatePixel ( QString  layerName_h,
int  x_h,
int  y_h,
QColor  color_h 
) [slot]

Definition at line 70 of file MapBox.cpp.

void updateImage ( QString  layerName_h,
const QImage &  image_h 
) [slot]

Definition at line 84 of file MapBox.cpp.

void switchToLayer ( QString  layerName_h  )  [slot]

Change the layer that currentLayer and currentLayerName points.

Definition at line 105 of file MapBox.cpp.

void addLayer ( QString  layerName_h  )  [slot]

Definition at line 132 of file MapBox.cpp.

void fitInWindow (  )  [slot]

Definition at line 214 of file MapBox.cpp.

Referenced by updateImage().

void zoom ( double  zoomFactor  )  [slot]

Definition at line 238 of file MapBox.cpp.

Referenced by keyPressEvent(), and wheelEvent().

void scroll ( int  deltaX,
int  deltaY 
) [slot]

Definition at line 252 of file MapBox.cpp.

Referenced by keyPressEvent(), and mouseMoveEvent().

void queryRequestOnPx ( int  px_ID,
int  currentLayerIndex,
bool  newRequest 
) [signal]

Referenced by prepareQueryEvent().

void updatePixmap ( const QImage &  image,
bool  reFit = false 
) [private]

void paintEvent ( QPaintEvent *  event  )  [private]

Reimplementation of the standard paintEvent method.

We paint the image pixel by pixel picking up the colors from the map pointed by currentLayer.

Definition at line 52 of file MapBox.cpp.

void prepareQueryEvent ( QPoint  click  )  [private]

Definition at line 189 of file MapBox.cpp.

Referenced by mousePressEvent().

Here is the caller graph for this function:

void keyPressEvent ( QKeyEvent *  event  )  [private]

Definition at line 146 of file MapBox.cpp.

void wheelEvent ( QWheelEvent *  event  )  [private]

Definition at line 172 of file MapBox.cpp.

void mousePressEvent ( QMouseEvent *  event  )  [private]

Definition at line 179 of file MapBox.cpp.

void mouseMoveEvent ( QMouseEvent *  event  )  [private]

Definition at line 206 of file MapBox.cpp.


Member Data Documentation

vector<QImage> layersVector [private]

Vector of QImages.

Definition at line 66 of file MapBox.h.

Referenced by addLayer(), getLayerIndex(), paintEvent(), switchToLayer(), updateImage(), and updatePixel().

vector<QString> layersNameVector [private]

Vector of layer names.

Definition at line 67 of file MapBox.h.

Referenced by addLayer(), getLayerIndex(), switchToLayer(), updateImage(), and updatePixel().

QImage currentLayer [private]

Definition at line 68 of file MapBox.h.

Referenced by addLayer(), fitInWindow(), paintEvent(), switchToLayer(), updateImage(), and updatePixel().

QString currentLayerName [private]

Definition at line 69 of file MapBox.h.

Referenced by addLayer(), getLayerIndex(), MapBox(), switchToLayer(), updateImage(), and updatePixel().

QPoint lastDragPos [private]

Definition at line 70 of file MapBox.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

double sx1 [private]

Definition at line 71 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), and prepareQueryEvent().

double sy1 [private]

Definition at line 71 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), and prepareQueryEvent().

double sx2 [private]

Definition at line 71 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), and prepareQueryEvent().

double sy2 [private]

coordinates of corner pixels of source - pixmap - rectangle

Definition at line 71 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), and prepareQueryEvent().

double dx1 [private]

Definition at line 72 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), prepareQueryEvent(), scroll(), and zoom().

double dy1 [private]

Definition at line 72 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), prepareQueryEvent(), scroll(), and zoom().

double dx2 [private]

Definition at line 72 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), prepareQueryEvent(), scroll(), and zoom().

double dy2 [private]

coordinates of corner pixels of destination - widget - rectangle

Definition at line 72 of file MapBox.h.

Referenced by fitInWindow(), MapBox(), paintEvent(), prepareQueryEvent(), scroll(), and zoom().


The documentation for this class was generated from the following files: