Skip to content

Commit

Permalink
Adjust tile size
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 9, 2023
1 parent ef89f70 commit 8282358
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 72 deletions.
5 changes: 3 additions & 2 deletions python/core/auto_generated/qgsmaplayer.sip.in
Expand Up @@ -982,6 +982,8 @@ Export the properties of this layer as SLD style in a QDomDocument
:param doc: the target QDomDocument
:param errorMsg: this QString will be initialized on error
during the execution of writeSymbology

.. seealso:: :py:func:`exportSldStyleV2`
%End

virtual void exportSldStyleV2( QDomDocument &doc, QString &errorMsg, const QgsSldExportContext &exportContext ) const;
Expand Down Expand Up @@ -1063,11 +1065,10 @@ Saves the properties of this layer to an SLD format file.
.. seealso:: :py:func:`saveSldStyleV2`
%End

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

:param uri: uri of destination for exported SLD file.
:param resultFlag: a reference to a flag that will be set to ``False`` if
the SLD file could not be generated
:param exportContext: SLD export context
Expand Down
Expand Up @@ -186,6 +186,8 @@ Returns the map unit scale for the fill's offset.

virtual Qt::BrushStyle dxfBrushStyle() const;

virtual QImage toTiledPattern( ) const;


protected:

Expand Down Expand Up @@ -1547,6 +1549,8 @@ ownership of the returned object.

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

virtual QImage toTiledPattern( ) const;

virtual double estimateMaxBleed( const QgsRenderContext &context ) const;


Expand Down Expand Up @@ -1842,6 +1846,8 @@ Caller takes ownership of the returned symbol layer.

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

virtual QImage toTiledPattern( ) const;

virtual double estimateMaxBleed( const QgsRenderContext &context ) const;

virtual bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
Expand Down
10 changes: 10 additions & 0 deletions python/core/auto_generated/symbology/qgssymbollayer.sip.in
Expand Up @@ -1313,6 +1313,16 @@ The ``rings`` argument optionally specifies a list of polygon rings to render as
void setAngle( double angle );
double angle() const;

virtual QImage toTiledPattern( ) const;
%Docstring
Renders the symbol layer to an image that can be used as a seamless pattern fill.
The default implementation returns a null image.

:return: the tile image (not necessarily a square) or a null image if not implemented.

.. versionadded:: 3.30
%End

protected:
QgsFillSymbolLayer( bool locked = false );
void _renderPolygon( QPainter *p, const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context );
Expand Down
8 changes: 6 additions & 2 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -1758,6 +1758,7 @@ QString QgsMapLayer::saveNamedStyle( const QString &uri, bool &resultFlag, Style

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

return exportSldStyleV2( doc, errorMsg, QgsSldExportContext() );
}

Expand Down Expand Up @@ -1848,15 +1849,18 @@ void QgsMapLayer::exportSldStyleV2( QDomDocument &doc, QString &errorMsg, const

QString QgsMapLayer::saveSldStyle( const QString &uri, bool &resultFlag ) const
{
return saveSldStyleV2( uri, resultFlag, QgsSldExportContext() );
QgsSldExportContext context;
context.setExportFilePath( uri );
return saveSldStyleV2( resultFlag, context );
}

QString QgsMapLayer::saveSldStyleV2( const QString &uri, bool &resultFlag, const QgsSldExportContext &exportContext ) const
QString QgsMapLayer::saveSldStyleV2( bool &resultFlag, const QgsSldExportContext &exportContext ) const
{
QGIS_PROTECT_QOBJECT_THREAD_ACCESS

const QgsMapLayer *mlayer = qobject_cast<const QgsMapLayer *>( this );

const QString uri { exportContext.exportFilePath() };

// check if the uri is a file or ends with .sld,
// which indicates that it should become one
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaplayer.h
Expand Up @@ -1096,6 +1096,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
* \param doc the target QDomDocument
* \param errorMsg this QString will be initialized on error
* during the execution of writeSymbology
* \see exportSldStyleV2()
*/
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ) const;

Expand Down Expand Up @@ -1165,7 +1166,6 @@ class CORE_EXPORT QgsMapLayer : public QObject

/**
* Saves the properties of this layer to an SLD format file.
* \param uri uri of destination for exported SLD file.
* \param resultFlag a reference to a flag that will be set to FALSE if
* the SLD file could not be generated
* \param exportContext SLD export context
Expand All @@ -1174,7 +1174,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
* \see loadSldStyle()
* \since QGIS 3.30
*/
virtual QString saveSldStyleV2( const QString &uri, bool &resultFlag, const QgsSldExportContext &exportContext ) const;
virtual QString saveSldStyleV2( bool &resultFlag, const QgsSldExportContext &exportContext ) const;

/**
* Attempts to style the layer using the formatting from an SLD type file.
Expand Down

0 comments on commit 8282358

Please sign in to comment.