Skip to content
Permalink
Browse files
Implement ogr style in simple line symbol layer
  • Loading branch information
mhugent committed Dec 7, 2012
1 parent b0b9098 commit ac2e77c144b5f7d6356994a14e436aa0e4e075d5
@@ -69,6 +69,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
, mLayer( NULL )
, mGeom( NULL )
, mError( NoError )
, mExportFeatureStyle( true )
{
QString vectorFileName = theVectorFileName;
QString fileEncoding = theFileEncoding;
@@ -588,6 +589,8 @@ bool QgsVectorFileWriter::addFeature( QgsFeature& feature, QgsFeatureRendererV2*
}
styleString.append( currentStyle );
}

OGR_F_SetStyleString( poFeature, styleString.toLocal8Bit().data() );
}

// put the created feature to layer
@@ -747,7 +750,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
{
fet.clearAttributeMap();
}
if ( !writer->addFeature( fet ) )
if ( !writer->addFeature( fet, layer->rendererV2() ) )
{
WriterError err = writer->hasError();
if ( err != NoError && errorMessage )
@@ -195,6 +195,22 @@ void QgsSimpleLineSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element,
}
}

QString QgsSimpleLineSymbolLayerV2::ogrFeatureStyle() const
{
QString symbolStyle;

//pen
symbolStyle.append( "PEN(" );
symbolStyle.append( "c:" );
symbolStyle.append( mPen.color().name() );
symbolStyle.append( ",w:" );
symbolStyle.append( QString::number( mPen.width() ) );
symbolStyle.append( "mm" );
symbolStyle.append( ")" );

return symbolStyle;
}

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

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

QString ogrFeatureStyle() const;

// new stuff

Qt::PenStyle penStyle() const { return mPenStyle; }
@@ -332,6 +332,7 @@ QString QgsSymbolV2::ogrFeatureStyle() const
}
styleString.append( currentStyleString );
}
return styleString;
}

QgsSymbolLayerV2List QgsSymbolV2::cloneLayers() const

0 comments on commit ac2e77c

Please sign in to comment.