00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef QGSRENDERER_H
00019 #define QGSRENDERER_H
00020
00021 class QgsFeature;
00022 class QgsVectorLayer;
00023 class QPainter;
00024 class QImage;
00025 class QDomNode;
00026 class QDomDocument;
00027 class QColor;
00028
00029 #include "qgis.h"
00030 #include "qgsrendercontext.h"
00031 #include <QList>
00032
00033 class QgsSymbol;
00034 class QBrush;
00035
00036 typedef QList<int> QgsAttributeList;
00037
00038
00040 class CORE_EXPORT QgsRenderer
00041 {
00042 public:
00044 QgsRenderer();
00046 virtual ~QgsRenderer();
00049 virtual bool willRenderFeature( QgsFeature *f )
00050 {
00051
00052 if ( !f )
00053 {
00054 return true;
00055 }
00056 return true;
00057 }
00066 void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 )
00067 {
00068 QgsRenderContext r;
00069 r.setPainter( p );
00070 r.setScaleFactor( widthScale );
00071 r.setRasterScaleFactor( rasterScaleFactor );
00072 renderFeature( r, f, img, selected );
00073 }
00074
00077 void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* pic, bool selected )
00078 {
00079 renderFeature( renderContext, f, pic, selected, 1.0 );
00080 }
00081
00082 virtual void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* pic, bool selected, double opacity ) = 0;
00083
00088 virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl ) = 0;
00089
00091
00094 virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const = 0;
00096 virtual bool needsAttributes() const = 0;
00098 virtual QgsAttributeList classificationAttributes() const = 0;
00100 virtual QString name() const = 0;
00102 virtual const QList<QgsSymbol*> symbols() const = 0;
00104 virtual QgsRenderer* clone() const = 0;
00106 static void setSelectionColor( QColor color );
00108 static QColor selectionColor();
00110 virtual bool containsPixmap() const;
00113 virtual bool usesTransparency() const {return false;}
00114
00116 static void scaleBrush( QBrush& b, double rasterScaleFactor );
00117
00118 protected:
00121 static QColor mSelectionColor;
00122
00124 QGis::GeometryType mGeometryType;
00125 };
00126
00127 #endif // QGSRENDERER_H