Quantum GIS API Documentation
1.7.5-Wroclaw
|
#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. More... | |
void | renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *img, bool selected, double opacity=1.0) |
Render feature added in 1.2. More... | |
int | readXML (const QDomNode &rnode, QgsVectorLayer &vl) |
Reads the renderer configuration from an XML file. More... | |
virtual bool | writeXML (QDomNode &layer_node, QDomDocument &document, const QgsVectorLayer &vl) const |
Writes the contents of the renderer to a configuration file. More... | |
bool | needsAttributes () const |
Returns true, if attribute values are used by the renderer and false otherwise. More... | |
QgsAttributeList | classificationAttributes () const |
Returns a list with indexes of classification attributes. More... | |
void | updateSymbolAttributes () |
QString | name () const |
Returns the renderers name. More... | |
void | insertValue (QString name, QgsSymbol *symbol) |
Inserts an entry into mEntries. More... | |
void | clearValues () |
Removes all entries from mEntries. More... | |
void | setClassificationField (int field) |
Sets the Field index used for classification. More... | |
int | classificationField () const |
Returns the index of the classification field. More... | |
const QList< QgsSymbol * > | symbols () const |
Return symbology items. More... | |
const QMap< QString, QgsSymbol * > | symbolMap () const |
Return the classification map. More... | |
QgsRenderer * | clone () const |
Returns a copy of the renderer (a deep copy on the heap) More... | |
QgsSymbol * | symbolForFeature (const QgsFeature *f) |
Returns the symbol for a feature or 0 if there isn't any. More... | |
![]() | |
QgsRenderer () | |
Default ctor sets up selection color from project properties. More... | |
virtual | ~QgsRenderer () |
Virtual destructor because we have virtual methods... More... | |
void | renderFeature (QPainter *p, QgsFeature &f, QImage *img, bool selected, double widthScale=1.0, double rasterScaleFactor=1.0) |
A vector layer passes features to a renderer object to change the brush and pen of the qpainter. More... | |
void | renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *pic, bool selected) |
A vector layer passes features to a renderer object to change the brush and pen of the qpainter. More... | |
virtual bool | containsPixmap () const |
Returns true if this renderer returns a pixmap in the render method (e.g. More... | |
virtual bool | usesTransparency () const |
Returns true if this renderer uses its own transparency settings, e.g. More... | |
Protected Attributes | |
int | mClassificationField |
Field index used for classification. More... | |
QMap< QString, QgsSymbol * > | mSymbols |
Symbols for the unique values. More... | |
QgsAttributeList | mSymbolAttributes |
Cached copy of all underlying symbols required attribute fields. More... | |
bool | mSymbolAttributesDirty |
![]() | |
QGis::GeometryType | mGeometryType |
Layer type. More... | |
Additional Inherited Members | |
![]() | |
static void | setSelectionColor (QColor color) |
Change selection color. More... | |
static QColor | selectionColor () |
Get selection color. More... | |
static void | scaleBrush (QBrush &b, double rasterScaleFactor) |
Scales a brush to a given raster scale factor (e.g. More... | |
![]() | |
static QColor | mSelectionColor = QColor( 0, 0, 0 ) |
Color to draw selected features - static so we can change it in proj props and automatically all renderers are updated. More... | |
Definition at line 24 of file qgsuniquevaluerenderer.h.
QgsUniqueValueRenderer::QgsUniqueValueRenderer | ( | QGis::GeometryType | type) |
Definition at line 33 of file qgsuniquevaluerenderer.cpp.
References QgsRenderer::mGeometryType, and mSymbolAttributesDirty.
Referenced by clone().
QgsUniqueValueRenderer::QgsUniqueValueRenderer | ( | const QgsUniqueValueRenderer & | other) |
Definition at line 39 of file qgsuniquevaluerenderer.cpp.
References insertValue(), mClassificationField, QgsRenderer::mGeometryType, mSymbols, and updateSymbolAttributes().
|
virtual |
Definition at line 69 of file qgsuniquevaluerenderer.cpp.
References mSymbols.
|
virtual |
Returns a list with indexes of classification attributes.
Implements QgsRenderer.
Definition at line 290 of file qgsuniquevaluerenderer.cpp.
References mClassificationField, and mSymbolAttributes.
int QgsUniqueValueRenderer::classificationField | ( | ) | const |
Returns the index of the classification field.
Definition at line 88 of file qgsuniquevaluerenderer.cpp.
References mClassificationField.
Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV1toV2().
void QgsUniqueValueRenderer::clearValues | ( | ) |
Removes all entries from mEntries.
Definition at line 248 of file qgsuniquevaluerenderer.cpp.
References mSymbols, and updateSymbolAttributes().
Referenced by operator=().
|
virtual |
Returns a copy of the renderer (a deep copy on the heap)
Implements QgsRenderer.
Definition at line 332 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 77 of file qgsuniquevaluerenderer.cpp.
References mSymbolAttributesDirty, and mSymbols.
Referenced by operator=(), QgsUniqueValueRenderer(), readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().
|
virtual |
Returns the renderers name.
Implements QgsRenderer.
Definition at line 285 of file qgsuniquevaluerenderer.cpp.
Referenced by renderFeature().
|
inlinevirtual |
Returns true, if attribute values are used by the renderer and false otherwise.
Implements QgsRenderer.
Definition at line 85 of file qgsuniquevaluerenderer.h.
QgsUniqueValueRenderer & QgsUniqueValueRenderer::operator= | ( | const QgsUniqueValueRenderer & | other) |
Definition at line 52 of file qgsuniquevaluerenderer.cpp.
References clearValues(), insertValue(), mClassificationField, QgsRenderer::mGeometryType, mSymbols, and updateSymbolAttributes().
|
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 216 of file qgsuniquevaluerenderer.cpp.
References classificationField(), QgsVectorLayer::dataProvider(), QgsVectorDataProvider::fieldNameIndex(), QgsVectorLayer::geometryType(), insertValue(), QgsSymbol::lowerValue(), QgsRenderer::mGeometryType, QgsSymbol::readXML(), setClassificationField(), QgsVectorLayer::setRenderer(), and updateSymbolAttributes().
|
virtual |
Render feature added in 1.2.
Implements QgsRenderer.
Definition at line 98 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 83 of file qgsuniquevaluerenderer.cpp.
References mClassificationField.
Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().
|
virtual |
Returns the symbol for a feature or 0 if there isn't any.
Reimplemented from QgsRenderer.
Definition at line 194 of file qgsuniquevaluerenderer.cpp.
References QgsFeature::attributeMap(), mClassificationField, and mSymbols.
Referenced by renderFeature(), and willRenderFeature().
|
inline |
Return the classification map.
Definition at line 68 of file qgsuniquevaluerenderer.h.
|
inlinevirtual |
Return symbology items.
Implements QgsRenderer.
Definition at line 65 of file qgsuniquevaluerenderer.h.
Referenced by QgsAttributeEditor::createAttributeEditor(), and QgsSymbologyV2Conversion::rendererV1toV2().
void QgsUniqueValueRenderer::updateSymbolAttributes | ( | ) |
Definition at line 258 of file qgsuniquevaluerenderer.cpp.
References mSymbolAttributes, mSymbolAttributesDirty, and mSymbols.
Referenced by clearValues(), operator=(), QgsUniqueValueRenderer(), and readXML().
|
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 93 of file qgsuniquevaluerenderer.cpp.
References symbolForFeature().
|
virtual |
Writes the contents of the renderer to a configuration file.
Implements QgsRenderer.
Definition at line 300 of file qgsuniquevaluerenderer.cpp.
References QgsVectorLayer::dataProvider(), QgsVectorDataProvider::fields(), mClassificationField, and mSymbols.
|
protected |
Field index used for classification.
Definition at line 76 of file qgsuniquevaluerenderer.h.
Referenced by classificationAttributes(), classificationField(), operator=(), QgsUniqueValueRenderer(), setClassificationField(), symbolForFeature(), and writeXML().
|
protected |
Cached copy of all underlying symbols required attribute fields.
Definition at line 81 of file qgsuniquevaluerenderer.h.
Referenced by classificationAttributes(), and updateSymbolAttributes().
|
protected |
Definition at line 82 of file qgsuniquevaluerenderer.h.
Referenced by insertValue(), QgsUniqueValueRenderer(), and updateSymbolAttributes().
|
protected |
Symbols for the unique values.
Definition at line 78 of file qgsuniquevaluerenderer.h.
Referenced by clearValues(), insertValue(), operator=(), QgsUniqueValueRenderer(), symbolForFeature(), updateSymbolAttributes(), writeXML(), and ~QgsUniqueValueRenderer().