QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
15 #ifndef QGSPALGEOMETRY_H
16 #define QGSPALGEOMETRY_H
53 QString
text(
int partId )
const
62 void calculateInfo(
bool curvedLabeling, QFontMetricsF *fm,
const QgsMapToPixel *xform,
double fontScale,
double maxinangle,
double maxoutangle )
73 if ( maxinangle < 20.0 )
75 if ( 60.0 < maxinangle )
77 if ( maxoutangle > -20.0 )
79 if ( -95.0 > maxoutangle )
84 double labelHeight = mapScale * fm->height() / fontScale;
95 for (
int i = 0; i <
mClusters.count(); i++ )
100 if ( curvedLabeling )
102 wordSpaceFix = qreal( 0.0 );
103 if (
mClusters[i] == QLatin1String(
" " ) )
107 wordSpaceFix = ( nxt <
mClusters.count() &&
mClusters[nxt] != QLatin1String(
" " ) ) ? wordSpacing : qreal( 0.0 );
115 wordSpaceFix -= wordSpacing;
118 charWidth = fm->width( QString(
mClusters[i] ) ) + wordSpaceFix;
121 double labelWidth = mapScale * charWidth / fontScale;
151 #endif //QGSPALGEOMETRY_H
QgsFeatureId id() const
Identifier of the label (unique within the parent label provider)
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > & dataDefinedValues() const
Gets data-defined values.
QString text(int partId) const
Returns the text component corresponding to a specified label part.
Optional additional info about label (for curved labels)
double mapUnitsPerPixel() const
Returns current map units per pixel.
QFontMetricsF * labelFontMetrics()
Metrics of the font for rendering.
~QgsTextLabelFeature()
Clean up.
QFontMetricsF * mFontMetrics
Metrics of the font for rendering.
QFont mDefinedFont
Font for rendering.
QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > mDataDefinedValues
Stores attribute values for data defined properties.
Class that adds extra information to QgsLabelFeature for text labels.
QStringList mClusters
List of graphemes (used for curved labels)
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QString mLabelText
text of the label
void setDefinedFont(const QFont &f)
Sets font to be used for rendering.
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.
QFont definedFont()
Font to be used for rendering.
CharacterInfo * char_info
void setDataDefinedValues(const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &values)
Sets data-defined values.
QSizeF size(double angle=0.0) const
Size of the label (in map units)
GEOSGeometry * geometry() const
Gets access to the associated geometry.
Perform transforms between map coordinates and device coordinates.
The QgsLabelFeature class describes a feature that should be used within the labeling engine.
pal::LabelInfo * mInfo
extra information for curved labels (may be nullptr)
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QgsTextLabelFeature(QgsFeatureId id, GEOSGeometry *geometry, const QSizeF &size)
Construct text label feature.
static QStringList splitToGraphemes(const QString &text)
Splits a text string to a list of graphemes, which are the smallest allowable character divisions in ...