QGIS API Documentation  2.3.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgspallabeling.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspallabeling.h
3  Smart labeling for vector layers
4  -------------------
5  begin : June 2009
6  copyright : (C) Martin Dobias
7  email : wonder dot sk at gmail dot com
8 
9  ***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 //Note: although this file is in the core library, it is not part of the stable API
19 //and might change at any time!
20 
21 #ifndef QGSPALLABELING_H
22 #define QGSPALLABELING_H
23 
24 class QFontMetricsF;
25 class QPainter;
26 class QPicture;
27 class QgsGeometry;
28 class QgsMapRenderer;
29 class QgsRectangle;
31 class QgsLabelSearchTree;
32 
33 class QgsMapSettings;
34 
35 #include <QString>
36 #include <QFont>
37 #include <QFontDatabase>
38 #include <QColor>
39 #include <QHash>
40 #include <QList>
41 #include <QRectF>
42 
43 namespace pal
44 {
45  class Pal;
46  class Layer;
47  class LabelPosition;
48 }
49 
50 class QgsMapToPixel;
51 class QgsFeature;
52 
53 #include "qgspoint.h"
54 #include "qgsrectangle.h"
55 #include "qgsmaprenderer.h" // definition of QgsLabelingEngineInterface
56 #include "qgsexpression.h"
57 #include "qgsdatadefined.h"
58 #include "qgsdiagramrendererv2.h"
59 
60 class QgsPalGeometry;
61 class QgsVectorLayer;
62 
63 class CORE_EXPORT QgsPalLayerSettings
64 {
65  public:
69 
71  static QgsPalLayerSettings fromLayer( QgsVectorLayer* layer );
72 
73  enum Placement
74  {
75  AroundPoint, // Point / Polygon
76  OverPoint, // Point / Polygon
77  Line, // Line / Polygon
78  Curved, // Line
79  Horizontal, // Polygon
80  Free // Polygon
81  };
82 
84  {
85  OnLine = 1,
86  AboveLine = 2,
87  BelowLine = 4,
88  MapOrientation = 8
89  };
90 
92  {
101  QuadrantBelowRight
102  };
103 
105  {
106  Upright, // upside-down labels (90 <= angle < 270) are shown upright
107  ShowDefined, // show upside down when rotation is layer- or data-defined
108  ShowAll // show upside down for all labels, including dynamic ones
109  };
110 
112  {
113  SymbolLeftRight, // place direction symbols on left/right of label
114  SymbolAbove, // place direction symbols on above label
115  SymbolBelow // place direction symbols on below label
116  };
117 
119  {
120  MultiLeft = 0,
122  MultiRight
123  };
124 
126  {
127  ShapeRectangle = 0,
131  ShapeSVG
132  };
133 
134  enum SizeType
135  {
136  SizeBuffer = 0,
138  SizePercent
139  };
140 
142  {
143  RotationSync = 0,
145  RotationFixed
146  };
147 
149  enum SizeUnit
150  {
151  Points = 0,
152  MM,
154  Percent
155  };
156 
158  {
159  ShadowLowest = 0,
162  ShadowShape
163  };
164 
165  // update mDataDefinedNames QMap in constructor when adding/deleting enum value
167  {
168  // text style
169  Size = 0,
170  Bold = 1,
171  Italic = 2,
172  Underline = 3,
173  Color = 4,
174  Strikeout = 5,
175  Family = 6,
176  FontStyle = 21,
177  FontSizeUnit = 22,
178  FontTransp = 18,
179  FontCase = 27,
180  FontLetterSpacing = 28,
181  FontWordSpacing = 29,
182  FontBlendMode = 30,
183 
184  // text formatting
185  MultiLineWrapChar = 31,
186  MultiLineHeight = 32,
187  MultiLineAlignment = 33,
188  DirSymbDraw = 34,
189  DirSymbLeft = 35,
190  DirSymbRight = 36,
191  DirSymbPlacement = 37,
192  DirSymbReverse = 38,
193  NumFormat = 39,
194  NumDecimals = 40,
195  NumPlusSign = 41,
196 
197  // text buffer
198  BufferDraw = 42,
199  BufferSize = 7,
200  BufferUnit = 43,
201  BufferColor = 8,
202  BufferTransp = 19,
203  BufferJoinStyle = 44,
204  BufferBlendMode = 45,
205 
206  // background
207  ShapeDraw = 46,
208  ShapeKind = 47,
209  ShapeSVGFile = 48,
210  ShapeSizeType = 49,
211  ShapeSizeX = 50,
212  ShapeSizeY = 85,
213  ShapeSizeUnits = 51,
214  ShapeRotationType = 52,
215  ShapeRotation = 53,
216  ShapeOffset = 54,
217  ShapeOffsetUnits = 55,
218  ShapeRadii = 56,
219  ShapeRadiiUnits = 57,
220  ShapeTransparency = 63,
221  ShapeBlendMode = 64,
222  ShapeFillColor = 58,
223  ShapeBorderColor = 59,
224  ShapeBorderWidth = 60,
225  ShapeBorderWidthUnits = 61,
226  ShapeJoinStyle = 62,
227 
228  // drop shadow
229  ShadowDraw = 65,
230  ShadowUnder = 66,
231  ShadowOffsetAngle = 67,
232  ShadowOffsetDist = 68,
233  ShadowOffsetUnits = 69,
234  ShadowRadius = 70,
235  ShadowRadiusUnits = 71,
236  ShadowTransparency = 72,
237  ShadowScale = 73,
238  ShadowColor = 74,
239  ShadowBlendMode = 75,
240 
241  // placement
242  CentroidWhole = 76,
243  OffsetQuad = 77,
244  OffsetXY = 78,
245  OffsetUnits = 80,
246  LabelDistance = 13,
247  DistanceUnits = 81,
248  OffsetRotation = 82,
249  CurvedCharAngleInOut = 83,
250  // (data defined only)
251  PositionX = 9, //x-coordinate data defined label position
252  PositionY = 10, //y-coordinate data defined label position
253  Hali = 11, //horizontal alignment for data defined label position (Left, Center, Right)
254  Vali = 12, //vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top)
255  Rotation = 14, //data defined rotation
256 
257  // rendering
258  ScaleVisibility = 23,
259  MinScale = 16,
260  MaxScale = 17,
261  FontLimitPixel = 24,
262  FontMinPixel = 25,
263  FontMaxPixel = 26,
264  // (data defined only)
265  Show = 15,
266  AlwaysShow = 20
267  };
268 
269 
270  // whether to label this layer
271  bool enabled;
272 
273  //-- text style
274 
275  QString fieldName;
276 
280 
283  QgsExpression* getLabelExpression();
284 
285  QFont textFont;
286  QString textNamedStyle;
287  bool fontSizeInMapUnits; //true if font size is in map units (otherwise in points)
288  QColor textColor;
290  QPainter::CompositionMode blendMode;
292 
293  //-- text formatting
294 
295  QString wrapChar;
296  double multilineHeight; //0.0 to 10.0, leading between lines as multiplyer of line height
297  MultiLineAlign multilineAlign; // horizontal alignment of multi-line labels
298 
299  // Adds '<' or '>', or user-defined symbol to the label string pointing to the
300  // direction of the line / polygon ring
301  // Works only if Placement == Line
305  DirectionSymbols placeDirectionSymbol; // whether to place left/right, above or below label
307 
309  int decimals;
310  bool plusSign;
311 
312  //-- text buffer
313 
315  double bufferSize; // buffer size
316  bool bufferSizeInMapUnits; //true if buffer is in map units (otherwise in mm)
317  QColor bufferColor;
318  bool bufferNoFill; //set interior of buffer to 100% transparent
320  Qt::PenJoinStyle bufferJoinStyle;
321  QPainter::CompositionMode bufferBlendMode;
322 
323  //-- shape background
324 
325  bool shapeDraw;
327  QString shapeSVGFile;
329  QPointF shapeSize;
333  QPointF shapeOffset;
335  QPointF shapeRadii;
338  QPainter::CompositionMode shapeBlendMode;
343  Qt::PenJoinStyle shapeJoinStyle;
344 
345  //-- drop shadow
346 
353  double shadowRadius;
358  QColor shadowColor;
359  QPainter::CompositionMode shadowBlendMode;
360 
361  //-- placement
362 
364  unsigned int placementFlags;
365 
366  bool centroidWhole; // whether centroid calculated from whole or visible polygon
367  double dist; // distance from the feature (in mm)
368  bool distInMapUnits; //true if distance is in map units (otherwise in mm)
369 
370  // offset labels of point/centroid features default to center
371  // move label to quadrant: left/down, don't move, right/up (-1, 0, 1)
373 
374  double xOffset; // offset from point in mm or map units
375  double yOffset; // offset from point in mm or map units
376  bool labelOffsetInMapUnits; //true if label offset is in map units (otherwise in mm)
377  double angleOffset; // rotation applied to offset labels
378  bool preserveRotation; // preserve predefined rotation data during label pin/unpin operations
379 
380  double maxCurvedCharAngleIn; // maximum angle between inside curved label characters (defaults to 20.0, range 20.0 to 60.0)
381  double maxCurvedCharAngleOut; // maximum angle between outside curved label characters (defaults to -20.0, range -20.0 to -95.0)
382 
383  int priority; // 0 = low, 10 = high
384 
385  //-- rendering
386 
388  int scaleMin;
389  int scaleMax;
390 
391  bool fontLimitPixelSize; // true is label should be limited by fontMinPixelSize/fontMaxPixelSize
392  int fontMinPixelSize; // minimum pixel size for showing rendered map unit labels (1 - 1000)
393  int fontMaxPixelSize; // maximum pixel size for showing rendered map unit labels (1 - 10000)
394 
395  bool displayAll; // if true, all features will be labelled even though overlaps occur
396  unsigned int upsidedownLabels; // whether, or how, to show upsidedown labels
397 
398  bool labelPerPart; // whether to label every feature's part or only the biggest one
400 
401  bool limitNumLabels; // whether to limit the number of labels to be drawn
402  int maxNumLabels; // maximum number of labels to be drawn
403 
404  double minFeatureSize; // minimum feature size to be labelled (in mm)
405  bool obstacle; // whether features for layer are obstacles to labels of other layers
406 
407  //-- scale factors
408  double vectorScaleFactor; //scale factor painter units->pixels
409  double rasterCompressFactor; //pixel resolution scale factor
410 
411  // called from register feature hook
412  void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = 0 );
413 
414  // implementation of register feature hook
415  void registerFeature( QgsFeature& f, const QgsRenderContext& context );
416 
417  void readFromLayer( QgsVectorLayer* layer );
418  void writeToLayer( QgsVectorLayer* layer );
419 
424 
428  void setDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties p,
429  bool active, bool useExpr, const QString& expr, const QString& field );
430 
432  void removeDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties p );
433 
437  QString updateDataDefinedString( const QString& value );
438 
442  QMap<QString, QString> dataDefinedMap( QgsPalLayerSettings::DataDefinedProperties p ) const;
443 
448  QVariant dataDefinedValue( QgsPalLayerSettings::DataDefinedProperties p, QgsFeature& f, const QgsFields& fields ) const;
449 
454  bool dataDefinedEvaluate( QgsPalLayerSettings::DataDefinedProperties p, QVariant& exprVal ) const;
455 
458  bool dataDefinedIsActive( QgsPalLayerSettings::DataDefinedProperties p ) const;
459 
462  bool dataDefinedUseExpression( QgsPalLayerSettings::DataDefinedProperties p ) const;
463 
466  QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* > dataDefinedProperties;
467 
468 
476  int sizeToPixel( double size, const QgsRenderContext& c , SizeUnit unit, bool rasterfactor = false ) const;
477 
486  double scaleToPixelContext( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false ) const;
487 
492  QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > dataDefinedNames() const { return mDataDefinedNames; }
493 
494  // temporary stuff: set when layer gets prepared or labeled
495  // NOTE: not in Python binding
496  pal::Layer* palLayer;
502  QgsPoint ptZero, ptOne;
503  QList<QgsPalGeometry*> geometries;
505  int mFeaturesToLabel; // total features that will probably be labeled, may be less (figured before PAL)
506  int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
507  int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
508 
511 
512  bool showingShadowRects; // whether to show debug rectangles for drop shadows
513 
514  private:
515  void readDataDefinedPropertyMap( QgsVectorLayer* layer,
517  QgsDataDefined* > & propertyMap );
518  void writeDataDefinedPropertyMap( QgsVectorLayer* layer,
520  QgsDataDefined* > & propertyMap );
521  void readDataDefinedProperty( QgsVectorLayer* layer,
524  QgsDataDefined* > & propertyMap );
525 
526  // convenience data defined evaluation function
527  bool dataDefinedValEval( const QString& valType,
529  QVariant& exprVal );
530 
531  void parseTextStyle( QFont& labelFont,
533  const QgsRenderContext& context );
534 
535  void parseTextBuffer();
536 
537  void parseTextFormatting();
538 
539  void parseShapeBackground();
540 
541  void parseDropShadow();
542 
545  bool checkMinimumSizeMM( const QgsRenderContext& ct, QgsGeometry* geom, double minSize ) const;
546 
547 
548  QMap<DataDefinedProperties, QVariant> dataDefinedValues;
550  QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > mDataDefinedNames;
551 
552  QFontDatabase mFontDB;
553 };
554 
555 class CORE_EXPORT QgsLabelCandidate
556 {
557  public:
558  QgsLabelCandidate( QRectF r, double c ): rect( r ), cost( c ) {}
559 
560  QRectF rect;
561  double cost;
562 };
563 
568 class CORE_EXPORT QgsLabelComponent
569 {
570  public:
572  : mText( QString() )
573  , mOrigin( QgsPoint() )
574  , mUseOrigin( false )
575  , mRotation( 0.0 )
576  , mRotationOffset( 0.0 )
577  , mUseRotation( false )
578  , mCenter( QgsPoint() )
579  , mUseCenter( false )
580  , mSize( QgsPoint() )
581  , mOffset( QgsPoint() )
582  , mPicture( 0 )
583  , mPictureBuffer( 0.0 )
584  , mDpiRatio( 1.0 )
585  {}
586 
587  const QString& text() { return mText; }
588  void setText( const QString& text ) { mText = text; }
589 
590  const QgsPoint& origin() { return mOrigin; }
591  void setOrigin( QgsPoint point ) { mOrigin = point; }
592 
593  bool useOrigin() const { return mUseOrigin; }
594  void setUseOrigin( bool use ) { mUseOrigin = use; }
595 
596  double rotation() const { return mRotation; }
597  void setRotation( double rotation ) { mRotation = rotation; }
598 
599  double rotationOffset() const { return mRotationOffset; }
600  void setRotationOffset( double rotation ) { mRotationOffset = rotation; }
601 
602  bool useRotation() const { return mUseRotation; }
603  void setUseRotation( bool use ) { mUseRotation = use; }
604 
605  const QgsPoint& center() { return mCenter; }
606  void setCenter( QgsPoint point ) { mCenter = point; }
607 
608  bool useCenter() const { return mUseCenter; }
609  void setUseCenter( bool use ) { mUseCenter = use; }
610 
611  const QgsPoint& size() { return mSize; }
612  void setSize( QgsPoint point ) { mSize = point; }
613 
614  const QgsPoint& offset() { return mOffset; }
615  void setOffset( QgsPoint point ) { mOffset = point; }
616 
617  const QPicture* picture() { return mPicture; }
618  void setPicture( QPicture* picture ) { mPicture = picture; }
619 
620  double pictureBuffer() const { return mPictureBuffer; }
621  void setPictureBuffer( double buffer ) { mPictureBuffer = buffer; }
622 
623  double dpiRatio() const { return mDpiRatio; }
624  void setDpiRatio( double ratio ) { mDpiRatio = ratio; }
625 
626  private:
627  // current label component text,
628  // e.g. single line in a multi-line label or charcater in curved labeling
629  QString mText;
630  // current origin point for painting (generally current painter rotation point)
632  // whether to translate the painter to supplied origin
634  // any rotation to be applied to painter (in radians)
635  double mRotation;
636  // any rotation to be applied to painter (in radians) after initial rotation
638  // whether to use the rotation to rotate the painter
640  // current center point of label compnent, after rotation
642  // whether to translate the painter to supplied origin based upon center
644  // width and height of label component, transformed and ready for painting
646  // any translation offsets to be applied before painting, transformed and ready for painting
648 
649  // a stored QPicture of painting for the component
650  QPicture* mPicture;
651  // buffer for component to accommodate graphic items ignored by QPicture,
652  // e.g. half-width of an applied QPen, which would extend beyond boundingRect() of QPicture
654 
655  // a ratio of native painter dpi and that of rendering context's painter
656  double mDpiRatio;
657 };
658 
659 
660 
665 class CORE_EXPORT QgsLabelingResults
666 {
667  public:
670 
672  QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) const;
674  QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) const;
675 
676  private:
677  QgsLabelingResults( const QgsLabelingResults& ) {} // no copying allowed
678 
680 
681  friend class QgsPalLabeling;
682 };
683 
684 
685 class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
686 {
687  public:
689  {
690  LabelText = 0,
694  LabelShadow
695  };
696 
697  QgsPalLabeling();
698  ~QgsPalLabeling();
699 
700  QgsPalLayerSettings& layer( const QString& layerName );
701 
702  void numCandidatePositions( int& candPoint, int& candLine, int& candPolygon );
703  void setNumCandidatePositions( int candPoint, int candLine, int candPolygon );
704 
705  enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain, Falp };
706 
707  void setSearchMethod( Search s );
708  Search searchMethod() const;
709 
710  bool isShowingCandidates() const { return mShowingCandidates; }
711  void setShowingCandidates( bool showing ) { mShowingCandidates = showing; }
712  const QList<QgsLabelCandidate>& candidates() { return mCandidates; }
713 
714  bool isShowingShadowRectangles() const { return mShowingShadowRects; }
715  void setShowingShadowRectangles( bool showing ) { mShowingShadowRects = showing; }
716 
717  bool isShowingAllLabels() const { return mShowingAllLabels; }
718  void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; }
719 
720  bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
721  void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
722 
723  // implemented methods from labeling engine interface
724 
727  Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mr );
729  virtual void init( const QgsMapSettings& mapSettings );
731  virtual bool willUseLayer( QgsVectorLayer* layer );
732 
735  static bool staticWillUseLayer( QgsVectorLayer* layer );
736  static bool staticWillUseLayer( const QString& layerID );
737 
740  virtual void clearActiveLayers();
743  virtual void clearActiveLayer( const QString& layerID );
745  virtual int prepareLayer( QgsVectorLayer* layer, QStringList &attrNames, QgsRenderContext& ctx );
747  virtual int addDiagramLayer( QgsVectorLayer* layer, const QgsDiagramLayerSettings *s );
749  virtual void registerFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
750  virtual void registerDiagramFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
752  virtual void drawLabeling( QgsRenderContext& context );
754  virtual void exit();
757  Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p );
760  Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r );
761 
764  QgsLabelingResults* takeResults();
765 
768 
770  void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform );
773  virtual void drawLabel( pal::LabelPosition* label, QgsRenderContext& context, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType, double dpiRatio = 1.0 );
774 
775  static void drawLabelBuffer( QgsRenderContext& context,
776  QgsLabelComponent component,
777  const QgsPalLayerSettings& tmpLyr );
778 
779  static void drawLabelBackground( QgsRenderContext& context,
780  QgsLabelComponent component,
781  const QgsPalLayerSettings& tmpLyr );
782 
783  static void drawLabelShadow( QgsRenderContext& context,
784  QgsLabelComponent component,
785  const QgsPalLayerSettings& tmpLyr );
786 
789  void loadEngineSettings();
790  void saveEngineSettings();
791  void clearEngineSettings();
793  Q_DECL_DEPRECATED bool isStoredWithProject() const { return true; }
795  Q_DECL_DEPRECATED void setStoredWithProject( bool store ) { Q_UNUSED( store ); }
796 
797  protected:
798  // update temporary QgsPalLayerSettings with any data defined text style values
799  void dataDefinedTextStyle( QgsPalLayerSettings& tmpLyr,
800  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
801 
802  // update temporary QgsPalLayerSettings with any data defined text formatting values
803  void dataDefinedTextFormatting( QgsPalLayerSettings& tmpLyr,
804  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
805 
806  // update temporary QgsPalLayerSettings with any data defined text buffer values
807  void dataDefinedTextBuffer( QgsPalLayerSettings& tmpLyr,
808  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
809 
810  // update temporary QgsPalLayerSettings with any data defined shape background values
811  void dataDefinedShapeBackground( QgsPalLayerSettings& tmpLyr,
812  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
813 
814  // update temporary QgsPalLayerSettings with any data defined drop shadow values
815  void dataDefinedDropShadow( QgsPalLayerSettings& tmpLyr,
816  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
817 
818  void deleteTemporaryData();
819 
820  // hashtable of layer settings, being filled during labeling (key = layer ID)
821  QHash<QString, QgsPalLayerSettings> mActiveLayers;
822  // hashtable of active diagram layers (key = layer ID)
823  QHash<QString, QgsDiagramLayerSettings> mActiveDiagramLayers;
825 
827  int mCandPoint, mCandLine, mCandPolygon;
829 
830  pal::Pal* mPal;
831 
832  // list of candidates from last labeling
833  QList<QgsLabelCandidate> mCandidates;
835  bool mShowingAllLabels; // whether to avoid collisions or not
836  bool mShowingShadowRects; // whether to show debugging rectangles for drop shadows
837  bool mShowingPartialsLabels; // whether to avoid partials labels or not
838 
840 };
841 
842 #endif // QGSPALLABELING_H
virtual void exit()=0
called when we're done with rendering
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition: qgsexpression.h:89
void setShowingCandidates(bool showing)
void setRotationOffset(double rotation)
virtual void clearActiveLayers()=0
clears all PAL layer settings for registered layers
virtual Q_DECL_DEPRECATED void init(QgsMapRenderer *mp)=0
called when we're going to start with rendering
A rectangle specified with double values.
Definition: qgsrectangle.h:35
QgsExpression * expression
A container class for data source field mapping or expression.
pal::Layer * palLayer
virtual int prepareLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)=0
called when starting rendering of a layer
const QgsMapSettings * mMapSettings
pal::Pal * mPal
QFontDatabase mFontDB
virtual void clearActiveLayer(const QString &layerID)=0
clears data defined objects from PAL layer settings for a registered layer
const QgsPoint & offset()
virtual QgsPalLayerSettings & layer(const QString &layerName)=0
returns PAL layer settings for a registered layer
A class to query the labeling structure at a given point (small wraper around pal RTree class) ...
void setShowingPartialsLabels(bool showing)
QPainter::CompositionMode bufferBlendMode
double rotationOffset() const
bool mShowingPartialsLabels
QuadrantPosition quadOffset
bool useRotation() const
virtual void registerFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())=0
called for every feature
Container of fields for a vector layer.
Definition: qgsfield.h:164
MultiLineAlign multilineAlign
void setOffset(QgsPoint point)
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:114
bool useCenter() const
double dpiRatio() const
A non GUI class for rendering a map layer set onto a QPainter.
virtual Q_DECL_DEPRECATED QList< QgsLabelPosition > labelsWithinRect(const QgsRectangle &r)=0
return infos about labels within a given (map) rectangle
Qt::PenJoinStyle bufferJoinStyle
void setRotation(double rotation)
QgsGeometry * extentGeom
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:33
double rotation() const
Q_DECL_DEPRECATED void setStoredWithProject(bool store)
QList< QgsPalGeometry * > geometries
const QgsCoordinateTransform * ct
bool useOrigin() const
virtual Q_DECL_DEPRECATED QList< QgsLabelPosition > labelsAtPosition(const QgsPoint &p)=0
return infos about labels at a given (map) position
QgsPalLayerSettings mInvalidLayerSettings
virtual QgsLabelingEngineInterface * clone()=0
called when passing engine among map renderers
SizeUnit shapeBorderWidthUnits
const QgsPoint & size()
QMap< QgsPalLayerSettings::DataDefinedProperties, QPair< QString, int > > mDataDefinedNames
QPainter::CompositionMode blendMode
const QgsPoint & center()
QHash< QString, QgsDiagramLayerSettings > mActiveDiagramLayers
Q_DECL_DEPRECATED bool isStoredWithProject() const
void setUseCenter(bool use)
const QgsMapToPixel * xform
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > dataDefinedProperties
Map of current data defined properties.
void setUseOrigin(bool use)
bool isShowingPartialsLabels() const
void setText(const QString &text)
void setDpiRatio(double ratio)
const QgsPoint & origin()
QgsFeature * mCurFeat
QPainter::CompositionMode shapeBlendMode
void setPictureBuffer(double buffer)
SizeUnit
Units used for option sizes, before being converted to rendered sizes.
const QList< QgsLabelCandidate > & candidates()
A class to represent a point geometry.
Definition: qgspoint.h:63
QHash< QString, QgsPalLayerSettings > mActiveLayers
Qt::PenJoinStyle shapeJoinStyle
unsigned int upsidedownLabels
unsigned int placementFlags
QgsLabelSearchTree * mLabelSearchTree
void setSize(QgsPoint point)
bool isShowingCandidates() const
Contains information about the context of a rendering operation.
const QPicture * picture()
void setShowingShadowRectangles(bool showing)
void setPicture(QPicture *picture)
QgsLabelingResults(const QgsLabelingResults &)
void setUseRotation(bool use)
virtual void drawLabeling(QgsRenderContext &context)=0
called when the map is drawn and labels should be placed
Class for doing transforms between two map coordinate systems.
QgsLabelCandidate(QRectF r, double c)
double pictureBuffer() const
QPainter::CompositionMode shadowBlendMode
bool isExpression
Is this label made from a expression string eg FieldName || 'mm'.
Class that stores computed placement from labeling engine.
virtual bool willUseLayer(QgsVectorLayer *layer)=0
called to find out whether the layer is used for labeling
bool isShowingAllLabels() const
void setShowingAllLabels(bool showing)
QMap< QgsPalLayerSettings::DataDefinedProperties, QPair< QString, int > > dataDefinedNames() const
Map of data defined enum to names and old-style indecies The QPair contains a new string for layer pr...
bool isShowingShadowRectangles() const
QList< QgsLabelCandidate > mCandidates
Labeling engine interface.
void setCenter(QgsPoint point)
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
const QString & text()
Represents a vector layer which manages a vector based data sets.
double size
Definition: qgssvgcache.cpp:77
Maintains current state of more grainular and temporal values when creating/painting component parts ...
RotationType shapeRotationType
QMap< DataDefinedProperties, QVariant > dataDefinedValues
QgsLabelingResults * mResults
const QgsFields * mCurFields
void setOrigin(QgsPoint point)
DirectionSymbols placeDirectionSymbol