QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgshighlight.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgshighlight.h - widget to highlight geometries
3  --------------------------------------
4  Date : 02-Mar-2011
5  Copyright : (C) 2011 by Juergen E. Fischer, norBIT GmbH
6  Email : jef at norbit dot de
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSHIGHLIGHT_H
16 #define QGSHIGHLIGHT_H
17 
18 #include "qgsmapcanvasitem.h"
19 #include "qgsgeometry.h"
20 #include <QBrush>
21 #include <QList>
22 #include <QPen>
23 #include <QPainter>
24 #include <QPainterPath>
25 
26 class QgsVectorLayer;
27 
30 class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
31 {
32  public:
33  QgsHighlight( QgsMapCanvas *mapCanvas, QgsGeometry *geom, QgsVectorLayer *layer );
34  ~QgsHighlight();
35 
36  void setColor( const QColor & color );
37  void setWidth( int width );
38 
39  protected:
40  virtual void paint( QPainter* p );
41 
43  void updateRect();
44 
45  private:
46  void paintPoint( QPainter *p, QgsPoint point );
47  void paintLine( QPainter *p, QgsPolyline line );
48  void paintPolygon( QPainter *p, QgsPolygon polygon );
49 
50  QgsHighlight();
51 
52  QBrush mBrush;
53  QPen mPen;
56 };
57 
58 #endif