Skip to content

Commit

Permalink
Ading all other labelling options supported by SLD. fixes #8925
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Jul 26, 2017
1 parent 59d8b18 commit 5cfed12
Show file tree
Hide file tree
Showing 11 changed files with 2,295 additions and 74 deletions.
6 changes: 6 additions & 0 deletions python/core/qgsvectorlayerlabeling.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
};
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions python/core/symbology-ng/qgssymbollayerutils.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,8 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
QgsSymbolLayerUtils::mergeScaleDependencies( maximumScale(), minimumScale(), localProps );
}

if ( isSpatial() ) {
if ( isSpatial() )
{
// store the Name element
QDomElement nameNode = doc.createElement( "se:Name" );
nameNode.appendChild( doc.createTextNode( name() ) );
Expand All @@ -2229,7 +2230,7 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
userStyleElem.appendChild( featureTypeStyleElem );

mRenderer->toSld( doc, featureTypeStyleElem, localProps );
if ( mLabeling != nullptr )
if ( labelsEnabled() )
{
mLabeling->toSld( featureTypeStyleElem, localProps );
}
Expand Down
Loading

0 comments on commit 5cfed12

Please sign in to comment.