Skip to content

Commit 4def416

Browse files
committedFeb 7, 2015
Merge pull request #1858 from vmora/symbol_list_refacto
line symbol layer refacto to avoid code duplication
2 parents b60221a + 2612715 commit 4def416

File tree

7 files changed

+26
-46
lines changed

7 files changed

+26
-46
lines changed
 

‎python/core/symbology-ng/qgslinesymbollayerv2.sip

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
5454
Qt::PenCapStyle penCapStyle() const;
5555
void setPenCapStyle( Qt::PenCapStyle style );
5656

57-
double offset() const;
58-
void setOffset( double offset );
59-
60-
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
61-
QgsSymbolV2::OutputUnit offsetUnit() const;
62-
63-
void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
64-
const QgsMapUnitScale& offsetMapUnitScale() const;
65-
6657
bool useCustomDashPattern() const;
6758
void setUseCustomDashPattern( bool b );
6859

@@ -152,9 +143,6 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
152143
double interval() const;
153144
void setInterval( double interval );
154145

155-
double offset() const;
156-
void setOffset( double offset );
157-
158146
Placement placement() const;
159147
void setPlacement( Placement p );
160148

@@ -213,12 +201,6 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
213201
void setIntervalMapUnitScale( const QgsMapUnitScale& scale );
214202
const QgsMapUnitScale& intervalMapUnitScale() const;
215203

216-
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
217-
QgsSymbolV2::OutputUnit offsetUnit() const;
218-
219-
void setOffsetMapUnitScale( const QgsMapUnitScale& scale );
220-
const QgsMapUnitScale& offsetMapUnitScale() const;
221-
222204
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
223205
QgsSymbolV2::OutputUnit outputUnit() const;
224206

‎python/core/symbology-ng/qgssymbollayerv2.sip

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,21 @@ class QgsLineSymbolLayerV2 : QgsSymbolLayerV2
262262
virtual void setWidth( double width );
263263
virtual double width() const;
264264

265+
double offset() const;
266+
void setOffset( double offset );
267+
265268
void setWidthUnit( QgsSymbolV2::OutputUnit unit );
266269
QgsSymbolV2::OutputUnit widthUnit() const;
267270

268271
void setWidthMapUnitScale( const QgsMapUnitScale& scale);
269272
const QgsMapUnitScale& widthMapUnitScale() const;
270273

274+
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
275+
QgsSymbolV2::OutputUnit offsetUnit() const;
276+
277+
void setOffsetMapUnitScale( const QgsMapUnitScale& scale );
278+
const QgsMapUnitScale& offsetMapUnitScale() const;
279+
271280
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
272281
QgsSymbolV2::OutputUnit outputUnit() const;
273282

‎src/core/symbology-ng/qgslinesymbollayerv2.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ QgsSimpleLineSymbolLayerV2::QgsSimpleLineSymbolLayerV2( QColor color, double wid
3232
: mPenStyle( penStyle )
3333
, mPenJoinStyle( DEFAULT_SIMPLELINE_JOINSTYLE )
3434
, mPenCapStyle( DEFAULT_SIMPLELINE_CAPSTYLE )
35-
, mOffset( 0 )
36-
, mOffsetUnit( QgsSymbolV2::MM )
3735
, mUseCustomDashPattern( false )
3836
, mCustomDashPatternUnit( QgsSymbolV2::MM )
3937
, mDrawInsidePolygon( false )
@@ -692,8 +690,6 @@ QgsMarkerLineSymbolLayerV2::QgsMarkerLineSymbolLayerV2( bool rotateMarker, doubl
692690
mInterval = interval;
693691
mIntervalUnit = QgsSymbolV2::MM;
694692
mMarker = NULL;
695-
mOffset = 0;
696-
mOffsetUnit = QgsSymbolV2::MM;
697693
mPlacement = Interval;
698694
mOffsetAlongLine = 0;
699695
mOffsetAlongLineUnit = QgsSymbolV2::MM;

‎src/core/symbology-ng/qgslinesymbollayerv2.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,6 @@ class CORE_EXPORT QgsSimpleLineSymbolLayerV2 : public QgsLineSymbolLayerV2
8282
Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
8383
void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
8484

85-
double offset() const { return mOffset; }
86-
void setOffset( double offset ) { mOffset = offset; }
87-
88-
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
89-
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
90-
91-
void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
92-
const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
93-
9485
bool useCustomDashPattern() const { return mUseCustomDashPattern; }
9586
void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
9687

@@ -121,9 +112,6 @@ class CORE_EXPORT QgsSimpleLineSymbolLayerV2 : public QgsLineSymbolLayerV2
121112
Qt::PenCapStyle mPenCapStyle;
122113
QPen mPen;
123114
QPen mSelPen;
124-
double mOffset;
125-
QgsSymbolV2::OutputUnit mOffsetUnit;
126-
QgsMapUnitScale mOffsetMapUnitScale;
127115

128116
//use a custom dash dot pattern instead of the predefined ones
129117
bool mUseCustomDashPattern;
@@ -204,9 +192,6 @@ class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2
204192
double interval() const { return mInterval; }
205193
void setInterval( double interval ) { mInterval = interval; }
206194

207-
double offset() const { return mOffset; }
208-
void setOffset( double offset ) { mOffset = offset; }
209-
210195
Placement placement() const { return mPlacement; }
211196
void setPlacement( Placement p ) { mPlacement = p; }
212197

@@ -265,12 +250,6 @@ class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2
265250
void setIntervalMapUnitScale( const QgsMapUnitScale& scale ) { mIntervalMapUnitScale = scale; }
266251
const QgsMapUnitScale& intervalMapUnitScale() const { return mIntervalMapUnitScale; }
267252

268-
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
269-
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
270-
271-
void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
272-
const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
273-
274253
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
275254
QgsSymbolV2::OutputUnit outputUnit() const override;
276255

@@ -289,9 +268,6 @@ class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2
289268
QgsSymbolV2::OutputUnit mIntervalUnit;
290269
QgsMapUnitScale mIntervalMapUnitScale;
291270
QgsMarkerSymbolV2* mMarker;
292-
double mOffset;
293-
QgsSymbolV2::OutputUnit mOffsetUnit;
294-
QgsMapUnitScale mOffsetMapUnitScale;
295271
Placement mPlacement;
296272
double mOffsetAlongLine; //distance to offset along line before marker is drawn
297273
QgsSymbolV2::OutputUnit mOffsetAlongLineUnit; //unit for offset along line

‎src/core/symbology-ng/qgssymbollayerv2.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ QgsMarkerSymbolLayerV2::QgsMarkerSymbolLayerV2( bool locked )
225225
QgsLineSymbolLayerV2::QgsLineSymbolLayerV2( bool locked )
226226
: QgsSymbolLayerV2( QgsSymbolV2::Line, locked )
227227
, mWidthUnit( QgsSymbolV2::MM )
228+
, mOffset( 0 )
229+
, mOffsetUnit( QgsSymbolV2::MM )
228230
{
229231
}
230232

‎src/core/symbology-ng/qgssymbollayerv2.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,21 @@ class CORE_EXPORT QgsLineSymbolLayerV2 : public QgsSymbolLayerV2
269269
virtual void setWidth( double width ) { mWidth = width; }
270270
virtual double width() const { return mWidth; }
271271

272+
double offset() const { return mOffset; }
273+
void setOffset( double offset ) { mOffset = offset; }
274+
272275
void setWidthUnit( QgsSymbolV2::OutputUnit unit ) { mWidthUnit = unit; }
273276
QgsSymbolV2::OutputUnit widthUnit() const { return mWidthUnit; }
274277

275278
void setWidthMapUnitScale( const QgsMapUnitScale& scale ) { mWidthMapUnitScale = scale; }
276279
const QgsMapUnitScale& widthMapUnitScale() const { return mWidthMapUnitScale; }
277280

281+
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
282+
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
283+
284+
void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
285+
const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
286+
278287
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
279288
QgsSymbolV2::OutputUnit outputUnit() const override;
280289

@@ -291,6 +300,9 @@ class CORE_EXPORT QgsLineSymbolLayerV2 : public QgsSymbolLayerV2
291300
double mWidth;
292301
QgsSymbolV2::OutputUnit mWidthUnit;
293302
QgsMapUnitScale mWidthMapUnitScale;
303+
double mOffset;
304+
QgsSymbolV2::OutputUnit mOffsetUnit;
305+
QgsMapUnitScale mOffsetMapUnitScale;
294306
};
295307

296308
class CORE_EXPORT QgsFillSymbolLayerV2 : public QgsSymbolLayerV2

‎src/core/symbology-ng/qgssymbolv2.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ QgsSymbolV2* QgsMarkerSymbolV2::clone() const
601601
{
602602
QgsSymbolV2* cloneSymbol = new QgsMarkerSymbolV2( cloneLayers() );
603603
cloneSymbol->setAlpha( mAlpha );
604+
cloneSymbol->setLayer( mLayer );
604605
return cloneSymbol;
605606
}
606607

@@ -671,6 +672,7 @@ QgsSymbolV2* QgsLineSymbolV2::clone() const
671672
{
672673
QgsSymbolV2* cloneSymbol = new QgsLineSymbolV2( cloneLayers() );
673674
cloneSymbol->setAlpha( mAlpha );
675+
cloneSymbol->setLayer( mLayer );
674676
return cloneSymbol;
675677
}
676678

@@ -722,6 +724,7 @@ QgsSymbolV2* QgsFillSymbolV2::clone() const
722724
{
723725
QgsSymbolV2* cloneSymbol = new QgsFillSymbolV2( cloneLayers() );
724726
cloneSymbol->setAlpha( mAlpha );
727+
cloneSymbol->setLayer( mLayer );
725728
return cloneSymbol;
726729
}
727730

0 commit comments

Comments
 (0)
Please sign in to comment.