Quantum GIS API Documentation  1.8
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( void ) const;
00102     const QString text( void ) const;
00103 
00104     /* Font */
00105     void setFamily( const QString & family );
00106     bool familyIsSet( void ) const;
00107     const QString family( void ) const;
00108 
00109     void setBold( bool enable );
00110     bool boldIsSet( void ) const;
00111     bool bold( void ) const;
00112 
00113     void setItalic( bool enable );
00114     bool italicIsSet( void ) const;
00115     bool italic( void ) const;
00116 
00117     void setUnderline( bool enable );
00118     bool underlineIsSet( void ) const;
00119     bool underline( void ) const;
00120 
00121     /* strikeout added in 1.5 */
00122     void setStrikeOut( bool enable );
00123     bool strikeOutIsSet( void ) const;
00124     bool strikeOut( void ) const;
00125 
00126     void   setSize( double size, int type );
00127     bool   sizeIsSet( void ) const;
00128     int    sizeType( void ) const;
00129     double size( void ) const;
00130 
00131     void  setColor( const QColor &color );
00132     bool  colorIsSet( void ) const;
00133     const QColor & color( void ) const;
00134 
00135     /* Offset */
00136     void   setOffset( double x, double y, int type );
00137     bool   offsetIsSet( void ) const;
00138     int    offsetType( void ) const;
00139     double xOffset( void ) const;
00140     double yOffset( void ) const;
00141 
00142     /* Angle */
00143     void   setAngle( double angle );
00144     bool   angleIsSet( void ) const;
00145     double angle( void ) const;
00146 
00147     bool   angleIsAuto( void ) const;
00148     void   setAutoAngle( bool state );
00149 
00150     /* Alignment */
00151     void setAlignment( int alignment );
00152     bool alignmentIsSet( void ) const;
00153     int  alignment( void ) const;
00154 
00155     /* Buffer */
00156     bool   bufferEnabled() const;
00157     void   setBufferEnabled( bool useBufferFlag );
00158     void   setBufferSize( double size, int type );
00159     bool   bufferSizeIsSet( void ) const;
00160     int    bufferSizeType( void ) const;
00161     double bufferSize( void ) const;
00162 
00163     void  setBufferColor( const QColor &color );
00164     bool  bufferColorIsSet( void ) const;
00165     QColor bufferColor( void ) const;
00166 
00167     void  setBufferStyle( Qt::BrushStyle style );
00168     bool  bufferStyleIsSet( void ) const;
00169     Qt::BrushStyle bufferStyle( void ) const;
00170 
00171     /* Border */
00172     void  setBorderColor( const QColor &color );
00173     bool  borderColorIsSet( void ) const;
00174     QColor borderColor( void ) const;
00175 
00176     void  setBorderWidth( int width );
00177     bool  borderWidthIsSet( void ) const;
00178     int   borderWidth( void ) const;
00179 
00180     void  setBorderStyle( Qt::PenStyle style );
00181     bool  borderStyleIsSet( void ) const;
00182     Qt::PenStyle   borderStyle( void ) 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 Friends Defines