Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Write offset into ogr pen style
  • Loading branch information
mhugent committed Dec 25, 2012
1 parent faf0abb commit 78f26ba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/core/symbology-ng/qgslinesymbollayerv2.cpp
Expand Up @@ -201,11 +201,12 @@ QString QgsSimpleLineSymbolLayerV2::ogrFeatureStyle( double widthScaleFactor ) c
{
return QgsSymbolLayerV2Utils::ogrFeatureStylePen( mWidth, widthScaleFactor,
mPen.color(), mPenJoinStyle,
mPenCapStyle, &mCustomDashVector );
mPenCapStyle, mOffset, &mCustomDashVector );
}
else
{
return QgsSymbolLayerV2Utils::ogrFeatureStylePen( mWidth, widthScaleFactor, mPen.color() );
return QgsSymbolLayerV2Utils::ogrFeatureStylePen( mWidth, widthScaleFactor, mPen.color(), mPenJoinStyle,
mPenCapStyle, mOffset );
}
}

Expand Down
13 changes: 11 additions & 2 deletions src/core/symbology-ng/qgssymbollayerv2utils.cpp
Expand Up @@ -2098,6 +2098,7 @@ void QgsSymbolLayerV2Utils::labelTextToSld( QDomDocument &doc, QDomElement &elem
QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthScaleFactor, const QColor& c,
Qt::PenJoinStyle joinStyle,
Qt::PenCapStyle capStyle,
double offset,
const QVector<qreal>* dashPattern )
{
QString penStyle;
Expand Down Expand Up @@ -2127,7 +2128,7 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
}

//cap
penStyle.append( ",cap=" );
penStyle.append( ",cap:" );
switch ( capStyle )
{
case Qt::SquareCap:
Expand All @@ -2142,7 +2143,7 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
}

//join
penStyle.append( ",j=" );
penStyle.append( ",j:" );
switch ( joinStyle )
{
case Qt::BevelJoin:
Expand All @@ -2156,6 +2157,14 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
penStyle.append( "m" );
}

//offset
if ( !doubleNear( offset, 0.0 ) )
{
penStyle.append( ",dp:" );
penStyle.append( QString::number( offset * widthScaleFactor ) );
penStyle.append( "mm" );
}

penStyle.append( ")" );
return penStyle;
}
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgssymbollayerv2utils.h
Expand Up @@ -170,6 +170,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
static QString ogrFeatureStylePen( double width, double widthScaleFactor, const QColor& c,
Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
Qt::PenCapStyle capStyle = Qt::FlatCap,
double offset = 0.0,
const QVector<qreal>* dashPattern = 0 );
/**Create ogr feature syle string for brush
@param fillColr fill color*/
Expand Down

0 comments on commit 78f26ba

Please sign in to comment.