QGIS API Documentation  master-6227475
src/core/qgslabelattributes.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgslabelattributes.h - render vector labels
00003                              -------------------
00004     begin                : August 2004
00005     copyright            : (C) 2004 by Radim Blazek
00006     email                : blazek@itc.it
00007  ***************************************************************************/
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef QGSLABELATTRIBUTES_H
00017 #define QGSLABELATTRIBUTES_H
00018 
00019 #include <QBrush>
00020 #include <QFont>
00021 #include <QPen>
00022 
00023 class QString;
00024 class QColor;
00025 
00076 class  CORE_EXPORT QgsLabelAttributes
00077 {
00078   public:
00082     QgsLabelAttributes( bool def = true );
00083 
00084     ~QgsLabelAttributes();
00085 
00086     /* Units type */
00087     enum Units
00088     {
00089       MapUnits = 0,
00090       PointUnits
00091     };
00092 
00093     static QString unitsName( int units );
00094     static int unitsCode( const QString &name );
00095 
00096     static QString alignmentName( int alignment );
00097     static int alignmentCode( const QString &name );
00098 
00099     /* Text */
00100     void setText( const QString & text );
00101     bool textIsSet() const;
00102     const QString text() const;
00103 
00104     /* Font */
00105     void setFamily( const QString & family );
00106     bool familyIsSet() const;
00107     const QString family() const;
00108 
00109     void setBold( bool enable );
00110     bool boldIsSet() const;
00111     bool bold() const;
00112 
00113     void setItalic( bool enable );
00114     bool italicIsSet() const;
00115     bool italic() const;
00116 
00117     void setUnderline( bool enable );
00118     bool underlineIsSet() const;
00119     bool underline() const;
00120 
00121     /* strikeout added in 1.5 */
00122     void setStrikeOut( bool enable );
00123     bool strikeOutIsSet() const;
00124     bool strikeOut() const;
00125 
00126     void   setSize( double size, int type );
00127     bool   sizeIsSet() const;
00128     int    sizeType() const;
00129     double size() const;
00130 
00131     void  setColor( const QColor &color );
00132     bool  colorIsSet() const;
00133     const QColor & color() const;
00134 
00135     /* Offset */
00136     void   setOffset( double x, double y, int type );
00137     bool   offsetIsSet() const;
00138     int    offsetType() const;
00139     double xOffset() const;
00140     double yOffset() const;
00141 
00142     /* Angle */
00143     void   setAngle( double angle );
00144     bool   angleIsSet() const;
00145     double angle() const;
00146 
00147     bool   angleIsAuto() const;
00148     void   setAutoAngle( bool state );
00149 
00150     /* Alignment */
00151     void setAlignment( int alignment );
00152     bool alignmentIsSet() const;
00153     int  alignment() const;
00154 
00155     /* Buffer */
00156     bool   bufferEnabled() const;
00157     void   setBufferEnabled( bool useBufferFlag );
00158     void   setBufferSize( double size, int type );
00159     bool   bufferSizeIsSet() const;
00160     int    bufferSizeType() const;
00161     double bufferSize() const;
00162 
00163     void  setBufferColor( const QColor &color );
00164     bool  bufferColorIsSet() const;
00165     QColor bufferColor() const;
00166 
00167     void  setBufferStyle( Qt::BrushStyle style );
00168     bool  bufferStyleIsSet() const;
00169     Qt::BrushStyle bufferStyle() const;
00170 
00171     /* Border */
00172     void  setBorderColor( const QColor &color );
00173     bool  borderColorIsSet() const;
00174     QColor borderColor() const;
00175 
00176     void  setBorderWidth( int width );
00177     bool  borderWidthIsSet() const;
00178     int   borderWidth() const;
00179 
00180     void  setBorderStyle( Qt::PenStyle style );
00181     bool  borderStyleIsSet() const;
00182     Qt::PenStyle   borderStyle() const;
00183 
00184     bool  multilineEnabled() const;
00185     void  setMultilineEnabled( bool useMultiline );
00186 
00187     /* label only selected features
00188      * added in 1.5
00189      */
00190     bool  selectedOnly() const;
00191     void  setSelectedOnly( bool selectedonly );
00192 
00193   protected:
00194     /* Text */
00195     QString mText;
00196     bool mTextIsSet;
00197 
00199     QFont mFont;
00200     bool mFamilyIsSet;
00201     bool mBoldIsSet;
00202     bool mItalicIsSet;
00203     bool mUnderlineIsSet;
00204     bool mStrikeOutIsSet;
00205 
00207     int  mSizeType;
00208     double mSize;
00209     bool   mSizeIsSet;
00210 
00212     QColor mColor;
00213     bool   mColorIsSet;
00214 
00216     int    mOffsetType;
00217     double mXOffset;
00218     double mYOffset;
00219     bool   mOffsetIsSet;
00220 
00222     double mAngle;
00223     bool   mAngleIsSet;
00224     bool   mAngleIsAuto;
00225 
00227     int  mAlignment;
00228     bool mAlignmentIsSet;
00229 
00231     bool mBufferEnabledFlag;
00233     int    mBufferSizeType;
00234     double mBufferSize;
00235     bool   mBufferSizeIsSet;
00236 
00238     QBrush mBufferBrush;
00239     bool   mBufferColorIsSet;
00240     bool   mBufferStyleIsSet;
00241 
00243     QPen mBorderPen;
00244     bool mBorderColorIsSet;
00245     bool mBorderWidthIsSet;
00246     bool mBorderStyleIsSet;
00247 
00249     bool mMultilineEnabledFlag;
00250 
00252     bool mSelectedOnly;
00253 };
00254 
00255 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines