Skip to content

Commit

Permalink
coordinateTransformContext -> transformContext for consistency
Browse files Browse the repository at this point in the history
I like "coordinateTransformContext" more btw.
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2019
1 parent df2bdf9 commit 4707598
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 94 deletions.
18 changes: 17 additions & 1 deletion python/core/auto_generated/mesh/qgsmeshlayer.sip.in
Expand Up @@ -77,7 +77,13 @@ is the MDAL connection string. QGIS must be built with MDAL support to allow thi

struct LayerOptions
{
int unused; //!< @todo remove me once there are actual members here (breaks SIP <4.19)

explicit LayerOptions( const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext() );
%Docstring
Constructor for LayerOptions.
%End

QgsCoordinateTransformContext transformContext;
};

explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory",
Expand Down Expand Up @@ -187,6 +193,16 @@ Interpolates the value on the given point from given dataset.
.. versionadded:: 3.4
%End

public slots:

virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Triggered when the coordinate transform context has changed ``transformContext``

.. versionadded:: 3.10
%End


signals:

void activeScalarDatasetChanged( const QgsMeshDatasetIndex &index );
Expand Down
28 changes: 8 additions & 20 deletions python/core/auto_generated/qgsdataprovider.sip.in
Expand Up @@ -58,7 +58,7 @@ Abstract base class for spatial data provider implementations.

struct ProviderOptions
{
QgsCoordinateTransformContext coordinateTransformContext;
QgsCoordinateTransformContext transformContext;
};

QgsDataProvider( const QString &uri = QString(), const QgsDataProvider::ProviderOptions &providerOptions = QgsDataProvider::ProviderOptions() );
Expand Down Expand Up @@ -387,24 +387,23 @@ Returns ``True`` if metadata was successfully written to the data provider.
.. versionadded:: 3.0
%End

QgsCoordinateTransformContext coordinateTransformContext() const;
QgsCoordinateTransformContext transformContext() const;
%Docstring
Returns data provider coordinate transform context

.. seealso:: :py:func:`setCoordinateTranformContext`

.. seealso:: :py:func:`coordinateTransformContextChanged`
.. seealso:: :py:func:`setTranformContext`

.. versionadded:: 3.10
%End

void setCoordinateTransformContext( const QgsCoordinateTransformContext &coordinateTransformContext );
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Sets data coordinate transform context to ``coordinateTransformContext``
Sets data coordinate transform context to ``transformContext``

.. seealso:: :py:func:`coordinateTransformContext`
The default implementation is a simple setter, subclasses may override to perform
additional actions required by a change of coordinate tranform context.

.. seealso:: :py:func:`coordinateTransformContextChanged`
.. seealso:: :py:func:`transformContext`

.. versionadded:: 3.10
%End
Expand Down Expand Up @@ -444,17 +443,6 @@ Emitted when the datasource issues a notification.
.. versionadded:: 3.0
%End

void coordinateTransformContextChanged( const QgsCoordinateTransformContext &coordinateTransformContext );
%Docstring
Emitted when the data provider coordinate transform context has changed

.. seealso:: :py:func:`coordinateTransformContext`

.. seealso:: :py:func:`setCoordinateTranformContext`

.. versionadded:: 3.10
%End


protected:

Expand Down
10 changes: 9 additions & 1 deletion python/core/auto_generated/qgsmaplayer.sip.in
Expand Up @@ -1341,11 +1341,18 @@ Set whether provider notification is connected to triggerRepaint

void setRefreshOnNofifyMessage( const QString &message );
%Docstring
Set the notification message that triggers repaine
Set the notification message that triggers repaint
If refresh on notification is enabled, the notification will triggerRepaint only
if the notification message is equal to:param message:

.. versionadded:: 3.0
%End

virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext ) = 0;
%Docstring
Triggered when the coordinate transform context has changed ``transformContext``

.. versionadded:: 3.10
%End

signals:
Expand Down Expand Up @@ -1482,6 +1489,7 @@ Emitted whenever the layer's data source has been changed.
.. versionadded:: 3.5
%End


protected:

