QGIS API Documentation  master-59fd5e0
src/core/diagram/qgstextdiagram.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgstextdiagram.h
00003     ---------------------
00004     begin                : March 2011
00005     copyright            : (C) 2011 by Marco Hugentobler
00006     email                : marco dot hugentobler at sourcepole dot ch
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 QGSTEXTDIAGRAM_H
00016 #define QGSTEXTDIAGRAM_H
00017 
00018 #define DIAGRAM_NAME_TEXT "Text"
00019 
00020 #include "qgsdiagram.h"
00021 #include "qgsfeature.h"
00022 #include <QPen>
00023 #include <QBrush>
00024 
00025 class QPainter;
00026 class QPointF;
00027 class QgsDiagramSettings;
00028 class QgsDiagramInterpolationSettings;
00029 
00030 class QgsRenderContext;
00031 
00032 
00033 class CORE_EXPORT QgsTextDiagram: public QgsDiagram
00034 {
00035   public:
00036     enum Shape
00037     {
00038       Circle = 0,
00039       Rectangle,
00040       Triangle
00041     };
00042 
00043     enum Orientation
00044     {
00045       Horizontal = 0,
00046       Vertical
00047     };
00048 
00049     QgsTextDiagram();
00050     ~QgsTextDiagram();
00051     void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, const QgsDiagramSettings& s, const QPointF& position );
00052     QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s );
00053     QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s, const QgsDiagramInterpolationSettings& is );
00054 
00055     QString diagramName() const { return DIAGRAM_NAME_TEXT; }
00056 
00057   private:
00058     Orientation mOrientation;
00059     Shape mShape;
00060     QBrush mBrush; //transparent brush
00061     QPen mPen;
00062 
00065     void lineEllipseIntersection( const QPointF& lineStart, const QPointF& lineEnd, const QPointF& ellipseMid, double r1, double r2, QList<QPointF>& result ) const;
00066 };
00067 
00068 #endif // QGSTEXTDIAGRAM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines