Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
back to const methods
  • Loading branch information
luipir committed Feb 1, 2019
1 parent d61940c commit bdda8d0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions python/core/auto_generated/qgsmaplayer.sip.in
Expand Up @@ -815,7 +815,7 @@ Export the properties of this layer as named style in a QDomDocument
%End


virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg );
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;
%Docstring
Export the properties of this layer as SLD style in a QDomDocument

Expand Down Expand Up @@ -856,7 +856,7 @@ record in the users style table in their personal qgis.db)
.. seealso:: :py:func:`saveDefaultStyle`
%End

virtual QString saveSldStyle( const QString &uri, bool &resultFlag );
virtual QString saveSldStyle( const QString &uri, bool &resultFlag ) const;
%Docstring
Saves the properties of this layer to an SLD format file.

Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/raster/qgsrasterlayer.sip.in
Expand Up @@ -362,7 +362,7 @@ Draws a preview of the rasterlayer into a QImage
virtual QDateTime timestamp() const;


bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() );
bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
%Docstring
Writes the symbology of the layer into the document provided in SLD 1.0.0 format

Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -1385,15 +1385,15 @@ QString QgsMapLayer::saveNamedStyle( const QString &uri, bool &resultFlag, Style
return saveNamedProperty( uri, QgsMapLayer::Style, resultFlag, categories );
}

void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg )
void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg ) const
{
QDomDocument myDocument = QDomDocument();

QDomNode header = myDocument.createProcessingInstruction( QStringLiteral( "xml" ), QStringLiteral( "version=\"1.0\" encoding=\"UTF-8\"" ) );
myDocument.appendChild( header );

const QgsVectorLayer *vlayer = qobject_cast<const QgsVectorLayer *>( this );
QgsRasterLayer *rlayer = qobject_cast<QgsRasterLayer *>( this );
const QgsRasterLayer *rlayer = qobject_cast<const QgsRasterLayer *>( this );
if ( !vlayer && !rlayer )
{
errorMsg = tr( "Could not save symbology because:\n%1" )
Expand Down Expand Up @@ -1462,7 +1462,7 @@ void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg )
doc = myDocument;
}

QString QgsMapLayer::saveSldStyle( const QString &uri, bool &resultFlag )
QString QgsMapLayer::saveSldStyle( const QString &uri, bool &resultFlag ) const
{
QString errorMsg;
QDomDocument myDocument;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaplayer.h
Expand Up @@ -780,7 +780,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
* \param errorMsg this QString will be initialized on error
* during the execution of writeSymbology
*/
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg );
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;

/**
* Save the properties of this layer as the default style
Expand Down Expand Up @@ -818,7 +818,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
* \returns a string with any status or error messages
* \see loadSldStyle()
*/
virtual QString saveSldStyle( const QString &uri, bool &resultFlag );
virtual QString saveSldStyle( const QString &uri, bool &resultFlag ) const;

/**
* Attempts to style the layer using the formatting from an SLD type file.
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterlayer.cpp
Expand Up @@ -1284,7 +1284,7 @@ QDateTime QgsRasterLayer::timestamp() const
}


bool QgsRasterLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props )
bool QgsRasterLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props ) const
{
Q_UNUSED( errorMessage );

Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterlayer.h
Expand Up @@ -423,7 +423,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
* \returns true in case of success
* \since QGIS 3.6
*/
bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() );
bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;


public slots:
Expand Down

0 comments on commit bdda8d0

Please sign in to comment.