Quantum GIS API Documentation
1.8
|
#include <qgsuniquevaluerenderer.h>
Public Member Functions | |
QgsUniqueValueRenderer (QGis::GeometryType type) | |
QgsUniqueValueRenderer (const QgsUniqueValueRenderer &other) | |
QgsUniqueValueRenderer & | operator= (const QgsUniqueValueRenderer &other) |
virtual | ~QgsUniqueValueRenderer () |
virtual bool | willRenderFeature (QgsFeature *f) |
Determines if a feature will be rendered or not. | |
void | renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *img, bool selected, double opacity=1.0) |
Render feature added in 1.2. | |
int | readXML (const QDomNode &rnode, QgsVectorLayer &vl) |
Reads the renderer configuration from an XML file. | |
virtual bool | writeXML (QDomNode &layer_node, QDomDocument &document, const QgsVectorLayer &vl) const |
Writes the contents of the renderer to a configuration file. | |
bool | needsAttributes () const |
Returns true, if attribute values are used by the renderer and false otherwise. | |
QgsAttributeList | classificationAttributes () const |
Returns a list with indexes of classification attributes. | |
void | updateSymbolAttributes () |
QString | name () const |
Returns the renderers name. | |
void | insertValue (QString name, QgsSymbol *symbol) |
Inserts an entry into mEntries. | |
void | clearValues () |
Removes all entries from mEntries. | |
void | setClassificationField (int field) |
Sets the Field index used for classification. | |
int | classificationField () const |
Returns the index of the classification field. | |
const QList< QgsSymbol * > | symbols () const |
Return symbology items. | |
const QMap< QString, QgsSymbol * > | symbolMap () const |
Return the classification map. | |
QgsRenderer * | clone () const |
Returns a copy of the renderer (a deep copy on the heap) | |
QgsSymbol * | symbolForFeature (const QgsFeature *f) |
Returns the symbol for a feature or 0 if there isn't any. | |
Protected Attributes | |
int | mClassificationField |
Field index used for classification. | |
QMap< QString, QgsSymbol * > | mSymbols |
Symbols for the unique values. | |
QgsAttributeList | mSymbolAttributes |
Cached copy of all underlying symbols required attribute fields. | |
bool | mSymbolAttributesDirty |
Definition at line 23 of file qgsuniquevaluerenderer.h.
Definition at line 32 of file qgsuniquevaluerenderer.cpp.
References QgsRenderer::mGeometryType, and mSymbolAttributesDirty.
Referenced by clone().
QgsUniqueValueRenderer::QgsUniqueValueRenderer | ( | const QgsUniqueValueRenderer & | other | ) |
Definition at line 38 of file qgsuniquevaluerenderer.cpp.
References insertValue(), mClassificationField, QgsRenderer::mGeometryType, mSymbols, and updateSymbolAttributes().
QgsUniqueValueRenderer::~QgsUniqueValueRenderer | ( | ) | [virtual] |
Definition at line 68 of file qgsuniquevaluerenderer.cpp.
References mSymbols.
QgsAttributeList QgsUniqueValueRenderer::classificationAttributes | ( | ) | const [virtual] |
Returns a list with indexes of classification attributes.
Implements QgsRenderer.
Definition at line 289 of file qgsuniquevaluerenderer.cpp.
References mClassificationField, and mSymbolAttributes.
int QgsUniqueValueRenderer::classificationField | ( | ) | const |
Returns the index of the classification field.
Definition at line 87 of file qgsuniquevaluerenderer.cpp.
References mClassificationField.
Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV1toV2().
void QgsUniqueValueRenderer::clearValues | ( | ) |
Removes all entries from mEntries.
Definition at line 247 of file qgsuniquevaluerenderer.cpp.
References mSymbols, and updateSymbolAttributes().
Referenced by operator=().
QgsRenderer * QgsUniqueValueRenderer::clone | ( | ) | const [virtual] |
Returns a copy of the renderer (a deep copy on the heap)
Implements QgsRenderer.
Definition at line 331 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 284 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.
QgsUniqueValueRenderer & QgsUniqueValueRenderer::operator= | ( | const QgsUniqueValueRenderer & | other | ) |
Definition at line 51 of file qgsuniquevaluerenderer.cpp.
References clearValues(), insertValue(), mClassificationField, QgsRenderer::mGeometryType, mSymbols, and updateSymbolAttributes().
int QgsUniqueValueRenderer::readXML | ( | const QDomNode & | rnode, |
QgsVectorLayer & | vl | ||
) | [virtual] |
Reads the renderer configuration from an XML file.
rnode | the Dom node to read |
vl | the vector layer which will be associated with the renderer |
Implements QgsRenderer.
Definition at line 215 of file qgsuniquevaluerenderer.cpp.
References classificationField(), QgsVectorLayer::dataProvider(), QgsVectorDataProvider::fieldNameIndex(), QgsVectorLayer::geometryType(), insertValue(), QgsSymbol::lowerValue(), QgsRenderer::mGeometryType, QgsSymbol::readXML(), setClassificationField(), QgsVectorLayer::setRenderer(), and updateSymbolAttributes().
void QgsUniqueValueRenderer::renderFeature | ( | QgsRenderContext & | renderContext, |
QgsFeature & | f, | ||
QImage * | img, | ||
bool | selected, | ||
double | opacity = 1.0 |
||
) | [virtual] |
Render feature added in 1.2.
Implements QgsRenderer.
Definition at line 97 of file qgsuniquevaluerenderer.cpp.
References QgsFeature::attributeMap(), QgsSymbol::brush(), QgsSymbol::getPointSymbolAsImage(), QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), QgsRenderer::mGeometryType, QgsRenderer::mSelectionColor, name(), QgsRenderContext::painter(), QgsSymbol::pen(), QGis::Point, QgsSymbol::pointSizeUnits(), QgsSymbol::pointSymbolName(), QGis::Polygon, QgsRenderContext::rasterScaleFactor(), QgsSymbol::rotationClassificationField(), QgsRenderer::scaleBrush(), QgsSymbol::scaleClassificationField(), QgsRenderContext::scaleFactor(), QgsSymbol::setNamedPointSymbol(), QgsSymbol::symbolField(), and symbolForFeature().
void QgsUniqueValueRenderer::setClassificationField | ( | int | field | ) |
Sets the Field index used for classification.
Definition at line 82 of file qgsuniquevaluerenderer.cpp.
References mClassificationField.
Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().
QgsSymbol * QgsUniqueValueRenderer::symbolForFeature | ( | const QgsFeature * | f | ) | [virtual] |
Returns the symbol for a feature or 0 if there isn't any.
Reimplemented from QgsRenderer.
Definition at line 193 of file qgsuniquevaluerenderer.cpp.
References QgsFeature::attributeMap(), mClassificationField, and mSymbols.
Referenced by renderFeature(), and willRenderFeature().
const QMap<QString, QgsSymbol*> QgsUniqueValueRenderer::symbolMap | ( | ) | const [inline] |
Return the classification map.
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().
Definition at line 257 of file qgsuniquevaluerenderer.cpp.
References mSymbolAttributes, mSymbolAttributesDirty, and mSymbols.
Referenced by clearValues(), operator=(), QgsUniqueValueRenderer(), and readXML().
bool QgsUniqueValueRenderer::willRenderFeature | ( | QgsFeature * | f | ) | [virtual] |
Determines if a feature will be rendered or not.
f | a 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.
Implements QgsRenderer.
Definition at line 299 of file qgsuniquevaluerenderer.cpp.
References QgsVectorLayer::dataProvider(), QgsVectorDataProvider::fields(), mClassificationField, and mSymbols.
int QgsUniqueValueRenderer::mClassificationField [protected] |
Field index used for classification.
Definition at line 75 of file qgsuniquevaluerenderer.h.
Referenced by classificationAttributes(), classificationField(), operator=(), QgsUniqueValueRenderer(), setClassificationField(), symbolForFeature(), and writeXML().
Cached copy of all underlying symbols required attribute fields.
Definition at line 80 of file qgsuniquevaluerenderer.h.
Referenced by classificationAttributes(), and updateSymbolAttributes().
bool QgsUniqueValueRenderer::mSymbolAttributesDirty [protected] |
Definition at line 81 of file qgsuniquevaluerenderer.h.
Referenced by insertValue(), QgsUniqueValueRenderer(), and updateSymbolAttributes().
QMap<QString, QgsSymbol*> QgsUniqueValueRenderer::mSymbols [protected] |
Symbols for the unique values.
Definition at line 77 of file qgsuniquevaluerenderer.h.
Referenced by clearValues(), insertValue(), operator=(), QgsUniqueValueRenderer(), symbolForFeature(), updateSymbolAttributes(), writeXML(), and ~QgsUniqueValueRenderer().