void clone( QgsMapLayer *layer ) const;
Expand Down
9 changes: 4 additions & 5 deletions python/core/auto_generated/qgsvectorlayer.sip.in
Expand Up @@ -328,7 +328,7 @@ TODO QGIS3: Remove virtual from non-inherited methods (like isModified)

explicit LayerOptions( bool loadDefaultStyle = true,
bool readExtentFromXml = false,
const QgsCoordinateTransformContext &coordinateTransformContext = QgsCoordinateTransformContext() );
const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext() );
%Docstring
Constructor for LayerOptions.
%End
Expand All @@ -337,7 +337,7 @@ Constructor for LayerOptions.

bool readExtentFromXml;

QgsCoordinateTransformContext coordinateTransformContext;
QgsCoordinateTransformContext transformContext;

};

Expand Down Expand Up @@ -2335,10 +2335,9 @@ rollBack().
.. seealso:: :py:func:`rollBack`
%End


void changeCoordinateTranformContext( const QgsCoordinateTransformContext &coordinateTransformContext );
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Change coordinate transform context to ``coordinateTransformContext``
Triggered when the coordinate transform context has changed ``transformContext``

.. versionadded:: 3.10
%End
Expand Down
8 changes: 4 additions & 4 deletions python/core/auto_generated/raster/qgsrasterlayer.sip.in
Expand Up @@ -105,14 +105,14 @@ Constructor. Provider is not set.
{

explicit LayerOptions( bool loadDefaultStyle = true,
const QgsCoordinateTransformContext &coordinateTransformContext = QgsCoordinateTransformContext() );
const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext() );
%Docstring
Constructor for LayerOptions.
%End

bool loadDefaultStyle;

QgsCoordinateTransformContext coordinateTransformContext;
QgsCoordinateTransformContext transformContext;

};

Expand Down Expand Up @@ -384,9 +384,9 @@ Writes the symbology of the layer into the document provided in SLD 1.0.0 format
public slots:
void showStatusMessage( const QString &message );

void changeCoordinateTranformContext( const QgsCoordinateTransformContext &coordinateTransformContext );
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Change coordinate transform context to ``coordinateTransformContext``
Triggered when the coordinate transform context has changed ``transformContext``

.. versionadded:: 3.10
%End
Expand Down
6 changes: 6 additions & 0 deletions src/core/mesh/qgsmeshlayer.cpp
Expand Up @@ -202,6 +202,12 @@ QgsMeshDatasetValue QgsMeshLayer::datasetValue( const QgsMeshDatasetIndex &index
return value;
}

void QgsMeshLayer::setTransformContext( const QgsCoordinateTransformContext &transformContext )
{
if ( mDataProvider )
mDataProvider->setTransformContext( transformContext );
}

void QgsMeshLayer::fillNativeMesh()
{
Q_ASSERT( !mNativeMesh );
Expand Down
20 changes: 19 additions & 1 deletion src/core/mesh/qgsmeshlayer.h
Expand Up @@ -97,7 +97,15 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer
*/
struct LayerOptions
{
int unused; //!< @todo remove me once there are actual members here (breaks SIP <4.19)

/**
* Constructor for LayerOptions.
*/
explicit LayerOptions( const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext() )
: transformContext( transformContext )
{}

QgsCoordinateTransformContext transformContext = QgsCoordinateTransformContext();
};

/**
Expand Down Expand Up @@ -218,6 +226,16 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer
*/
QgsMeshDatasetValue datasetValue( const QgsMeshDatasetIndex &index, const QgsPointXY &point ) const;

public slots:

/**
* Triggered when the coordinate transform context has changed \a transformContext
*
* \since QGIS 3.10
*/
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext ) override;


signals:

/**
Expand Down
12 changes: 7 additions & 5 deletions src/core/qgsdataprovider.cpp
Expand Up @@ -13,6 +13,7 @@
* *
***************************************************************************/

#include <QMutexLocker>
#include "qgsdataprovider.h"

