17 #include <QApplication>
29 , mFamilyIsSet( false )
31 , mItalicIsSet( false )
32 , mUnderlineIsSet( false )
33 , mStrikeOutIsSet( false )
37 , mColorIsSet( false )
41 , mOffsetIsSet( false )
43 , mAngleIsSet( false )
44 , mAngleIsAuto( false )
46 , mAlignmentIsSet( false )
47 , mBufferEnabledFlag( false )
48 , mBufferSizeType( 0 )
50 , mBufferSizeIsSet( false )
51 , mBufferColorIsSet( false )
52 , mBufferStyleIsSet( false )
53 , mBorderColorIsSet( false )
54 , mBorderWidthIsSet( false )
55 , mBorderStyleIsSet( false )
56 , mMultilineEnabledFlag( false )
57 , mSelectedOnly( false )
64 mFont = QApplication::font();
186 mFont.setFamily( family );
197 return mFont.family();
203 mFont.setBold( enable );
220 mFont.setItalic( enable );
231 return mFont.italic();
237 mFont.setUnderline( enable );
248 return mFont.underline();
253 mFont.setStrikeOut( enable );
264 return mFont.strikeOut();
447 return QString(
"mu" );
450 return QString(
"pt" );
455 if ( name.compare(
"mu" ) == 0 )
466 QgsDebugMsg( QString(
"alignment=%1" ).arg( alignment ) );
467 if ( !alignment )
return QString(
"center" );
468 if ( alignment == ( Qt::AlignRight | Qt::AlignBottom ) )
return QString(
"aboveleft" );
469 if ( alignment == ( Qt::AlignRight | Qt::AlignTop ) )
return QString(
"belowleft" );
470 if ( alignment == ( Qt::AlignLeft | Qt::AlignBottom ) )
return QString(
"aboveright" );
471 if ( alignment == ( Qt::AlignLeft | Qt::AlignTop ) )
return QString(
"belowright" );
472 if ( alignment == ( Qt::AlignRight | Qt::AlignVCenter ) )
return QString(
"left" );
473 if ( alignment == ( Qt::AlignLeft | Qt::AlignVCenter ) )
return QString(
"right" );
474 if ( alignment == ( Qt::AlignBottom | Qt::AlignHCenter ) )
return QString(
"above" );
475 if ( alignment == ( Qt::AlignTop | Qt::AlignHCenter ) )
return QString(
"below" );
476 if ( alignment == ( Qt::AlignCenter ) )
return QString(
"center" );
477 return QString(
"center" );
482 QString lname = name.toLower();
483 if ( lname.compare(
"aboveleft" ) == 0 )
return Qt::AlignRight | Qt::AlignBottom ;
484 if ( lname.compare(
"belowleft" ) == 0 )
return Qt::AlignRight | Qt::AlignTop ;
485 if ( lname.compare(
"aboveright" ) == 0 )
return Qt::AlignLeft | Qt::AlignBottom ;
486 if ( lname.compare(
"belowright" ) == 0 )
return Qt::AlignLeft | Qt::AlignTop ;
487 if ( lname.compare(
"left" ) == 0 )
return Qt::AlignRight | Qt::AlignVCenter ;
488 if ( lname.compare(
"right" ) == 0 )
return Qt::AlignLeft | Qt::AlignVCenter ;
489 if ( lname.compare(
"above" ) == 0 )
return Qt::AlignBottom | Qt::AlignHCenter ;
490 if ( lname.compare(
"below" ) == 0 )
return Qt::AlignTop | Qt::AlignHCenter ;
491 if ( lname.compare(
"center" ) == 0 )
return Qt::AlignCenter ;
494 return Qt::AlignCenter;
void setBufferColor(const QColor &color)
double bufferSize() const
bool borderColorIsSet() const
void setMultilineEnabled(bool useMultiline)
void setBold(bool enable)
void setSize(double size, int type)
bool mSelectedOnly
Label only selected.
void setUnderline(bool enable)
void setSelectedOnly(bool selectedonly)
static int unitsCode(const QString &name)
void setFamily(const QString &family)
bool alignmentIsSet() const
static QString alignmentName(int alignment)
bool selectedOnly() const
bool bufferEnabled() const
int bufferSizeType() const
QBrush mBufferBrush
Buffer brush (color, style)
void setBorderStyle(Qt::PenStyle style)
void setAutoAngle(bool state)
static QString unitsName(int units)
QColor bufferColor() const
int mSizeType
Font size, size type.
void setBufferStyle(Qt::BrushStyle style)
static int alignmentCode(const QString &name)
const QColor & color() const
void setBufferSize(double size, int type)
double mAngle
Angle (degrees)
bool borderWidthIsSet() const
void setBorderColor(const QColor &color)
QgsLabelAttributes(bool def=true)
Constructor.
void setText(const QString &text)
bool multilineEnabled() const
void setAngle(double angle)
bool mBufferEnabledFlag
Buffer enablement.
bool mMultilineEnabledFlag
Multiline enablement.
bool bufferSizeIsSet() const
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
const QString family() const
void setStrikeOut(bool enable)
Qt::BrushStyle bufferStyle() const
Qt::PenStyle borderStyle() const
QFont mFont
Font (family, weight, italic, underline, strikeout)
void setAlignment(int alignment)
void setOffset(double x, double y, int type)
bool strikeOutIsSet() const
bool borderStyleIsSet() const
QPen mBorderPen
Border pen (color, width, style)
bool underlineIsSet() const
int mBufferSizeType
Buffer size, size type.
bool bufferStyleIsSet() const
void setColor(const QColor &color)
QColor borderColor() const
void setBufferEnabled(bool useBufferFlag)
bool bufferColorIsSet() const
void setBorderWidth(int width)
void setItalic(bool enable)
const QString text() const