QgsRenderer Class Reference

Abstract base class for renderers. More...

#include <qgsrenderer.h>

Inheritance diagram for QgsRenderer:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 QgsRenderer ()
 Default ctor sets up selection color from project properties.
virtual ~QgsRenderer ()
 Virtual destructor because we have virtual methods.
virtual bool willRenderFeature (QgsFeature *f)
 Determines if a feature will be rendered or not.
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.
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.
virtual void renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *pic, bool selected, double opacity)=0
virtual int readXML (const QDomNode &rnode, QgsVectorLayer &vl)=0
 Reads the renderer configuration from an XML file.
virtual bool writeXML (QDomNode &layer_node, QDomDocument &document, const QgsVectorLayer &vl) const =0
 Writes the contents of the renderer to a configuration file.
virtual bool needsAttributes () const =0
 Returns true, if attribute values are used by the renderer and false otherwise.
virtual QgsAttributeList classificationAttributes () const =0
 Returns a list with indexes of classification attributes.
virtual QString name () const =0
 Returns the renderers name.
virtual const QList< QgsSymbol * > symbols () const =0
 Return symbology items.
virtual QgsRendererclone () const =0
 Returns a copy of the renderer (a deep copy on the heap).
virtual bool containsPixmap () const
 Returns true if this renderer returns a pixmap in the render method (e.g.
virtual bool usesTransparency () const
 Returns true if this renderer uses its own transparency settings, e.g.

Static Public Member Functions

static void setSelectionColor (QColor color)
 Change selection color.
static QColor selectionColor ()
 Get selection color.
static void scaleBrush (QBrush &b, double rasterScaleFactor)
 Scales a brush to a given raster scale factor (e.g.

Protected Attributes

QGis::GeometryType mGeometryType
 Layer type.

Static Protected Attributes

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.


Detailed Description

Abstract base class for renderers.

A renderer holds all the information necessary to draw the contents of a vector layer to a map canvas. The vector layer then passes each feature to paint to the renderer

Definition at line 40 of file qgsrenderer.h.


Constructor & Destructor Documentation

QgsRenderer::QgsRenderer (  ) 

Default ctor sets up selection color from project properties.

Definition at line 28 of file qgsrenderer.cpp.

QgsRenderer::~QgsRenderer (  )  [virtual]

Virtual destructor because we have virtual methods.

..

Definition at line 33 of file qgsrenderer.cpp.


Member Function Documentation

virtual bool QgsRenderer::willRenderFeature ( QgsFeature f  )  [inline, virtual]

Determines if a feature will be rendered or not.

Parameters:
f a pointer to the feature to determine if rendering will happen

Reimplemented in QgsGraduatedSymbolRenderer, and QgsUniqueValueRenderer.

Definition at line 49 of file qgsrenderer.h.

Referenced by QgsVectorLayer::draw(), and QgsVectorLayer::drawLabels().

void QgsRenderer::renderFeature ( QPainter *  p,
QgsFeature f,
QImage *  img,
bool  selected,
double  widthScale = 1.0,
double  rasterScaleFactor = 1.0 
) [inline]

A vector layer passes features to a renderer object to change the brush and pen of the qpainter.

Parameters:
p the painter storing brush and pen
f a pointer to the feature to be rendered
img a pointer to picture
selected feature is selected
widthScale scale
rasterScaleFactor raster scale
Note:
deprecated

Definition at line 66 of file qgsrenderer.h.

References QgsRenderContext::setPainter(), QgsRenderContext::setRasterScaleFactor(), and QgsRenderContext::setScaleFactor().

Referenced by QgsVectorLayer::draw().

void QgsRenderer::renderFeature ( QgsRenderContext renderContext,
QgsFeature f,
QImage *  pic,
bool  selected 
) [inline]

A vector layer passes features to a renderer object to change the brush and pen of the qpainter.

Note:
added in 1.2

Definition at line 77 of file qgsrenderer.h.

virtual void QgsRenderer::renderFeature ( QgsRenderContext renderContext,
QgsFeature f,
QImage *  pic,
bool  selected,
double  opacity 
) [pure virtual]

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

Reads the renderer configuration from an XML file.

Parameters:
rnode the Dom node to read
vl the 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

Implemented in QgsContinuousColorRenderer, QgsGraduatedSymbolRenderer, QgsSingleSymbolRenderer, and QgsUniqueValueRenderer.

Referenced by QgsVectorLayer::readSymbology().

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

Writes the contents of the renderer to a configuration file.

Writes the contents of the renderer to a configuration file @ return true in case of success

Implemented in QgsContinuousColorRenderer, QgsGraduatedSymbolRenderer, QgsSingleSymbolRenderer, and QgsUniqueValueRenderer.

Referenced by QgsVectorLayer::writeSymbology().

virtual bool QgsRenderer::needsAttributes (  )  const [pure virtual]

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

Implemented in QgsContinuousColorRenderer, QgsGraduatedSymbolRenderer, QgsSingleSymbolRenderer, and QgsUniqueValueRenderer.

virtual QgsAttributeList QgsRenderer::classificationAttributes (  )  const [pure virtual]

virtual QString QgsRenderer::name (  )  const [pure virtual]

virtual const QList<QgsSymbol*> QgsRenderer::symbols (  )  const [pure virtual]

virtual QgsRenderer* QgsRenderer::clone (  )  const [pure virtual]

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

Implemented in QgsContinuousColorRenderer, QgsGraduatedSymbolRenderer, QgsSingleSymbolRenderer, and QgsUniqueValueRenderer.

Referenced by QgsVectorLayer::copySymbologySettings().

void QgsRenderer::setSelectionColor ( QColor  color  )  [static]

Change selection color.

Definition at line 37 of file qgsrenderer.cpp.

References mSelectionColor.

QColor QgsRenderer::selectionColor (  )  [static]

Get selection color.

Added in QGIS v1.4

Definition at line 42 of file qgsrenderer.cpp.

References mSelectionColor.

Referenced by QgsVectorLayer::drawRendererV2Levels(), and QgsSymbolV2RenderContext::selectionColor().

bool QgsRenderer::containsPixmap (  )  const [virtual]

Returns true if this renderer returns a pixmap in the render method (e.g.

for point data or diagrams)

Definition at line 47 of file qgsrenderer.cpp.

References mGeometryType, and QGis::Point.

virtual bool QgsRenderer::usesTransparency (  )  const [inline, virtual]

Returns true if this renderer uses its own transparency settings, e.g.

differentiated by classification. This is a hint for QgsVectorLayer to not use the transparency setting on layer level in this cases

Definition at line 113 of file qgsrenderer.h.

Referenced by QgsVectorLayer::draw(), QgsVectorLayer::drawLineString(), and QgsVectorLayer::drawPolygon().

void QgsRenderer::scaleBrush ( QBrush &  b,
double  rasterScaleFactor 
) [static]

Scales a brush to a given raster scale factor (e.g.

for printing)

Definition at line 59 of file qgsrenderer.cpp.

Referenced by QgsComposerLegend::drawPolygonSymbol(), QgsUniqueValueRenderer::renderFeature(), QgsSingleSymbolRenderer::renderFeature(), and QgsGraduatedSymbolRenderer::renderFeature().


Member Data Documentation

QColor QgsRenderer::mSelectionColor = QColor( 0, 0, 0 ) [static, protected]

Color to draw selected features - static so we can change it in proj props and automatically all renderers are updated.

Definition at line 121 of file qgsrenderer.h.

Referenced by QgsUniqueValueRenderer::renderFeature(), QgsSingleSymbolRenderer::renderFeature(), QgsGraduatedSymbolRenderer::renderFeature(), QgsContinuousColorRenderer::renderFeature(), selectionColor(), and setSelectionColor().


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:48 2012 for Quantum GIS API Documentation by  doxygen 1.5.6