QGIS/python/core/qgslabel.sip
wonder ce3eea0dcf QgsFeatureAttribute class has been removed and QVariant is used instead (supports arbitrary data types).
All providers and python bindings have been updated accordingly.
Currently supported variant types by providers are String, Int and Double.

Other API changes:
- QgsField
  - type info as QString is now typeName() and setTypeName()
  - added variant type (QVariant::Type) info: type(), setType()
- QgsFeature
  - removed fields() - use QgsVectorDataProvider::fields()
  - removed boundingBox() - use QgsGeometry::boundingBox()
- QgsVectorLayer - removed fields(), fieldCount(), getDefaultValue() - use directly QgsVectorDataProvider
- QgsVectorDataProvider - getDefaultValue() - field now addressed by id, returns variant
- QgsLabel - setLabelField() - field now addressed by id


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6833 c8812cc2-4d05-0410-92ff-de0c093fc19c
2007-03-24 22:40:10 +00:00

86 lines
2.0 KiB
Plaintext

/** Render class to display labels */
class QgsLabel
{
%TypeHeaderCode
#include <qgslabel.h>
%End
private:
QgsLabel (); // pretend that constructor is private for now
public:
QgsLabel ( const QMap<int, QgsField> & fields );
~QgsLabel();
/* Fields */
enum LabelField {
Text = 0,
Family,
Size,
Bold,
Italic,
Underline,
Color,
XCoordinate,
YCoordinate,
XOffset,
YOffset,
Angle,
Alignment,
BufferEnabled,
BufferSize,
BufferColor,
BufferBrush,
BorderWidth,
BorderColor,
BorderStyle,
LabelFieldCount
};
/** \brief render label
* \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
*/
void renderLabel ( QPainter* painter, QgsRect& viewExtent,
QgsCoordinateTransform* coordTransform,
QgsMapToPixel *transform,
QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0, double sizeScale = 1);
/** Reads the renderer configuration from an XML file
@param rnode the DOM node to read
*/
void readXML(const QDomNode& node);
/** Writes the contents of the renderer to a configuration file */
// TODO: wrap void writeXML(std::ostream& xml);
//! add vector of required fields to existing list of fields
void addRequiredFields ( QList<int> & fields );
//! Set available fields
void setFields( const QMap<int, QgsField> & fields );
//! Available vector fields
QMap<int, QgsField> & fields ( );
//! Pointer to default attributes
QgsLabelAttributes *layerAttributes ( );
//! Set label field
void setLabelField ( int attr, int fieldId );
//! label field
QString labelField ( int attr );
/** Get field value if : 1) field name is not empty
* 2) field exists
* 3) value is defined
* otherwise returns empty string
*/
QString fieldValue ( int attr, QgsFeature& feature );
};