QGIS API Documentation  2.10.1-Pisa
 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 #include <QString>
25 #include <QFont>
26 #include <QFontDatabase>
27 #include <QColor>
28 #include <QHash>
29 #include <QList>
30 #include <QRectF>
31 #include "qgspoint.h"
32 #include "qgsmaprenderer.h" // definition of QgsLabelingEngineInterface
33 #include "qgsdiagramrendererv2.h"
34 #include "qgsmapunitscale.h"
35 
36 namespace pal
37 {
38  class Pal;
39  class Layer;
40  class LabelPosition;
41 }
42 
43 class QgsRectangle;
44 class QgsMapToPixel;
45 class QgsFeature;
46 class QgsPalGeometry;
47 class QgsVectorLayer;
48 class QgsDataDefined;
49 class QgsExpression;
50 class QFontMetricsF;
51 class QPainter;
52 class QPicture;
53 class QgsGeometry;
54 class QgsMapRenderer;
56 class QgsLabelSearchTree;
57 class QgsMapSettings;
58 
59 class CORE_EXPORT QgsPalLayerSettings
60 {
61  public:
65 
67  static QgsPalLayerSettings fromLayer( QgsVectorLayer* layer );
68 
69  enum Placement
70  {
71  AroundPoint, // Point / Polygon
72  OverPoint, // Point / Polygon
73  Line, // Line / Polygon
74  Curved, // Line
75  Horizontal, // Polygon
76  Free // Polygon
77  };
78 
80  {
81  OnLine = 1,
82  AboveLine = 2,
83  BelowLine = 4,
84  MapOrientation = 8
85  };
86 
88  {
97  QuadrantBelowRight
98  };
99 
101  {
104  ShowAll
105  };
106 
108  {
111  SymbolBelow
112  };
113 
115  {
116  MultiLeft = 0,
119  MultiFollowPlacement
121  };
122 
124  {
125  ShapeRectangle = 0,
129  ShapeSVG
130  };
131 
132  enum SizeType
133  {
134  SizeBuffer = 0,
136  SizePercent
137  };
138 
140  {
141  RotationSync = 0,
143  RotationFixed
144  };
145 
147  enum SizeUnit
148  {
149  Points = 0,
150  MM,
152  Percent
153  };
154 
156  {
157  ShadowLowest = 0,
160  ShadowShape
161  };
162 
163  // update mDataDefinedNames QMap in constructor when adding/deleting enum value
165  {
166  // text style
167  Size = 0,
168  Bold = 1,
169  Italic = 2,
170  Underline = 3,
171  Color = 4,
172  Strikeout = 5,
173  Family = 6,
174  FontStyle = 21,
175  FontSizeUnit = 22,
176  FontTransp = 18,
177  FontCase = 27,
178  FontLetterSpacing = 28,
179  FontWordSpacing = 29,
180  FontBlendMode = 30,
181 
182  // text formatting
183  MultiLineWrapChar = 31,
184  MultiLineHeight = 32,
185  MultiLineAlignment = 33,
186  DirSymbDraw = 34,
187  DirSymbLeft = 35,
188  DirSymbRight = 36,
189  DirSymbPlacement = 37,
190  DirSymbReverse = 38,
191  NumFormat = 39,
192  NumDecimals = 40,
193  NumPlusSign = 41,
194 
195  // text buffer
196  BufferDraw = 42,
197  BufferSize = 7,
198  BufferUnit = 43,
199  BufferColor = 8,
200  BufferTransp = 19,
201  BufferJoinStyle = 44,
202  BufferBlendMode = 45,
203 
204  // background
205  ShapeDraw = 46,
206  ShapeKind = 47,
207  ShapeSVGFile = 48,
208  ShapeSizeType = 49,
209  ShapeSizeX = 50,
210  ShapeSizeY = 85,
211  ShapeSizeUnits = 51,
212  ShapeRotationType = 52,
213  ShapeRotation = 53,
214  ShapeOffset = 54,
215  ShapeOffsetUnits = 55,
216  ShapeRadii = 56,
217  ShapeRadiiUnits = 57,
218  ShapeTransparency = 63,
219  ShapeBlendMode = 64,
220  ShapeFillColor = 58,
221  ShapeBorderColor = 59,
222  ShapeBorderWidth = 60,
223  ShapeBorderWidthUnits = 61,
224  ShapeJoinStyle = 62,
225 
226  // drop shadow
227  ShadowDraw = 65,
228  ShadowUnder = 66,
229  ShadowOffsetAngle = 67,
230  ShadowOffsetDist = 68,
231  ShadowOffsetUnits = 69,
232  ShadowRadius = 70,
233  ShadowRadiusUnits = 71,
234  ShadowTransparency = 72,
235  ShadowScale = 73,
236  ShadowColor = 74,
237  ShadowBlendMode = 75,
238 
239  // placement
240  CentroidWhole = 76,
241  OffsetQuad = 77,
242  OffsetXY = 78,
243  OffsetUnits = 80,
244  LabelDistance = 13,
245  DistanceUnits = 81,
246  OffsetRotation = 82,
247  CurvedCharAngleInOut = 83,
248  // (data defined only)
249  PositionX = 9, //x-coordinate data defined label position
250  PositionY = 10, //y-coordinate data defined label position
251  Hali = 11, //horizontal alignment for data defined label position (Left, Center, Right)
252  Vali = 12, //vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top)
253  Rotation = 14, //data defined rotation
254  RepeatDistance = 84,
255  RepeatDistanceUnit = 86,
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  // whether to label this layer
270  bool enabled;
271 
272  //-- text style
273 
275 
279 
282  QgsExpression* getLabelExpression();
283 
286  bool fontSizeInMapUnits; //true if font size is in map units (otherwise in points)
287  QgsMapUnitScale fontSizeMapUnitScale; // scale range for map units for font size
290  QPainter::CompositionMode blendMode;
292 
293  //-- text formatting
294 
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  QgsMapUnitScale bufferSizeMapUnitScale; // scale range for map units for buffer size
319  bool bufferNoFill; //set interior of buffer to 100% transparent
321  Qt::PenJoinStyle bufferJoinStyle;
322  QPainter::CompositionMode bufferBlendMode;
323 
324  //-- shape background
325 
326  bool shapeDraw;
342  QPainter::CompositionMode shapeBlendMode;
348  Qt::PenJoinStyle shapeJoinStyle;
349 
350  //-- drop shadow
351 
359  double shadowRadius;
366  QPainter::CompositionMode shadowBlendMode;
367 
368  //-- placement
369 
371  unsigned int placementFlags;
372 
373  bool centroidWhole; // whether centroid calculated from whole or visible polygon
374  bool centroidInside; // whether centroid-point calculated must be inside polygon
375  double dist; // distance from the feature (in mm)
376  bool distInMapUnits; //true if distance is in map units (otherwise in mm)
378 
382 
383  // offset labels of point/centroid features default to center
384  // move label to quadrant: left/down, don't move, right/up (-1, 0, 1)
386 
387  double xOffset; // offset from point in mm or map units
388  double yOffset; // offset from point in mm or map units
389  bool labelOffsetInMapUnits; //true if label offset is in map units (otherwise in mm)
391  double angleOffset; // rotation applied to offset labels
392  bool preserveRotation; // preserve predefined rotation data during label pin/unpin operations
393 
394  double maxCurvedCharAngleIn; // maximum angle between inside curved label characters (defaults to 20.0, range 20.0 to 60.0)
395  double maxCurvedCharAngleOut; // maximum angle between outside curved label characters (defaults to -20.0, range -20.0 to -95.0)
396 
397  int priority; // 0 = low, 10 = high
398 
399  //-- rendering
400 
402  int scaleMin;
403  int scaleMax;
404 
405  bool fontLimitPixelSize; // true is label should be limited by fontMinPixelSize/fontMaxPixelSize
406  int fontMinPixelSize; // minimum pixel size for showing rendered map unit labels (1 - 1000)
407  int fontMaxPixelSize; // maximum pixel size for showing rendered map unit labels (1 - 10000)
408 
409  bool displayAll; // if true, all features will be labelled even though overlaps occur
410  unsigned int upsidedownLabels; // whether, or how, to show upsidedown labels
411 
412  bool labelPerPart; // whether to label every feature's part or only the biggest one
414 
415  bool limitNumLabels; // whether to limit the number of labels to be drawn
416  int maxNumLabels; // maximum number of labels to be drawn
417 
418  double minFeatureSize; // minimum feature size to be labelled (in mm)
419  bool obstacle; // whether features for layer are obstacles to labels of other layers
420 
421  //-- scale factors
422  double vectorScaleFactor; //scale factor painter units->pixels
423  double rasterCompressFactor; //pixel resolution scale factor
424 
425  // called from register feature hook
426  void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = 0 );
427 
428  // implementation of register feature hook
429  void registerFeature( QgsFeature& f, const QgsRenderContext& context, QString dxfLayer );
430 
431  void readFromLayer( QgsVectorLayer* layer );
432  void writeToLayer( QgsVectorLayer* layer );
433 
438 
442  void setDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties p,
443  bool active, bool useExpr, const QString& expr, const QString& field );
444 
446  void removeDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties p );
447 
451  QString updateDataDefinedString( const QString& value );
452 
457 
462  QVariant dataDefinedValue( QgsPalLayerSettings::DataDefinedProperties p, QgsFeature& f, const QgsFields& fields ) const;
463 
468  bool dataDefinedEvaluate( QgsPalLayerSettings::DataDefinedProperties p, QVariant& exprVal ) const;
469 
472  bool dataDefinedIsActive( QgsPalLayerSettings::DataDefinedProperties p ) const;
473 
476  bool dataDefinedUseExpression( QgsPalLayerSettings::DataDefinedProperties p ) const;
477 
481 
482 
491  int sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ) const;
492 
501  double scaleToPixelContext( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ) const;
502 
508 
509  // temporary stuff: set when layer gets prepared or labeled
510  // NOTE: not in Python binding
517  QgsPoint ptZero, ptOne;
520  int mFeaturesToLabel; // total features that will probably be labeled, may be less (figured before PAL)
521  int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
522  int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
523 
526 
527  bool showingShadowRects; // whether to show debug rectangles for drop shadows
528 
529  private:
530 
531  void readDataDefinedPropertyMap( QgsVectorLayer* layer,
533  QgsDataDefined* > & propertyMap );
534  void writeDataDefinedPropertyMap( QgsVectorLayer* layer,
536  QgsDataDefined* > & propertyMap );
537  void readDataDefinedProperty( QgsVectorLayer* layer,
540  QgsDataDefined* > & propertyMap );
541 
542  // convenience data defined evaluation function
543  bool dataDefinedValEval( const QString& valType,
545  QVariant& exprVal );
546 
547  void parseTextStyle( QFont& labelFont,
549  const QgsRenderContext& context );
550 
551  void parseTextBuffer();
552 
553  void parseTextFormatting();
554 
555  void parseShapeBackground();
556 
557  void parseDropShadow();
558 
561  bool checkMinimumSizeMM( const QgsRenderContext& ct, const QgsGeometry* geom, double minSize ) const;
562 
563 
564  QMap<DataDefinedProperties, QVariant> dataDefinedValues;
565  QgsExpression* expression;
567 
568  QFontDatabase mFontDB;
569 };
570 
571 class CORE_EXPORT QgsLabelCandidate
572 {
573  public:
574  QgsLabelCandidate( QRectF r, double c ): rect( r ), cost( c ) {}
575 
577  double cost;
578 };
579 
584 class CORE_EXPORT QgsLabelComponent
585 {
586  public:
588  : mText( QString() )
589  , mOrigin( QgsPoint() )
590  , mUseOrigin( false )
591  , mRotation( 0.0 )
592  , mRotationOffset( 0.0 )
593  , mUseRotation( false )
594  , mCenter( QgsPoint() )
595  , mUseCenter( false )
596  , mSize( QgsPoint() )
597  , mOffset( QgsPoint() )
598  , mPicture( 0 )
599  , mPictureBuffer( 0.0 )
600  , mDpiRatio( 1.0 )
601  {}
602 
603  // methods
604 
605  const QString& text() const { return mText; }
606  void setText( const QString& text ) { mText = text; }
607 
608  const QgsPoint& origin() const { return mOrigin; }
609  void setOrigin( const QgsPoint& point ) { mOrigin = point; }
610 
611  bool useOrigin() const { return mUseOrigin; }
612  void setUseOrigin( const bool use ) { mUseOrigin = use; }
613 
614  double rotation() const { return mRotation; }
615  void setRotation( const double rotation ) { mRotation = rotation; }
616 
617  double rotationOffset() const { return mRotationOffset; }
618  void setRotationOffset( const double rotation ) { mRotationOffset = rotation; }
619 
620  bool useRotation() const { return mUseRotation; }
621  void setUseRotation( const bool use ) { mUseRotation = use; }
622 
623  const QgsPoint& center() const { return mCenter; }
624  void setCenter( const QgsPoint& point ) { mCenter = point; }
625 
626  bool useCenter() const { return mUseCenter; }
627  void setUseCenter( const bool use ) { mUseCenter = use; }
628 
629  const QgsPoint& size() const { return mSize; }
630  void setSize( const QgsPoint& point ) { mSize = point; }
631 
632  const QgsPoint& offset() const { return mOffset; }
633  void setOffset( const QgsPoint& point ) { mOffset = point; }
634 
635  const QPicture* picture() const { return mPicture; }
636  void setPicture( QPicture* picture ) { mPicture = picture; }
637 
638  double pictureBuffer() const { return mPictureBuffer; }
639  void setPictureBuffer( const double buffer ) { mPictureBuffer = buffer; }
640 
641  double dpiRatio() const { return mDpiRatio; }
642  void setDpiRatio( const double ratio ) { mDpiRatio = ratio; }
643 
644  private:
645  // current label component text,
646  // e.g. single line in a multi-line label or charcater in curved labeling
647  QString mText;
648  // current origin point for painting (generally current painter rotation point)
649  QgsPoint mOrigin;
650  // whether to translate the painter to supplied origin
651  bool mUseOrigin;
652  // any rotation to be applied to painter (in radians)
653  double mRotation;
654  // any rotation to be applied to painter (in radians) after initial rotation
655  double mRotationOffset;
656  // whether to use the rotation to rotate the painter
657  bool mUseRotation;
658  // current center point of label compnent, after rotation
659  QgsPoint mCenter;
660  // whether to translate the painter to supplied origin based upon center
661  bool mUseCenter;
662  // width and height of label component, transformed and ready for painting
663  QgsPoint mSize;
664  // any translation offsets to be applied before painting, transformed and ready for painting
665  QgsPoint mOffset;
666 
667  // a stored QPicture of painting for the component
668  QPicture* mPicture;
669  // buffer for component to accommodate graphic items ignored by QPicture,
670  // e.g. half-width of an applied QPen, which would extend beyond boundingRect() of QPicture
671  double mPictureBuffer;
672 
673  // a ratio of native painter dpi and that of rendering context's painter
674  double mDpiRatio;
675 };
676 
677 
682 class CORE_EXPORT QgsLabelingResults
683 {
684  public:
687 
689  QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) const;
691  QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) const;
692 
693  private:
694  QgsLabelingResults( const QgsLabelingResults& ) {} // no copying allowed
695 
696  QgsLabelSearchTree* mLabelSearchTree;
697 
698  friend class QgsPalLabeling;
699 };
700 
702 class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
703 {
704  public:
706  {
707  LabelText = 0,
711  LabelShadow
712  };
713 
714  QgsPalLabeling();
715  ~QgsPalLabeling();
716 
717  QgsPalLayerSettings& layer( const QString& layerName ) override;
718 
719  void numCandidatePositions( int& candPoint, int& candLine, int& candPolygon );
720  void setNumCandidatePositions( int candPoint, int candLine, int candPolygon );
721 
722  enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain, Falp };
723 
724  void setSearchMethod( Search s );
725  Search searchMethod() const;
726 
727  bool isShowingCandidates() const { return mShowingCandidates; }
728  void setShowingCandidates( bool showing ) { mShowingCandidates = showing; }
729  const QList<QgsLabelCandidate>& candidates() { return mCandidates; }
730 
731  bool isShowingShadowRectangles() const { return mShowingShadowRects; }
732  void setShowingShadowRectangles( bool showing ) { mShowingShadowRects = showing; }
733 
734  bool isShowingAllLabels() const { return mShowingAllLabels; }
735  void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; }
736 
737  bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
738  void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
739 
741  bool isDrawingOutlineLabels() const { return mDrawOutlineLabels; }
742  void setDrawingOutlineLabels( bool outline ) { mDrawOutlineLabels = outline; }
743 
744  // implemented methods from labeling engine interface
745 
748  Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mr ) override;
750  virtual void init( const QgsMapSettings& mapSettings ) override;
752  virtual bool willUseLayer( QgsVectorLayer* layer ) override;
753 
756  static bool staticWillUseLayer( QgsVectorLayer* layer );
757  static bool staticWillUseLayer( const QString& layerID );
758 
760  virtual void clearActiveLayers() override;
762  virtual void clearActiveLayer( const QString& layerID ) override;
764  virtual int prepareLayer( QgsVectorLayer* layer, QStringList &attrNames, QgsRenderContext& ctx ) override;
766  virtual int addDiagramLayer( QgsVectorLayer* layer, const QgsDiagramLayerSettings *s ) override;
768  virtual void registerFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext(), QString dxfLayer = QString::null ) override;
769  virtual void registerDiagramFeature( const QString& layerID, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) override;
771  virtual void drawLabeling( QgsRenderContext& context ) override;
773  virtual void exit() override;
774 
777  Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) override;
780  Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) override;
781 
784  QgsLabelingResults* takeResults();
785 
787  virtual QgsLabelingEngineInterface* clone() override;
788 
790  void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform );
793  virtual void drawLabel( pal::LabelPosition* label, QgsRenderContext& context, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType, double dpiRatio = 1.0 );
794 
795  static void drawLabelBuffer( QgsRenderContext& context,
796  const QgsLabelComponent &component,
797  const QgsPalLayerSettings& tmpLyr );
798 
799  static void drawLabelBackground( QgsRenderContext& context,
800  QgsLabelComponent component,
801  const QgsPalLayerSettings& tmpLyr );
802 
803  static void drawLabelShadow( QgsRenderContext &context,
804  const QgsLabelComponent &component,
805  const QgsPalLayerSettings& tmpLyr );
806 
808  void loadEngineSettings();
809  void saveEngineSettings();
810  void clearEngineSettings();
812  Q_DECL_DEPRECATED bool isStoredWithProject() const { return true; }
814  Q_DECL_DEPRECATED void setStoredWithProject( bool store ) { Q_UNUSED( store ); }
815 
824  static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, const QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = 0 );
825 
834  static bool geometryRequiresPreparation( const QgsGeometry *geometry, const QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = 0 );
835 
843  static QStringList splitToLines( const QString& text, const QString& wrapCharacter );
844 
852  static QStringList splitToGraphemes( const QString& text );
853 
854  protected:
855  // update temporary QgsPalLayerSettings with any data defined text style values
856  void dataDefinedTextStyle( QgsPalLayerSettings& tmpLyr,
858 
859  // update temporary QgsPalLayerSettings with any data defined text formatting values
860  void dataDefinedTextFormatting( QgsPalLayerSettings& tmpLyr,
862 
863  // update temporary QgsPalLayerSettings with any data defined text buffer values
864  void dataDefinedTextBuffer( QgsPalLayerSettings& tmpLyr,
866 
867  // update temporary QgsPalLayerSettings with any data defined shape background values
868  void dataDefinedShapeBackground( QgsPalLayerSettings& tmpLyr,
870 
871  // update temporary QgsPalLayerSettings with any data defined drop shadow values
872  void dataDefinedDropShadow( QgsPalLayerSettings& tmpLyr,
874 
875  void deleteTemporaryData();
876 
884  static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry *geom, double minSize );
885 
886  // hashtable of layer settings, being filled during labeling (key = layer ID)
888  // hashtable of active diagram layers (key = layer ID)
891 
893  int mCandPoint, mCandLine, mCandPolygon;
895 
897 
898  // list of candidates from last labeling
901  bool mShowingAllLabels; // whether to avoid collisions or not
902  bool mShowingShadowRects; // whether to show debugging rectangles for drop shadows
903  bool mShowingPartialsLabels; // whether to avoid partials labels or not
904  bool mDrawOutlineLabels; // whether to draw labels as text or outlines
905 
907 
908  friend class QgsPalLayerSettings;
909 };
911 
912 
913 #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:86
void setShowingCandidates(bool showing)
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
QgsMapUnitScale shapeSizeMapUnitScale
A container class for data source field mapping or expression.
QgsMapUnitScale shadowRadiusMapUnitScale
pal::Layer * palLayer
virtual int prepareLayer(QgsVectorLayer *layer, QStringList &attrNames, QgsRenderContext &ctx)=0
called when starting rendering of a layer
void setOrigin(const QgsPoint &point)
const QgsMapSettings * mMapSettings
pal::Pal * mPal
const QString & text() const
virtual void clearActiveLayer(const QString &layerID)=0
clears data defined objects from PAL layer settings for a registered layer
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
A layer of spacial entites.
Definition: layer.h:65
double rotationOffset() const
QgsMapUnitScale shadowOffsetMapUnitScale
const QgsPoint & size() const
bool mShowingPartialsLabels
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:464
QuadrantPosition quadOffset
bool useRotation() const
void setUseOrigin(const bool use)
Pal main class.
Definition: pal.h:126
Container of fields for a vector layer.
Definition: qgsfield.h:173
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:75
void setUseCenter(const bool use)
QgsMapUnitScale repeatDistanceMapUnitScale
MultiLineAlign multilineAlign
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:162
bool useCenter() const
const QgsPoint & origin() 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
const QgsPoint & center() const
void setRotationOffset(const double rotation)
Qt::PenJoinStyle bufferJoinStyle
QgsMapUnitScale fontSizeMapUnitScale
const QgsPoint & offset() const
The QgsMapSettings class contains configuration for rendering of the map.
QgsMapUnitScale shapeBorderWidthMapUnitScale
QgsGeometry * extentGeom
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
double rotation() const
Q_DECL_DEPRECATED void setStoredWithProject(bool store)
void setRotation(const double rotation)
QList< QgsPalGeometry * > geometries
const QgsCoordinateTransform * ct
bool useOrigin() const
QgsMapUnitScale shapeRadiiMapUnitScale
virtual Q_DECL_DEPRECATED QList< QgsLabelPosition > labelsAtPosition(const QgsPoint &p)=0
return infos about labels at a given (map) position
const QPicture * picture() const
QgsPalLayerSettings mInvalidLayerSettings
virtual QgsLabelingEngineInterface * clone()=0
called when passing engine among map renderers
SizeUnit shapeBorderWidthUnits
QPainter::CompositionMode blendMode
QHash< QString, QgsDiagramLayerSettings > mActiveDiagramLayers
Q_DECL_DEPRECATED bool isStoredWithProject() const
struct pal::_chain Chain
void setCenter(const QgsPoint &point)
const QgsMapToPixel * xform
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined * > dataDefinedProperties
Map of current data defined properties.
bool isShowingPartialsLabels() const
void setText(const QString &text)
QgsMapUnitScale bufferSizeMapUnitScale
QgsFeature * mCurFeat
QPainter::CompositionMode shapeBlendMode
SizeUnit
Units used for option sizes, before being converted to rendered sizes.
const QList< QgsLabelCandidate > & candidates()
A class to represent a point.
Definition: qgspoint.h:63
QHash< QString, QgsPalLayerSettings > mActiveLayers
Qt::PenJoinStyle shapeJoinStyle
unsigned int upsidedownLabels
void setDpiRatio(const double ratio)
unsigned int placementFlags
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:465
bool isShowingCandidates() const
void setDrawingOutlineLabels(bool outline)
Contains information about the context of a rendering operation.
void setShowingShadowRectangles(bool showing)
void setPicture(QPicture *picture)
void setOffset(const QgsPoint &point)
virtual void registerFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext(), QString dxfLayer=QString::null)=0
called for every feature
QgsMapUnitScale distMapUnitScale
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)
LabelPosition is a candidate feature label position.
Definition: labelposition.h:54
double pictureBuffer() const
QPainter::CompositionMode shadowBlendMode
bool isExpression
Is this label made from a expression string eg FieldName || 'mm'.
void setSize(const QgsPoint &point)
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
QgsMapUnitScale shapeOffsetMapUnitScale
QList< QgsLabelCandidate > mCandidates
Labeling engine interface.
void setPictureBuffer(const double buffer)
bool isDrawingOutlineLabels() const
void setUseRotation(const bool use)
virtual void registerDiagramFeature(const QString &layerID, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
Represents a vector layer which manages a vector based data sets.
Maintains current state of more grainular and temporal values when creating/painting component parts ...
RotationType shapeRotationType
QgsMapUnitScale labelOffsetMapUnitScale
QgsLabelingResults * mResults
const QgsFields * mCurFields
DirectionSymbols placeDirectionSymbol