QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgstextlabelfeature.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstextlabelfeature.h
3  ---------------------
4  begin : December 2015
5  copyright : (C) 2015 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 #ifndef QGSTEXTLABELFEATURE_H
16 #define QGSTEXTLABELFEATURE_H
17 
18 #define SIP_NO_FILE
19 
20 #include "qgslabelfeature.h"
21 
29 {
30  public:
33 
35  ~QgsTextLabelFeature() override;
36 
43  QString text( int partId ) const;
44 
46  void calculateInfo( bool curvedLabeling, QFontMetricsF *fm, const QgsMapToPixel *xform, double maxinangle, double maxoutangle );
47 
49  const QMap< QgsPalLayerSettings::Property, QVariant > &dataDefinedValues() const { return mDataDefinedValues; }
51  void setDataDefinedValues( const QMap< QgsPalLayerSettings::Property, QVariant > &values ) { mDataDefinedValues = values; }
52 
54  void setDefinedFont( const QFont &f ) { mDefinedFont = f; }
56  QFont definedFont() { return mDefinedFont; }
57 
59  QFontMetricsF *labelFontMetrics() { return mFontMetrics; }
60 
61  protected:
63  QStringList mClusters;
65  QFont mDefinedFont;
67  QFontMetricsF *mFontMetrics = nullptr;
69  QMap< QgsPalLayerSettings::Property, QVariant > mDataDefinedValues;
70 
71 };
72 
73 #endif //QGSTEXTLABELFEATURE_H
QMap< QgsPalLayerSettings::Property, QVariant > mDataDefinedValues
Stores attribute values for data defined properties.
QFontMetricsF * mFontMetrics
Metrics of the font for rendering.
QgsTextLabelFeature(QgsFeatureId id, GEOSGeometry *geometry, const QSizeF &size)
Construct text label feature.
QStringList mClusters
List of graphemes (used for curved labels)
~QgsTextLabelFeature()
Clean up.
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
Class that adds extra information to QgsLabelFeature for text labels.
GEOSGeometry * geometry() const
Gets access to the associated geometry.
void setDefinedFont(const QFont &f)
Sets font to be used for rendering.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:37
QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > mDataDefinedValues
Stores attribute values for data defined properties.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
void calculateInfo(bool curvedLabeling, QFontMetricsF *fm, const QgsMapToPixel *xform, double fontScale, double maxinangle, double maxoutangle)
calculate data for info(). setDefinedFont() must have been called already.
QString text(int partId) const
Returns the text component corresponding to a specified label part.
const QMap< QgsPalLayerSettings::Property, QVariant > & dataDefinedValues() const
Gets data-defined values.
QFont definedFont()
Font to be used for rendering.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QSizeF size(double angle=0.0) const
Size of the label (in map units)
QFont mDefinedFont
Font for rendering.
QFontMetricsF * labelFontMetrics()
Metrics of the font for rendering.
void setDataDefinedValues(const QMap< QgsPalLayerSettings::Property, QVariant > &values)
Sets data-defined values.