1
/***************************************************************************
2
qgslabelattributes.h - render vector labels
5
copyright : (C) 2004 by Radim Blazek
7
***************************************************************************/
8
/***************************************************************************
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. *
15
***************************************************************************/
16
/* $Id: qgslabelattributes.h,v 1.5 2004/11/30 01:32:44 mcoletti Exp $ */
17
#ifndef QGSLABELATTRIBUTES_H
18
#define QGSLABELATTRIBUTES_H
20
#include <qnamespace.h>
28
/** This class can be used to store attributes needed for label rendering.
31
* border (color, width, style)
35
* +-----------/--+ buffer (color, pattern)
38
* | |Text| / |--- text size
43
* | >|----|<--- buffer width
49
* - size type (map units, points)
50
* - size (in points - device independent)
58
* - offset type (map units, points)
59
* - x offset, y offset (measured in text coordinate system, not in map coordinate system)
61
* - alignment (from a point calculated by angle and offset)
64
* - buffer size type (map units, points)
74
* Each attribute is either se or unset.
77
class QgsLabelAttributes
81
* @param def if true, defaults are set, if false all all attributes are unset
83
QgsLabelAttributes ( bool def = true );
85
~QgsLabelAttributes();
93
static QString unitsName ( int units );
94
static int unitsCode ( const QString &name );
96
static QString alignmentName ( int alignment );
97
static int alignmentCode ( const QString &name );
100
void setText ( const QString & text );
101
bool textIsSet ( void ) const;
102
const QString text ( void ) const;
105
void setFamily ( const QString & family );
106
bool familyIsSet ( void ) const;
107
const QString family ( void ) const;
109
void setBold ( bool enable );
110
bool boldIsSet ( void ) const;
111
bool bold ( void ) const;
113
void setItalic ( bool enable );
114
bool italicIsSet ( void ) const;
115
bool italic ( void ) const;
117
void setUnderline ( bool enable );
118
bool underlineIsSet ( void ) const;
119
bool underline ( void ) const;
121
void setSize ( double size, int type );
122
bool sizeIsSet ( void ) const;
123
int sizeType ( void ) const;
124
double size ( void ) const;
126
void setColor ( const QColor &color );
127
bool colorIsSet ( void ) const;
128
const QColor & color ( void ) const;
131
void setOffset ( double x, double y, int type );
132
bool offsetIsSet ( void ) const;
133
int offsetType ( void ) const;
134
double xOffset ( void ) const;
135
double yOffset ( void ) const;
138
void setAngle ( double angle );
139
bool angleIsSet ( void ) const;
140
double angle ( void ) const;
143
void setAlignment ( int alignment );
144
bool alignmentIsSet ( void ) const;
145
int alignment ( void ) const;
148
bool bufferEnabled() const;
149
void setBufferEnabled(bool useBufferFlag);
150
void setBufferSize ( double size, int type );
151
bool bufferSizeIsSet ( void ) const;
152
int bufferSizeType ( void ) const;
153
double bufferSize ( void ) const;
155
void setBufferColor ( const QColor &color );
156
bool bufferColorIsSet ( void ) const;
157
const QColor & bufferColor ( void ) const;
159
void setBufferStyle ( Qt::BrushStyle style );
160
bool bufferStyleIsSet ( void ) const;
161
Qt::BrushStyle bufferStyle ( void ) const;
164
void setBorderColor ( const QColor &color );
165
bool borderColorIsSet ( void ) const;
166
const QColor & borderColor ( void ) const;
168
void setBorderWidth ( int width );
169
bool borderWidthIsSet ( void ) const;
170
int borderWidth ( void ) const;
172
void setBorderStyle ( Qt::PenStyle style );
173
bool borderStyleIsSet ( void ) const;
174
Qt::PenStyle borderStyle ( void ) const;
181
/** Font (family, weight, italic, underline) */
186
bool mUnderlineIsSet;
188
/** Font size, size type */
203
/** Angle (degrees) */
209
bool mAlignmentIsSet;
211
/** Buffer enablement */
212
bool mBufferEnabledFlag;
213
/** Buffer size, size type */
216
bool mBufferSizeIsSet;
218
/** Buffer brush (color, style) */
220
bool mBufferColorIsSet;
221
bool mBufferStyleIsSet;
223
/** Border pen (color, width, style) */
225
bool mBorderColorIsSet;
226
bool mBorderWidthIsSet;
227
bool mBorderStyleIsSet;