Skip to content

Commit 0625c79

Browse files
committed
#9254: QgsEllipseSymbolLayerV2 use OutlineStyle
1 parent 9ef3f86 commit 0625c79

File tree

5 files changed

+43
-13
lines changed

5 files changed

+43
-13
lines changed

src/core/symbology-ng/qgsellipsesymbollayerv2.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
#include <QDomElement>
2727

2828
QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2(): mSymbolName( "circle" ), mSymbolWidth( 4 ), mSymbolWidthUnit( QgsSymbolV2::MM ), mSymbolHeight( 3 ),
29-
mSymbolHeightUnit( QgsSymbolV2::MM ), mFillColor( Qt::white ), mOutlineColor( Qt::black ), mOutlineWidth( 0 ), mOutlineWidthUnit( QgsSymbolV2::MM )
29+
mSymbolHeightUnit( QgsSymbolV2::MM ), mFillColor( Qt::white ), mOutlineColor( Qt::black ), mOutlineStyle( Qt::SolidLine ), mOutlineWidth( 0 ), mOutlineWidthUnit( QgsSymbolV2::MM )
3030
{
3131
mPen.setColor( mOutlineColor );
32+
mPen.setStyle( mOutlineStyle );
3233
mPen.setWidth( 1.0 );
3334
mPen.setJoinStyle( Qt::MiterJoin );
3435
mBrush.setColor( mFillColor );
@@ -69,6 +70,10 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
6970
{
7071
layer->setAngle( properties["angle"].toDouble() );
7172
}
73+
if ( properties.contains( "outline_style" ) )
74+
{
75+
layer->setOutlineStyle( QgsSymbolLayerV2Utils::decodePenStyle( properties["outline_style"] ) );
76+
}
7277
if ( properties.contains( "outline_width" ) )
7378
{
7479
layer->setOutlineWidth( properties["outline_width"].toDouble() );
@@ -262,6 +267,7 @@ void QgsEllipseSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
262267
preparePath( mSymbolName, context );
263268
}
264269
mPen.setColor( mOutlineColor );
270+
mPen.setStyle( mOutlineStyle );
265271
mPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit ) );
266272
mBrush.setColor( mFillColor );
267273
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
@@ -396,6 +402,7 @@ QgsStringMap QgsEllipseSymbolLayerV2::properties() const
396402
map["symbol_height"] = QString::number( mSymbolHeight );
397403
map["symbol_height_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mSymbolHeightUnit );
398404
map["angle"] = QString::number( mAngle );
405+
map["outline_style"] = QgsSymbolLayerV2Utils::encodePenStyle( mOutlineStyle );
399406
map["outline_width"] = QString::number( mOutlineWidth );
400407
map["outline_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit );
401408
map["fill_color"] = QgsSymbolLayerV2Utils::encodeColor( mFillColor );

src/core/symbology-ng/qgsellipsesymbollayerv2.h

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
5151
void setSymbolHeight( double h ) { mSymbolHeight = h; }
5252
double symbolHeight() const { return mSymbolHeight; }
5353

54+
Qt::PenStyle outlineStyle() const { return mOutlineStyle; }
55+
void setOutlineStyle( Qt::PenStyle outlineStyle ) { mOutlineStyle = outlineStyle; }
56+
5457
void setOutlineWidth( double w ) { mOutlineWidth = w; }
5558
double outlineWidth() const { return mOutlineWidth; }
5659

@@ -80,6 +83,7 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
8083
QgsSymbolV2::OutputUnit mSymbolHeightUnit;
8184
QColor mFillColor;
8285
QColor mOutlineColor;
86+
Qt::PenStyle mOutlineStyle;
8387
double mOutlineWidth;
8488
QgsSymbolV2::OutputUnit mOutlineWidthUnit;
8589

src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
5757
mWidthSpinBox->setValue( mLayer->symbolWidth() );
5858
mHeightSpinBox->setValue( mLayer->symbolHeight() );
5959
mRotationSpinBox->setValue( mLayer->angle() );
60+
mOutlineStyleComboBox->setPenStyle( mLayer->outlineStyle() );
6061
mOutlineWidthSpinBox->setValue( mLayer->outlineWidth() );
6162

6263
btnChangeColorBorder->setColor( mLayer->outlineColor() );
@@ -132,6 +133,15 @@ void QgsEllipseSymbolLayerV2Widget::on_mRotationSpinBox_valueChanged( double d )
132133
}
133134
}
134135

