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