@@ -172,31 +172,31 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
172
172
// compatibility with old project file format
173
173
if ( !properties[" width_field" ].isEmpty () )
174
174
{
175
- layer->setDataDefinedProperty ( " width " , new QgsDataDefined ( properties[" width_field" ] ) );
175
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_WIDTH , new QgsDataDefined ( properties[" width_field" ] ) );
176
176
}
177
177
if ( !properties[" height_field" ].isEmpty () )
178
178
{
179
- layer->setDataDefinedProperty ( " height " , new QgsDataDefined ( properties[" height_field" ] ) );
179
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_HEIGHT , new QgsDataDefined ( properties[" height_field" ] ) );
180
180
}
181
181
if ( !properties[" rotation_field" ].isEmpty () )
182
182
{
183
- layer->setDataDefinedProperty ( " rotation " , new QgsDataDefined ( properties[" rotation_field" ] ) );
183
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_ROTATION , new QgsDataDefined ( properties[" rotation_field" ] ) );
184
184
}
185
185
if ( !properties[" outline_width_field" ].isEmpty () )
186
186
{
187
- layer->setDataDefinedProperty ( " outline_width " , new QgsDataDefined ( properties[ " outline_width_field" ] ) );
187
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH , new QgsDataDefined ( properties[ " outline_width_field" ] ) );
188
188
}
189
189
if ( !properties[" fill_color_field" ].isEmpty () )
190
190
{
191
- layer->setDataDefinedProperty ( " fill_color " , new QgsDataDefined ( properties[" fill_color_field" ] ) );
191
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_FILL_COLOR , new QgsDataDefined ( properties[" fill_color_field" ] ) );
192
192
}
193
193
if ( !properties[" outline_color_field" ].isEmpty () )
194
194
{
195
- layer->setDataDefinedProperty ( " outline_color " , new QgsDataDefined ( properties[" outline_color_field" ] ) );
195
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR , new QgsDataDefined ( properties[" outline_color_field" ] ) );
196
196
}
197
197
if ( !properties[" symbol_name_field" ].isEmpty () )
198
198
{
199
- layer->setDataDefinedProperty ( " symbol_name " , new QgsDataDefined ( properties[" symbol_name_field" ] ) );
199
+ layer->setDataDefinedProperty ( QgsSymbolLayerV2::EXPR_SYMBOL_NAME , new QgsDataDefined ( properties[" symbol_name_field" ] ) );
200
200
}
201
201
202
202
return layer;
@@ -205,41 +205,41 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
205
205
void QgsEllipseSymbolLayerV2::renderPoint ( const QPointF& point, QgsSymbolV2RenderContext& context )
206
206
{
207
207
bool ok;
208
- if ( hasDataDefinedProperty ( " outline_width " ) )
208
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
209
209
{
210
- double width = evaluateDataDefinedProperty ( " outline_width " , context.feature (), mOutlineWidth ).toDouble ();
210
+ double width = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH , context.feature (), mOutlineWidth ).toDouble ();
211
211
width *= QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mOutlineWidthUnit , mOutlineWidthMapUnitScale );
212
212
mPen .setWidthF ( width );
213
213
}
214
- if ( hasDataDefinedProperty ( " outline_style " ) )
214
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_STYLE ) )
215
215
{
216
- QString styleString = evaluateDataDefinedProperty ( " outline_style " , context.feature (), QVariant (), &ok ).toString ();
216
+ QString styleString = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_STYLE , context.feature (), QVariant (), &ok ).toString ();
217
217
if ( ok )
218
218
{
219
219
Qt::PenStyle style = QgsSymbolLayerV2Utils::decodePenStyle ( styleString );
220
220
mPen .setStyle ( style );
221
221
}
222
222
}
223
- if ( hasDataDefinedProperty ( " fill_color " ) )
223
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_FILL_COLOR ) )
224
224
{
225
- QString colorString = evaluateDataDefinedProperty ( " fill_color " , context.feature (), QVariant (), &ok ).toString ();
225
+ QString colorString = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_FILL_COLOR , context.feature (), QVariant (), &ok ).toString ();
226
226
if ( ok )
227
227
mBrush .setColor ( QColor ( QgsSymbolLayerV2Utils::decodeColor ( colorString ) ) );
228
228
}
229
- if ( hasDataDefinedProperty ( " outline_color " ) )
229
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR ) )
230
230
{
231
- QString colorString = evaluateDataDefinedProperty ( " outline_color " , context.feature (), QVariant (), &ok ).toString ();
231
+ QString colorString = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR , context.feature (), QVariant (), &ok ).toString ();
232
232
if ( ok )
233
233
mPen .setColor ( QColor ( QgsSymbolLayerV2Utils::decodeColor ( colorString ) ) );
234
234
}
235
235
double scaledWidth = mSymbolWidth ;
236
236
double scaledHeight = mSymbolHeight ;
237
- if ( hasDataDefinedProperty ( " width " ) || hasDataDefinedProperty ( " height " ) || hasDataDefinedProperty ( " symbol_name " ) )
237
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_WIDTH ) || hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_HEIGHT ) || hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_SYMBOL_NAME ) )
238
238
{
239
239
QString symbolName = mSymbolName ;
240
- if ( hasDataDefinedProperty ( " symbol_name " ) )
240
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_SYMBOL_NAME ) )
241
241
{
242
- symbolName = evaluateDataDefinedProperty ( " symbol_name " , context.feature (), mSymbolName ).toString ();
242
+ symbolName = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_SYMBOL_NAME , context.feature (), mSymbolName ).toString ();
243
243
}
244
244
preparePath ( symbolName, context, &scaledWidth, &scaledHeight, context.feature () );
245
245
}
@@ -258,9 +258,9 @@ void QgsEllipseSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Rend
258
258
259
259
// priority for rotation: 1. data defined symbol level, 2. symbol layer rotation (mAngle)
260
260
double rotation = 0.0 ;
261
- if ( hasDataDefinedProperty ( " rotation " ) )
261
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_ROTATION ) )
262
262
{
263
- rotation = evaluateDataDefinedProperty ( " rotation " , context.feature (), mAngle ).toDouble () + mLineAngle ;
263
+ rotation = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_ROTATION , context.feature (), mAngle ).toDouble () + mLineAngle ;
264
264
}
265
265
else if ( !qgsDoubleNear ( mAngle + mLineAngle , 0.0 ) )
266
266
{
@@ -336,7 +336,7 @@ void QgsEllipseSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement &el
336
336
graphicElem.appendChild ( factorElem );
337
337
338
338
// <Rotation>
339
- QgsDataDefined* ddRotation = getDataDefinedProperty ( " rotation " );
339
+ QgsDataDefined* ddRotation = getDataDefinedProperty ( QgsSymbolLayerV2::EXPR_ROTATION );
340
340
341
341
QString angleFunc = props.value ( " angle" , " " );
342
342
if ( angleFunc.isEmpty () ) // symbol has no angle set
@@ -460,9 +460,9 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
460
460
461
461
double width = 0 ;
462
462
463
- if ( hasDataDefinedProperty ( " width " ) ) // 1. priority: data defined setting on symbol layer le
463
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_WIDTH ) ) // 1. priority: data defined setting on symbol layer le
464
464
{
465
- width = evaluateDataDefinedProperty ( " width " , f, mSymbolWidth ).toDouble ();
465
+ width = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_WIDTH , f, mSymbolWidth ).toDouble ();
466
466
}
467
467
else if ( context.renderHints () & QgsSymbolV2::DataDefinedSizeScale ) // 2. priority: is data defined size on symbol level
468
468
{
@@ -479,9 +479,9 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
479
479
width *= QgsSymbolLayerV2Utils::lineWidthScaleFactor ( ct, mSymbolWidthUnit , mSymbolHeightMapUnitScale );
480
480
481
481
double height = 0 ;
482
- if ( hasDataDefinedProperty ( " height " ) ) // 1. priority: data defined setting on symbol layer level
482
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_HEIGHT ) ) // 1. priority: data defined setting on symbol layer level
483
483
{
484
- height = evaluateDataDefinedProperty ( " height " , f, mSymbolHeight ).toDouble ();
484
+ height = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_HEIGHT , f, mSymbolHeight ).toDouble ();
485
485
}
486
486
else if ( context.renderHints () & QgsSymbolV2::DataDefinedSizeScale ) // 2. priority: is data defined size on symbol level
487
487
{
@@ -563,9 +563,9 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
563
563
// width
564
564
double symbolWidth = mSymbolWidth ;
565
565
566
- if ( hasDataDefinedProperty ( " width " ) ) // 1. priority: data defined setting on symbol layer le
566
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_WIDTH ) ) // 1. priority: data defined setting on symbol layer le
567
567
{
568
- symbolWidth = evaluateDataDefinedProperty ( " width " , f, mSymbolWidth ).toDouble ();
568
+ symbolWidth = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_WIDTH , f, mSymbolWidth ).toDouble ();
569
569
}
570
570
else if ( context->renderHints () & QgsSymbolV2::DataDefinedSizeScale ) // 2. priority: is data defined size on symbol level
571
571
{
@@ -578,9 +578,9 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
578
578
579
579
// height
580
580
double symbolHeight = mSymbolHeight ;
581
- if ( hasDataDefinedProperty ( " height " ) ) // 1. priority: data defined setting on symbol layer level
581
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_HEIGHT ) ) // 1. priority: data defined setting on symbol layer level
582
582
{
583
- symbolHeight = evaluateDataDefinedProperty ( " height " , f, mSymbolHeight ).toDouble ();
583
+ symbolHeight = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_HEIGHT , f, mSymbolHeight ).toDouble ();
584
584
}
585
585
else if ( context->renderHints () & QgsSymbolV2::DataDefinedSizeScale ) // 2. priority: is data defined size on symbol level
586
586
{
@@ -594,9 +594,9 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
594
594
// outline width
595
595
double outlineWidth = mOutlineWidth ;
596
596
597
- if ( hasDataDefinedProperty ( " outline_width " ) )
597
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
598
598
{
599
- outlineWidth = evaluateDataDefinedProperty ( " outline_width " , f, mOutlineWidth ).toDouble ();
599
+ outlineWidth = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH , f, mOutlineWidth ).toDouble ();
600
600
}
601
601
if ( mOutlineWidthUnit == QgsSymbolV2::MM )
602
602
{
@@ -606,27 +606,27 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
606
606
// fill color
607
607
bool ok;
608
608
QColor fc = mFillColor ;
609
- if ( hasDataDefinedProperty ( " fill_color " ) )
609
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_FILL_COLOR ) )
610
610
{
611
- QString colorString = evaluateDataDefinedProperty ( " fill_color " , f, QVariant (), &ok ).toString ();
611
+ QString colorString = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_FILL_COLOR , f, QVariant (), &ok ).toString ();
612
612
if ( ok )
613
613
fc = QColor ( colorString );
614
614
}
615
615
616
616
// outline color
617
617
QColor oc = mOutlineColor ;
618
- if ( hasDataDefinedProperty ( " outline_color " ) )
618
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR ) )
619
619
{
620
- QString colorString = evaluateDataDefinedProperty ( " outline_color " , f, QVariant (), &ok ).toString ();
620
+ QString colorString = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR , f, QVariant (), &ok ).toString ();
621
621
if ( ok )
622
622
oc = QColor ( colorString );
623
623
}
624
624
625
625
// symbol name
626
626
QString symbolName = mSymbolName ;
627
- if ( hasDataDefinedProperty ( " symbol_name " ) )
627
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_SYMBOL_NAME ) )
628
628
{
629
- symbolName = evaluateDataDefinedProperty ( " symbol_name " , f, mSymbolName ).toString ();
629
+ symbolName = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_SYMBOL_NAME , f, mSymbolName ).toString ();
630
630
}
631
631
632
632
// offset
@@ -637,9 +637,9 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
637
637
638
638
// priority for rotation: 1. data defined symbol level, 2. symbol layer rotation (mAngle)
639
639
double rotation = 0.0 ;
640
- if ( hasDataDefinedProperty ( " rotation " ) )
640
+ if ( hasDataDefinedProperty ( QgsSymbolLayerV2::EXPR_ROTATION ) )
641
641
{
642
- rotation = evaluateDataDefinedProperty ( " rotation " , f, mAngle ).toDouble () + mLineAngle ;
642
+ rotation = evaluateDataDefinedProperty ( QgsSymbolLayerV2::EXPR_ROTATION , f, mAngle ).toDouble () + mLineAngle ;
643
643
}
644
644
else if ( !qgsDoubleNear ( mAngle + mLineAngle , 0.0 ) )
645
645
{
0 commit comments