1 #ifndef QGSPALGEOMETRY_H
2 #define QGSPALGEOMETRY_H
4 #include <pal/feature.h>
5 #include <pal/palgeometry.h>
13 qreal ltrSpacing = 0.0, qreal wordSpacing = 0.0,
bool curvedLabeling =
false )
20 , mFontMetrics( NULL )
21 , mLetterSpacing( ltrSpacing )
22 , mWordSpacing( wordSpacing )
23 , mCurvedLabeling( curvedLabeling )
26 mDefinedFont = QFont();
32 GEOSGeom_destroy( mG );
39 const GEOSGeometry* getGeosGeometry()
43 void releaseGeosGeometry(
const GEOSGeometry* )
48 const char*
strId() {
return mStrId.data(); }
49 QString
text() {
return mText; }
51 pal::LabelInfo* info( QFontMetricsF* fm,
const QgsMapToPixel* xform,
double fontScale,
double maxinangle,
double maxoutangle )
56 mFontMetrics =
new QFontMetricsF( *fm );
59 if ( maxinangle < 20.0 )
61 if ( 60.0 < maxinangle )
63 if ( maxoutangle > -20.0 )
65 if ( -95.0 > maxoutangle )
76 mInfo =
new pal::LabelInfo( mText.count(), ptSize.
y() - ptZero.
y(), maxinangle, maxoutangle );
77 for (
int i = 0; i < mText.count(); i++ )
79 mInfo->char_info[i].chr = mText[i].unicode();
83 charWidth = fm->width( mText[i] );
84 if ( mCurvedLabeling )
86 wordSpaceFix = qreal( 0.0 );
87 if ( mText[i] == QString(
" " )[0] )
91 wordSpaceFix = ( nxt < mText.count() && mText[nxt] != QString(
" " )[0] ) ? mWordSpacing : qreal( 0.0 );
93 if ( fm->width( QString( mText[i] ) ) - fm->width( mText[i] ) - mLetterSpacing != qreal( 0.0 ) )
96 wordSpaceFix -= mWordSpacing;
98 charWidth = fm->width( QString( mText[i] ) ) + wordSpaceFix;
102 mInfo->char_info[i].width = ptSize.
x() - ptZero.
x();
107 const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >&
dataDefinedValues()
const {
return mDataDefinedValues; }
127 feature.
setFields( mDiagramFields,
false );
153 #endif //QGSPALGEOMETRY_H