Skip to content
Permalink
Browse files

Merge pull request #4838 from aaime/textsymbolizer_sc

SLD label exports. fixes #8925
  • Loading branch information
nyalldawson committed Jul 26, 2017
2 parents 1b9dea9 + 5cfed12 commit cf042dc5dd66432c6d9333943522da1fb90a41df
@@ -76,6 +76,11 @@ Try to create instance of an implementation based on the XML data
:rtype: QgsAbstractVectorLayerLabeling
%End

virtual void toSld( QDomNode &parent, const QgsStringMap &props ) const;
%Docstring
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings
%End

private:
QgsAbstractVectorLayerLabeling( const QgsAbstractVectorLayerLabeling &rhs );
};
@@ -105,6 +110,7 @@ Constructs simple labeling configuration with given initial settings
virtual QgsPalLayerSettings settings( const QString &providerId = QString() ) const;
virtual bool requiresAdvancedEffects() const;

virtual void toSld( QDomNode &parent, const QgsStringMap &props ) const;

static QgsVectorLayerSimpleLabeling *create( const QDomElement &element, const QgsReadWriteContext &context );
%Docstring
@@ -481,6 +481,14 @@ Create ogr feature style string for pen
:rtype: bool
%End

static void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
%Docstring
Creates a SE 1.1 anchor point element as a child of the specified element
\param doc The document
\param element The parent element
\param anchor An anchor specification, with values between 0 and 1
%End

static void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
static bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
%Docstring
@@ -2205,11 +2205,6 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
{
Q_UNUSED( errorMessage );

// store the Name element
QDomElement nameNode = doc.createElement( QStringLiteral( "se:Name" ) );
nameNode.appendChild( doc.createTextNode( name() ) );
node.appendChild( nameNode );

QgsStringMap localProps = QgsStringMap( props );
if ( hasScaleBasedVisibility() )
{
@@ -2218,7 +2213,27 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error

if ( isSpatial() )
{
node.appendChild( mRenderer->writeSld( doc, name(), localProps ) );
// store the Name element
QDomElement nameNode = doc.createElement( "se:Name" );
nameNode.appendChild( doc.createTextNode( name() ) );
node.appendChild( nameNode );

QDomElement userStyleElem = doc.createElement( "UserStyle" );
node.appendChild( userStyleElem );

QDomElement nameElem = doc.createElement( "se:Name" );
nameElem.appendChild( doc.createTextNode( name() ) );

userStyleElem.appendChild( nameElem );

QDomElement featureTypeStyleElem = doc.createElement( "se:FeatureTypeStyle" );
userStyleElem.appendChild( featureTypeStyleElem );

mRenderer->toSld( doc, featureTypeStyleElem, localProps );
if ( labelsEnabled() )
{
mLabeling->toSld( featureTypeStyleElem, localProps );
}
}
return true;
}

0 comments on commit cf042dc

Please sign in to comment.
You can’t perform that action at this time.