1 #ifndef QGSPALGEOMETRY_H
2 #define QGSPALGEOMETRY_H
14 qreal ltrSpacing = 0.0, qreal wordSpacing = 0.0,
bool curvedLabeling =
false )
21 , mFontMetrics( NULL )
22 , mLetterSpacing( ltrSpacing )
23 , mWordSpacing( wordSpacing )
24 , mCurvedLabeling( curvedLabeling )
27 mDefinedFont = QFont();
40 const GEOSGeometry* getGeosGeometry()
override
44 void releaseGeosGeometry(
const GEOSGeometry* )
override
49 const char*
strId() {
return mStrId.data(); }
50 QString
text() {
return mText; }
57 mFontMetrics =
new QFontMetricsF( *fm );
60 if ( maxinangle < 20.0 )
62 if ( 60.0 < maxinangle )
64 if ( maxoutangle > -20.0 )
66 if ( -95.0 > maxoutangle )
71 double labelHeight = mapScale * fm->height() / fontScale;
77 mInfo =
new pal::LabelInfo( mText.count(), labelHeight, maxinangle, maxoutangle );
78 for (
int i = 0; i < mText.count(); i++ )
84 charWidth = fm->width( mText[i] );
85 if ( mCurvedLabeling )
87 wordSpaceFix = qreal( 0.0 );
88 if ( mText[i] == QString(
" " )[0] )
92 wordSpaceFix = ( nxt < mText.count() && mText[nxt] != QString(
" " )[0] ) ? mWordSpacing : qreal( 0.0 );
94 if ( fm->width( QString( mText[i] ) ) - fm->width( mText[i] ) - mLetterSpacing != qreal( 0.0 ) )
97 wordSpaceFix -= mWordSpacing;
99 charWidth = fm->width( QString( mText[i] ) ) + wordSpaceFix;
102 double labelWidth = mapScale * charWidth / fontScale;
103 mInfo->char_info[i].width = labelWidth;
108 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >&
dataDefinedValues()
const {
return mDataDefinedValues; }
157 #endif //QGSPALGEOMETRY_H