Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgssinglesymbolrendererv2.h 00003 --------------------- 00004 begin : November 2009 00005 copyright : (C) 2009 by Martin Dobias 00006 email : wonder.sk at gmail.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 QGSSINGLESYMBOLRENDERERV2_H 00016 #define QGSSINGLESYMBOLRENDERERV2_H 00017 00018 #include "qgis.h" 00019 #include "qgsrendererv2.h" 00020 00021 class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2 00022 { 00023 public: 00024 00025 QgsSingleSymbolRendererV2( QgsSymbolV2* symbol ); 00026 00027 virtual ~QgsSingleSymbolRendererV2(); 00028 00029 virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); 00030 00031 virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ); 00032 00033 virtual void stopRender( QgsRenderContext& context ); 00034 00035 virtual QList<QString> usedAttributes(); 00036 00037 QgsSymbolV2* symbol() const; 00038 void setSymbol( QgsSymbolV2* s ); 00039 00041 void setRotationField( QString fieldName ) { mRotationField = fieldName; } 00043 QString rotationField() const { return mRotationField; } 00044 00046 void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldName; } 00048 QString sizeScaleField() const { return mSizeScaleField; } 00049 00050 virtual QString dump(); 00051 00052 virtual QgsFeatureRendererV2* clone(); 00053 00054 virtual void toSld( QDomDocument& doc, QDomElement &element ) const; 00055 static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis::GeometryType geomType ); 00056 00059 virtual int capabilities() { return SymbolLevels | RotationField; } 00060 00061 virtual QgsSymbolV2List symbols(); 00062 00064 static QgsFeatureRendererV2* create( QDomElement& element ); 00065 00067 virtual QDomElement save( QDomDocument& doc ); 00068 00070 virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); 00071 00074 virtual QgsLegendSymbolList legendSymbolItems(); 00075 00076 protected: 00077 QgsSymbolV2* mSymbol; 00078 QString mRotationField; 00079 QString mSizeScaleField; 00080 00081 // temporary stuff for rendering 00082 int mRotationFieldIdx, mSizeScaleFieldIdx; 00083 QgsSymbolV2* mTempSymbol; 00084 double mOrigSize; 00085 }; 00086 00087 00088 #endif // QGSSINGLESYMBOLRENDERERV2_H