QGIS API Documentation  2.8.6-Wien
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 
21 #include "qgssinglesymbolrendererv2.h" // for default renderer
22 
23 #include "qgsrendererv2registry.h"
24 
25 #include "qgsrendercontext.h"
26 #include "qgsclipper.h"
27 #include "qgsgeometry.h"
28 #include "qgsfeature.h"
29 #include "qgslogger.h"
30 #include "qgsvectorlayer.h"
31 
32 #include <QDomElement>
33 #include <QDomDocument>
34 #include <QPolygonF>
35 
36 
37 
38 const unsigned char* QgsFeatureRendererV2::_getPoint( QPointF& pt, QgsRenderContext& context, const unsigned char* wkb )
39 {
40  QgsConstWkbPtr wkbPtr( wkb + 1 );
41  unsigned int wkbType;
42  wkbPtr >> wkbType >> pt.rx() >> pt.ry();
43 
44  if ( wkbType == QGis::WKBPoint25D )
45  wkbPtr += sizeof( double );
46 
47  if ( context.coordinateTransform() )
48  {
49  double z = 0; // dummy variable for coordiante transform
50  context.coordinateTransform()->transformInPlace( pt.rx(), pt.ry(), z );
51  }
52 
53  context.mapToPixel().transformInPlace( pt.rx(), pt.ry() );
54 
55  return wkbPtr;
56 }
57 
58 const unsigned char* QgsFeatureRendererV2::_getLineString( QPolygonF& pts, QgsRenderContext& context, const unsigned char* wkb )
59 {
60  QgsConstWkbPtr wkbPtr( wkb );
61  unsigned int wkbType, nPoints;
62  wkbPtr >> wkbType >> nPoints;
63 
64  bool hasZValue = wkbType == QGis::WKBLineString25D;
65 
66  double x, y;
67  const QgsCoordinateTransform* ct = context.coordinateTransform();
68  const QgsMapToPixel& mtp = context.mapToPixel();
69 
70  //apply clipping for large lines to achieve a better rendering performance
71  if ( nPoints > 1 )
72  {
73  const QgsRectangle& e = context.extent();
74  double cw = e.width() / 10; double ch = e.height() / 10;
75  QgsRectangle clipRect( e.xMinimum() - cw, e.yMinimum() - ch, e.xMaximum() + cw, e.yMaximum() + ch );
76  wkbPtr = QgsConstWkbPtr( QgsClipper::clippedLineWKB( wkb, clipRect, pts ) );
77  }
78  else
79  {
80  pts.resize( nPoints );
81 
82  QPointF* ptr = pts.data();
83  for ( unsigned int i = 0; i < nPoints; ++i, ++ptr )
84  {
85  wkbPtr >> x >> y;
86  if ( hasZValue )
87  wkbPtr += sizeof( double );
88 
89  *ptr = QPointF( x, y );
90  }
91  }
92 
93  //transform the QPolygonF to screen coordinates
94  if ( ct )
95  {
96  ct->transformPolygon( pts );
97  }
98 
99  QPointF* ptr = pts.data();
100  for ( int i = 0; i < pts.size(); ++i, ++ptr )
101  {
102  mtp.transformInPlace( ptr->rx(), ptr->ry() );
103  }
104 
105  return wkbPtr;
106 }
107 
108 const unsigned char* QgsFeatureRendererV2::_getPolygon( QPolygonF& pts, QList<QPolygonF>& holes, QgsRenderContext& context, const unsigned char* wkb )
109 {
110  QgsConstWkbPtr wkbPtr( wkb + 1 );
111 
112  unsigned int wkbType, numRings;
113  wkbPtr >> wkbType >> numRings;
114 
115  if ( numRings == 0 ) // sanity check for zero rings in polygon
116  return wkbPtr;
117 
118  bool hasZValue = ( wkbType == QGis::WKBPolygon25D );
119 
120  double x, y;
121  holes.clear();
122 
123  const QgsCoordinateTransform* ct = context.coordinateTransform();
124  const QgsMapToPixel& mtp = context.mapToPixel();
125  const QgsRectangle& e = context.extent();
126  double cw = e.width() / 10; double ch = e.height() / 10;
127  QgsRectangle clipRect( e.xMinimum() - cw, e.yMinimum() - ch, e.xMaximum() + cw, e.yMaximum() + ch );
128 
129  for ( unsigned int idx = 0; idx < numRings; idx++ )
130  {
131  unsigned int nPoints;
132  wkbPtr >> nPoints;
133 
134  QPolygonF poly( nPoints );
135 
136  // Extract the points from the WKB and store in a pair of vectors.
137  QPointF* ptr = poly.data();
138  for ( unsigned int jdx = 0; jdx < nPoints; ++jdx, ++ptr )
139  {
140  wkbPtr >> x >> y;
141  if ( hasZValue )
142  wkbPtr += sizeof( double );
143 
144  *ptr = QPointF( x, y );
145  }
146 
147  if ( nPoints < 1 )
148  continue;
149 
150  //clip close to view extent, if needed
151  QRectF ptsRect = poly.boundingRect();
152  if ( !context.extent().contains( ptsRect ) ) QgsClipper::trimPolygon( poly, clipRect );
153 
154  //transform the QPolygonF to screen coordinates
155  if ( ct )
156  {
157  ct->transformPolygon( poly );
158  }
159 
160 
161  ptr = poly.data();
162  for ( int i = 0; i < poly.size(); ++i, ++ptr )
163  {
164  mtp.transformInPlace( ptr->rx(), ptr->ry() );
165  }
166 
167  if ( idx == 0 )
168  pts = poly;
169  else
170  holes.append( poly );
171  }
172 
173  return wkbPtr;
174 }
175 
177 {
178  if ( symbol )
179  {
180  if ( symbol->type() == QgsSymbolV2::Marker )
181  {
182  QgsMarkerSymbolV2* ms = static_cast<QgsMarkerSymbolV2*>( symbol );
183  if ( ms )
184  {
185  ms->setScaleMethod(( QgsSymbolV2::ScaleMethod )scaleMethod );
186  }
187  }
188  }
189 }
190 
191 
193  : mType( type ), mUsingSymbolLevels( false ),
196 {
197 }
198 
200 {
201  return new QgsSingleSymbolRendererV2( QgsSymbolV2::defaultSymbol( geomType ) );
202 }
203 
205 {
206  startRender( context, vlayer->pendingFields() );
207 }
208 
209 
210 bool QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
211 {
212  QgsSymbolV2* symbol = symbolForFeature( feature );
213  if ( symbol == NULL )
214  return false;
215 
216  renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
217  return true;
218 }
219 
220 void QgsFeatureRendererV2::renderFeatureWithSymbol( QgsFeature& feature, QgsSymbolV2* symbol, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
221 {
222  QgsSymbolV2::SymbolType symbolType = symbol->type();
223 
224  QgsGeometry* geom = feature.geometry();
225  switch ( geom->wkbType() )
226  {
227  case QGis::WKBPoint:
228  case QGis::WKBPoint25D:
229  {
230  if ( symbolType != QgsSymbolV2::Marker )
231  {
232  QgsDebugMsg( "point can be drawn only with marker symbol!" );
233  break;
234  }
235  QPointF pt;
236  _getPoint( pt, context, geom->asWkb() );
237  (( QgsMarkerSymbolV2* )symbol )->renderPoint( pt, &feature, context, layer, selected );
238 
239  //if ( drawVertexMarker )
240  // renderVertexMarker( pt, context );
241  }
242  break;
243 
244  case QGis::WKBLineString:
246  {
247  if ( symbolType != QgsSymbolV2::Line )
248  {
249  QgsDebugMsg( "linestring can be drawn only with line symbol!" );
250  break;
251  }
252  QPolygonF pts;
253  _getLineString( pts, context, geom->asWkb() );
254  (( QgsLineSymbolV2* )symbol )->renderPolyline( pts, &feature, context, layer, selected );
255 
256  if ( drawVertexMarker )
257  renderVertexMarkerPolyline( pts, context );
258  }
259  break;
260 
261  case QGis::WKBPolygon:
262  case QGis::WKBPolygon25D:
263  {
264  if ( symbolType != QgsSymbolV2::Fill )
265  {
266  QgsDebugMsg( "polygon can be drawn only with fill symbol!" );
267  break;
268  }
269  QPolygonF pts;
270  QList<QPolygonF> holes;
271  _getPolygon( pts, holes, context, geom->asWkb() );
272  (( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), &feature, context, layer, selected );
273 
274  if ( drawVertexMarker )
275  renderVertexMarkerPolygon( pts, ( holes.count() ? &holes : NULL ), context );
276  }
277  break;
278 
279  case QGis::WKBMultiPoint:
281  {
282  if ( symbolType != QgsSymbolV2::Marker )
283  {
284  QgsDebugMsg( "multi-point can be drawn only with marker symbol!" );
285  break;
286  }
287 
288  QgsConstWkbPtr wkbPtr( geom->asWkb() + 5 );
289  unsigned int num;
290  wkbPtr >> num;
291  const unsigned char* ptr = wkbPtr;
292  QPointF pt;
293 
294  for ( unsigned int i = 0; i < num; ++i )
295  {
296  ptr = QgsConstWkbPtr( _getPoint( pt, context, ptr ) );
297  (( QgsMarkerSymbolV2* )symbol )->renderPoint( pt, &feature, context, layer, selected );
298 
299  //if ( drawVertexMarker )
300  // renderVertexMarker( pt, context );
301  }
302  }
303  break;
304 
307  {
308  if ( symbolType != QgsSymbolV2::Line )
309  {
310  QgsDebugMsg( "multi-linestring can be drawn only with line symbol!" );
311  break;
312  }
313 
314  QgsConstWkbPtr wkbPtr( geom->asWkb() + 5 );
315  unsigned int num;
316  wkbPtr >> num;
317  const unsigned char* ptr = wkbPtr;
318  QPolygonF pts;
319 
320  for ( unsigned int i = 0; i < num; ++i )
321  {
322  ptr = QgsConstWkbPtr( _getLineString( pts, context, ptr ) );
323  (( QgsLineSymbolV2* )symbol )->renderPolyline( pts, &feature, context, layer, selected );
324 
325  if ( drawVertexMarker )
326  renderVertexMarkerPolyline( pts, context );
327  }
328  }
329  break;
330 
333  {
334  if ( symbolType != QgsSymbolV2::Fill )
335  {
336  QgsDebugMsg( "multi-polygon can be drawn only with fill symbol!" );
337  break;
338  }
339 
340  QgsConstWkbPtr wkbPtr( geom->asWkb() + 5 );
341  unsigned int num;
342  wkbPtr >> num;
343  const unsigned char* ptr = wkbPtr;
344  QPolygonF pts;
345  QList<QPolygonF> holes;
346 
347  for ( unsigned int i = 0; i < num; ++i )
348  {
349  ptr = _getPolygon( pts, holes, context, ptr );
350  (( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), &feature, context, layer, selected );
351 
352  if ( drawVertexMarker )
353  renderVertexMarkerPolygon( pts, ( holes.count() ? &holes : NULL ), context );
354  }
355  }
356  break;
357 
358  default:
359  QgsDebugMsg( QString( "feature %1: unsupported wkb type 0x%2 for rendering" ).arg( feature.id() ).arg( geom->wkbType(), 0, 16 ) );
360  }
361 }
362 
364 {
365  return "UNKNOWN RENDERER\n";
366 }
367 
368 
370 {
371  // <renderer-v2 type=""> ... </renderer-v2>
372 
373  if ( element.isNull() )
374  return NULL;
375 
376  // load renderer
377  QString rendererType = element.attribute( "type" );
378 
380  if ( m == NULL )
381  return NULL;
382 
383  QgsFeatureRendererV2* r = m->createRenderer( element );
384  if ( r )
385  {
386  r->setUsingSymbolLevels( element.attribute( "symbollevels", "0" ).toInt() );
387  }
388  return r;
389 }
390 
391 QDomElement QgsFeatureRendererV2::save( QDomDocument& doc )
392 {
393  // create empty renderer element
394  return doc.createElement( RENDERER_TAG_NAME );
395 }
396 
397 QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage )
398 {
399  QDomElement element = node.toElement();
400  if ( element.isNull() )
401  return NULL;
402 
403  // get the UserStyle element
404  QDomElement userStyleElem = element.firstChildElement( "UserStyle" );
405  if ( userStyleElem.isNull() )
406  {
407  // UserStyle element not found, nothing will be rendered
408  errorMessage = "Info: UserStyle element not found.";
409  return NULL;
410  }
411 
412  // get the FeatureTypeStyle element
413  QDomElement featTypeStyleElem = userStyleElem.firstChildElement( "FeatureTypeStyle" );
414  if ( featTypeStyleElem.isNull() )
415  {
416  errorMessage = "Info: FeatureTypeStyle element not found.";
417  return NULL;
418  }
419 
420  // use the RuleRenderer when more rules are present or the rule
421  // has filters or min/max scale denominators set,
422  // otherwise use the SingleSymbol renderer
423  bool needRuleRenderer = false;
424  int ruleCount = 0;
425 
426  QDomElement ruleElem = featTypeStyleElem.firstChildElement( "Rule" );
427  while ( !ruleElem.isNull() )
428  {
429  ruleCount++;
430 
431  // more rules present, use the RuleRenderer
432  if ( ruleCount > 1 )
433  {
434  QgsDebugMsg( "more Rule elements found: need a RuleRenderer" );
435  needRuleRenderer = true;
436  break;
437  }
438 
439  QDomElement ruleChildElem = ruleElem.firstChildElement();
440  while ( !ruleChildElem.isNull() )
441  {
442  // rule has filter or min/max scale denominator, use the RuleRenderer
443  if ( ruleChildElem.localName() == "Filter" ||
444  ruleChildElem.localName() == "MinScaleDenominator" ||
445  ruleChildElem.localName() == "MaxScaleDenominator" )
446  {
447  QgsDebugMsg( "Filter or Min/MaxScaleDenominator element found: need a RuleRenderer" );
448  needRuleRenderer = true;
449  break;
450  }
451 
452  ruleChildElem = ruleChildElem.nextSiblingElement();
453  }
454 
455  if ( needRuleRenderer )
456  {
457  break;
458  }
459 
460  ruleElem = ruleElem.nextSiblingElement( "Rule" );
461  }
462 
463  QString rendererType;
464  if ( needRuleRenderer )
465  {
466  rendererType = "RuleRenderer";
467  }
468  else
469  {
470  rendererType = "singleSymbol";
471  }
472  QgsDebugMsg( QString( "Instantiating a '%1' renderer..." ).arg( rendererType ) );
473 
474  // create the renderer and return it
476  if ( m == NULL )
477  {
478  errorMessage = QString( "Error: Unable to get metadata for '%1' renderer." ).arg( rendererType );
479  return NULL;
480  }
481 
482  QgsFeatureRendererV2* r = m->createRendererFromSld( featTypeStyleElem, geomType );
483  return r;
484 }
485 
486 QDomElement QgsFeatureRendererV2::writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const
487 {
488  return writeSld( doc, layer.name() );
489 }
490 
491 QDomElement QgsFeatureRendererV2::writeSld( QDomDocument& doc, const QString& styleName ) const
492 {
493  QDomElement userStyleElem = doc.createElement( "UserStyle" );
494 
495  QDomElement nameElem = doc.createElement( "se:Name" );
496  nameElem.appendChild( doc.createTextNode( styleName ) );
497  userStyleElem.appendChild( nameElem );
498 
499  QDomElement featureTypeStyleElem = doc.createElement( "se:FeatureTypeStyle" );
500  toSld( doc, featureTypeStyleElem );
501  userStyleElem.appendChild( featureTypeStyleElem );
502 
503  return userStyleElem;
504 }
505 
507 {
508  Q_UNUSED( iconSize );
509  // empty list by default
510  return QgsLegendSymbologyList();
511 }
512 
514 {
515  return false;
516 }
517 
519 {
520  Q_UNUSED( key );
521  return false;
522 }
523 
524 void QgsFeatureRendererV2::checkLegendSymbolItem( QString key, bool state )
525 {
526  Q_UNUSED( key );
527  Q_UNUSED( state );
528 }
529 
530 QgsLegendSymbolList QgsFeatureRendererV2::legendSymbolItems( double scaleDenominator, QString rule )
531 {
532  Q_UNUSED( scaleDenominator );
533  Q_UNUSED( rule );
534  return QgsLegendSymbolList();
535 }
536 
538 {
539  QgsLegendSymbolList lst = const_cast<QgsFeatureRendererV2*>( this )->legendSymbolItems();
541  int i = 0;
542  for ( QgsLegendSymbolList::const_iterator it = lst.begin(); it != lst.end(); ++it, ++i )
543  {
544  lst2 << QgsLegendSymbolItemV2( it->second, it->first, QString::number( i ), legendSymbolItemsCheckable() );
545  }
546  return lst2;
547 }
548 
550 {
553 }
554 
556 {
557  QgsVectorLayer::drawVertexMarker( pt.x(), pt.y(), *context.painter(),
560 }
561 
563 {
564  foreach ( QPointF pt, pts )
565  renderVertexMarker( pt, context );
566 }
567 
568 void QgsFeatureRendererV2::renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings, QgsRenderContext& context )
569 {
570  foreach ( QPointF pt, pts )
571  renderVertexMarker( pt, context );
572 
573  if ( rings )
574  {
575  foreach ( QPolygonF ring, *rings )
576  {
577  foreach ( QPointF pt, ring )
578  renderVertexMarker( pt, context );
579  }
580  }
581 }
582 
584 {
585  QgsSymbolV2List lst;
586  QgsSymbolV2* s = symbolForFeature( feat );
587  if ( s ) lst.append( s );
588  return lst;
589 }
590 
592 {
593  QgsSymbolV2List lst;
595  if ( s ) lst.append( s );
596  return lst;
597 }
QgsFeatureId id() const
Get the feature id for this feature.
Definition: qgsfeature.cpp:100
static QgsRendererV2Registry * instance()
#define RENDERER_TAG_NAME
Definition: qgsrendererv2.h:47
A rectangle specified with double values.
Definition: qgsrectangle.h:35
virtual QgsSymbolV2 * originalSymbolForFeature(QgsFeature &feature)
Return symbol for feature.
Definition: qgsrendererv2.h:95
virtual void checkLegendSymbolItem(QString key, bool state=true)
item in symbology was checked
GeometryType
Definition: qgis.h:155
QList< QgsSymbolV2 * > QgsSymbolV2List
Definition: qgsrendererv2.h:38
QgsRendererV2AbstractMetadata * rendererMetadata(QString rendererName)
get metadata for particular renderer. Returns NULL if not found in registry.
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 ...
SymbolType type() const
Definition: qgssymbolv2.h:79
static const unsigned char * _getPoint(QPointF &pt, QgsRenderContext &context, const unsigned char *wkb)
void transformPolygon(QPolygonF &poly, TransformDirection direction=ForwardTransform) const
virtual QString dump() const
for debugging
double yMaximum() const
Get the y maximum value (top side of rectangle)
Definition: qgsrectangle.h:188
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
void transformInPlace(qreal &x, qreal &y) const
virtual QDomElement save(QDomDocument &doc)
store renderer info to XML element
static const unsigned char * clippedLineWKB(const unsigned char *wkb, const QgsRectangle &clipExtent, QPolygonF &line)
Reads a polyline from WKB and clips it to clipExtent.
Definition: qgsclipper.cpp:39
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
Definition: qgsfeature.cpp:112
bool contains(const QgsRectangle &rect) const
return true when rectangle contains other rectangle
VertexMarkerType
Editing vertex markers.
static const unsigned char * _getLineString(QPolygonF &pts, QgsRenderContext &context, const unsigned char *wkb)
virtual QgsLegendSymbolList legendSymbolItems(double scaleDenominator=-1, QString rule="")
return a list of item text / symbol
Stores metadata about one renderer class.
const QgsRectangle & extent() const
void renderVertexMarkerPolyline(QPolygonF &pts, QgsRenderContext &context)
render editing vertex marker for a polyline
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:156
const QgsCoordinateTransform * coordinateTransform() const
virtual QgsLegendSymbologyList legendSymbologyItems(QSize iconSize)
return a list of symbology items for the legend
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
void renderFeatureWithSymbol(QgsFeature &feature, QgsSymbolV2 *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
QString type() const
Definition: qgsrendererv2.h:81
const QString & name() const
Get the display name of the layer.
virtual QgsSymbolV2List originalSymbolsForFeature(QgsFeature &feat)
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbol...
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
static const unsigned char * _getPolygon(QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, const unsigned char *wkb)
void transformInPlace(double &x, double &y, double &z, TransformDirection direction=ForwardTransform) const
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
virtual bool legendSymbolItemChecked(QString key)
items of symbology items in legend is checked
int mCurrentVertexMarkerSize
The current size of editing marker.
int mCurrentVertexMarkerType
The current type of editing marker.
QGis::WkbType wkbType() const
Returns type of wkb (point / linestring / polygon etc.)
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
static void drawVertexMarker(double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize)
Draws a vertex symbol at (screen) coordinates x, y.
QList< QPair< QString, QPixmap > > QgsLegendSymbologyList
QgsFeatureRendererV2(QString type)
virtual void toSld(QDomDocument &doc, QDomElement &element) const
used from subclasses to create SLD Rule elements following SLD v1.1 specs
void setUsingSymbolLevels(bool usingSymbolLevels)
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 QgsSymbolV2List symbolsForFeature(QgsFeature &feat)
return list of symbols used for rendering the feature.
static QgsFeatureRendererV2 * load(QDomElement &symbologyElem)
create a renderer from XML element
virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const
Return a list of symbology items for the legend.
virtual bool legendSymbolItemsCheckable() const
items of symbology items in legend should be checkable
void setVertexMarkerAppearance(int type, int size)
set type and size of editing vertex markers for subsequent rendering
void setScaleMethodToSymbol(QgsSymbolV2 *symbol, int scaleMethod)
virtual Q_DECL_DEPRECATED QDomElement writeSld(QDomDocument &doc, const QgsVectorLayer &layer) const
create the SLD UserStyle element following the SLD v1.1 specs
void renderVertexMarkerPolygon(QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
render editing vertex marker for a polygon
Class for doing transforms between two map coordinate systems.
const QgsMapToPixel & mapToPixel() const
QList< QgsLegendSymbolItemV2 > QgsLegendSymbolListV2
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
double width() const
Width of the rectangle.
Definition: qgsrectangle.h:198
static void trimPolygon(QPolygonF &pts, const QgsRectangle &clipRect)
Definition: qgsclipper.h:178
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:42
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
const unsigned char * asWkb() const
Returns the buffer containing this geometry in WKB format.
double xMinimum() const
Get the x minimum value (left side of rectangle)
Definition: qgsrectangle.h:183
void setScaleMethod(QgsSymbolV2::ScaleMethod scaleMethod)
void renderVertexMarker(QPointF &pt, QgsRenderContext &context)
render editing vertex marker at specified point
double height() const
Height of the rectangle.
Definition: qgsrectangle.h:203