~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/qgslabelattributes.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *   (at your option) any later version.                                   *
14
14
 *                                                                         *
15
15
 ***************************************************************************/
16
 
/* $Id: qgslabelattributes.h 5886 2006-09-30 05:58:51Z g_j_m $ */
 
16
/* $Id$ */
17
17
#ifndef QGSLABELATTRIBUTES_H
18
18
#define QGSLABELATTRIBUTES_H
19
19
 
 
20
#include <QBrush>
 
21
#include <QFont>
20
22
#include <QPen>
 
23
 
21
24
class QString;
22
 
class QFont;
23
25
class QColor;
24
 
class QBrush;
25
26
 
26
 
/** This class can be used to store attributes needed for label rendering. 
 
27
/** \ingroup core
 
28
 * A class to store attributes needed for label rendering.
27
29
 *
28
30
 *  Label attributes:
29
31
 *                         border (color, width, style)
30
32
 *                        /
31
33
 *                       /     text bounding box
32
34
 *                      /     /
33
 
 *               +-----------/--+  buffer (color, pattern)                
34
 
 *               |          /   | /                                       
35
 
 *               |    +----+    |/  --+                                   
36
 
 *               |    |Text|    /     |--- text size                      
 
35
 *               +-----------/--+  buffer (color, pattern)
 
36
 *               |          /   | /
 
37
 *               |    +----+    |/  --+
 
38
 *               |    |Text|    /     |--- text size
37
39
 *               |    +----+   /|   --+
38
40
 *               |              |
39
41
 *               +--------------+
40
 
 *               |         |    |  
 
42
 *               |         |    |
41
43
 *               |        >|----|<--- buffer width
42
44
 *               |
43
 
 *              >|<--- border width 
 
45
 *              >|<--- border width
44
46
 *
45
 
 *   Text:            
 
47
 *   Text:
46
48
 *   - font family
47
49
 *   - size type (map units, points)
48
50
 *   - size (in points - device independent)
57
59
 *   - x offset, y offset (measured in text coordinate system, not in map coordinate system)
58
60
 *   - angle
59
61
 *   - alignment (from a point calculated by angle and offset)
60
 
 *   
 
62
 *
61
63
 *   Buffer:
62
64
 *   - buffer size type (map units, points)
63
65
 *   - buffer size
69
71
 *   - border color
70
72
 *   - border style
71
73
 *
72
 
 *   Each attribute is either se or unset.
 
74
 *   Each attribute is either set or unset.
73
75
 */
74
76
 
75
 
class QgsLabelAttributes
 
