Skip to content
Permalink
Browse files
Feature style for simple fill
  • Loading branch information
mhugent committed Dec 23, 2012
1 parent d9c7991 commit 7fef39e6f649bef5874b250d36a9d1928d6632b5
@@ -175,6 +175,17 @@ void QgsSimpleFillSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element,
QgsSymbolLayerV2Utils::createDisplacementElement( doc, symbolizerElem, mOffset );
}

QString QgsSimpleFillSymbolLayerV2::ogrFeatureStyle( double widthScaleFactor ) const
{
//brush
QString symbolStyle;
symbolStyle.append( QgsSymbolLayerV2Utils::ogrFeatureStyleBrush( mColor ) );
symbolStyle.append( ";" );
//pen
symbolStyle.append( QgsSymbolLayerV2Utils::ogrFeatureStylePen( mBorderWidth * widthScaleFactor, mBorderColor ) );
return symbolStyle;
}

QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2::createFromSld( QDomElement &element )
{
QgsDebugMsg( "Entered." );
@@ -57,6 +57,8 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2

void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

QString ogrFeatureStyle( double widthScaleFactor ) const;

Qt::BrushStyle brushStyle() const { return mBrushStyle; }
void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; }

@@ -2095,6 +2095,29 @@ void QgsSymbolLayerV2Utils::labelTextToSld( QDomDocument &doc, QDomElement &elem
}
}

QString QgsSymbolLayerV2Utils::ogrFeatureStylePen( double width, const QColor& c )
{
QString penStyle;
penStyle.append( "PEN(" );
penStyle.append( "c:" );
penStyle.append( c.name() );
penStyle.append( ",w:" );
//dxf driver writes ground units as mm? Should probably be changed in ogr
penStyle.append( QString::number( width ) );
penStyle.append( "mm" );
return penStyle;
}

QString QgsSymbolLayerV2Utils::ogrFeatureStyleBrush( const QColor& fillColor )
{
QString brushStyle;
brushStyle.append( "BRUSH(" );
brushStyle.append( "fc:" );
brushStyle.append( fillColor.name() );
brushStyle.append( ")" );
return brushStyle;
}

void QgsSymbolLayerV2Utils::createGeometryElement( QDomDocument &doc, QDomElement &element, QString geomFunc )
{
if ( geomFunc.isEmpty() )
@@ -164,6 +164,14 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
static void labelTextToSld( QDomDocument &doc, QDomElement &element, QString label,
QFont font, QColor color = QColor(), double size = -1 );

/**Create ogr feature style string for pen
@param width linewidth in mm
@param c line color*/
static QString ogrFeatureStylePen( double width, const QColor& c );
/**Create ogr feature syle string for brush
@param fillColr fill color*/
static QString ogrFeatureStyleBrush( const QColor& fillColr );

static void createRotationElement( QDomDocument &doc, QDomElement &element, QString rotationFunc );
static bool rotationFromSldElement( QDomElement &element, QString &rotationFunc );

0 comments on commit 7fef39e

Please sign in to comment.