Skip to content
Permalink
Browse files

coordinateTransformContext -> transformContext for consistency

I like "coordinateTransformContext" more btw.
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2019
1 parent df2bdf9 commit 470759833e5f9c9c2dccda1d3a84ef1f4534e027
@@ -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",
@@ -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 );
@@ -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() );
@@ -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
@@ -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:

@@ -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:
@@ -1482,6 +1489,7 @@ Emitted whenever the layer's data source has been changed.
.. versionadded:: 3.5
%End


protected:

void clone( QgsMapLayer *layer ) const;
@@ -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
@@ -337,7 +337,7 @@ Constructor for LayerOptions.

bool readExtentFromXml;

QgsCoordinateTransformContext coordinateTransformContext;
QgsCoordinateTransformContext transformContext;

};

@@ -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
@@ -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;

};

@@ -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
@@ -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 );
@@ -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();
};

/**
@@ -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:

/**
@@ -13,6 +13,7 @@
* *
***************************************************************************/

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

QString QgsDataProvider::SUBLAYER_SEPARATOR = QString( "!!::!!" );
@@ -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;
}
@@ -21,6 +21,7 @@
#include <QObject>
#include <QString>
#include <QStringList>
#include <QMutex>

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

/**
@@ -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:

@@ -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:

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

QgsDataProvider::ProviderOptions mOptions;

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

};


@@ -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)
@@ -1310,6 +1317,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
void dataSourceChanged();


private slots:

void onNotifiedTriggerRepaint( const QString &message );

0 comments on commit 4707598

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