1
/***************************************************************************
2
qgslabel.cpp - 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
***************************************************************************/
18
#include <math.h> //needed for win32 build (ts)
22
#include <qfontmetrics.h>
25
#include <qpaintdevice.h>
30
#include "qgsfeature.h"
33
#include "qgscoordinatetransform.h"
35
#include "qgslabelattributes.h"
36
#include "qgslabeldialog.h"
39
// use M_PI define PI 3.141592654
41
#define M_PI 4*atan(1.0)
44
static const char * const ident_ =
45
"$Id: qgslabel.cpp,v 1.21 2004/12/01 01:07:36 mcoletti Exp $";
48
QgsLabel::QgsLabel( std::vector<QgsField>& fields )
51
std::cerr << "QgsLabel::QgsLabel()" << std::endl;
55
mLabelField.resize ( LabelFieldCount );
56
mLabelFieldIdx.resize ( LabelFieldCount );
57
for ( int i = 0; i < LabelFieldCount; i++ )
60
mLabelFieldIdx[i] = -1;
62
mLabelAttributes = new QgsLabelAttributes ( true );
68
QString QgsLabel::fieldValue ( int attr, QgsFeature *feature )
70
if ( mLabelField[attr].isEmpty() )
73
std::vector<QgsFeatureAttribute> fields = feature->attributeMap();
75
for ( unsigned int i = 0; i < fields.size(); i++ )
77
if ( fields[i].fieldName().lower().compare(mLabelField[attr]) == 0 )
79
return fields[i].fieldValue();
85
void QgsLabel::renderLabel( QPainter * painter, QgsRect *viewExtent,
86
QgsCoordinateTransform *transform, QPaintDevice* device,
87
QgsFeature *feature, bool selected, QgsLabelAttributes *classAttributes )
90
std::cerr << "QgsLabel::renderLabel()" << std::endl;
99
/* Clac scale (not nice) */
101
point = transform->transform ( 0, 0 );
103
point = transform->transform ( 1000, 0 );
105
scale = (x2-x1)/1000;
108
value = fieldValue ( Text, feature );
109
if ( value.isEmpty() )
111
text = mLabelAttributes->text();
119
value = fieldValue ( Family, feature );
120
if ( value.isEmpty() )
122
font.setFamily ( mLabelAttributes->family() );
126
font.setFamily ( value );
130
value = fieldValue ( Size, feature );
131
if ( value.isEmpty() )
133
size = mLabelAttributes->size();
137
size = value.toDouble();
139
if ( mLabelAttributes->sizeType() == QgsLabelAttributes::MapUnits )
143
font.setPointSizeFloat ( size );
145
value = fieldValue ( Color, feature );
146
if ( value.isEmpty() )
148
pen.setColor ( mLabelAttributes->color() );
152
pen.setColor ( QColor(value) );
155
value = fieldValue ( Bold, feature );
156
if ( value.isEmpty() )
158
font.setBold ( mLabelAttributes->bold() );
162
font.setBold ( (bool) value.toInt() );
165
value = fieldValue ( Italic, feature );
166
if ( value.isEmpty() )
168
font.setItalic ( mLabelAttributes->italic() );
172
font.setItalic ( (bool) value.toInt() );
175
value = fieldValue ( Underline, feature );
176
if ( value.isEmpty() )
178
font.setUnderline ( mLabelAttributes->underline() );
182
font.setUnderline ( (bool) value.toInt() );
187
double x, y, xoffset, yoffset, ang;
189
point = labelPoint ( feature );
191
value = fieldValue ( XCoordinate, feature );
192
if ( !value.isEmpty() )
194
point.setX ( value.toDouble() );
196
value = fieldValue ( YCoordinate, feature );
197
if ( !value.isEmpty() )
199
point.setY ( value.toDouble() );
202
transform->transform(&point);
206
value = fieldValue ( XOffset, feature );
207
if ( value.isEmpty() )
209
xoffset = mLabelAttributes->xOffset();
213
xoffset = value.toDouble();
215
value = fieldValue ( YOffset, feature );
216
if ( value.isEmpty() )
218
yoffset = mLabelAttributes->yOffset();
222
yoffset = value.toDouble();
225
// recalc offset to points
226
if ( mLabelAttributes->offsetType() == QgsLabelAttributes::MapUnits )
232
value = fieldValue ( Angle, feature );
233
if ( value.isEmpty() )
235
ang = mLabelAttributes->angle();
239
ang = value.toDouble();
241
double rad = ang * M_PI/180;
243
x = x + xoffset * cos(rad) - yoffset * sin(rad);
244
y = y - xoffset * sin(rad) - yoffset * cos(rad);
248
QFontMetrics fm ( font );
249
int width = fm.width ( text );
250
int height = fm.height();
253
value = fieldValue ( Alignment, feature );
254
if ( value.isEmpty() )
256
alignment = mLabelAttributes->alignment();
260
value = value.lower();
261
alignment = Qt::AlignCenter;
262
if ( value.compare("left") == 0 )
264
alignment = Qt::AlignLeft | Qt::AlignVCenter;
266
else if ( value.compare("right") == 0 )
268
alignment = Qt::AlignRight | Qt::AlignVCenter;
270
else if ( value.compare("bottom") == 0 )
272
alignment = Qt::AlignBottom | Qt::AlignHCenter;
274
else if ( value.compare("top") == 0 )
276
alignment = Qt::AlignTop | Qt::AlignHCenter;
280
if ( alignment & Qt::AlignLeft )
284
else if ( alignment & Qt::AlignHCenter )
288
else if ( alignment & Qt::AlignRight )
293
if ( alignment & Qt::AlignBottom )
297
else if ( alignment & Qt::AlignVCenter )
301
else if ( alignment & Qt::AlignTop )
307
painter->setFont ( font );
308
painter->translate ( x, y );
309
painter->rotate ( -ang );
311
// Draw a buffer behind the text if one is desired
313
if (mLabelAttributes->bufferSizeIsSet() && mLabelAttributes->bufferEnabled())
315
int myBufferSize = static_cast<int>(mLabelAttributes->bufferSize());
316
if (mLabelAttributes->bufferColorIsSet())
318
painter->setPen( mLabelAttributes->bufferColor());
320
else //default to a white buffer
322
painter->setPen( Qt::white);
324
for (int i = dx-myBufferSize; i <= dx+myBufferSize; i++)
326
for (int j = dy-myBufferSize; j <= dy+myBufferSize; j++)
328
painter->drawText( i ,j, text);
332
painter->setPen ( pen );
333
painter->drawText ( dx, dy, text );
337
void QgsLabel::addRequiredFields ( std::list<int> *fields )
339
for ( int i = 0; i < LabelFieldCount; i++ )
341
if ( mLabelFieldIdx[i] == -1 )
344
for (std::list<int>::iterator it = fields->
349
if ( *it == mLabelFieldIdx[i] )
357
fields->push_back(mLabelFieldIdx[i])
363
std::vector<QgsField> & QgsLabel::fields ( void )
368
void QgsLabel::setLabelField ( int attr, const QString str )
370
if ( attr >= LabelFieldCount )
374
mLabelField[attr] = str;
376
mLabelFieldIdx[attr] = -1;
377
for ( int i = 0; i < mField.size(); i++ )
379
if ( mField[i].name().compare(str) == 0 )
381
mLabelFieldIdx[attr] = i;
386
QString QgsLabel::labelField ( int attr )
388
if ( attr > LabelFieldCount )
391
return mLabelField[attr];
394
QgsLabelAttributes *QgsLabel::layerAttributes ( void )
396
return mLabelAttributes;
399
QgsPoint QgsLabel::labelPoint ( QgsFeature *feature )
406
unsigned char *geom = feature->getGeometry();
408
memcpy(&wkbType, (geom+1), sizeof(wkbType));
415
x = (double *) (geom + 5);
416
y = (double *) (geom + 5 + sizeof(double));
421
case QGis::WKBLineString: // Line center
422
double dx, dy, tl, l;
424
nPoints = (int *)ptr;
425
ptr = geom + 1 + 2 * sizeof(int);
428
for (int i = 1; i < *nPoints; i++)
430
dx = ((double *)ptr)[2*i] - ((double *)ptr)[2*i-2];
431
dy = ((double *)ptr)[2*i+1] - ((double *)ptr)[2*i-1];
432
tl += sqrt(dx*dx + dy*dy);
437
for (int i = 1; i < *nPoints; i++)
441
dx = ((double *)ptr)[2*i] - ((double *)ptr)[2*i-2];
442
dy = ((double *)ptr)[2*i+1] - ((double *)ptr)[2*i-1];
443
dl = sqrt(dx*dx + dy*dy);
450
point.setX ( ((double *)ptr)[2*i-2] + k * dx );
451
point.setY ( ((double *)ptr)[2*i-1] + k * dy );
458
case QGis::WKBPolygon:
460
ptr = geom + 1 + 2 * sizeof(int); // set pointer to the first ring
461
nPoints = (int *) ptr;
465
for (int i = 0; i < *nPoints-1; i++)
467
sx += ((double *)ptr)[2*i];
468
sy += ((double *)ptr)[2*i+1];
470
point.setX ( sx/(*nPoints-1) );
471
point.setY ( sy/(*nPoints-1) );
474
case QGis::WKBMultiPolygon:
475
break; ///// <--------------remove this when code below needs testing..........
480
int *numPolygons, *numRings;
482
// get the number of polygons
484
numPolygons = (int *) ptr;
487
std::cout << "Finding label point for mutipolygon with "
488
<< *numPolygons << " parts " << std::endl;
490
//for (kdx = 0; kdx < *numPolygons; kdx++)
491
for (kdx = 0; kdx < 1; kdx++) //just label the first sub polygon
493
//skip the endian and feature type info and
494
// get number of rings in the polygon
496
numRings = (int *) ptr;
500
std::cout << "Multipolygon part " << kdx << " ring iteration " << std::endl;
503
for (idx = 0; idx < *numRings; idx++)
506
std::cout << "Multipolygon part " << kdx << " ring " << idx
509
// get number of points in the ring
510
nPoints = (int *) ptr;
514
//loop through vertices skipping last which == first
515
for (int i = 0; i < *nPoints-1; i++)
518
ptr += sizeof(double);
520
ptr += sizeof(double);
525
std::cout << "\tVertex " << i << " x: " << *x << " y: " << *y << std::endl;
531
std::cout << "Setting multipart polygon label point to" << sx/(*nPoints-1) << ", "<< sy/(*nPoints-1) << std::endl;
534
point.setX ( sx/(*nPoints-1) );
535
point.setY ( sy/(*nPoints-1) );
542
return QgsPoint ( point );
545
void QgsLabel::readXML( const QDomNode& node )
548
std::cout << "QgsLabel::readXML() called for layer label properties \n" << std::endl;
551
qDebug( "%s:%d QgsLabel::readXML() got node %s", __FILE__, __LINE__, node.nodeName().ascii() );
553
QDomNode scratchNode; // DOM node re-used to get current QgsLabel attribute
556
int red, green, blue;
560
scratchNode = node.namedItem("label");
562
if ( scratchNode.isNull() )
564
qDebug( "%s:%d couldn't find QgsLabel ``label'' attribute", __FILE__, __LINE__ );
568
el = scratchNode.toElement();
569
mLabelAttributes->setText ( el.attribute("text","") );
570
setLabelField ( Text, el.attribute("field","") );
574
scratchNode = node.namedItem("family");
576
if ( scratchNode.isNull() )
578
qDebug( "%s:%d couldn't find QgsLabel ``family'' attribute", __FILE__, __LINE__ );
582
el = scratchNode.toElement();
583
mLabelAttributes->setFamily ( el.attribute("name","") );
584
setLabelField ( Family, el.attribute("field","") );
588
scratchNode = node.namedItem("size");
590
if ( scratchNode.isNull() )
592
qDebug( "%s:%d couldn't find QgsLabel ``size'' attribute", __FILE__, __LINE__ );
596
el = scratchNode.toElement();
597
type = QgsLabelAttributes::unitsCode( el.attribute("units","") );
598
mLabelAttributes->setSize ( el.attribute("value", "0.0").toDouble(), type );
599
setLabelField ( Size, el.attribute("field","") );
603
scratchNode = node.namedItem("bold");
605
if ( scratchNode.isNull() )
607
qDebug( "%s:%d couldn't find QgsLabel ``bold'' attribute", __FILE__, __LINE__ );
611
el = scratchNode.toElement();
612
mLabelAttributes->setBold ( (bool)el.attribute("on","0").toInt() );
613
setLabelField ( Bold, el.attribute("field","") );
617
scratchNode = node.namedItem("italic");
619
if ( scratchNode.isNull() )
621
qDebug( "%s:%d couldn't find QgsLabel ``italic'' attribute", __FILE__, __LINE__ );
625
el = scratchNode.toElement();
626
mLabelAttributes->setItalic ( (bool)el.attribute("on","0").toInt() );
627
setLabelField ( Italic, el.attribute("field","") );
631
scratchNode = node.namedItem("underline");
633
if ( scratchNode.isNull() )
635
qDebug( "%s:%d couldn't find QgsLabel ``underline'' attribute", __FILE__, __LINE__ );
639
el = scratchNode.toElement();
640
mLabelAttributes->setUnderline ( (bool)el.attribute("on","0").toInt() );
641
setLabelField ( Underline, el.attribute("field","") );
645
scratchNode = node.namedItem("color");
647
if ( scratchNode.isNull() )
649
qDebug( "%s:%d couldn't find QgsLabel ``color'' attribute", __FILE__, __LINE__ );
653
el = scratchNode.toElement();
655
red = el.attribute("red","0").toInt();
656
green = el.attribute("green","0").toInt();
657
blue = el.attribute("blue","0").toInt();
659
mLabelAttributes->setColor( QColor(red, green, blue) );
661
setLabelField ( Color, el.attribute("field","") );
665
scratchNode = node.namedItem("x");
667
if ( scratchNode.isNull() )
669
qDebug( "%s:%d couldn't find QgsLabel ``x'' attribute", __FILE__, __LINE__ );
673
el = scratchNode.toElement();
674
setLabelField ( XCoordinate, el.attribute("field","") );
678
scratchNode = node.namedItem("y");
680
if ( scratchNode.isNull() )
682
qDebug( "%s:%d couldn't find QgsLabel ``y'' attribute", __FILE__, __LINE__ );
686
el = scratchNode.toElement();
687
setLabelField ( YCoordinate, el.attribute("field","") );
692
scratchNode = node.namedItem("offset");
694
if ( scratchNode.isNull() )
696
qDebug( "%s:%d couldn't find QgsLabel ``offset'' attribute", __FILE__, __LINE__ );
700
double xoffset, yoffset;
702
el = scratchNode.toElement();
704
type = QgsLabelAttributes::unitsCode( el.attribute("units","") );
705
xoffset = el.attribute("x","0.0").toDouble();
706
yoffset = el.attribute("y","0.0").toDouble();
708
mLabelAttributes->setOffset ( xoffset, yoffset, type );
709
setLabelField ( XOffset, el.attribute("xfield","0") );
710
setLabelField ( YOffset, el.attribute("yfield","0") );
714
scratchNode = node.namedItem("angle");
716
if ( scratchNode.isNull() )
718
qDebug( "%s:%d couldn't find QgsLabel ``angle'' attribute", __FILE__, __LINE__ );
722
el = scratchNode.toElement();
723
mLabelAttributes->setAngle ( el.attribute("value","0.0").toDouble() );
724
setLabelField ( Angle, el.attribute("field","0.0") );
728
scratchNode = node.namedItem("alignment");
730
if ( scratchNode.isNull() )
732
qDebug( "%s:%d couldn't find QgsLabel ``alignment'' attribute", __FILE__, __LINE__ );
736
el = scratchNode.toElement();
737
mLabelAttributes->setAlignment ( QgsLabelAttributes::alignmentCode(el.attribute("value","")) );
738
setLabelField ( Alignment, el.attribute("field","") );
743
scratchNode = node.namedItem("buffercolor");
745
if ( scratchNode.isNull() )
747
qDebug( "%s:%d couldn't find QgsLabel ``buffercolor'' attribute", __FILE__, __LINE__ );
751
el = scratchNode.toElement();
753
red = el.attribute("red","0").toInt();
754
green = el.attribute("green","0").toInt();
755
blue = el.attribute("blue","0").toInt();
757
mLabelAttributes->setBufferColor( QColor(red, green, blue) );
758
setLabelField ( BufferColor, el.attribute("field","") );
761
scratchNode = node.namedItem("buffersize");
763
if ( scratchNode.isNull() )
765
qDebug( "%s:%d couldn't find QgsLabel ``buffersize'' attribute", __FILE__, __LINE__ );
769
el = scratchNode.toElement();
771
type = QgsLabelAttributes::unitsCode( el.attribute("units","") );
772
mLabelAttributes->setBufferSize ( el.attribute("value","0.0").toDouble(), type );
773
setLabelField ( BufferSize, el.attribute("field","") );
776
scratchNode = node.namedItem("bufferenabled");
778
if ( scratchNode.isNull() )
780
qDebug( "%s:%d couldn't find QgsLabel ``bufferenabled'' attribute", __FILE__, __LINE__ );
784
el = scratchNode.toElement();
786
mLabelAttributes->setBufferEnabled ( (bool)el.attribute("on","0").toInt() );
787
setLabelField ( BufferEnabled, el.attribute("field","") );
790
} // QgsLabel::readXML()
794
void QgsLabel::writeXML(std::ostream& xml)
797
xml << "\t\t<labelattributes>\n";
800
if ( mLabelAttributes->textIsSet() && !mLabelField[Text].isEmpty() )
802
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"" << mLabelField[Text] << "\" />\n";
804
else if ( mLabelAttributes->textIsSet() )
806
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"\" />\n";
810
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"" << mLabelField[Text] << "\" />\n";
813
if ( mLabelAttributes->familyIsSet() && ! mLabelAttributes->family().isNull() && mLabelField[Family].isNull())
815
xml << "\t\t\t<family name=\"" << mLabelAttributes->family() << "\" field=\"" << mLabelField[Family] << "\" />\n";
817
else if ( mLabelAttributes->familyIsSet() && ! mLabelAttributes->family().isNull() )
819
xml << "\t\t\t<family name=\"" << mLabelAttributes->family() << "\" field=\"\" />\n";
823
xml << "\t\t\t<family name=\"Arial\" field=\"\" />\n";
827
if ( mLabelAttributes->sizeIsSet() && !mLabelField[Size].isEmpty())
829
xml << "\t\t\t<size value=\"" << mLabelAttributes->size() << "\" units=\""
830
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->sizeType()) << "\" field=\"" << mLabelField[Size] << "\" />\n";
832
else if ( mLabelAttributes->sizeIsSet() )
834
xml << "\t\t\t<size value=\"" << mLabelAttributes->size() << "\" units=\""
835
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->sizeType()) << "\" field=\"\" />\n";
839
xml << "\t\t\t<size value=\"12\" units=\"Points\" field=\"\" />\n";
845
if ( mLabelAttributes->boldIsSet() && !mLabelField[Bold].isEmpty() )
847
xml << "\t\t\t<bold on=\"" << mLabelAttributes->bold() << "\" field=\"" << mLabelField[Bold] << "\" />\n";
849
else if ( mLabelAttributes->boldIsSet() )
851
xml << "\t\t\t<bold on=\"" << mLabelAttributes->bold() << "\" field=\"\" />\n";
855
xml << "\t\t\t<bold on=\"0\" field=\"0\" />\n";
859
if ( mLabelAttributes->italicIsSet() && ! mLabelField[Italic].isEmpty())
861
xml << "\t\t\t<italic on=\"" << mLabelAttributes->italic() << "\" field=\"" << mLabelField[Italic] << "\" />\n";
863
else if ( mLabelAttributes->italicIsSet() )
865
xml << "\t\t\t<italic on=\"" << mLabelAttributes->italic() << "\" field=\"\" />\n";
869
xml << "\t\t\t<italic on=\"0\" field=\"\" />\n";
872
if ( mLabelAttributes->underlineIsSet() && !mLabelField[Underline].isEmpty())
874
xml << "\t\t\t<underline on=\"" << mLabelAttributes->underline() << "\" field=\"" << mLabelField[Underline] << "\" />\n";
876
else if ( mLabelAttributes->underlineIsSet() )
878
xml << "\t\t\t<underline on=\"" << mLabelAttributes->underline() << "\" field=\"\" />\n";
882
xml << "\t\t\t<underline on=\"0\" field=\"\" />\n";
885
if ( mLabelAttributes->colorIsSet() && ! mLabelField[Color].isNull() )
887
xml << "\t\t\t<color red=\"" << mLabelAttributes->color().red() << "\" green=\"" << mLabelAttributes->color().green()
888
<< "\" blue=\"" << mLabelAttributes->color().blue() << "\" field=\"" << mLabelField[Color] << "\" />\n";
890
else if ( mLabelAttributes->colorIsSet() )
892
xml << "\t\t\t<color red=\"" << mLabelAttributes->color().red() << "\" green=\"" << mLabelAttributes->color().green()
893
<< "\" blue=\"" << mLabelAttributes->color().blue() << "\" field=\"\" />\n";
897
xml << "\t\t\t<color red=\"0\" green=\"0\" blue=\"0\" field=\"\" />\n";
902
if (! mLabelField[XCoordinate].isEmpty() )
904
xml << "\t\t\t<x field=\"" << mLabelField[XCoordinate] << "\" />\n";
908
xml << "\t\t\t<x field=\"" << "\" />\n";
912
if (! mLabelField[YCoordinate].isEmpty() )
914
xml << "\t\t\t<y field=\"" << mLabelField[YCoordinate] << "\" />\n";
918
xml << "\t\t\t<y field=\"" << "\" />\n";
922
if ( mLabelAttributes->offsetIsSet() )
924
xml << "\t\t\t<offset units=\"" << QgsLabelAttributes::unitsName(mLabelAttributes->offsetType())
925
<< "\" x=\"" << mLabelAttributes->xOffset() << "\" xfield=\"" << mLabelField[XOffset]
926
<< "\" y=\"" << mLabelAttributes->yOffset() << "\" yfield=\"" << mLabelField[YOffset]
931
if ( mLabelAttributes->angleIsSet() )
933
xml << "\t\t\t<angle value=\"" << mLabelAttributes->angle() << "\" field=\"" << mLabelField[Angle] << "\" />\n";
935
else if ( mLabelAttributes->angleIsSet() )
937
xml << "\t\t\t<angle value=\"" << mLabelAttributes->angle() << "\" field=\"" << "\" />\n";
941
xml << "\t\t\t<angle value=\"" << "\" field=\"" << "\" />\n";
945
if ( mLabelAttributes->alignmentIsSet() )
947
xml << "\t\t\t<alignment value=\"" << QgsLabelAttributes::alignmentName(mLabelAttributes->alignment())
948
<< "\" field=\"" << mLabelField[Alignment] << "\" />\n";
952
if ( mLabelAttributes->bufferColorIsSet() && ! mLabelField[BufferColor].isNull() )
954
xml << "\t\t\t<buffercolor red=\"" << mLabelAttributes->bufferColor().red() << "\" green=\"" << mLabelAttributes->bufferColor().green()
955
<< "\" blue=\"" << mLabelAttributes->bufferColor().blue() << "\" field=\"" << mLabelField[BufferColor] << "\" />\n";
957
else if ( mLabelAttributes->bufferColorIsSet() )
959
xml << "\t\t\t<buffercolor red=\"" << mLabelAttributes->bufferColor().red() << "\" green=\"" << mLabelAttributes->bufferColor().green()
960
<< "\" blue=\"" << mLabelAttributes->bufferColor().blue() << "\" field=\"" << "\" />\n";
964
xml << "\t\t\t<buffercolor red=\"" << "\" green=\""
965
<< "\" blue=\"" << "\" field=\"" << "\" />\n";
969
if ( mLabelAttributes->bufferSizeIsSet() && ! mLabelField[BufferSize].isNull() )
971
xml << "\t\t\t<buffersize value=\"" << mLabelAttributes->bufferSize() << "\" units=\""
972
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->bufferSizeType()) << "\" field=\"" << mLabelField[BufferSize] << "\" />\n";
974
else if ( mLabelAttributes->bufferSizeIsSet() )
976
xml << "\t\t\t<buffersize value=\"" << mLabelAttributes->bufferSize() << "\" units=\""
977
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->bufferSizeType()) << "\" field=\"" << "\" />\n";
981
xml << "\t\t\t<buffersize value=\"" << "\" units=\""
982
<< "\" field=\"" << "\" />\n";
986
if ( mLabelAttributes->bufferEnabled() && ! mLabelField[BufferEnabled].isNull() )
988
xml << "\t\t\t<bufferenabled on=\"" << mLabelAttributes->bufferEnabled() << "\" field=\"" << mLabelField[BufferEnabled] << "\" />\n";
990
else if ( mLabelAttributes->bufferEnabled())
992
xml << "\t\t\t<bufferenabled on=\"" << mLabelAttributes->bufferEnabled() << "\" field=\"" << "\" />\n";
996
xml << "\t\t\t<bufferenabled on=\"" << "\" field=\"" << "\" />\n";
998
xml << "\t\t</labelattributes>\n";