40 loader_.map->setScaledContents(
true);
42 loader_.map->installEventFilter(
this);
50 std::string(
"/resources/images/zoom_in.png")).c_str());
55 std::string(
"/resources/images/zoom_out.png")).c_str());
147 if(event->type() == QEvent::MouseButtonPress)
150 loader_.map->setFocus(Qt::MouseFocusReason);
152 const QMouseEvent*
const me =
153 static_cast<const QMouseEvent*
>( event );
154 QPoint p = me->pos();
155 if(me->button() == Qt::RightButton)
158 loader_.map->setCursor(QCursor(Qt::CrossCursor));
161 else if(me->button() == Qt::LeftButton)
174 loader_.map->setCursor(QCursor(Qt::CrossCursor));
184 loader_.map->setCursor(QCursor(Qt::CrossCursor));
190 loader_.map->setCursor(QCursor(Qt::CrossCursor));
196 loader_.map->setCursor(QCursor(Qt::CrossCursor));
202 loader_.map->setCursor(QCursor(Qt::CrossCursor));
208 loader_.map->setCursor(QCursor(Qt::CrossCursor));
213 else if(event->type() == QEvent::Wheel)
215 const QWheelEvent*
const me =
216 static_cast<const QWheelEvent*
>( event );
217 QPoint p = me->pos();
227 else if(event->type() == QEvent::KeyPress)
229 const QKeyEvent*
const me =
230 static_cast<const QKeyEvent*
>( event );
236 if(me->key() == Qt::Key_Right)
240 else if(me->key() == Qt::Key_Left)
244 else if(me->key() == Qt::Key_Up)
248 else if(me->key() == Qt::Key_Down)
306 loader_.map->setCursor(QCursor(Qt::CrossCursor));
329 loader_.map->setCursor(QCursor(Qt::CrossCursor));
346 loader_.map->setCursor(QCursor(Qt::CrossCursor));
360 loader_.map->setCursor(Qt::PointingHandCursor);
374 loader_.map->setCursor(Qt::PointingHandCursor);
388 loader_.map->setCursor(Qt::PointingHandCursor);
402 loader_.map->setCursor(Qt::PointingHandCursor);
416 loader_.map->setCursor(Qt::PointingHandCursor);
425 return static_cast<QWidget *
>(&
loader_);
440 loader_.map->setCursor(Qt::PointingHandCursor);
void updateZoom(QPoint p, bool z)
Updates the map zoom. Wrapper for a loader function.
void updateCenter(QPoint p)
Updates the image center.
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.
void waitForRfidPlace(void)
Changes the map state. Waits for an RFID tag to be placed.
void drawGrid(QImage *img, float resolution)
Draws a grid in an image.
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.
QPoint getGlobalPoint(QPoint p)
Calculates the "real" point in the image.
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.
void setInitialImageSize(QSize s)
Sets the initial image size.
void updateImage(QImage *img)
Updates the image.
~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 updateZoom(QPoint p, bool zoomIn)
Updates the zoom of the image.
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.
The main namespace for STDR GUI.
EStdrMapState map_state_
Object of CMapLoader.
void waitForThermalPlace(void)
Changes the map state. Waits for a thermal source to be placed.
void resetZoom(void)
Resets the zoom of the image.
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.
void moveDirectionally(int key)
Updates the image center by moving directionally.
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.