QString QgsDataProvider::SUBLAYER_SEPARATOR = QString( "!!::!!" );
Expand Down Expand Up @@ -53,13 +54,14 @@ bool QgsDataProvider::renderInPreview( const PreviewContext &context )
return context.lastRenderingTimeMs <= context.maxRenderingTimeMs;
}

QgsCoordinateTransformContext QgsDataProvider::coordinateTransformContext() const
QgsCoordinateTransformContext QgsDataProvider::transformContext() const
{
return mOptions.coordinateTransformContext;
QMutexLocker locker( &mOptionsMutex );
return mOptions.transformContext;
}

void QgsDataProvider::setCoordinateTransformContext( const QgsCoordinateTransformContext &value )
void QgsDataProvider::setTransformContext( const QgsCoordinateTransformContext &value )
{
mOptions.coordinateTransformContext = value;
emit coordinateTransformContextChanged( value );
QMutexLocker locker( &mOptionsMutex );
mOptions.transformContext = value;
}
33 changes: 15 additions & 18 deletions src/core/qgsdataprovider.h
Expand Up @@ -21,6 +21,7 @@
#include <QObject>
#include <QString>
#include <QStringList>
#include <QMutex>

//#include "qgsdataitem.h"
#include "qgsdatasourceuri.h"
Expand Down Expand Up @@ -98,7 +99,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
*/
struct ProviderOptions
{
QgsCoordinateTransformContext coordinateTransformContext;
QgsCoordinateTransformContext transformContext;
};

/**
Expand Down Expand Up @@ -524,22 +525,23 @@ class CORE_EXPORT QgsDataProvider : public QObject
/**
* Returns data provider coordinate transform context
*
* \see setCoordinateTranformContext()
* \see coordinateTransformContextChanged()
* \see setTranformContext()
*
* \since QGIS 3.10
*/
QgsCoordinateTransformContext coordinateTransformContext() const;
QgsCoordinateTransformContext transformContext() const;

/**
* Sets data coordinate transform context to \a coordinateTransformContext
* Sets data coordinate transform context to \a transformContext
*
* \see coordinateTransformContext()
* \see coordinateTransformContextChanged()
* The default implementation is a simple setter, subclasses may override to perform
* additional actions required by a change of coordinate tranform context.
*
* \see transformContext()
*
* \since QGIS 3.10
*/
void setCoordinateTransformContext( const QgsCoordinateTransformContext &coordinateTransformContext );
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );

signals:

Expand Down Expand Up @@ -574,16 +576,6 @@ class CORE_EXPORT QgsDataProvider : public QObject
*/
void notify( const QString &msg );

/**
* Emitted when the data provider coordinate transform context has changed
*
* \see coordinateTransformContext()
* \see setCoordinateTranformContext()
*
* \since QGIS 3.10
*/
void coordinateTransformContextChanged( const QgsCoordinateTransformContext &coordinateTransformContext );


protected:

Expand Down Expand Up @@ -613,6 +605,11 @@ class CORE_EXPORT QgsDataProvider : public QObject

QgsDataProvider::ProviderOptions mOptions;

/**
* Protects options from being accessed concurrently
*/
mutable QMutex mOptionsMutex;

};


Expand Down
10 changes: 9 additions & 1 deletion src/core/qgsmaplayer.h
Expand Up @@ -1192,14 +1192,21 @@ class CORE_EXPORT QgsMapLayer : public QObject
void setRefreshOnNotifyEnabled( bool enabled );

/**
* Set the notification message that triggers repaine
* Set the notification message that triggers repaint
* If refresh on notification is enabled, the notification will triggerRepaint only
* if the notification message is equal to \param message
*
* \since QGIS 3.0
*/
void setRefreshOnNofifyMessage( const QString &message ) { mRefreshOnNofifyMessage = message; }

/**
* Triggered when the coordinate transform context has changed \a transformContext
*
* \since QGIS 3.10
*/
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext ) = 0;

signals:

//! Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar)
Expand Down Expand Up @@ -1310,6 +1317,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
void dataSourceChanged();


private slots:

void onNotifiedTriggerRepaint( const QString &message );
Expand Down

0 comments on commit 4707598

Please sign in to comment.