Skip to content
Permalink
Browse files
Write offset into ogr pen style
  • Loading branch information
mhugent committed Dec 25, 2012
1 parent faf0abb commit 78f26bae131b7af3540651b1caf394f244b4157c
Showing with 15 additions and 4 deletions.
  1. +3 −2 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  2. +11 −2 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  3. +1 −0 src/core/symbology-ng/qgssymbollayerv2utils.h
@@ -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 );
}
}

@@ -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;
@@ -2127,7 +2128,7 @@ QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, double widthSca
}

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

//join
penStyle.append( ",j=" );
penStyle.append( ",j:" );
switch ( joinStyle )
{
case Qt::BevelJoin:
@@ -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;
}
@@ -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*/

0 comments on commit 78f26ba

Please sign in to comment.