77
class  CORE_EXPORT QgsLabelAttributes
76
78
{
77
 
public:
 
79
  public:
78
80
    /** Constructor.
79
81
     *  @param def if true, defaults are set, if false all all attributes are unset
80
82
     */
81
 
    QgsLabelAttributes ( bool def = true );
 
83
    QgsLabelAttributes( bool def = true );
82
84
 
83
85
    ~QgsLabelAttributes();
84
86
 
85
87
    /* Units type */
86
 
    enum Units { 
87
 
        MapUnits = 0,
88
 
        PointUnits
 
88
    enum Units
 
89
    {
 
90
      MapUnits = 0,
 
91
      PointUnits
89
92
    };
90
93
 
91
 
    static QString unitsName ( int units );
92
 
    static int unitsCode ( const QString &name );
93
 
    
94
 
    static QString alignmentName ( int alignment );
95
 
    static int alignmentCode ( const QString &name );
 
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 );
96
99
 
97
100
    /* Text */
98
 
    void setText ( const QString & text );
99
 
    bool textIsSet ( void ) const;
100
 
    const QString text ( void ) const;
 
101
    void setText( const QString & text );
 
102
    bool textIsSet( void ) const;
 
103
    const QString text( void ) const;
101
104
 
102
105
    /* Font */
103
 
    void setFamily ( const QString & family );
104
 
    bool familyIsSet ( void ) const;
105
 
    const QString family ( void ) const;
106
 
 
107
 
    void setBold ( bool enable );
108
 
    bool boldIsSet ( void ) const;
109
 
    bool bold ( void ) const;
110
 
 
111
 
    void setItalic ( bool enable );
112
 
    bool italicIsSet ( void ) const;
113
 
    bool italic ( void ) const;
114
 
 
115
 
    void setUnderline ( bool enable );
116
 
    bool underlineIsSet ( void ) const;
117
 
    bool underline ( void ) const; 
118
 
    
119
 
    void   setSize ( double size, int type );
120
 
    bool   sizeIsSet ( void ) const;
121
 
    int    sizeType ( void ) const;
122
 
    double size ( void ) const;
123
 
 
124
 
    void  setColor ( const QColor &color );
125
 
    bool  colorIsSet ( void ) const;
126
 
    const QColor & color ( void ) const;
 
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
    void   setSize( double size, int type );
 
123
    bool   sizeIsSet( void ) const;
 
124
    int    sizeType( void ) const;
 
125
    double size( void ) const;
 
126
 
 
127
    void  setColor( const QColor &color );
 
128
    bool  colorIsSet( void ) const;
 
129
    const QColor & color( void ) const;
127
130
 
128
131
    /* Offset */
129
 
    void   setOffset ( double x, double y, int type );
130
 
    bool   offsetIsSet ( void ) const;
131
 
    int    offsetType ( void ) const;
132
 
    double xOffset ( void ) const;
133
 
    double yOffset ( void ) const;
 
132
    void   setOffset( double x, double y, int type );
 
133
    bool   offsetIsSet( void ) const;
 
134
    int    offsetType( void ) const;
 
135
    double xOffset( void ) const;
 
136
    double yOffset( void ) const;
134
137
 
135
138
    /* Angle */
136
 
    void   setAngle ( double angle );
137
 
    bool   angleIsSet ( void ) const;
138
 
    double angle ( void ) const;
 
139
    void   setAngle( double angle );
 
140
    bool   angleIsSet( void ) const;
 
141
    double angle( void ) const;
 
142
 
 
143
    bool   angleIsAuto( void ) const;
 
144
    void   setAutoAngle( bool state );
139
145
 
140
146
    /* Alignment */
141
 
    void setAlignment ( int alignment );
142
 
    bool alignmentIsSet ( void ) const;
143
 
    int  alignment ( void ) const;
 
147
    void setAlignment( int alignment );
 
148
    bool alignmentIsSet( void ) const;
 
149
    int  alignment( void ) const;
144
150
 
145
151
    /* Buffer */
146
152
    bool   bufferEnabled() const;
147
 
    void   setBufferEnabled(bool useBufferFlag);
148
 
    void   setBufferSize ( double size, int type );
149
 
    bool   bufferSizeIsSet ( void ) const;
150
 
    int    bufferSizeType ( void ) const;
151
 
    double bufferSize ( void ) const;
152
 
 
153
 
    void  setBufferColor ( const QColor &color );
154
 
    bool  bufferColorIsSet ( void ) const;
155
 
    QColor bufferColor ( void ) const;
156
 
 
157
 
    void  setBufferStyle ( Qt::BrushStyle style );
158
 
    bool  bufferStyleIsSet ( void ) const;
159
 
    Qt::BrushStyle bufferStyle ( void ) const;
 
153
    void   setBufferEnabled( bool useBufferFlag );
 
154
    void   setBufferSize( double size, int type );
 
155
    bool   bufferSizeIsSet( void ) const;
 
156
    int    bufferSizeType( void ) const;
 
157
    double bufferSize( void ) const;
 
158
 
 
159
    void  setBufferColor( const QColor &color );
 
160
    bool  bufferColorIsSet( void ) const;
 
161
    QColor bufferColor( void ) const;
 
162
 
 
163
    void  setBufferStyle( Qt::BrushStyle style );
 
164
    bool  bufferStyleIsSet( void ) const;
 
165
    Qt::BrushStyle bufferStyle( void ) const;
160
166
 
161
167
    /* Border */
162
 
    void  setBorderColor ( const QColor &color );
163
 
    bool  borderColorIsSet ( void ) const;
164
 
    QColor borderColor ( void ) const;
165
 
 
166
 
    void  setBorderWidth ( int width );
167
 
    bool  borderWidthIsSet ( void ) const;
168
 
    int   borderWidth ( void ) const;
169
 
    
170
 
    void  setBorderStyle ( Qt::PenStyle style );
171
 
    bool  borderStyleIsSet ( void ) const;
172
 
    Qt::PenStyle   borderStyle ( void ) const;
173
 
    
174
 
 protected:
 
168
    void  setBorderColor( const QColor &color );
 
169
    bool  borderColorIsSet( void ) const;
 
170
    QColor borderColor( void ) const;
 
171
 
 
172
    void  setBorderWidth( int width );
 
173
    bool  borderWidthIsSet( void ) const;
 
174
    int   borderWidth( void ) const;
 
175
 
 
176
    void  setBorderStyle( Qt::PenStyle style );
 
177
    bool  borderStyleIsSet( void ) const;
 
178
    Qt::PenStyle   borderStyle( void ) const;
 
179
 
 
180
    bool  multilineEnabled() const;
 
181
    void  setMultilineEnabled( bool useMultiline );
 
182
 
 
183
  protected:
175
184
    /* Text */
176
185
    QString mText;
177
186
    bool mTextIsSet;
201
210
    /** Angle (degrees) */
202
211
    double mAngle;
203
212
    bool   mAngleIsSet;
 
213
    bool   mAngleIsAuto;
204
214
 
205
215
    /** Alignment */
206
216
    int  mAlignment;
207
 
    bool mAlignmentIsSet;            
 
217
    bool mAlignmentIsSet;
208
218
 
209
219
    /** Buffer enablement */
210
220
    bool mBufferEnabledFlag;
212
222
    int    mBufferSizeType;
213
223
    double mBufferSize;
214
224
    bool   mBufferSizeIsSet;
215
 
    
 
225
 
216
226
    /** Buffer brush (color, style) */
217
227
    QBrush mBufferBrush;
218
228
    bool   mBufferColorIsSet;
223
233
    bool mBorderColorIsSet;
224
234
    bool mBorderWidthIsSet;
225
235
    bool mBorderStyleIsSet;
 
236
 
 
237
    /** Multiline enablement */
 
238
    bool mMultilineEnabledFlag;
226
239
};
227
240
 
228
241
#endif