136+
void QgsEllipseSymbolLayerV2Widget::on_mOutlineStyleComboBox_currentIndexChanged( int index )
137+
{
138+
if ( mLayer )
139+
{
140+
mLayer->setOutlineStyle( mOutlineStyleComboBox->penStyle() );
141+
emit changed();
142+
}
143+
}
144+
135145
void QgsEllipseSymbolLayerV2Widget::on_mOutlineWidthSpinBox_valueChanged( double d )
136146
{
137147
if ( mLayer )
@@ -278,5 +288,3 @@ void QgsEllipseSymbolLayerV2Widget::setOffset()
278288
mLayer->setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
279289
emit changed();
280290
}
281-
282-

src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class GUI_EXPORT QgsEllipseSymbolLayerV2Widget: public QgsSymbolLayerV2Widget, p
4444
void on_mWidthSpinBox_valueChanged( double d );
4545
void on_mHeightSpinBox_valueChanged( double d );
4646
void on_mRotationSpinBox_valueChanged( double d );
47+
void on_mOutlineStyleComboBox_currentIndexChanged( int index );
4748
void on_mOutlineWidthSpinBox_valueChanged( double d );
4849
void on_btnChangeColorBorder_colorChanged( const QColor& newColor );
4950
void on_btnChangeColorFill_colorChanged( const QColor& newColor );

src/ui/symbollayer/widget_ellipse.ui

+20-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</property>
2424
</widget>
2525
</item>
26-
<item row="3" column="1">
26+
<item row="4" column="1">
2727
<widget class="QDoubleSpinBox" name="mRotationSpinBox">
2828
<property name="minimum">
2929
<double>-360.000000000000000</double>
@@ -33,14 +33,14 @@
3333
</property>
3434
</widget>
3535
</item>
36-
<item row="4" column="0">
36+
<item row="5" column="0">
3737
<widget class="QLabel" name="mSymbolHeightLabel">
3838
<property name="text">
3939
<string>Symbol height</string>
4040
</property>
4141
</widget>
4242
</item>
43-
<item row="3" column="0">
43+
<item row="4" column="0">
4444
<widget class="QLabel" name="mRotationLabel">
4545
<property name="text">
4646
<string>Rotation</string>
@@ -128,7 +128,7 @@
128128
</item>
129129
</layout>
130130
</item>
131-
<item row="4" column="1">
131+
<item row="5" column="1">
132132
<layout class="QHBoxLayout" name="horizontalLayout_3">
133133
<item>
134134
<widget class="QDoubleSpinBox" name="mHeightSpinBox">
@@ -209,7 +209,7 @@
209209
</property>
210210
</widget>
211211
</item>
212-
<item row="6" column="1">
212+
<item row="7" column="1">
213213
<layout class="QHBoxLayout" name="horizontalLayout_6">
214214
<item>
215215
<widget class="QComboBox" name="mHorizontalAnchorComboBox">
@@ -251,7 +251,17 @@
251251
</item>
252252
</layout>
253253
</item>
254+
<item row="2" column="0">
255+
<widget class="QLabel" name="mOutlineStyleLabel">
256+
<property name="text">
257+
<string>Outline style</string>
258+
</property>
259+
</widget>
260+
</item>
254261
<item row="2" column="1">
262+
<widget class="QgsPenStyleComboBox" name="mOutlineStyleComboBox"/>
263+
</item>
264+
<item row="3" column="1">
255265
<layout class="QHBoxLayout" name="horizontalLayout_2">
256266
<item>
257267
<widget class="QDoubleSpinBox" name="mOutlineWidthSpinBox">
@@ -285,28 +295,28 @@
285295
</item>
286296
</layout>
287297
</item>
288-
<item row="2" column="0">
298+
<item row="3" column="0">
289299
<widget class="QLabel" name="mOutlineWidthLabel">
290300
<property name="text">
291301
<string>Outline width</string>
292302
</property>
293303
</widget>
294304
</item>
295-
<item row="6" column="0">
305+
<item row="7" column="0">
296306
<widget class="QLabel" name="mAnchorPointLabel">
297307
<property name="text">
298308
<string>Anchor point</string>
299309
</property>
300310
</widget>
301311
</item>
302-
<item row="5" column="0">
312+
<item row="6" column="0">
303313
<widget class="QLabel" name="label_5">
304314
<property name="text">
305315
<string>Offset X,Y</string>
306316
</property>
307317
</widget>
308318
</item>
309-
<item row="5" column="1">
319+
<item row="6" column="1">
310320
<layout class="QHBoxLayout" name="horizontalLayout_5">
311321
<item>
312322
<widget class="QDoubleSpinBox" name="spinOffsetX">
@@ -356,7 +366,7 @@
356366
</item>
357367
</layout>
358368
</item>
359-
<item row="7" column="0" colspan="2">
369+
<item row="8" column="0" colspan="2">
360370
<widget class="QPushButton" name="mDataDefinedPropertiesButton">
361371
<property name="sizePolicy">
362372
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">

0 commit comments

Comments
 (0)