QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgsvectorlayerrenderer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerrenderer.cpp
3  --------------------------------------
4  Date : December 2013
5  Copyright : (C) 2013 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsvectorlayerrenderer.h"
17 
18 //#include "qgsfeatureiterator.h"
19 #include "diagram/qgsdiagram.h"
20 #include "qgsdiagramrendererv2.h"
21 #include "qgsgeometrycache.h"
22 #include "qgsmessagelog.h"
23 #include "qgspallabeling.h"
24 #include "qgsrendererv2.h"
25 #include "qgsrendercontext.h"
27 #include "qgssymbollayerv2.h"
28 #include "qgssymbolv2.h"
29 #include "qgsvectorlayer.h"
31 
32 #include <QSettings>
33 
34 // TODO:
35 // - passing of cache to QgsVectorLayer
36 
37 
39  : QgsMapLayerRenderer( layer->id() )
40  , mContext( context )
41  , mFields( layer->pendingFields() )
42  , mRendererV2( 0 )
43  , mCache( 0 )
44  , mLabeling( false )
45  , mDiagrams( false )
46  , mLayerTransparency( 0 )
47 {
48  mSource = new QgsVectorLayerFeatureSource( layer );
49 
50  mRendererV2 = layer->rendererV2() ? layer->rendererV2()->clone() : 0;
52 
53  mDrawVertexMarkers = ( layer->editBuffer() != 0 );
54 
55  mGeometryType = layer->geometryType();
56 
59 
62 
63  QSettings settings;
64  mVertexMarkerOnlyForSelection = settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool();
65 
66  QString markerTypeString = settings.value( "/qgis/digitizing/marker_style", "Cross" ).toString();
67  if ( markerTypeString == "Cross" )
68  {
70  }
71  else if ( markerTypeString == "SemiTransparentCircle" )
72  {
74  }
75  else
76  {
78  }
79 
80  mVertexMarkerSize = settings.value( "/qgis/digitizing/marker_size", 3 ).toInt();
81 
82  if ( !mRendererV2 )
83  return;
84 
85  QgsDebugMsg( "rendering v2:\n " + mRendererV2->dump() );
86 
87  if ( mDrawVertexMarkers )
88  {
89  // set editing vertex markers style
91  }
92 
94 
95  //register label and diagram layer to the labeling engine
96  prepareLabeling( layer, mAttrNames );
97  prepareDiagrams( layer, mAttrNames );
98 
99 }
100 
101 
103 {
104  delete mRendererV2;
105  delete mSource;
106 }
107 
108 
110 {
112  return true;
113 
114  if ( !mRendererV2 )
115  {
116  mErrors.append( QObject::tr( "No renderer for drawing." ) );
117  return false;
118  }
119 
120  // Per feature blending mode
121  if ( mContext.useAdvancedEffects() && mFeatureBlendMode != QPainter::CompositionMode_SourceOver )
122  {
123  // set the painter to the feature blend mode, so that features drawn
124  // on this layer will interact and blend with each other
125  mContext.painter()->setCompositionMode( mFeatureBlendMode );
126  }
127 
129 
130  QgsFeatureRequest featureRequest = QgsFeatureRequest()
132  .setSubsetOfAttributes( mAttrNames, mFields );
133 
134  // enable the simplification of the geometries (Using the current map2pixel context) before send it to renderer engine.
135  if ( mSimplifyGeometry )
136  {
137  double map2pixelTol = mSimplifyMethod.threshold();
138  bool validTransform = true;
139 
140  const QgsMapToPixel& mtp = mContext.mapToPixel();
141  map2pixelTol *= mtp.mapUnitsPerPixel();
143 
144  // resize the tolerance using the change of size of an 1-BBOX from the source CoordinateSystem to the target CoordinateSystem
145  if ( ct && !(( QgsCoordinateTransform* )ct )->isShortCircuited() )
146  {
147  try
148  {
149  QgsPoint center = mContext.extent().center();
150  double rectSize = ct->sourceCrs().geographicFlag() ? 0.0008983 /* ~100/(40075014/360=111319.4833) */ : 100;
151 
152  QgsRectangle sourceRect = QgsRectangle( center.x(), center.y(), center.x() + rectSize, center.y() + rectSize );
153  QgsRectangle targetRect = ct->transform( sourceRect );
154 
155  QgsDebugMsg( QString( "Simplify - SourceTransformRect=%1" ).arg( sourceRect.toString( 16 ) ) );
156  QgsDebugMsg( QString( "Simplify - TargetTransformRect=%1" ).arg( targetRect.toString( 16 ) ) );
157 
158  if ( !sourceRect.isEmpty() && sourceRect.isFinite() && !targetRect.isEmpty() && targetRect.isFinite() )
159  {
160  QgsPoint minimumSrcPoint( sourceRect.xMinimum(), sourceRect.yMinimum() );
161  QgsPoint maximumSrcPoint( sourceRect.xMaximum(), sourceRect.yMaximum() );
162  QgsPoint minimumDstPoint( targetRect.xMinimum(), targetRect.yMinimum() );
163  QgsPoint maximumDstPoint( targetRect.xMaximum(), targetRect.yMaximum() );
164 
165  double sourceHypothenuse = sqrt( minimumSrcPoint.sqrDist( maximumSrcPoint ) );
166  double targetHypothenuse = sqrt( minimumDstPoint.sqrDist( maximumDstPoint ) );
167 
168  QgsDebugMsg( QString( "Simplify - SourceHypothenuse=%1" ).arg( sourceHypothenuse ) );
169  QgsDebugMsg( QString( "Simplify - TargetHypothenuse=%1" ).arg( targetHypothenuse ) );
170 
171  if ( targetHypothenuse != 0 )
172  map2pixelTol *= ( sourceHypothenuse / targetHypothenuse );
173  }
174  }
175  catch ( QgsCsException &cse )
176  {
177  QgsMessageLog::logMessage( QObject::tr( "Simplify transform error caught: %1" ).arg( cse.what() ), QObject::tr( "CRS" ) );
178  validTransform = false;
179  }
180  }
181 
182  if ( validTransform )
183  {
184  QgsSimplifyMethod simplifyMethod;
186  simplifyMethod.setTolerance( map2pixelTol );
188 
189  featureRequest.setSimplifyMethod( simplifyMethod );
190 
192  mContext.setVectorSimplifyMethod( vectorMethod );
193  }
194  else
195  {
196  QgsVectorSimplifyMethod vectorMethod;
198  mContext.setVectorSimplifyMethod( vectorMethod );
199  }
200  }
201  else
202  {
203  QgsVectorSimplifyMethod vectorMethod;
205  mContext.setVectorSimplifyMethod( vectorMethod );
206  }
207 
208  QgsFeatureIterator fit = mSource->getFeatures( featureRequest );
209 
211  drawRendererV2Levels( fit );
212  else
213  drawRendererV2( fit );
214 
215  //apply layer transparency for vector layers
217  {
218  // a layer transparency has been set, so update the alpha for the flattened layer
219  // by combining it with the layer transparency
220  QColor transparentFillColor = QColor( 0, 0, 0, 255 - ( 255 * mLayerTransparency / 100 ) );
221  // use destination in composition mode to merge source's alpha with destination
222  mContext.painter()->setCompositionMode( QPainter::CompositionMode_DestinationIn );
223  mContext.painter()->fillRect( 0, 0, mContext.painter()->device()->width(),
224  mContext.painter()->device()->height(), transparentFillColor );
225  }
226 
227  return true;
228 }
229 
231 {
232  mCache = cache;
233 
234  if ( mCache )
235  {
236  // Destroy all cached geometries and clear the references to them
238  }
239 }
240 
241 
242 
243 void QgsVectorLayerRenderer::drawRendererV2( QgsFeatureIterator& fit )
244 {
245  QgsFeature fet;
246  while ( fit.nextFeature( fet ) )
247  {
248  try
249  {
250  if ( !fet.geometry() )
251  continue; // skip features without geometry
252 
253  if ( mContext.renderingStopped() )
254  {
255  QgsDebugMsg( QString( "Drawing of vector layer %1 cancelled." ).arg( layerID() ) );
256  break;
257  }
258 
259  bool sel = mContext.showSelection() && mSelectedFeatureIds.contains( fet.id() );
260  bool drawMarker = ( mDrawVertexMarkers && mContext.drawEditingInformation() && ( !mVertexMarkerOnlyForSelection || sel ) );
261 
262  // render feature
263  bool rendered = mRendererV2->renderFeature( fet, mContext, -1, sel, drawMarker );
264 
265  if ( mCache )
266  {
267  // Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
268  mCache->cacheGeometry( fet.id(), *fet.geometry() );
269  }
270 
271  // labeling - register feature
272  Q_UNUSED( rendered );
273  if ( rendered && mContext.labelingEngine() )
274  {
275  if ( mLabeling )
276  {
278  }
279  if ( mDiagrams )
280  {
282  }
283  }
284  }
285  catch ( const QgsCsException &cse )
286  {
287  Q_UNUSED( cse );
288  QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
289  .arg( fet.id() ).arg( cse.what() ) );
290  }
291  }
292 
293  stopRendererV2( NULL );
294 }
295 
296 void QgsVectorLayerRenderer::drawRendererV2Levels( QgsFeatureIterator& fit )
297 {
298  QHash< QgsSymbolV2*, QList<QgsFeature> > features; // key = symbol, value = array of features
299 
300  QgsSingleSymbolRendererV2* selRenderer = NULL;
301  if ( !mSelectedFeatureIds.isEmpty() )
302  {
304  selRenderer->symbol()->setColor( mContext.selectionColor() );
306  selRenderer->startRender( mContext, mFields );
307  }
308 
309  // 1. fetch features
310  QgsFeature fet;
311  while ( fit.nextFeature( fet ) )
312  {
313  if ( !fet.geometry() )
314  continue; // skip features without geometry
315 
316  if ( mContext.renderingStopped() )
317  {
318  qDebug( "rendering stop!" );
319  stopRendererV2( selRenderer );
320  return;
321  }
322 
324  if ( !sym )
325  {
326  continue;
327  }
328 
329  if ( !features.contains( sym ) )
330  {
331  features.insert( sym, QList<QgsFeature>() );
332  }
333  features[sym].append( fet );
334 
335  if ( mCache )
336  {
337  // Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
338  mCache->cacheGeometry( fet.id(), *fet.geometry() );
339  }
340 
341  if ( mContext.labelingEngine() )
342  {
343  if ( mLabeling )
344  {
346  }
347  if ( mDiagrams )
348  {
350  }
351  }
352  }
353 
354  // find out the order
355  QgsSymbolV2LevelOrder levels;
356  QgsSymbolV2List symbols = mRendererV2->symbols();
357  for ( int i = 0; i < symbols.count(); i++ )
358  {
359  QgsSymbolV2* sym = symbols[i];
360  for ( int j = 0; j < sym->symbolLayerCount(); j++ )
361  {
362  int level = sym->symbolLayer( j )->renderingPass();
363  if ( level < 0 || level >= 1000 ) // ignore invalid levels
364  continue;
365  QgsSymbolV2LevelItem item( sym, j );
366  while ( level >= levels.count() ) // append new empty levels
367  levels.append( QgsSymbolV2Level() );
368  levels[level].append( item );
369  }
370  }
371 
372  // 2. draw features in correct order
373  for ( int l = 0; l < levels.count(); l++ )
374  {
375  QgsSymbolV2Level& level = levels[l];
376  for ( int i = 0; i < level.count(); i++ )
377  {
378  QgsSymbolV2LevelItem& item = level[i];
379  if ( !features.contains( item.symbol() ) )
380  {
381  QgsDebugMsg( "level item's symbol not found!" );
382  continue;
383  }
384  int layer = item.layer();
385  QList<QgsFeature>& lst = features[item.symbol()];
386  QList<QgsFeature>::iterator fit;
387  for ( fit = lst.begin(); fit != lst.end(); ++fit )
388  {
389  if ( mContext.renderingStopped() )
390  {
391  stopRendererV2( selRenderer );
392  return;
393  }
394 
395  bool sel = mSelectedFeatureIds.contains( fit->id() );
396  // maybe vertex markers should be drawn only during the last pass...
397  bool drawMarker = ( mDrawVertexMarkers && mContext.drawEditingInformation() && ( !mVertexMarkerOnlyForSelection || sel ) );
398 
399  try
400  {
401  mRendererV2->renderFeature( *fit, mContext, layer, sel, drawMarker );
402  }
403  catch ( const QgsCsException &cse )
404  {
405  Q_UNUSED( cse );
406  QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
407  .arg( fet.id() ).arg( cse.what() ) );
408  }
409  }
410  }
411  }
412 
413  stopRendererV2( selRenderer );
414 }
415 
416 
417 void QgsVectorLayerRenderer::stopRendererV2( QgsSingleSymbolRendererV2* selRenderer )
418 {
420  if ( selRenderer )
421  {
422  selRenderer->stopRender( mContext );
423  delete selRenderer;
424  }
425 }
426 
427 
428 
429 
430 void QgsVectorLayerRenderer::prepareLabeling( QgsVectorLayer* layer, QStringList& attributeNames )
431 {
432  if ( !mContext.labelingEngine() )
433  return;
434 
435  if ( mContext.labelingEngine()->prepareLayer( layer, attributeNames, mContext ) )
436  {
437  mLabeling = true;
438 
440  Q_UNUSED( palyr );
441 
442 #if 0 // TODO: limit of labels, font not found
443  // see if feature count limit is set for labeling
444  if ( palyr.limitNumLabels && palyr.maxNumLabels > 0 )
445  {
446  QgsFeatureIterator fit = getFeatures( QgsFeatureRequest()
447  .setFilterRect( mContext.extent() )
448  .setSubsetOfAttributes( QgsAttributeList() ) );
449 
450  // total number of features that may be labeled
451  QgsFeature f;
452  int nFeatsToLabel = 0;
453  while ( fit.nextFeature( f ) )
454  {
455  nFeatsToLabel++;
456  }
457  palyr.mFeaturesToLabel = nFeatsToLabel;
458  }
459 
460  // notify user about any font substitution
461  if ( !palyr.mTextFontFound && !mLabelFontNotFoundNotified )
462  {
463  emit labelingFontNotFound( this, palyr.mTextFontFamily );
464  mLabelFontNotFoundNotified = true;
465  }
466 #endif
467  }
468 }
469 
470 void QgsVectorLayerRenderer::prepareDiagrams( QgsVectorLayer* layer, QStringList& attributeNames )
471 {
472  if ( !mContext.labelingEngine() )
473  return;
474 
475  if ( !layer->diagramRenderer() || !layer->diagramLayerSettings() )
476  return;
477 
478  mDiagrams = true;
479 
480  const QgsDiagramRendererV2* diagRenderer = layer->diagramRenderer();
481  const QgsDiagramLayerSettings* diagSettings = layer->diagramLayerSettings();
482 
483  mContext.labelingEngine()->addDiagramLayer( layer, diagSettings ); // will make internal copy of diagSettings + initialize it
484 
485  //add attributes needed by the diagram renderer
486  QList<QString> att = diagRenderer->diagramAttributes();
487  QList<QString>::const_iterator attIt = att.constBegin();
488  for ( ; attIt != att.constEnd(); ++attIt )
489  {
490  QgsExpression* expression = diagRenderer->diagram()->getExpression( *attIt, &mFields );
491  QStringList columns = expression->referencedColumns();
492  QStringList::const_iterator columnsIterator = columns.constBegin();
493  for ( ; columnsIterator != columns.constEnd(); ++columnsIterator )
494  {
495  if ( !attributeNames.contains( *columnsIterator ) )
496  attributeNames << *columnsIterator;
497  }
498  }
499 
500  const QgsLinearlyInterpolatedDiagramRenderer* linearlyInterpolatedDiagramRenderer = dynamic_cast<const QgsLinearlyInterpolatedDiagramRenderer*>( layer->diagramRenderer() );
501  if ( linearlyInterpolatedDiagramRenderer != NULL )
502  {
503  if ( linearlyInterpolatedDiagramRenderer->classificationAttributeIsExpression() )
504  {
505  QgsExpression* expression = diagRenderer->diagram()->getExpression( linearlyInterpolatedDiagramRenderer->classificationAttributeExpression(), &mFields );
506  QStringList columns = expression->referencedColumns();
507  QStringList::const_iterator columnsIterator = columns.constBegin();
508  for ( ; columnsIterator != columns.constEnd(); ++columnsIterator )
509  {
510  if ( !attributeNames.contains( *columnsIterator ) )
511  attributeNames << *columnsIterator;
512  }
513  }
514  else
515  {
516  QString name = mFields.at( linearlyInterpolatedDiagramRenderer->classificationAttribute() ).name();
517  if ( !attributeNames.contains( name ) )
518  attributeNames << name;
519  }
520  }
521 
522  //and the ones needed for data defined diagram positions
523  if ( diagSettings->xPosColumn != -1 )
524  attributeNames << mFields.at( diagSettings->xPosColumn ).name();
525  if ( diagSettings->yPosColumn != -1 )
526  attributeNames << mFields.at( diagSettings->yPosColumn ).name();
527 }
QgsFeatureId id() const
Get the feature id for this feature.
Definition: qgsfeature.cpp:100
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition: qgsexpression.h:87
const QString & name() const
Gets the name of the field.
Definition: qgsfield.cpp:59
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
const QgsCoordinateReferenceSystem & sourceCrs() const
Wrapper for iterator of features from vector data provider or vector layer.
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
A rectangle specified with double values.
Definition: qgsrectangle.h:35
bool isEmpty() const
test if rectangle is empty.
float threshold() const
Gets the simplification threshold of the vector layer managed.
virtual int prepareLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)=0
called when starting rendering of a layer
QList< QgsSymbolV2 * > QgsSymbolV2List
Definition: qgsrendererv2.h:37
QColor selectionColor() const
virtual QgsPalLayerSettings & layer(const QString &layerName)=0
returns PAL layer settings for a registered layer
virtual QString dump() const
for debugging
virtual QList< QString > diagramAttributes() const =0
Returns attribute indices needed for diagram rendering.
bool isFinite() const
Returns true if the rectangle has finite boundaries.
QgsExpression * getExpression(const QString &expression, const QgsFields *fields)
Definition: qgsdiagram.cpp:47
double yMaximum() const
Get the y maximum value (top side of rectangle)
Definition: qgsrectangle.h:188
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
The geometries can be simplified using the current map2pixel context state.
QgsDiagram * diagram() const
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
Definition: qgsfeature.cpp:112
void setSimplifyHints(SimplifyHints simplifyHints)
Sets the simplification hints of the vector layer managed.
void setGeometryCachePointer(QgsGeometryCache *cache)
where to save the cached geometries
QPainter::CompositionMode mFeatureBlendMode
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request)
void setVectorSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
const QgsRectangle & extent() const
bool showSelection() const
Returns true if vector selections should be shown in the rendered map.
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
Definition: qgsfield.h:227
QgsPoint transform(const QgsPoint &p, TransformDirection direction=ForwardTransform) const
virtual QList< QString > usedAttributes()=0
virtual int addDiagramLayer(QgsVectorLayer *layer, const QgsDiagramLayerSettings *s)
adds a diagram layer to the labeling engine
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
const QgsDiagramLayerSettings * diagramLayerSettings() const
const QgsCoordinateTransform * coordinateTransform() const
virtual void stopRender(QgsRenderContext &context)
void setCachedGeometriesRect(const QgsRectangle &extent)
QgsVectorSimplifyMethod mSimplifyMethod
double x() const
Definition: qgspoint.h:126
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
Returns diagram settings for a feature.
QString layerID() const
Get access to the ID of the layer rendered by this class.
virtual void stopRender(QgsRenderContext &context)=0
bool useAdvancedEffects() const
Returns true if advanced effects such as blend modes such be used.
virtual QgsSymbolV2List symbols()=0
for symbol levels
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:33
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
void setColor(const QColor &color)
Simplify using the map2pixel data to optimize the rendering of geometries.
virtual QgsFeatureRendererV2 * clone() const =0
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
No simplification can be applied.
bool simplifyDrawingCanbeApplied(const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint) const
Returns whether the VectorLayer can apply the specified simplification hint.
QPainter::CompositionMode featureBlendMode() const
Read blend mode for layer.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
Definition: qgsrectangle.h:193
double xMaximum() const
Get the x maximum value (right side of rectangle)
Definition: qgsrectangle.h:178
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
QgsVectorLayerRenderer(QgsVectorLayer *layer, QgsRenderContext &context)
bool renderingStopped() const
void setTolerance(double tolerance)
Sets the tolerance of simplification. Represents the maximum distance between two coordinates which c...
QStringList referencedColumns()
Get list of columns referenced by the expression.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsVectorLayerFeatureSource * mSource
QList< int > QgsAttributeList
int symbolLayerCount()
Definition: qgssymbolv2.h:85
double mapUnitsPerPixel() const
Return current map units per pixel.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
QgsFeatureRendererV2 * mRendererV2
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point.
Definition: qgspoint.h:63
bool drawEditingInformation() const
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported...
QList< QgsSymbolV2LevelItem > QgsSymbolV2Level
Definition: qgsrendererv2.h:63
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
int renderingPass() const
QgsFeatureRequest & setSimplifyMethod(const QgsSimplifyMethod &simplifyMethod)
Set a simplification method for geometries that will be fetched.
int layerTransparency() const
Read transparency for layer.
void setForceLocalOptimization(bool localOptimization)
Sets whether the simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries.
QString what() const
Definition: qgsexception.h:35
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
QPainter * painter()
static QgsSymbolV2 * defaultSymbol(QGis::GeometryType geomType)
return new default symbol for specified geometry type
virtual void registerFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext(), QString dxfLayer=QString::null)=0
called for every feature
QGis::GeometryType mGeometryType
void setMethodType(MethodType methodType)
Sets the simplification type.
QgsSymbolV2 * symbol()
Definition: qgsrendererv2.h:55
void setVertexMarkerAppearance(int type, int size)
set type and size of editing vertex markers for subsequent rendering
bool usingSymbolLevels() const
void cacheGeometry(QgsFeatureId fid, const QgsGeometry &geom)
store a geometry in the cache
Class for doing transforms between two map coordinate systems.
const QgsMapToPixel & mapToPixel() const
QList< QgsSymbolV2Level > QgsSymbolV2LevelOrder
Definition: qgsrendererv2.h:66
double y() const
Definition: qgspoint.h:134
Base class for utility classes that encapsulate information necessary for rendering of map layers...
This class contains information about how to simplify geometries fetched from a QgsFeatureIterator.
Custom exception class for Coordinate Reference System related exceptions.
QgsSymbolLayerV2 * symbolLayer(int layer)
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
Represents a vector layer which manages a vector based data sets.
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
double xMinimum() const
Get the x minimum value (left side of rectangle)
Definition: qgsrectangle.h:183
QgsPoint center() const
Center point of the rectangle.
Definition: qgsrectangle.h:208
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
QgsLabelingEngineInterface * labelingEngine() const
virtual bool render()
Do the rendering (based on data stored in the class)
#define tr(sourceText)