Quantum GIS API Documentation  master-2bfffaa
QgsUniqueValueRenderer Class Reference

#include <qgsuniquevaluerenderer.h>

+ Inheritance diagram for QgsUniqueValueRenderer:
+ Collaboration diagram for QgsUniqueValueRenderer:

List of all members.

Public Member Functions

 QgsUniqueValueRenderer (QGis::GeometryType type)
 QgsUniqueValueRenderer (const QgsUniqueValueRenderer &other)
virtual ~QgsUniqueValueRenderer ()
QgsAttributeList classificationAttributes () const
 Returns a list with indexes of classification attributes.
int classificationField () const
 Returns the index of the classification field.
void clearValues ()
 Removes all entries from mEntries.
QgsRendererclone () const
 Returns a copy of the renderer (a deep copy on the heap)
void insertValue (QString name, QgsSymbol *symbol)
 Inserts an entry into mEntries.
QString name () const
 Returns the renderers name.
bool needsAttributes () const
 Returns true, if attribute values are used by the renderer and false otherwise.
QgsUniqueValueRendereroperator= (const QgsUniqueValueRenderer &other)
int readXML (const QDomNode &rnode, QgsVectorLayer &vl)
 Reads the renderer configuration from an XML file.
void renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *img, bool selected, double opacity=1.0)
 Render feature added in 1.2.
void setClassificationField (int field)
 Sets the Field index used for classification.
QgsSymbolsymbolForFeature (const QgsFeature *f)
 Returns the symbol for a feature or 0 if there isn't any.
const QMap< QString, QgsSymbol * > symbolMap () const
 Return the classification map.
const QList< QgsSymbol * > symbols () const
 Return symbology items.
void updateSymbolAttributes ()
virtual bool willRenderFeature (QgsFeature *f)
 Determines if a feature will be rendered or not.
virtual bool writeXML (QDomNode &layer_node, QDomDocument &document, const QgsVectorLayer &vl) const
 Writes the contents of the renderer to a configuration file.

Protected Attributes

int mClassificationField
 Field index used for classification.
QgsAttributeList mSymbolAttributes
 Cached copy of all underlying symbols required attribute fields.
bool mSymbolAttributesDirty
QMap< QString, QgsSymbol * > mSymbols
 Symbols for the unique values.

Detailed Description

Definition at line 23 of file qgsuniquevaluerenderer.h.


Constructor & Destructor Documentation

Definition at line 68 of file qgsuniquevaluerenderer.cpp.

References mSymbols.


Member Function Documentation

Returns a list with indexes of classification attributes.

Implements QgsRenderer.

Definition at line 285 of file qgsuniquevaluerenderer.cpp.

References mClassificationField, and mSymbolAttributes.

Returns the index of the classification field.

Definition at line 87 of file qgsuniquevaluerenderer.cpp.

References mClassificationField.

Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV1toV2().

Removes all entries from mEntries.

Definition at line 243 of file qgsuniquevaluerenderer.cpp.

References mSymbols, and updateSymbolAttributes().

Referenced by operator=().

Returns a copy of the renderer (a deep copy on the heap)

Implements QgsRenderer.

Definition at line 327 of file qgsuniquevaluerenderer.cpp.

References QgsUniqueValueRenderer().

void QgsUniqueValueRenderer::insertValue ( QString  name,
QgsSymbol symbol 
)

Inserts an entry into mEntries.

The render items have to be created with the new operator and are automatically destroyed if not needed anymore

Definition at line 76 of file qgsuniquevaluerenderer.cpp.

References mSymbolAttributesDirty, and mSymbols.

Referenced by operator=(), QgsUniqueValueRenderer(), readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().

QString QgsUniqueValueRenderer::name ( ) const [virtual]

Returns the renderers name.

Implements QgsRenderer.

Definition at line 280 of file qgsuniquevaluerenderer.cpp.

Referenced by renderFeature().

bool QgsUniqueValueRenderer::needsAttributes ( ) const [inline, virtual]

Returns true, if attribute values are used by the renderer and false otherwise.

Implements QgsRenderer.

Definition at line 84 of file qgsuniquevaluerenderer.h.

int QgsUniqueValueRenderer::readXML ( const QDomNode &  rnode,
QgsVectorLayer vl 
) [virtual]

Reads the renderer configuration from an XML file.

Parameters:
rnodethe Dom node to read
vlthe vector layer which will be associated with the renderer
Returns:
0 in case of success, 1 if vector layer has no renderer, 2 if classification field not found

Implements QgsRenderer.

Definition at line 211 of file qgsuniquevaluerenderer.cpp.

References classificationField(), QgsVectorLayer::dataProvider(), QgsVectorLayer::fieldNameIndex(), QgsVectorLayer::geometryType(), insertValue(), QgsSymbol::lowerValue(), QgsRenderer::mGeometryType, QgsSymbol::readXML(), setClassificationField(), QgsVectorLayer::setRenderer(), and updateSymbolAttributes().

Sets the Field index used for classification.

Definition at line 82 of file qgsuniquevaluerenderer.cpp.

References mClassificationField.

Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().

Returns the symbol for a feature or 0 if there isn't any.

Reimplemented from QgsRenderer.

Definition at line 190 of file qgsuniquevaluerenderer.cpp.

References QgsFeature::attribute(), mClassificationField, and mSymbols.

Referenced by renderFeature(), and willRenderFeature().

const QMap<QString, QgsSymbol*> QgsUniqueValueRenderer::symbolMap ( ) const [inline]

Return the classification map.

Note:
added in 1.4

Definition at line 67 of file qgsuniquevaluerenderer.h.

const QList<QgsSymbol*> QgsUniqueValueRenderer::symbols ( ) const [inline, virtual]

Return symbology items.

Implements QgsRenderer.

Definition at line 64 of file qgsuniquevaluerenderer.h.

Referenced by QgsAttributeEditor::createAttributeEditor(), and QgsSymbologyV2Conversion::rendererV1toV2().

Determines if a feature will be rendered or not.

Parameters:
fa pointer to the feature to determine if rendering will happen

Reimplemented from QgsRenderer.

Definition at line 92 of file qgsuniquevaluerenderer.cpp.

References symbolForFeature().

bool QgsUniqueValueRenderer::writeXML ( QDomNode &  layer_node,
QDomDocument &  document,
const QgsVectorLayer vl 
) const [virtual]

Writes the contents of the renderer to a configuration file.

Returns:
true in case of success

Implements QgsRenderer.

Definition at line 295 of file qgsuniquevaluerenderer.cpp.

References QgsFields::count(), QgsVectorLayer::dataProvider(), mClassificationField, mSymbols, and QgsVectorLayer::pendingFields().


Member Data Documentation

Cached copy of all underlying symbols required attribute fields.

Definition at line 80 of file qgsuniquevaluerenderer.h.

Referenced by classificationAttributes(), and updateSymbolAttributes().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines