Quantum GIS API Documentation  master-693a1fe
src/gui/qgsmaptip.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsmaptip.h  -  Query a layer and show a maptip on the canvas
00003     ---------------------
00004     begin                : October 2007
00005     copyright            : (C) 2007 by Gary Sherman
00006     email                : sherman @ mrcc dot com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 #ifndef _QGSMAPTIP_H_
00016 #define _QGSMAPTIP_H_
00017 
00018 class QgsMapLayer;
00019 class QgsMapCanvas;
00020 class QPoint;
00021 class QString;
00022 
00023 #include "qgsfeature.h"
00024 
00029 class GUI_EXPORT QgsMapTip
00030 {
00031   public:
00034     QgsMapTip();
00037     virtual ~QgsMapTip();
00047     void showMapTip( QgsMapLayer * thepLayer,
00048                      QgsPoint & theMapPosition,
00049                      QPoint & thePixelPosition,
00050                      QgsMapCanvas *mpMapCanvas );
00054     void clear( QgsMapCanvas *mpMapCanvas );
00055   private:
00056     // Fetch the feature to use for the maptip text. Only the first feature in the
00057     // search radius is used
00058     QString fetchFeature( QgsMapLayer * thepLayer,
00059                           QgsPoint & theMapPosition,
00060                           QgsMapCanvas *thepMapCanvas );
00061 
00062     QString replaceText( QString displayText, QgsVectorLayer *layer, QgsFeature &feat );
00063 
00064     // Flag to indicate if a maptip is currently being displayed
00065     bool mMapTipVisible;
00066     // Last point on the map canvas when the maptip timer fired. This point is in widget pixel
00067     // coordinates
00068     QPoint mLastPosition;
00069 
00070 };
00071 #endif // _QGSMAPTIP_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines