Skip to content

Commit 78f26ba

Browse files
committed
Write offset into ogr pen style
1 parent faf0abb commit 78f26ba

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/core/symbology-ng/qgslinesymbollayerv2.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ QString QgsSimpleLineSymbolLayerV2::ogrFeatureStyle( double widthScaleFactor ) c
201201
{
202202
return QgsSymbolLayerV2Utils::ogrFeatureStylePen( mWidth, widthScaleFactor,
203203
mPen.color(), mPenJoinStyle,
204-
mPenCapStyle, &mCustomDashVector );
204+
mPenCapStyle, mOffset, &mCustomDashVector );
205205
}
206206
else
207207
{
208-
return QgsSymbolLayerV2Utils::ogrFeatureStylePen( mWidth, widthScaleFactor, mPen.color() );
208+
return QgsSymbolLayerV2Utils::ogrFeatureStylePen( mWidth, widthScaleFactor, mPen.color(), mPenJoinStyle,
209+
mPenCapStyle, mOffset );
209210
}
210211
}
211212

src/core/symbology-ng/qgssymbollayerv2utils.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,7 @@ void QgsSymbolLayerV2Utils::labelTextToSld( QDomDocument &doc, QDomElement &elem
20982098
QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthScaleFactor, const QColor& c,
20992099
Qt::PenJoinStyle joinStyle,
21002100
Qt::PenCapStyle capStyle,
2101+
double offset,
21012102
const QVector<qreal>* dashPattern )
21022103
{
21032104
QString penStyle;
@@ -2127,7 +2128,7 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
21272128
}
21282129

21292130
//cap
2130-
penStyle.append( ",cap=" );
2131+
penStyle.append( ",cap:" );
21312132
switch ( capStyle )
21322133
{
21332134
case Qt::SquareCap:
@@ -2142,7 +2143,7 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
21422143
}
21432144

21442145
//join
2145-
penStyle.append( ",j=" );
2146+
penStyle.append( ",j:" );
21462147
switch ( joinStyle )
21472148
{
21482149
case Qt::BevelJoin:
@@ -2156,6 +2157,14 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
21562157
penStyle.append( "m" );
21572158
}
21582159

2160+
//offset
2161+
if ( !doubleNear( offset, 0.0 ) )
2162+
{
2163+
penStyle.append( ",dp:" );
2164+
penStyle.append( QString::number( offset * widthScaleFactor ) );
2165+
penStyle.append( "mm" );
2166+
}
2167+
21592168
penStyle.append( ")" );
21602169
return penStyle;
21612170
}

src/core/symbology-ng/qgssymbollayerv2utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
170170
static QString ogrFeatureStylePen( double width, double widthScaleFactor, const QColor& c,
171171
Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
172172
Qt::PenCapStyle capStyle = Qt::FlatCap,
173+
double offset = 0.0,
173174
const QVector<qreal>* dashPattern = 0 );
174175
/**Create ogr feature syle string for brush
175176
@param fillColr fill color*/

0 commit comments

Comments
 (0)