QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgstextdiagram.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstextdiagram.h
3  ---------------------
4  begin : March 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
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 QGSTEXTDIAGRAM_H
16 #define QGSTEXTDIAGRAM_H
17 
18 #define DIAGRAM_NAME_TEXT "Text"
19 
20 #include "qgsdiagram.h"
21 #include "qgsfeature.h"
22 #include <QPen>
23 #include <QBrush>
24 
25 class QPainter;
26 class QPointF;
27 class QgsDiagramSettings;
29 
30 class QgsRenderContext;
31 
32 
33 class CORE_EXPORT QgsTextDiagram: public QgsDiagram
34 {
35  public:
36  enum Shape
37  {
38  Circle = 0,
40  Triangle
41  };
42 
44  {
45  Horizontal = 0,
46  Vertical
47  };
48 
50  ~QgsTextDiagram();
51  virtual QgsDiagram* clone() const;
52 
53  void renderDiagram( const QgsFeature& feature, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
54 
55  QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
56  QSizeF diagramSize( const QgsFeature& feature, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
57 
58  QString diagramName() const { return DIAGRAM_NAME_TEXT; }
59 
60  private:
61  Orientation mOrientation;
62  Shape mShape;
63  QBrush mBrush; //transparent brush
64  QPen mPen;
65 
68  void lineEllipseIntersection( const QPointF& lineStart, const QPointF& lineEnd, const QPointF& ellipseMid, double r1, double r2, QList<QPointF>& result ) const;
69 };
70 
71 #endif // QGSTEXTDIAGRAM_H
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
virtual Q_DECL_DEPRECATED void renderDiagram(const QgsAttributes &att, QgsRenderContext &c, const QgsDiagramSettings &s, const QPointF &position)
Definition: qgsdiagram.cpp:110
virtual QSizeF diagramSize(const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s)=0
Returns the size in map units the diagram will use to render.
Base class for all diagram types.
Definition: qgsdiagram.h:34
virtual QgsDiagram * clone() const =0
Returns an instance that is equivalent to this one.
Contains information about the context of a rendering operation.
QVector< QVariant > QgsAttributes
Definition: qgsfeature.h:100
#define DIAGRAM_NAME_TEXT
QString diagramName() const