Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgslabelattributes.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslabelattributes.h - render vector labels
3  -------------------
4  begin : August 2004
5  copyright : (C) 2004 by Radim Blazek
6  email : blazek@itc.it
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 /* $Id$ */
17 #ifndef QGSLABELATTRIBUTES_H
18 #define QGSLABELATTRIBUTES_H
19 
20 #include <QBrush>
21 #include <QFont>
22 #include <QPen>
23 
24 class QString;
25 class QColor;
26 
77 class CORE_EXPORT QgsLabelAttributes
78 {
79  public:
83  QgsLabelAttributes( bool def = true );
84 
86 
87  /* Units type */
88  enum Units
89  {
90  MapUnits = 0,
91  PointUnits
92  };
93 
94  static QString unitsName( int units );
95  static int unitsCode( const QString &name );
96 
97  static QString alignmentName( int alignment );
98  static int alignmentCode( const QString &name );
99 
100  /* Text */
101  void setText( const QString & text );
102  bool textIsSet( void ) const;
103  const QString text( void ) const;
104 
105  /* Font */
106  void setFamily( const QString & family );
107  bool familyIsSet( void ) const;
108  const QString family( void ) const;
109 
110  void setBold( bool enable );
111  bool boldIsSet( void ) const;
112  bool bold( void ) const;
113 
114  void setItalic( bool enable );
115  bool italicIsSet( void ) const;
116  bool italic( void ) const;
117 
118  void setUnderline( bool enable );
119  bool underlineIsSet( void ) const;
120  bool underline( void ) const;
121 
122  /* strikeout added in 1.5 */
123  void setStrikeOut( bool enable );
124  bool strikeOutIsSet( void ) const;
125  bool strikeOut( void ) const;
126 
127  void setSize( double size, int type );
128  bool sizeIsSet( void ) const;
129  int sizeType( void ) const;
130  double size( void ) const;
131 
132  void setColor( const QColor &color );
133  bool colorIsSet( void ) const;
134  const QColor & color( void ) const;
135 
136  /* Offset */
137  void setOffset( double x, double y, int type );
138  bool offsetIsSet( void ) const;
139  int offsetType( void ) const;
140  double xOffset( void ) const;
141  double yOffset( void ) const;
142 
143  /* Angle */
144  void setAngle( double angle );
145  bool angleIsSet( void ) const;
146  double angle( void ) const;
147 
148  bool angleIsAuto( void ) const;
149  void setAutoAngle( bool state );
150 
151  /* Alignment */
152  void setAlignment( int alignment );
153  bool alignmentIsSet( void ) const;
154  int alignment( void ) const;
155 
156  /* Buffer */
157  bool bufferEnabled() const;
158  void setBufferEnabled( bool useBufferFlag );
159  void setBufferSize( double size, int type );
160  bool bufferSizeIsSet( void ) const;
161  int bufferSizeType( void ) const;
162  double bufferSize( void ) const;
163 
164  void setBufferColor( const QColor &color );
165  bool bufferColorIsSet( void ) const;
166  QColor bufferColor( void ) const;
167 
168  void setBufferStyle( Qt::BrushStyle style );
169  bool bufferStyleIsSet( void ) const;
170  Qt::BrushStyle bufferStyle( void ) const;
171 
172  /* Border */
173  void setBorderColor( const QColor &color );
174  bool borderColorIsSet( void ) const;
175  QColor borderColor( void ) const;
176 
177  void setBorderWidth( int width );
178  bool borderWidthIsSet( void ) const;
179  int borderWidth( void ) const;
180 
181  void setBorderStyle( Qt::PenStyle style );
182  bool borderStyleIsSet( void ) const;
183  Qt::PenStyle borderStyle( void ) const;
184 
185  bool multilineEnabled() const;
186  void setMultilineEnabled( bool useMultiline );
187 
188  /* label only selected features
189  * added in 1.5
190  */
191  bool selectedOnly() const;
192  void setSelectedOnly( bool selectedonly );
193 
194  protected:
195  /* Text */
196  QString mText;
198 
200  QFont mFont;
206 
209  double mSize;
211 
213  QColor mColor;
215 
218  double mXOffset;
219  double mYOffset;
221 
223  double mAngle;
226 
230 
235  double mBufferSize;
237 
239  QBrush mBufferBrush;
242 
248 
251 
254 };
255 
256 #endif