|
QGIS API Documentation
master-6227475
|
00001 /*************************************************************************** 00002 qgssinglesymbolrendererv2.h 00003 --------------------- 00004 begin : November 2009 00005 copyright : (C) 2009 by Martin Dobias 00006 email : wonder dot sk at gmail dot 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 #include "qgssymbolv2.h" 00021 00022 class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2 00023 { 00024 public: 00025 00026 QgsSingleSymbolRendererV2( QgsSymbolV2* symbol ); 00027 00028 virtual ~QgsSingleSymbolRendererV2(); 00029 00030 virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); 00031 00032 virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ); 00033 00034 virtual void stopRender( QgsRenderContext& context ); 00035 00036 virtual QList<QString> usedAttributes(); 00037 00038 QgsSymbolV2* symbol() const; 00039 void setSymbol( QgsSymbolV2* s ); 00040 00042 void setRotationField( QString fieldName ) { mRotationField = fieldName; } 00044 QString rotationField() const { return mRotationField; } 00045 00047 void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldName; } 00049 QString sizeScaleField() const { return mSizeScaleField; } 00050 00052 void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod ); 00054 QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; } 00055 00056 virtual QString dump(); 00057 00058 virtual QgsFeatureRendererV2* clone(); 00059 00060 virtual void toSld( QDomDocument& doc, QDomElement &element ) const; 00061 static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis::GeometryType geomType ); 00062 00065 virtual int capabilities() { return SymbolLevels | RotationField; } 00066 00067 virtual QgsSymbolV2List symbols(); 00068 00070 static QgsFeatureRendererV2* create( QDomElement& element ); 00071 00073 virtual QDomElement save( QDomDocument& doc ); 00074 00076 virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); 00077 00081 virtual QgsLegendSymbolList legendSymbolItems(); 00082 00083 protected: 00084 QgsSymbolV2* mSymbol; 00085 QString mRotationField; 00086 QString mSizeScaleField; 00087 QgsSymbolV2::ScaleMethod mScaleMethod; 00088 00089 // temporary stuff for rendering 00090 int mRotationFieldIdx, mSizeScaleFieldIdx; 00091 QgsSymbolV2* mTempSymbol; 00092 double mOrigSize; 00093 }; 00094 00095 00096 #endif // QGSSINGLESYMBOLRENDERERV2_H