QGIS API Documentation  2.17.0-Master (0497e4a)
qgsrendererv2.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrendererv2.cpp
3  ---------------------
4  begin : November 2009
5  copyright : (C) 2009 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 "qgsrendererv2.h"
17 #include "qgssymbolv2.h"
18 #include "qgssymbollayerv2utils.h"
19 #include "qgsrulebasedrendererv2.h"
20 #include "qgsdatadefined.h"
21 
22 #include "qgssinglesymbolrendererv2.h" // for default renderer
23 
24 #include "qgsrendererv2registry.h"
25 
26 #include "qgsrendercontext.h"
27 #include "qgsclipper.h"
28 #include "qgsgeometry.h"
30 #include "qgsfeature.h"
31 #include "qgslogger.h"
32 #include "qgsvectorlayer.h"
33 #include "qgspainteffect.h"
34 #include "qgseffectstack.h"
35 #include "qgspainteffectregistry.h"
36 #include "qgswkbptr.h"
37 #include "qgspointv2.h"
38 
39 #include <QDomElement>
40 #include <QDomDocument>
41 #include <QPolygonF>
42 
43 
44 
46 {
47  return QgsSymbolV2::_getPoint( pt, context, wkbPtr );
48 }
49 
51 {
52  return QgsSymbolV2::_getLineString( pts, context, wkbPtr, clipToExtent );
53 }
54 
56 {
57  return QgsSymbolV2::_getPolygon( pts, holes, context, wkbPtr, clipToExtent );
58 }
59 
61 {
62  if ( symbol )
63  {
64  if ( symbol->type() == QgsSymbolV2::Marker )
65  {
66  QgsMarkerSymbolV2* ms = static_cast<QgsMarkerSymbolV2*>( symbol );
67  if ( ms )
68  {
69  ms->setScaleMethod( static_cast< QgsSymbolV2::ScaleMethod >( scaleMethod ) );
70  }
71  }
72  }
73 }
74 
76 {
77  if ( !destRenderer || !mPaintEffect )
78  return;
79 
80  destRenderer->setPaintEffect( mPaintEffect->clone() );
81  destRenderer->mOrderBy = mOrderBy;
82  destRenderer->mOrderByEnabled = mOrderByEnabled;
83 }
84 
86 {
87  if ( !destRenderer || !mPaintEffect )
88  return;
89 
90  destRenderer->setPaintEffect( mPaintEffect->clone() );
91 }
92 
94  : mType( type )
95  , mUsingSymbolLevels( false )
98  , mPaintEffect( nullptr )
99  , mForceRaster( false )
100  , mOrderByEnabled( false )
101 {
103  mPaintEffect->setEnabled( false );
104 }
105 
107 {
108  delete mPaintEffect;
109 }
110 
112 {
113  return new QgsSingleSymbolRendererV2( QgsSymbolV2::defaultSymbol( geomType ) );
114 }
115 
117 {
118  QgsRenderContext context;
120  return symbolForFeature( feature, context );
121 }
122 
124 {
125  Q_UNUSED( context );
126  // base method calls deprecated symbolForFeature to maintain API
128  return symbolForFeature( feature );
130 }
131 
133 {
135  return symbolForFeature( feature );
137 }
138 
140 {
141  return symbolForFeature( feature, context );
142 }
143 
145 {
146  Q_UNUSED( feature );
147  Q_UNUSED( context );
148  return QSet< QString >();
149 }
150 
152 {
153  startRender( context, vlayer->fields() );
154 }
155 
157 {
158  return false;
159 }
160 
161 bool QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
162 {
163  QgsSymbolV2* symbol = symbolForFeature( feature, context );
164  if ( !symbol )
165  return false;
166 
167  renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
168  return true;
169 }
170 
171 void QgsFeatureRendererV2::renderFeatureWithSymbol( QgsFeature& feature, QgsSymbolV2* symbol, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
172 {
173  symbol->renderFeature( feature, context, layer, selected, drawVertexMarker, mCurrentVertexMarkerType, mCurrentVertexMarkerSize );
174 }
175 
177 {
178  return "UNKNOWN RENDERER\n";
179 }
180 
182 {
183  QgsRenderContext context;
184  return symbols( context );
185 }
186 
188 {
189  Q_UNUSED( context );
190 
191  //base implementation calls deprecated method to maintain API
193  return symbols();
195 }
196 
197 
199 {
200  // <renderer-v2 type=""> ... </renderer-v2>
201 
202  if ( element.isNull() )
203  return nullptr;
204 
205  // load renderer
206  QString rendererType = element.attribute( "type" );
207 
209  if ( !m )
210  return nullptr;
211 
212  QgsFeatureRendererV2* r = m->createRenderer( element );
213  if ( r )
214  {
215  r->setUsingSymbolLevels( element.attribute( "symbollevels", "0" ).toInt() );
216  r->setForceRasterRender( element.attribute( "forceraster", "0" ).toInt() );
217 
218  //restore layer effect
219  QDomElement effectElem = element.firstChildElement( "effect" );
220  if ( !effectElem.isNull() )
221  {
222  r->setPaintEffect( QgsPaintEffectRegistry::instance()->createEffect( effectElem ) );
223  }
224 
225  // restore order by
226  QDomElement orderByElem = element.firstChildElement( "orderby" );
227  r->mOrderBy.load( orderByElem );
228  r->setOrderByEnabled( element.attribute( "enableorderby", "0" ).toInt() );
229  }
230  return r;
231 }
232 
234 {
235  // create empty renderer element
236  QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
237  rendererElem.setAttribute( "forceraster", ( mForceRaster ? "1" : "0" ) );
238 
240  mPaintEffect->saveProperties( doc, rendererElem );
241 
242  if ( !mOrderBy.isEmpty() )
243  {
244  QDomElement orderBy = doc.createElement( "orderby" );
245  mOrderBy.save( orderBy );
246  rendererElem.appendChild( orderBy );
247  }
248  rendererElem.setAttribute( "enableorderby", ( mOrderByEnabled ? "1" : "0" ) );
249  return rendererElem;
250 }
251 
253 {
254  QDomElement element = node.toElement();
255  if ( element.isNull() )
256  return nullptr;
257 
258  // get the UserStyle element
259  QDomElement userStyleElem = element.firstChildElement( "UserStyle" );
260  if ( userStyleElem.isNull() )
261  {
262  // UserStyle element not found, nothing will be rendered
263  errorMessage = "Info: UserStyle element not found.";
264  return nullptr;
265  }
266 
267  // get the FeatureTypeStyle element
268  QDomElement featTypeStyleElem = userStyleElem.firstChildElement( "FeatureTypeStyle" );
269  if ( featTypeStyleElem.isNull() )
270  {
271  errorMessage = "Info: FeatureTypeStyle element not found.";
272  return nullptr;
273  }
274 
275  // use the RuleRenderer when more rules are present or the rule
276  // has filters or min/max scale denominators set,
277  // otherwise use the SingleSymbol renderer
278  bool needRuleRenderer = false;
279  int ruleCount = 0;
280 
281  QDomElement ruleElem = featTypeStyleElem.firstChildElement( "Rule" );
282  while ( !ruleElem.isNull() )
283  {
284  ruleCount++;
285 
286  // more rules present, use the RuleRenderer
287  if ( ruleCount > 1 )
288  {
289  QgsDebugMsg( "more Rule elements found: need a RuleRenderer" );
290  needRuleRenderer = true;
291  break;
292  }
293 
294  QDomElement ruleChildElem = ruleElem.firstChildElement();
295  while ( !ruleChildElem.isNull() )
296  {
297  // rule has filter or min/max scale denominator, use the RuleRenderer
298  if ( ruleChildElem.localName() == "Filter" ||
299  ruleChildElem.localName() == "MinScaleDenominator" ||
300  ruleChildElem.localName() == "MaxScaleDenominator" )
301  {
302  QgsDebugMsg( "Filter or Min/MaxScaleDenominator element found: need a RuleRenderer" );
303  needRuleRenderer = true;
304  break;
305  }
306 
307  ruleChildElem = ruleChildElem.nextSiblingElement();
308  }
309 
310  if ( needRuleRenderer )
311  {
312  break;
313  }
314 
315  ruleElem = ruleElem.nextSiblingElement( "Rule" );
316  }
317 
318  QString rendererType;
319  if ( needRuleRenderer )
320  {
321  rendererType = "RuleRenderer";
322  }
323  else
324  {
325  rendererType = "singleSymbol";
326  }
327  QgsDebugMsg( QString( "Instantiating a '%1' renderer..." ).arg( rendererType ) );
328 
329  // create the renderer and return it
331  if ( !m )
332  {
333  errorMessage = QString( "Error: Unable to get metadata for '%1' renderer." ).arg( rendererType );
334  return nullptr;
335  }
336 
337  QgsFeatureRendererV2* r = m->createRendererFromSld( featTypeStyleElem, geomType );
338  return r;
339 }
340 
342 {
343  QgsStringMap props;
344  return writeSld( doc, layer.name(), props );
345 }
346 
347 QDomElement QgsFeatureRendererV2::writeSld( QDomDocument& doc, const QString& styleName, const QgsStringMap& props ) const
348 {
349  QDomElement userStyleElem = doc.createElement( "UserStyle" );
350 
351  QDomElement nameElem = doc.createElement( "se:Name" );
352  nameElem.appendChild( doc.createTextNode( styleName ) );
353  userStyleElem.appendChild( nameElem );
354 
355  QDomElement featureTypeStyleElem = doc.createElement( "se:FeatureTypeStyle" );
356  toSld( doc, featureTypeStyleElem, props );
357  userStyleElem.appendChild( featureTypeStyleElem );
358 
359  return userStyleElem;
360 }
361 
363 {
364  Q_UNUSED( iconSize );
365  // empty list by default
366  return QgsLegendSymbologyList();
367 }
368 
370 {
371  return false;
372 }
373 
375 {
376  Q_UNUSED( key );
377  return false;
378 }
379 
381 {
382  Q_UNUSED( key );
383  Q_UNUSED( state );
384 }
385 
387 {
388  Q_UNUSED( key );
389  delete symbol;
390 }
391 
393 {
394  Q_UNUSED( scaleDenominator );
395  Q_UNUSED( rule );
396  return QgsLegendSymbolList();
397 }
398 
400 {
401  QgsLegendSymbolList lst = const_cast<QgsFeatureRendererV2*>( this )->legendSymbolItems();
403  int i = 0;
404  for ( QgsLegendSymbolList::const_iterator it = lst.begin(); it != lst.end(); ++it, ++i )
405  {
406  lst2 << QgsLegendSymbolItemV2( it->second, it->first, QString::number( i ), legendSymbolItemsCheckable() );
407  }
408  return lst2;
409 }
410 
412 {
415 }
416 
418 {
420  return nullptr != symbolForFeature( feat );
422 }
423 
425 {
426  return nullptr != symbolForFeature( feat, context );
427 }
428 
430 {
431  QgsVectorLayer::drawVertexMarker( pt.x(), pt.y(), *context.painter(),
434 }
435 
437 {
438  Q_FOREACH ( QPointF pt, pts )
439  renderVertexMarker( pt, context );
440 }
441 
443 {
444  Q_FOREACH ( QPointF pt, pts )
445  renderVertexMarker( pt, context );
446 
447  if ( rings )
448  {
449  Q_FOREACH ( const QPolygonF& ring, *rings )
450  {
451  Q_FOREACH ( QPointF pt, ring )
452  renderVertexMarker( pt, context );
453  }
454  }
455 }
456 
458 {
459  QgsSymbolV2List lst;
461  QgsSymbolV2* s = symbolForFeature( feat );
463  if ( s ) lst.append( s );
464  return lst;
465 }
466 
468 {
469  QgsSymbolV2List lst;
470  QgsSymbolV2* s = symbolForFeature( feat, context );
471  if ( s ) lst.append( s );
472  return lst;
473 }
474 
476 {
477  QgsSymbolV2List lst;
481  if ( s ) lst.append( s );
482  return lst;
483 }
484 
486 {
487  QgsSymbolV2List lst;
488  QgsSymbolV2* s = originalSymbolForFeature( feat, context );
489  if ( s ) lst.append( s );
490  return lst;
491 }
492 
494 {
495  return mPaintEffect;
496 }
497 
499 {
500  delete mPaintEffect;
501  mPaintEffect = effect;
502 }
503 
505 {
506  return mOrderBy;
507 }
508 
510 {
511  mOrderBy = orderBy;
512 }
513 
515 {
516  return mOrderByEnabled;
517 }
518 
520 {
521  mOrderByEnabled = enabled;
522 }
523 
525 {
526  if ( symbol->type() == QgsSymbolV2::Marker )
527  {
528  QgsMarkerSymbolV2 * s = static_cast<QgsMarkerSymbolV2 *>( symbol );
530  {
531  const QgsDataDefined dd( "coalesce(sqrt(" + QString::number( s->size() ) + " * (" + field + ")),0)" );
532  s->setDataDefinedSize( dd );
533  }
534  else
535  {
536  const QgsDataDefined dd( "coalesce(" + QString::number( s->size() ) + " * (" + field + "),0)" );
537  s->setDataDefinedSize( dd );
538  }
540  }
541  else if ( symbol->type() == QgsSymbolV2::Line )
542  {
543  QgsLineSymbolV2 * s = static_cast<QgsLineSymbolV2 *>( symbol );
544  const QgsDataDefined dd( "coalesce(" + QString::number( s->width() ) + " * (" + field + "),0)" );
545  s->setDataDefinedWidth( dd );
546  }
547 }
548 
550 {
551  if ( symbol->type() == QgsSymbolV2::Marker )
552  {
553  QgsMarkerSymbolV2 * s = static_cast<QgsMarkerSymbolV2 *>( symbol );
554  const QgsDataDefined dd(( s->angle()
555  ? QString::number( s->angle() ) + " + "
556  : QString() ) + field );
557  s->setDataDefinedAngle( dd );
558  }
559 }
static QgsConstWkbPtr _getPolygon(QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
Creates a polygon in screen coordinates from a wkb string in map coordinates.
static QgsRendererV2Registry * instance()
Returns a pointer to the QgsRendererV2Registry singleton.
#define RENDERER_TAG_NAME
Definition: qgsrendererv2.h:49
virtual QSet< QString > legendKeysForFeature(QgsFeature &feature, QgsRenderContext &context)
Return legend keys matching a specified feature.
double angle() const
Returns the marker angle for the whole symbol.
void setEnabled(const bool enabled)
Sets whether the effect is enabled.
void setDataDefinedAngle(const QgsDataDefined &dd)
Set data defined angle for whole symbol (including all symbol layers).
A container class for data source field mapping or expression.
GeometryType
Definition: qgis.h:115
QgsFeatureRendererV2(const QString &type)
QDomNode appendChild(const QDomNode &newChild)
static QgsFeatureRendererV2 * loadSld(const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage)
Create a new renderer according to the information contained in the UserStyle element of a SLD style ...
Q_DECL_DEPRECATED void copyPaintEffect(QgsFeatureRendererV2 *destRenderer) const
Copies paint effect of this renderer to another renderer.
QString attribute(const QString &name, const QString &defValue) const
void setForceRasterRender(bool forceRaster)
Sets whether the renderer should be rendered to a raster destination.
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
void setDataDefinedSize(const QgsDataDefined &dd)
Set data defined size for whole symbol (including all symbol layers).
virtual Q_DECL_DEPRECATED QgsSymbolV2 * originalSymbolForFeature(QgsFeature &feature)
Return symbol for feature.
static QgsExpressionContext createFeatureBasedContext(const QgsFeature &feature, const QgsFields &fields)
Helper function for creating an expression context which contains just a feature and fields collectio...
virtual QDomElement save(QDomDocument &doc)
store renderer info to XML element
Calculate scale by the diameter.
Definition: qgssymbolv2.h:93
VertexMarkerType
Editing vertex markers.
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:515
Base class for visual effects which can be applied to QPicture drawings.
QDomElement nextSiblingElement(const QString &tagName) const
static void _getPoint(QPointF &pt, QgsRenderContext &context, const QgsPointV2 *point)
Creates a point in screen coordinates from a QgsPointV2 in map coordinates.
Definition: qgssymbolv2.h:265
Container of fields for a vector layer.
Definition: qgsfield.h:252
void CORE_EXPORT load(const QDomElement &elem)
Deserialize from XML.
SymbolType type() const
Definition: qgssymbolv2.h:107
Stores metadata about one renderer class.
Line symbol.
Definition: qgssymbolv2.h:82
virtual ~QgsFeatureRendererV2()
void renderVertexMarkerPolyline(QPolygonF &pts, QgsRenderContext &context)
render editing vertex marker for a polyline
virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const
Return a list of symbology items for the legend.
double size() const
Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the s...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:187
void renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false, int currentVertexMarkerType=0, int currentVertexMarkerSize=0)
Render a feature.
virtual void toSld(QDomDocument &doc, QDomElement &element) const
used from subclasses to create SLD Rule elements following SLD v1.1 specs
virtual Q_DECL_DEPRECATED bool willRenderFeature(QgsFeature &feat)
Returns whether the renderer will render a feature or not.
virtual bool legendSymbolItemChecked(const QString &key)
items of symbology items in legend is checked
QgsRendererV2AbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
QgsPaintEffect * mPaintEffect
virtual void checkLegendSymbolItem(const QString &key, bool state=true)
item in symbology was checked
static QgsConstWkbPtr _getLineString(QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
Creates a line string in screen coordinates from a wkb string in map coordinates. ...
virtual QgsLegendSymbologyList legendSymbologyItems(QSize iconSize)
return a list of symbology items for the legend
Marker symbol.
Definition: qgssymbolv2.h:81
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
Needs to be called when a new render cycle is started.
QgsFields fields() const
Returns the list of fields of this layer.
void renderFeatureWithSymbol(QgsFeature &feature, QgsSymbolV2 *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
QDomElement toElement() const
void renderVertexMarker(QPointF pt, QgsRenderContext &context)
render editing vertex marker at specified point
virtual Q_DECL_DEPRECATED QgsSymbolV2List originalSymbolsForFeature(QgsFeature &feat)
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbol...
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
Render a feature using this renderer in the given context.
QString number(int n, int base)
virtual Q_DECL_DEPRECATED QgsSymbolV2 * symbolForFeature(QgsFeature &feature)
To be overridden.
qreal x() const
qreal y() const
void append(const T &value)
QString localName() const
virtual QString dump() const
for debugging
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects. ...
static QgsPaintEffectRegistry * instance()
Returns a reference to the singleton instance of the paint effect registry.
virtual QgsLegendSymbolList legendSymbolItems(double scaleDenominator=-1, const QString &rule="")
return a list of item text / symbol
int mCurrentVertexMarkerSize
The current size of editing marker.
void setAttribute(const QString &name, const QString &value)
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer...
int toInt(bool *ok, int base) const
bool isEmpty() const
QString type() const
Definition: qgsrendererv2.h:92
int mCurrentVertexMarkerType
The current type of editing marker.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the renderer.
virtual QgsFeatureRendererV2 * createRenderer(QDomElement &elem)=0
Return new instance of the renderer given the DOM element.
static QgsFeatureRendererV2 * defaultRenderer(QGis::GeometryType geomType)
return a new renderer - used by default in vector layers
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbols()
For symbol levels.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
static void drawVertexMarker(double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize)
Draws a vertex symbol at (screen) coordinates x, y.
static void convertSymbolSizeScale(QgsSymbolV2 *symbol, QgsSymbolV2::ScaleMethod method, const QString &field)
QList< QPair< QString, QPixmap > > QgsLegendSymbologyList
QDomText createTextNode(const QString &value)
iterator end()
virtual bool filterNeedsGeometry() const
Returns true if this renderer requires the geometry to apply the filter.
bool isNull() const
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:516
void setDataDefinedWidth(const QgsDataDefined &dd)
Set data defined width for whole symbol (including all symbol layers).
void setUsingSymbolLevels(bool usingSymbolLevels)
QgsFeatureRequest::OrderBy orderBy() const
Get the order in which features shall be processed by this renderer.
void copyRendererData(QgsFeatureRendererV2 *destRenderer) const
Clones generic renderer data to another renderer.
Contains information about the context of a rendering operation.
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
bool orderByEnabled() const
Returns whether custom ordering will be applied before features are processed by this renderer...
QPainter * painter()
static QgsSymbolV2 * defaultSymbol(QGis::GeometryType geomType)
return new default symbol for specified geometry type
ScaleMethod
Scale method.
Definition: qgssymbolv2.h:90
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbolsForFeature(QgsFeature &feat)
Returns list of symbols used for rendering the feature.
static QgsFeatureRendererV2 * load(QDomElement &symbologyElem)
create a renderer from XML element
virtual Q_DECL_DEPRECATED QDomElement writeSld(QDomDocument &doc, const QgsVectorLayer &layer) const
create the SLD UserStyle element following the SLD v1.1 specs
QgsFeatureRequest::OrderBy mOrderBy
void setVertexMarkerAppearance(int type, int size)
set type and size of editing vertex markers for subsequent rendering
QDomElement firstChildElement(const QString &tagName) const
void setScaleMethodToSymbol(QgsSymbolV2 *symbol, int scaleMethod)
void CORE_EXPORT save(QDomElement &elem) const
Serialize to XML.
void renderVertexMarkerPolygon(QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
render editing vertex marker for a polygon
static QgsConstWkbPtr _getPolygon(QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
Creates a polygon in screen coordinates from a wkb string in map coordinates.
QString name
Read property of QString layerName.
Definition: qgsmaplayer.h:53
static QgsConstWkbPtr _getPoint(QPointF &pt, QgsRenderContext &context, QgsConstWkbPtr &wkb)
Creates a point in screen coordinates from a wkb string in map coordinates.
Calculate scale by the area.
Definition: qgssymbolv2.h:92
double width() const
virtual bool legendSymbolItemsCheckable() const
items of symbology items in legend should be checkable
QDomElement createElement(const QString &tagName)
virtual QgsFeatureRendererV2 * createRendererFromSld(QDomElement &elem, QGis::GeometryType geomType)
Represents a vector layer which manages a vector based data sets.
QList< QPair< QString, QgsSymbolV2 * > > QgsLegendSymbolList
Definition: qgsrendererv2.h:44
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
iterator begin()
void setScaleMethod(QgsSymbolV2::ScaleMethod scaleMethod)
virtual void setLegendSymbolItem(const QString &key, QgsSymbolV2 *symbol)
Sets the symbol to be used for a legend symbol item.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
Represents a list of OrderByClauses, with the most important first and the least important last...
static QgsConstWkbPtr _getLineString(QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
Creates a line string in screen coordinates from a wkb string in map coordinates. ...
static void convertSymbolRotation(QgsSymbolV2 *symbol, const QString &field)
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const
Saves the current state of the effect to a DOM element.