2007-04-02 17:41:47 +00:00
/**This class contains the information for graduate symbol rendering*/
class QgsGraduatedSymbolRenderer : QgsRenderer
{
%TypeHeaderCode
#include <qgsgraduatedsymbolrenderer.h>
%End
public:
2012-09-24 02:28:15 +02:00
enum Mode
2008-10-16 17:30:14 +00:00
{
EqualInterval,
Quantile,
Empty
};
2012-09-24 02:28:15 +02:00
QgsGraduatedSymbolRenderer( QGis::GeometryType type );
QgsGraduatedSymbolRenderer( const QgsGraduatedSymbolRenderer& other );
2007-04-02 17:41:47 +00:00
virtual ~QgsGraduatedSymbolRenderer();
2008-10-16 17:30:14 +00:00
/** Get the mode - which is only really used to be able to reinstate
2012-09-24 02:28:15 +02:00
* the graduated dialog properties properly, so we
2009-12-20 12:29:07 +00:00
* don't do anything else besides accessors and mutators in
2008-10-16 17:30:14 +00:00
* this class.
*/
2012-09-24 02:28:15 +02:00
Mode mode() const;
2008-10-16 17:30:14 +00:00
/** Set the mode - which is only really used to be able to reinstate
2012-09-24 02:28:15 +02:00
* the graduated dialog properties properly, so we
2009-12-20 12:29:07 +00:00
* don't do anything else besides accessors and mutators in
2008-10-16 17:30:14 +00:00
* this class.
*/
void setMode( Mode theMode );
2007-04-02 17:41:47 +00:00
/**Adds a new item
\param sy a pointer to the QgsSymbol to be inserted. It has to be created using the new operator and is automatically destroyed when 'removeItems' is called or when this object is destroyed*/
2012-09-24 02:28:15 +02:00
void addSymbol( QgsSymbol* sy /Transfer/ );
/**Returns the index of the classification field*/
2007-04-02 17:41:47 +00:00
int classificationField() const;
2012-09-24 02:28:15 +02:00
2007-04-02 17:41:47 +00:00
/**Removes all symbols*/
void removeSymbols();
2012-09-24 02:28:15 +02:00
/** Determines if a feature will be rendered or not
@param f a pointer to the feature to determine if rendering will happen*/
bool willRenderFeature( QgsFeature *f );
2009-07-23 10:59:59 +00:00
/**Renders a feature
2012-09-24 02:28:15 +02:00
\param renderContext the render context
2007-04-02 17:41:47 +00:00
\param f a pointer to a feature to render
2012-09-24 02:28:15 +02:00
\param img image to render in
\param selected feature is selected
\param opacity opacity of feature
\note added in 1.2 */
void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
/**Sets the classicifation field by index
2007-04-02 17:41:47 +00:00
\param field the number of the field to classify*/
2012-09-24 02:28:15 +02:00
void setClassificationField( int field );
2007-04-02 17:41:47 +00:00
/**Reads the renderer configuration from an XML file
2012-09-24 02:28:15 +02:00
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer
@return 0 in case of success, 1 if vector layer has no renderer, 2 if classification field not found
*/
virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
2007-04-02 17:41:47 +00:00
/**Writes the contents of the renderer to a configuration file
@ return true in case of success*/
2009-08-17 10:40:36 +00:00
virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
2012-09-24 02:28:15 +02:00
2007-04-02 17:41:47 +00:00
/** Returns true*/
bool needsAttributes() const;
2012-09-24 02:28:15 +02:00
/**Returns a list of all needed attributes*/
2007-04-02 17:41:47 +00:00
QList<int> classificationAttributes() const;
2012-09-24 02:28:15 +02:00
void updateSymbolAttributes();
2007-04-02 17:41:47 +00:00
/**Returns the renderers name*/
QString name() const;
2012-09-24 02:28:15 +02:00
2007-04-02 17:41:47 +00:00
/**Returns the symbols of the items*/
const QList<QgsSymbol*> symbols() const;
2012-09-24 02:28:15 +02:00
2007-04-02 17:41:47 +00:00
/**Returns a copy of the renderer (a deep copy on the heap)*/
2007-11-27 23:05:24 +00:00
QgsRenderer* clone() const /Factory/;
2012-09-24 02:28:15 +02:00
QgsSymbol *symbolForFeature( const QgsFeature* f );
2007-04-02 17:41:47 +00:00
};